旋转图像时候强迫光滑

导读:


forceSmoothing


强迫光滑属性
在FLASH里进行伸缩和旋转是很容易的,只要使用_rotation,_xscale,成员。除非你发布一个FB8或者更新的SWF媒体内容,你伸缩或者旋转的每一张图片都会被锯齿化,非常讨厌。为了消除这一点你必须将媒体内容发布为FLASH7获得使用复杂的loadBitmapSmoothed 函数。
当FLASH8.5播放器发布时,他引入一个forceSmoothing 属性,该属性在AS2中也存在,现在我们所做的就是当装载图片的时侯将此属性设置为TRUE,当然不要忘记在FLASH播放器8.5以前的版本中该做法是没有任何效果。
这样做得到的效果很好,下面有一个例子展示这种做法。



Rotating and scaling pictures in flash is easy. Just use _rotation, _xscale and _yscale. Except when you publish an swf for Flash Player 8 or newer. Every image you rotate or scale will become jagged. Very anoying. To remedy this you can either publish for Flash 7 or use a complicated loadBitmapSmoothed function that uses BitmapData.


When Flash Player 8.5 came out it introduced the forceSmoothing property. This property is also available in as2. Now all we need to do is set it to true when we load images. Don’t forget that this will have no effect in Flash players older than version 8.5!


It works quite well. In the example below you can clearly see the left picture is more jagged than the right one.





var outer_mc = this.createEmptyMovieClip("outer_mc", 0);
var inner_mc = outer_mc.createEmptyMovieClip("inner_mc", 0);

// don't rotate the inner_mc
// it will lose its properties when the image is loaded
outer_mc
._rotation = 45;
outer_mc
._xscale = 120;
outer_mc
._yscale = 60;

var mcl:MovieClipLoader = new MovieClipLoader();

mcl
.addListener({
  onLoadInit
: function(target:MovieClip){
   
// this prevents that awfully jagged look
    target
.forceSmoothing = true;
 
}
});

mcl
.loadClip("image.jpg", inner_mc);


本文转自
http://www.crydust.be/blog/2008/02/15/forcesmoothing/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值