pt.tumba.parser.swf
Class Shape

java.lang.Object
  extended by pt.tumba.parser.swf.Symbol
      extended by pt.tumba.parser.swf.Shape

public class Shape
extends Symbol

A Shape Symbol

Author:
unknown

Nested Class Summary
static class Shape.ColorFill
          Description of the Class
static class Shape.Curve
          Description of the Class
static class Shape.Element
          Description of the Class
static class Shape.FillStyle
          Description of the Class
static class Shape.GradientFill
          Description of the Class
static class Shape.ImageFill
          Description of the Class
static class Shape.Line
          Description of the Class
static class Shape.LineStyle
          Description of the Class
static class Shape.Move
          Description of the Class
static class Shape.SetFillStyle
          Description of the Class
static class Shape.SetLeftFillStyle
          Description of the Class
static class Shape.SetLineStyle
          Description of the Class
static class Shape.SetRightFillStyle
          Description of the Class
static class Shape.SetStyle
          Description of the Class
static class Shape.Style
          Description of the Class
static class Shape.Vector
          Description of the Class
 
Field Summary
protected  double currx
          Description of the Field
protected  double curry
          Description of the Field
protected  java.util.List elements
          Description of the Field
protected  boolean hasAlpha
          Description of the Field
protected  double maxLineWidth
          Description of the Field
protected  double maxX
          Description of the Field
protected  double maxY
          Description of the Field
protected  double minX
          Description of the Field
protected  double minY
          Description of the Field
 
Fields inherited from class pt.tumba.parser.swf.Symbol
id
 
Constructor Summary
Shape()
          Constructor for the Shape object
 
Method Summary
 void curve(double x, double y, double controlX, double controlY)
          Draw a curve in the current line style (if any)
 void defineFillStyle(Color color2)
          Define a color fill
 void defineFillStyle(Color[] colors, int[] ratios, Transform matrix, boolean radial)
          Define a gradient fill
 void defineFillStyle(Symbol image, Transform matrix, boolean clipped)
          Define an image fill
 void defineLineStyle(double width, Color color2)
          Define a line style
protected  int defineSymbol(Movie movie, SWFTagTypes timelineWriter, SWFTagTypes definitionWriter)
          Description of the Method
 double[] getBoundingRectangle()
          Get the bounding rectangle as a double[4] - (min-X,min-Y,max-X,max-Y)
protected  Rect getRect()
          Gets the rect attribute of the Shape object
 java.util.List getShapeElements()
          Access the list of shape elements Each object is a subclass of Shape.Element
 void line(double x, double y)
          Draw a line in the current line style (if any)
 void move(double x, double y)
          Move the pen without drawing any line
protected  void predefineImageFills(Movie movie, SWFTagTypes timelineWriter, SWFTagTypes definitionWriter)
          Description of the Method
 void setBoundingRectangle(double minX, double minY, double maxX, double maxY)
          Set the bounding rectangle.
 void setLeftFillStyle(int index)
          Set the left fill style
 void setLineStyle(int index)
          Set the line style
 void setRightFillStyle(int index)
          Set the right fill style
protected  void writeGlyph(SWFVectors vecs)
          Description of the Method
protected  void writeShape(SWFShape shape)
          Description of the Method
protected  void writeVector(SWFVectors vecs, java.lang.Object el)
          Description of the Method
 
Methods inherited from class pt.tumba.parser.swf.Symbol
define, getId, getNextId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elements

protected java.util.List elements
Description of the Field


minX

protected double minX
Description of the Field


maxX

protected double maxX
Description of the Field


minY

protected double minY
Description of the Field


maxY

protected double maxY
Description of the Field


hasAlpha

protected boolean hasAlpha
Description of the Field


maxLineWidth

protected double maxLineWidth
Description of the Field


currx

protected double currx
Description of the Field


curry

protected double curry
Description of the Field

Constructor Detail

Shape

public Shape()
Constructor for the Shape object

Method Detail

getBoundingRectangle

public double[] getBoundingRectangle()
Get the bounding rectangle as a double[4] - (min-X,min-Y,max-X,max-Y)

