Return to Snippet

Revision: 13894
at May 11, 2009 05:50 by alexaivars


Initial Code
package {
	import flash.display.Bitmap;
	import flash.display.Shader;
	import flash.display.Sprite;
	import flash.filters.*;
	import flash.utils.ByteArray;
	
	public class PixelBenderTest extends Sprite
	{
		[Embed(source='image.jpg')]
		private var ImageFile:Class;

		[Embed(source="filter.pbj" ,  mimeType="application/octet-stream")]
		private var FilterFile : Class;
		
		private var shader:Shader;
		private var filter:ShaderFilter;
		private var bmp:Bitmap;
		
		public function PBTest()
		{
			bmp = new ImageFile() as Bitmap;
			
			shader = new Shader( new FilterFile() as ByteArray ) ;
			shader.data.size.value = [20];
			shader.data.base.value = [400,250];
			
			filter = new ShaderFilter(shader);
			
			bmp.filters = [ filter ];
			addChild(bmp);
		}
		
	}
}

Initial URL

                                

Initial Description

                                

Initial Title
Embedding and using a pixel-bender filter

Initial Tags

                                

Initial Language
ActionScript 3