Posts Tagged ‘BitmapData’
[AS3] Animated GIF optimization - frame differencing
Thursday, May 24th, 2007Now a days, I was thinking about how to optimize an animated GIF image. And I’ve got some solutions from the following link.
Optimizing Animated GIFsI tried one thing, frame differenecing. I don’t know it conforms to the GIF specification. But it can be useful somehow.
요즘 GIF 애니메이션 최적화에 대해서 연구하고 있는데, 아래 사이트에서 유용한 정보들을 얻을 수 있었습니다.
Optimizing Animated GIFs그 중에 프레임 디퍼런싱을 만들어 보았습니다. GIF 스펙을 따르는지는 모르지만, 써먹을 데가 있을듯 하여…
(more…)
[AS3] Fading Border Effect
Tuesday, May 22nd, 2007BitmapData.copyChannel() method copies a channel from a source image and pastes it into a target image’s alpha channel. You can control the transparecy of an image by manipulating the image’s alpha channel with a source image.
The following code adds fading border effect to an image.
BitmapData.copyChannel() 메소드를 사용하여, 원하는 이미지의 특정 채널을 대상 이미지의 알파채널로 복사할 수 있습니다. 이것을 사용하면 소스 이미지를 알파채널로 사용하여 이미지의 투명도를 제어할 수 있습니다.
아래 코드는 이미지의 테두리를 부드럽게 빼는 효과를 구현한 것입니다.
(more…)
동적으로 로드한 이미지 Allow smoothing 컨트롤 하기…
Friday, August 11th, 2006Dcaland.com을 만들면서 사용한 메소드를 하나 올릴까 합니다. 플래시 8 버전에서는 이미지를 외부로 부터 로드를 할 경우에 default로 Allow smoothing(매끄럽게)이 false 값을 가지게 되는데 Allow smoothing이 false일 경우에는 에니메이션(좌표,로테이션등) 할때 이미지가 지글거리는 문제가 있죠. 라이브러리에 등록된 이미지는 속성에서 수동으로 채킹을 해서 사용하면 된다지만 외부에서 동적으로 불러온 이미지를 움직일 때는 문제가 있죠. 아래 메소드는 그 문제를 해결해 주는 메소드입니다. http://www.kaourantin.net/ 에 기술된 내용을 간단하게 수정해서 사용하고 있습니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import flash.display.*; private function loadImg (target : MovieClip, url : String) : Void { var bmc : MovieClip = target.createEmptyMovieClip ("bmc", target.getNextHighestDepth ()); var listener : Object = new Object (); listener.tmc = target; listener.onLoadInit = function (mc : MovieClip) { mc._visible = false; var bitmap : BitmapData = new BitmapData (mc._width, mc._height, true); this.tmc.attachBitmap (bitmap, this.tmc.getNextHighestDepth () , "auto", true); bitmap.draw (mc); }; var loader : MovieClipLoader = new MovieClipLoader (); loader.addListener (listener); loader.loadClip (url, bmc); } |
BitmapData 를 사용하기 위해서 import flash.display.*; 임포트 시켜서 사용하세요
입맛에 맞게 수정해서 사용하세요 어떻게 보면 약간의 꼼수가 있는거 같지만 8.5 나오기 전까지는 작지만 유용한 메소드가 될듯 싶습니다.


