最近发现使用 BitmapData.pixelDissolve 溶解像素时,无论 randomSeed 和 numOfPixels 参数是多少,sourceRect 指定的矩形的左上角一定会被溶解!
比如设定为溶解 10 个像素时,左上角 + 剩下的像素中取 10 个会变化。设为溶解 0 个时,只有左上角会变化。
例子: 可以看到左上角很不自然。
例子的代码:
package {
import flash.display.*;
import flash.events.Event;
import flash.geom.*;
[SWF(width="32",height="32")]
public class Test2 extends Sprite{
public function Test2():void {
var bitmap:BitmapData = new BitmapData(32, 32, false,0);
var seed:int = 0;
addChild(new Bitmap(bitmap));
addEventListener(Event.ENTER_FRAME,
function (event:Event):void {
seed = bitmap.pixelDissolve(bitmap, bitmap.rect, new Point(0,0),
seed, 5, Math.random()*0x1000000);
}
);
}
}
}我用的 Flash Player 的版本是 9.0.115.0。
![[Google]](http://www.google.com/logos/Logo_25wht.gif)
![[Synchronous Space]](http://weihe924stephen.googlepages.com/syncspace-banner.jpg)
![[Creative Commons License]](http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png)
![[Add to Google]](http://buttons.googlesyndication.com/fusion/add.gif)
![[Aggregated by MXNA]](http://weblogs.macromedia.com/mxna/images/mxna88x31.gif)
![[Flex.org]](http://www.flex.org/images/flexorg.gif)
![Validate my Atom 1.0 feed [Valid Atom 1.0]](http://validator.w3.org/feed/images/valid-atom.png)
![Validate my RSS feed [Valid RSS]](http://resource.googlecode.com/files/valid-rss.png)
![[I heart FeedBurner]](http://www.feedburner.com/fb/images/pub/i_heart_fb.gif)
没有评论:
发表评论