| java.lang.Object org.openlaszlo.iv.flash.api.FlashItem org.openlaszlo.iv.flash.api.FlashObject org.openlaszlo.iv.flash.api.FlashDef org.openlaszlo.iv.flash.api.shape.Shape
Shape | final public class Shape extends FlashDef (Code) | | Shape.
Shapes are defined by a list of edges called a path. A path may be closed - where the start
and end of the path meet to close the figure, or open - where the path forms an
open-ended stroke. A path may contain a mixture of straight edges, curved edges, and
"pen up and move" commands. The latter allows multiple disconnected figures to be
described by a single shape structure. (see MoveTo flag)
A fill style defines the appearance of an area enclosed by a path. Fill styles supported
by SWF include a color, a gradient, or a bitmapped image.
A line style defines the appearance of the outline of a path. The line style may be a stroke
of any thickness and color.
SWF format allows each edge to have its own line and fill style.
This can have unpredictable results when fill styles change in the middle of a path.
Flash also supports two fill styles per edge, one for each side of the edge:
FillStyle0 and FillStyle1. FillStyle0 should always be used first and then
FillStyle1 if the shape is filled on both sides of the edge.
A shape is comprised of the following elements:
- CharacterId - A 16-bit value that uniquely identifies this shape as a
'character' in the dictionary. The CharacterId can be referred to in
control tags such as PlaceObject. Characters can be re-used and combined
with other characters to make more complex shapes.
- Bounding box - The rectangle that completely encloses the shape.
- Fill style array - A list of all the fill styles used in a shape.
- Line style array - A list of all the line styles used in a shape.
- Shape-record array - A list of shape-records. Shape-records can define straight
or curved edges, style changes, or move the drawing position.
Note: Line and fill styles are defined once only, and may be used (and re-used) by
any of the edges in the shape.
Note that objects of this class will always be generated as DefineShape3 tags which
means that all the colors used in the shape (in line and fillstyles) have to be AlphaColors!
author: Dmitry Skavish |
Constructor Summary | |
public | Shape() |
Method Summary | |
public int | addFillStyle(FillStyle fillStyle) Adds specified fill style to the array of shape styles. | public int | addLineStyle(LineStyle lineStyle) | public void | collectDeps(DepsCollector dc) | protected FlashItem | copyInto(FlashItem item, ScriptCopier copier) | public void | draw(java.awt.Graphics2D g2) | public void | drawAWTPathIterator(java.awt.geom.PathIterator pi) | public void | drawAWTShape(java.awt.Shape shape) | public void | drawAWTShape(java.awt.Shape shape, AffineTransform matrix) | public void | drawCurve(int ax1, int ay1, int cx, int cy, int ax2, int ay2) Draws curve record.
All coordinates are in twixels. | public void | drawCurve(Point2D anchor1, Point2D control, Point2D anchor2) Draws curve record.
All coordinates are in twixels. | public void | drawCurveTo(int cx, int cy, int ax, int ay) Draws curve record.
All coordinates are in twixels. | public void | drawLine(int x1, int y1, int x2, int y2) Draws a straight line specified by two points. | public void | drawLine(Point2D p0, Point2D p1) Draws a straight line specified by two points. | public void | drawLineTo(int x, int y) Draws a straight line from current position to the specified one.
All coordinates are in twixels. | public void | drawLineTo(Point2D p1) Draws a straight line from current position to the specified one.
All coordinates are in twixels. | public void | drawRectangle(int x, int y, int width, int height) Draws a rectangle specified by its top-left corner and width and height
All coordinates are in twixels. | public void | drawRectangle(Rectangle2D r) Draws a rectangle specified by
java.awt.geom.Rectangle2D
All coordinates are in twixels. | public Rectangle2D | getBounds() | public FlashItem | getCopy(ScriptCopier copier) | public Point2D | getCurrentPos() | public FillStyle | getFillStyle0() | public int | getFillStyle0Index() | public FillStyle | getFillStyle1() | public int | getFillStyle1Index() | public Point2D | getFirstPos() | public LineStyle | getLineStyle() | public int | getLineStyleIndex() | public ShapeRecords | getShapeRecords() | public ShapeStyles | getShapeStyles() | protected StyleChangeRecord | getStyleChange() | public int | getTag() | public boolean | isConstant() | public boolean | isWithAlpha() | public void | movePenTo(int x, int y) Moves pen to the specified position.
All coordinates are ABSOLUTE and are in twixels. | public void | movePenTo(Point2D p) | public static Shape | newEmptyShape1() | public static Shape | newShape1() | public static Shape | newShape2() | public static Shape | newShape3() | public static Shape | newShape3(ShapeStyles styles, ShapeRecords records) | public void | newStyleBlock() Creates new style block
Each style block contains styles and records which use
these styles. | public static Shape | parse(Parser p) | public void | printContent(PrintStream out, String indent) | public void | setBounds(Rectangle2D bounds) Sets bounding box for this shape. | public void | setBounds(int x, int y, int width, int height) Sets bounding box for this shape. | public int | setFillStyle0(FillStyle fillStyle) Sets specified fillstyle as current fillstyle0. | public void | setFillStyle0(int fillStyle) Sets current fillstyle0 by its index in shapestyle array. | public int | setFillStyle1(FillStyle fillStyle) Sets specified fillstyle as current fillstyle1. | public void | setFillStyle1(int fillStyle) Sets current fillstyle1 by its index in shapestyle array. | public int | setLineStyle(LineStyle lineStyle) Sets specified linestyle as current linestyle. | public void | setLineStyle(int lineStyle) Sets current linestyle by its index in shapestyle array. | public void | write(FlashOutput main) |
Shape | public Shape()(Code) | | Creates new empty shape (Shape3 - all colors with alpha)
|
addFillStyle | public int addFillStyle(FillStyle fillStyle)(Code) | | Adds specified fill style to the array of shape styles.
Note: colors used in the specified fillstyle have to be AlphaColors
Parameters: fillStyle - specified fill style index of added fill style in the array |
addLineStyle | public int addLineStyle(LineStyle lineStyle)(Code) | | Adds specified line style to the array of shape styles
Note: colors used in the specified linestyle have to be AlphaColors
Parameters: lineStyle - specified line style index of added line style in the array |
drawAWTPathIterator | public void drawAWTPathIterator(java.awt.geom.PathIterator pi)(Code) | | Draw AWT PathIterator
All coordinates are in twixels!
Parameters: pi - AWT PathIterator |
drawAWTShape | public void drawAWTShape(java.awt.Shape shape)(Code) | | Draw AWT Shape
All shape coordinates are in twixels!
Parameters: shape - AWT shape |
drawCurve | public void drawCurve(int ax1, int ay1, int cx, int cy, int ax2, int ay2)(Code) | | Draws curve record.
All coordinates are in twixels.
Parameters: ax1 - X anchor point 1 Parameters: ay1 - Y anchor point 1 Parameters: cx - X control point Parameters: cy - Y control point Parameters: ax2 - X anchor point 2 Parameters: ay2 - Y anchor point 2 |
drawCurve | public void drawCurve(Point2D anchor1, Point2D control, Point2D anchor2)(Code) | | Draws curve record.
All coordinates are in twixels.
Parameters: anchor0 - first anchor point Parameters: control - control point Parameters: anchor1 - second anchor point |
drawCurveTo | public void drawCurveTo(int cx, int cy, int ax, int ay)(Code) | | Draws curve record.
All coordinates are in twixels.
Parameters: cx - X control point Parameters: cy - Y control point Parameters: ax - X anchor point Parameters: ay - Y anchor point |
drawLine | public void drawLine(int x1, int y1, int x2, int y2)(Code) | | Draws a straight line specified by two points.
All coordinates are in twixels.
Parameters: x1 - X of the beginning of the line Parameters: y1 - Y of the beginning of the line Parameters: x2 - X of the end of the line Parameters: y2 - Y of the end of the line |
drawLine | public void drawLine(Point2D p0, Point2D p1)(Code) | | Draws a straight line specified by two points.
All coordinates are in twixels.
Parameters: p0 - first point Parameters: p1 - second point |
drawLineTo | public void drawLineTo(int x, int y)(Code) | | Draws a straight line from current position to the specified one.
All coordinates are in twixels.
Parameters: x - X of end of line Parameters: y - Y of end of line |
drawLineTo | public void drawLineTo(Point2D p1)(Code) | | Draws a straight line from current position to the specified one.
All coordinates are in twixels.
Parameters: p1 - end of line |
drawRectangle | public void drawRectangle(int x, int y, int width, int height)(Code) | | Draws a rectangle specified by its top-left corner and width and height
All coordinates are in twixels.
Parameters: x - x coordinates of top-left corner of the rectangle Parameters: y - y coordinates of top-left corner of the rectangle Parameters: width - width of the rectangle Parameters: height - height of the rectangle |
getCurrentPos | public Point2D getCurrentPos()(Code) | | Returns current pen position
current pen position |
getFillStyle0 | public FillStyle getFillStyle0()(Code) | | Returns current fill style 0
currently used fill style 0 |
getFillStyle0Index | public int getFillStyle0Index()(Code) | | Returns index of current fill style 0
index of currently used fill style 0 |
getFillStyle1 | public FillStyle getFillStyle1()(Code) | | Returns current fill style 1
currently used fill style 1 |
getFillStyle1Index | public int getFillStyle1Index()(Code) | | Returns index of current fill style 1
index of currently used fill style 1 |
getFirstPos | public Point2D getFirstPos()(Code) | | Returns first pen position (first moveTo)
first pen position |
getLineStyle | public LineStyle getLineStyle()(Code) | | Returns current line style
currently used line style |
getLineStyleIndex | public int getLineStyleIndex()(Code) | | Returns index of current line style
index of currently used line style |
getShapeRecords | public ShapeRecords getShapeRecords()(Code) | | Returns shape records
object representing array of shape records |
getShapeStyles | public ShapeStyles getShapeStyles()(Code) | | Returns shape styles
object representing array of shape styles |
getTag | public int getTag()(Code) | | |
isConstant | public boolean isConstant()(Code) | | |
isWithAlpha | public boolean isWithAlpha()(Code) | | |
movePenTo | public void movePenTo(int x, int y)(Code) | | Moves pen to the specified position.
All coordinates are ABSOLUTE and are in twixels.
Parameters: x - new current X Parameters: y - new current Y |
movePenTo | public void movePenTo(Point2D p)(Code) | | Moves pen to the specified point.
All coordinates are ABSOLUTE and are in twixels!
Parameters: p - new pen position |
newEmptyShape1 | public static Shape newEmptyShape1()(Code) | | Creates empty Shape (DEFINESHAPE tag)
empty shape |
newShape1 | public static Shape newShape1()(Code) | | Creates new Shape defined by tag DEFINESHAPE
new Shape |
newShape2 | public static Shape newShape2()(Code) | | Creates new Shape defined by tag DEFINESHAPE2
new Shape |
newShape3 | public static Shape newShape3()(Code) | | Creates new Shape defined by tag DEFINESHAPE3
new Shape |
newStyleBlock | public void newStyleBlock()(Code) | | Creates new style block
Each style block contains styles and records which use
these styles. Records cannot use styles from different
style blocks. It means that after this call one cannot
use styles (and style indexes) from previous style blocks.
|
parse | public static Shape parse(Parser p)(Code) | | Parses Shape
Parameters: p - Parser parsed shape |
setBounds | public void setBounds(Rectangle2D bounds)(Code) | | Sets bounding box for this shape.
Parameters: bounds - new bounding box |
setBounds | public void setBounds(int x, int y, int width, int height)(Code) | | Sets bounding box for this shape.
|
setFillStyle0 | public int setFillStyle0(FillStyle fillStyle)(Code) | | Sets specified fillstyle as current fillstyle0.
If the specified fillstyle is not in the shapestyle array
then it's added, if it's already there it's reused.
Note: colors used in the specified fillstyle have to be AlphaColors
Parameters: fillStyle - specified fillstyle index of specified fillstyle in the shapestyle array |
setFillStyle0 | public void setFillStyle0(int fillStyle)(Code) | | Sets current fillstyle0 by its index in shapestyle array.
Parameters: fillStyle - index of fillstyle in shapestyle array to be set as current fillstyle0 |
setFillStyle1 | public int setFillStyle1(FillStyle fillStyle)(Code) | | Sets specified fillstyle as current fillstyle1.
If the specified fillstyle is not in the shapestyle array
then it's added, if it's already there it's reused.
Note: colors used in the specified fillstyle have to be AlphaColors
Parameters: fillStyle - specified fillstyle index of specified fillstyle in the shapestyle array |
setFillStyle1 | public void setFillStyle1(int fillStyle)(Code) | | Sets current fillstyle1 by its index in shapestyle array.
Parameters: fillStyle - index of fillstyle in shapestyle array to be set as current fillstyle1 |
setLineStyle | public int setLineStyle(LineStyle lineStyle)(Code) | | Sets specified linestyle as current linestyle.
If the specified linestyle is not in the shapestyle array
then it's added, if it's already there it's reused.
Note: color used in the specified linestyle has to be AlphaColor
Parameters: lineStyle - specified linestyle index of specified linestyle in the shapestyle array |
setLineStyle | public void setLineStyle(int lineStyle)(Code) | | Sets current linestyle by its index in shapestyle array.
Parameters: lineStyle - index of linestyle in shapestyle array to be set as current linestyle |
|
|