Advertisement
Guest User

Untitled

a guest
May 28th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         public function BuildSurface():void
  2.         {          
  3.             //Reset image
  4.             shape.graphics.clear();
  5.            
  6.             //Line style
  7.             if(lineWeight)
  8.                 shape.graphics.lineStyle(lineWeight,lineColor);
  9.             else
  10.                 shape.graphics.lineStyle();
  11.             //Begin fill
  12.             switch(fillType)
  13.             {
  14.                 case TFILL_FLAT:
  15.                     shape.graphics.beginFill(fillColor);
  16.                     break;
  17.                 case TFILL_GRAD:
  18.                     var gradient:Matrix = new Matrix();
  19.                     gradient.createGradientBox(width,height,gradDir*Math.PI/2.0);
  20.                     shape.graphics.beginGradientFill(GradientType.LINEAR,[fillColor,fillColor2],[1,1],[0,255],gradient);
  21.                     break;
  22.                 case TFILL_PATTERN:
  23.                     shape.graphics.beginBitmapFill(ho.getImage(patterns[0]).img);
  24.                     break;
  25.                 case TFILL_IMAGE:
  26.                     var image:CImage = ho.getImage(images[0]);
  27.                     var mat:Matrix = new Matrix();
  28.                     mat.scale(width/image.width,height/image.height);
  29.                     shape.graphics.beginBitmapFill(image.img,mat,false,(imageOptions&IMGOPT_RESAMPLE)>0);
  30.                     break;
  31.             }
  32.            
  33.             //Shape
  34.             switch(shapeType)
  35.             {
  36.                 case TSHAPE_RECT:
  37.                     shape.graphics.drawRect(0,0,width,height);
  38.                     break;
  39.                 case TSHAPE_ELLIPSE:
  40.                     shape.graphics.drawEllipse(0,0,width,height);
  41.                     break;
  42.                 case TSHAPE_POLY:
  43.                     break;
  44.             }
  45.            
  46.             //End fill
  47.             shape.graphics.endFill();
  48.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement