topical media & game development

talk show tell print

#graphic-flex-image-effects-07-source-aether-textures-patterns-PixelPattern.ax

#graphic-flex-image-effects-07-source-aether-textures-patterns-PixelPattern.ax [swf] [flash] flex


  package aether.textures.patterns {
          
          import aether.textures.ITexture;
  
          import flash.display.BitmapData;
          
          public class @ax-graphic-flex-image-effects-07-source-aether-textures-patterns-PixelPattern implements ITexture {
          
                  private var _definition:Array;
          
                  public function @ax-graphic-flex-image-effects-07-source-aether-textures-patterns-PixelPattern(definition:Array) {
                          _definition = definition;
                  }
          
                  public function draw():BitmapData {
                          var w:Number = _definition[0].length;
                          var h:Number = _definition.length;
                          var pattern:BitmapData = new BitmapData(w, h, true, 0x00FFFFFF);
                          var c:uint;
                          for (var r:uint = 0; r < h; r++) {
                                  for (c = 0; c < w; c++) {
                                          pattern.setPixel32(c, r, _definition[r][c]);
                                  }
                          }
                          return pattern;
                  }
          
          }
          
  }


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.