1 50 51 package org.openlaszlo.iv.flash.api.shape; 52 53 import org.openlaszlo.iv.flash.util.*; 54 import org.openlaszlo.iv.flash.api.*; 55 import org.openlaszlo.iv.flash.parser.*; 56 import java.io.PrintStream ; 57 58 72 public final class LineStyle extends FlashItem { 73 74 private int width; private Color color; 77 public LineStyle() {} 78 79 85 public LineStyle( int width, Color color ) { 86 setWidth( width ); 87 setColor( color ); 88 } 89 90 95 public int getWidth() { 96 return width; 97 } 98 99 104 public void setWidth( int width ) { 105 this.width = width; 106 } 107 108 113 public Color getColor() { 114 return color; 115 } 116 117 122 public void setColor( Color color ) { 123 this.color = color; 124 } 125 126 public static LineStyle parse( Parser p, boolean withAlpha ) { 127 int width = p.getUWord(); 128 Color color = Color.parse(p, withAlpha); 129 return new LineStyle(width, color); 130 } 131 132 public void write( FlashOutput fob ) { 133 fob.writeWord(width); 134 Shape shape = (Shape) fob.getUserData(); 135 if( shape.isWithAlpha() ) { 136 color.writeRGBA(fob); 137 } else { 138 color.writeRGB(fob); 139 } 140 } 141 142 public void printContent( PrintStream out, String indent ) { 143 out.print( indent+"LineStyle: width="+width+" color=" ); 144 color.printContent(out, ""); 145 } 146 147 protected FlashItem copyInto( FlashItem item, ScriptCopier copier ) { 148 ((LineStyle)item).width = width; 149 ((LineStyle)item).color = (Color) color.getCopy(copier); 150 return item; 151 } 152 153 public FlashItem getCopy( ScriptCopier copier ) { 154 return copyInto( new LineStyle(), copier ); 155 } 156 } 157 | Popular Tags |