clipRect 介绍_JAVA_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > JAVA > clipRect 介绍

clipRect 介绍

 2011/12/9 9:39:55  qq125922714  http://qq125922714.iteye.com  我要评论(0)
  • 摘要:<spanlang="EN-US">android</span>的<spanlang="EN-US">clip</span>有以下两点疑问:<pclass="MsoListParagraph"><span><spanlang="EN-US">Clip</span>中的<spanlang="EN-US">Op</span>的参数的意思。</span><
  • 标签:

    <span lang="EN-US">android</span>的<span lang="EN-US">clip</span>有以下两点疑问:


<p class="MsoListParagraph"><span><span lang="EN-US">Clip</span>中的<span lang="EN-US">Op</span>的参数的意思。</span>

<p class="MsoNormal"><span>通常咱们理解的<span lang="EN-US">clip(</span>剪切<span lang="EN-US">)</span>,是对已经存在的图形进行<span lang="EN-US">clip</span>的。但是,在<span lang="EN-US">android</span>上是对<span lang="EN-US">canvas</span>(画布)上进行<span lang="EN-US">clip</span>的,要在画图之前对<span lang="EN-US">canvas</span>进行<span lang="EN-US">clip</span>,如果画图之后再对<span lang="EN-US">canvas</span>进行<span lang="EN-US">clip</span>不会影响到已经画好的图形。一定要记住<span lang="EN-US">clip</span>是针对<span lang="EN-US">canvas</span>而非图形。</span>

<p class="MsoNormal"><span>接下来通过<span lang="EN-US">android</span>自带的<span lang="EN-US">APIdemo Clipping</span>例子详细讲述<span lang="EN-US">Clip</span>中的<span lang="EN-US">Op</span>的参数的意思。<span lang="EN-US">Android</span>提供<span lang="EN-US">clipRect</span>、<span lang="EN-US">clipPath</span>和<span lang="EN-US">clipRegion</span>剪切区域的<span lang="EN-US">API</span>。</span>

DIFFERENCE,INTERSECT,UNION,XOR, REVERSE_DIFFERENCE, REPLACE</span>六种选择。</span>[/b]

<p class="MsoNormal"><span>例子<span lang="EN-US">:</span></span>

<p class="MsoListParagraph"><span>在<span lang="EN-US">canvas</span>上剪切从<span lang="EN-US">(40,40)</span>到<span lang="EN-US">(100,100)</span>的方块。下图橄榄色区域加紫色区域。</span>


<br><img src="/Upload/Images/2011120909/68BD44B60829AC28.bmp" alt=""><br>?<span><br></span>

<p class="MsoNormal"><span>先在第二方块上加上<span lang="EN-US">Op</span>参数例如:<span lang="EN-US">canvas.clipRect(40, 40, 100, 100, Region.Op. DIFFERENCE);</span></span>

<p class="MsoNormal"><span><span lang="EN-US">Op</span>参数针对的对象是之前剪切的区域以及当前要剪切的区域。</span>

<p class="MsoNormal"><span>那有哪些含义呢?就是表示当前要剪切的区域与之前剪切过的之间的关系。</span>

<p class="MsoNormal"><span><span lang="EN-US">DIFFERENCE</span>:之前剪切过除去当前要剪切的区域(蓝色区域)。</span>

<p class="MsoNormal"><span><span lang="EN-US">UNION</span>:当前要剪切的区域加上之前剪切过内部的部分(蓝色区域<span lang="EN-US">+</span>紫色区域<span lang="EN-US">+</span>橄榄色区域)。</span>

<p class="MsoNormal"><span><span lang="EN-US">REVERSE_DIFFERENCE</span>:与<span lang="EN-US">DIFFERENCE</span>相反,以当前要剪切的区域为参照物,当前要剪切的区域除去之前剪切过的区域<span lang="EN-US">(</span>橄榄色区域<span lang="EN-US">);</span></span>

<p class="MsoNormal"><span>没带<span lang="EN-US">Op</span>参数效果与<span lang="EN-US">INTERSECT</span>的效果一样,两个区域的交集。</span>
 
   
     
        <ul style="display:none;">
         
  • <img src='/Upload/Images/2011120909/C735F2B9717E32C0.bmp' class='magplus' title='点击查看原始大小图片' />

  •          
             
  • 大小: 2.1 KB

  •         </ul>
         
       
       
         

             
    • 查看图片附件

    •      

       
     
    • 相关文章
    发表评论
    用户名: 匿名