Returns:
The boundingRectangle value

setBoundingRectangle

public void setBoundingRectangle(double minX,
                                 double minY,
                                 double maxX,
                                 double maxY)
Set the bounding rectangle. This will be automatically calculated as the geometry vectors are defined and this rectangle will be enlarged if it does not contain all the vectors.

Parameters:
minx - The new boundingRectangle value
minY - The new boundingRectangle value
maxX - The new boundingRectangle value
maxY - The new boundingRectangle value

getShapeElements

public java.util.List getShapeElements()
Access the list of shape elements Each object is a subclass of Shape.Element

Returns:
The shapeElements value

defineLineStyle

public void defineLineStyle(double width,
                            Color color2)
Define a line style

Parameters:
color - if null then black is assumed
width - Description of the Parameter

defineFillStyle

public void defineFillStyle(Color color2)
Define a color fill

Parameters:
color - if null then white is assumed

defineFillStyle

public void defineFillStyle(Symbol image,
                            Transform matrix,
                            boolean clipped)
Define an image fill

Parameters:
image - Description of the Parameter
matrix - Description of the Parameter
clipped - Description of the Parameter

defineFillStyle

public void defineFillStyle(Color[] colors,
                            int[] ratios,
                            Transform matrix,
                            boolean radial)
Define a gradient fill

Parameters:
colors - Description of the Parameter
ratios - Description of the Parameter
matrix - Description of the Parameter
radial - Description of the Parameter

setLeftFillStyle

public void setLeftFillStyle(int index)
Set the left fill style

Parameters:
index - The new leftFillStyle value

setRightFillStyle

public void setRightFillStyle(int index)
Set the right fill style

Parameters:
index - The new rightFillStyle value

setLineStyle

public void setLineStyle(int index)
Set the line style

Parameters:
index - The new lineStyle value

move

public void move(double x,
                 double y)
Move the pen without drawing any line

Parameters:
x - Description of the Parameter
y - Description of the Parameter

line

public void line(double x,
                 double y)
Draw a line in the current line style (if any)

Parameters:
x - Description of the Parameter
y - Description of the Parameter

curve

public void curve(double x,
                  double y,
                  double controlX,
                  double controlY)
Draw a curve in the current line style (if any)

Parameters:
x - Description of the Parameter
y - Description of the Parameter
controlX - Description of the Parameter
controlY - Description of the Parameter

defineSymbol

protected int defineSymbol(Movie movie,
                           SWFTagTypes timelineWriter,
                           SWFTagTypes definitionWriter)
                    throws java.io.IOException
Description of the Method

Specified by:
defineSymbol in class Symbol
Parameters:
movie - Description of the Parameter
timelineWriter - Description of the Parameter
definitionWriter - Description of the Parameter
Returns:
Description of the Return Value
Throws:
java.io.IOException - Description of the Exception

getRect

protected Rect getRect()
Gets the rect attribute of the Shape object

Returns:
The rect value

predefineImageFills

protected void predefineImageFills(Movie movie,
                                   SWFTagTypes timelineWriter,
                                   SWFTagTypes definitionWriter)
                            throws java.io.IOException
Description of the Method

Parameters:
movie - Description of the Parameter
timelineWriter - Description of the Parameter
definitionWriter - Description of the Parameter
Throws:
java.io.IOException - Description of the Exception

writeShape

protected void writeShape(SWFShape shape)
                   throws java.io.IOException
Description of the Method

Parameters:
shape - Description of the Parameter
Throws:
java.io.IOException - Description of the Exception

writeVector

protected void writeVector(SWFVectors vecs,
                           java.lang.Object el)
                    throws java.io.IOException
Description of the Method

Parameters:
vecs - Description of the Parameter
el - Description of the Parameter
Throws:
java.io.IOException - Description of the Exception

writeGlyph

protected void writeGlyph(SWFVectors vecs)
                   throws java.io.IOException
Description of the Method

Parameters:
vecs - Description of the Parameter
Throws:
java.io.IOException - Description of the Exception