使用BitmapData.applyFilter实现伪景深(Depth of field)

景深 (Depth of field (wiki))有时可以增强立体感 可惜Flash未内置这种滤镜,Pixel Bender也许能实现,不过不会写 -_- 借助BitmapData.applyFilter分段为位图添加BlurFilter,可以实现假的"景深"效果: 视点在左侧: 视点在中间: 方法: public function applyFilter(sourceBitmapData:BitmapData, sourceRect:Rectangle, destPoint:Point, filter:BitmapFilter):void 参数: sourceBitmapData:BitmapData — 要使用的输入位图图像。 sourceRect:Rectangle — 定义要用作输入的源图像区域的矩形。 destPoint:Point — 目标图像(当前 BitmapData 实例)中与源矩形的左上角对应的点。 filter:BitmapFilter — 用于执行过滤操作的滤镜对象。 Demo(点击apply应用滤镜) Source 不过位图块之间的过渡有时不是很自然,会由于模糊得太过导致较大的间隙,当然,离远些就不明显了(笑).

2 comments to 使用BitmapData.applyFilter实现伪景深(Depth of field)

  • 凡客

    不错,很喜欢看你写的东西,能学到不少东西,不知道介意交换个链接不?交个朋友方便以后访问~~
    本站名称:凡客
    本站域名:www.f9011.cn/
    [reply=auzn,2009-05-12 08:55 AM]好的,感谢你的支持 :) [/reply]

    [Reply]

  • Y.Boy

    哇,很不错的效果。
    [reply=auzn,2009-05-10 02:27 PM]呵呵,谢谢支持哇。还有些瑕疵,以现在的能力是改不掉了 &_*[/reply]

    [Reply]

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">