1 50 51 package org.openlaszlo.iv.flash.api.shape; 52 53 import org.openlaszlo.iv.flash.util.*; 54 import java.io.PrintStream ; 55 import org.openlaszlo.iv.flash.api.*; 56 57 81 public final class CurvedEdgeRecord extends FlashItem { 82 83 private int controlDeltaX; 84 private int controlDeltaY; 85 private int anchorDeltaX; 86 private int anchorDeltaY; 87 88 public CurvedEdgeRecord() {} 89 90 public CurvedEdgeRecord( int controlDeltaX, int controlDeltaY, int anchorDeltaX, int anchorDeltaY ) { 91 setControlDeltaX(controlDeltaX); 92 setControlDeltaY(controlDeltaY); 93 setAnchorDeltaX(anchorDeltaX); 94 setAnchorDeltaY(anchorDeltaY); 95 } 96 97 public int getControlDeltaX() { 98 return controlDeltaX; 99 } 100 public void setControlDeltaX( int controlDeltaX ) { 101 this.controlDeltaX = controlDeltaX; 102 } 103 104 public int getControlDeltaY() { 105 return controlDeltaY; 106 } 107 public void setControlDeltaY( int controlDeltaY ) { 108 this.controlDeltaY = controlDeltaY; 109 } 110 111 public int getAnchorDeltaX() { 112 return anchorDeltaX; 113 } 114 public void setAnchorDeltaX( int anchorDeltaX ) { 115 this.anchorDeltaX = anchorDeltaX; 116 } 117 118 public int getAnchorDeltaY() { 119 return anchorDeltaY; 120 } 121 public void setAnchorDeltaY( int anchorDeltaY ) { 122 this.anchorDeltaY = anchorDeltaY; 123 } 124 125 public void write( FlashOutput fob ) { 126 fob.writeBits(0x2, 2); 127 int nBits = Util.getMinBitsS( Util.getMax(controlDeltaX, controlDeltaY, anchorDeltaX, anchorDeltaY) ); 128 if( nBits < 3 ) nBits = 3; 129 fob.writeBits(nBits-2, 4); 130 fob.writeBits(controlDeltaX, nBits); 131 fob.writeBits(controlDeltaY, nBits); 132 fob.writeBits(anchorDeltaX, nBits); 133 fob.writeBits(anchorDeltaY, nBits); 134 } 135 136 public void printContent( PrintStream out, String indent ) { 137 out.println( indent+" curve ("+controlDeltaX+","+controlDeltaY+","+anchorDeltaX+","+anchorDeltaY+")" ); 138 } 139 140 protected FlashItem copyInto( FlashItem item, ScriptCopier copier ) { 141 ((CurvedEdgeRecord)item).controlDeltaX = controlDeltaX; 142 ((CurvedEdgeRecord)item).controlDeltaY = controlDeltaY; 143 ((CurvedEdgeRecord)item).anchorDeltaX = anchorDeltaX; 144 ((CurvedEdgeRecord)item).anchorDeltaY = anchorDeltaY; 145 return item; 146 } 147 148 public FlashItem getCopy( ScriptCopier copier ) { 149 return copyInto( new CurvedEdgeRecord(), copier ); 150 } 151 } 152 | Popular Tags |