|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.graphics.device.AbstractDevice
com.tensegrity.graphics.device.SVGDevice
This Device implementation is used to export graph
documents to the scalable vector graphics (SVG) format.
| Field Summary | |
static int |
IMGTYPE_JPG
IMGTYPE_JPG: Constant for image type JPEG |
static int |
IMGTYPE_PNG
IMGTYPE_PNG: Constant for image type PNG |
static int |
OPTIMIZE_COLORS
Flag for optimizing colors, so that colors that differ less than the color tolerance value will be considered equal and no new style is created for each of them |
static int |
OPTIMIZE_COMPRESS
Constant for compression, if set the result will be gzipped |
static int |
OPTIMIZE_MAPS
Flag for optimizing rasters and try to gather as many pixels as possible in one drawRect |
static int |
OPTIMIZE_STYLES
Flag for optimizing styles and creating CSS items and reference them instead of storing the whole style string more than once |
| Fields inherited from class com.tensegrity.graphics.device.AbstractDevice |
fontFormat, fontFormatData, paintFormat, paintFormatData, strokeFormat, strokeFormatData, visibleFont, visiblePaint, visibleStroke |
| Fields inherited from interface com.tensegrity.graphics.device.Device |
DRAW_FILL, DRAW_OUTLINE |
| Method Summary | |
void |
addCustomInfo(java.lang.String name,
AttributeSet attributes)
Adds custom information to the current group context |
void |
clearClip()
Clears the currently used clip rectangle. |
void |
clearRect(int x,
int y,
int width,
int height)
Clears the specified rectangle by filling it with the background color of the current drawing surface. |
void |
clipRect(int x,
int y,
int width,
int height)
Intersects the current clip with the specified rectangle. |
void |
closeStream()
Closes the output stream |
void |
dispose()
MUST be called after finishing all drawing routines! |
void |
drawArc(int flags,
int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Draws a circular or elliptical arc covering the specified rectangle. |
void |
drawLine(int x1,
int y1,
int x2,
int y2)
This method draws a line from the starting coordinate given by x1 and y1 to the ending coordinate given
by x2 and y2. |
void |
drawOval(int flags,
int x,
int y,
int width,
int height)
Draws an oval. |
void |
drawPolygon(int flags,
int[] ptX,
int[] ptY,
int ptCount)
This method draws a closed polygon. |
void |
drawPolyline(int[] ptX,
int[] ptY,
int ptCount)
This method draws a polyline. |
void |
drawRect(int flags,
int x,
int y,
int width,
int height)
This methods draws the rectangle defined by the given parameters. |
void |
drawRoundRect(int flags,
int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Draws a round-cornered rectangle using this graphic contexts currently set Stroke- and PaintFormat. |
void |
drawString(java.lang.String str,
int x,
int y)
Draws the text given by the specified string, using this graphics context's current font and color. |
void |
enterGroup(java.lang.String name,
java.util.Map attributes)
Opens a new group context to that custom attributes can be added. |
void |
enterLinkGroup(java.lang.String title,
java.lang.String hRef,
java.lang.String targetFrame)
Opens a new group context to that custom attributes can be added. |
Boundary |
getClipBounds()
Returns the bounding rectangle of the current clipping area. |
Boundary |
getClipBounds(Boundary r)
Returns the bounding rectangle of the current clipping area. |
int |
getColorTolerance()
Returns the current color tolerance of this device. |
static SVGDevice |
getDevice()
Returns the reusable SVG device |
static SVGDevice |
getDevice(int bgColor)
Returns the reusable SVG device |
static SVGDevice |
getDevice(int bgColor,
Coordinate viewPos)
Returns the reusable SVG device |
static int |
getImgTypeForRasters()
Returns the imgTypeForRasters. |
boolean |
getJPEGForceBaseline()
Returns the force baseline option that is used for the jpg encoding when storing embedded textures |
float |
getJPEGQuality()
Returns the quality setting that is used for JPEG encoding when storing embedded textures |
Transform2D |
getTransform()
Returns a copy of the current AffineTransform in the
Device. |
boolean |
hitClip(int x,
int y,
int width,
int height)
Returns true if the specified rectangular area intersects
the bounding rectangle of the current clipping area. |
void |
initiate()
MUST be called before any drawing routine! |
boolean |
isAntialiasing()
Returns true if antialising is enabled for
this Device, otherwise false is returned. |
boolean |
isInhibitLT2RBFlip()
|
boolean |
isInhibitYFlip()
|
boolean |
isInLinkGroup()
Checks whether the device is currently in a link group context |
boolean |
isOptimizing2DMaps()
Returns true, if the optimization of 2DMaps (textures, patterns) is turned on. |
boolean |
isOptimizingColors()
Returns true, if the optimization of colors is turned on. |
boolean |
isOptimizingCompress()
Returns true, if the compression is turned on. |
boolean |
isOptimizingStyles()
Returns true, if the optimization of styles is turned on. |
boolean |
isPrinting()
|
void |
leaveGroup()
Leaves the current group context and enters the parent group context |
void |
leaveLinkGroup()
Leaves the current group context and enters the parent group context |
void |
setAntialiasing(boolean antialiasing)
Enables or disables antialiasing for this Device |
void |
setBackground(int colorRGB)
Sets the background color |
void |
setClip(int x,
int y,
int width,
int height)
Sets the current clip to the rectangle specified by the given coordinates. |
void |
setClipBounds(Boundary boundary)
Sets the current clip to the rectangle specified by the given coordinates. |
void |
setColorTolerance(int tolerance)
Sets the color tolerance for this device. |
void |
setFontFormat(FontFormat fontFormat)
Sets the FontFormat that will be used for all
subsequent text drawing operations. |
void |
setFontFormatData(java.lang.Object[] fontFormatData)
Because all formats get pooled, illustrators and users need an easy way to change them. |
static void |
setImgTypeForRasters(int imgTypeForRasters)
Sets the value of imgTypeForRasters |
void |
setInhibitLT2RBFlip(boolean inhibitLT2RBFlip)
|
void |
setInhibitYFlip(boolean inhibitYFlip)
|
void |
setIsPrinting(boolean isPrinting)
|
void |
setJPEGForceBaseline(boolean forceBaseline)
Sets the force baseline option that is used for the jpg encoding when storing embedded textures |
void |
setJPEGQuality(float quality)
Sets the quality setting that is used for JPEG encoding when storing embedded textures. |
void |
setOptimization(int optimizationMask)
Sets the optimization setting to a selection of items and removes all others. |
void |
setOptimization(int optimizationMask,
boolean enabled)
Sets the optimization state of a single or a selection of items without changing the others. |
void |
setOutput(java.io.OutputStream os)
Sets the output stream for this device. |
void |
setPaintFormat(PaintFormat paintFormat)
Sets the PaintFormat the Device should use
for filling areas. |
void |
setPaintFormatData(java.lang.Object[] paintFormatData)
Sets the PaintFormat rendering data the Device
should use for filling areas.
|
void |
setPaintMode()
Sets the paint mode of this graphics context to overwrite the destination with this graphics context's current color. |
void |
setStrokeFormat(StrokeFormat strokeFormat)
Sets a new stroke format |
void |
setStrokeFormatData(java.lang.Object[] strokeFormatData)
Sets the StrokeFormat rendering data the Device
should use for drawing lines or borders around rectangles and polygons.
|
void |
setTransform(Transform2D xform)
Sets the Transform2D in the Device. |
void |
setXORMode(int xorAlternationColor)
Sets mode to XOR mode (unsupported) |
void |
translate(int x,
int y)
This method translates the origin of this devise to the point given by x and y in the actual coordinate of this
device. |
| Methods inherited from class com.tensegrity.graphics.device.AbstractDevice |
getFontFormat, getPaintFormat, getStrokeFormat |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.tensegrity.graphics.device.Device |
getFontFormat, getPaintFormat, getStrokeFormat |
| Field Detail |
public static final int OPTIMIZE_MAPS
public static final int OPTIMIZE_STYLES
public static final int OPTIMIZE_COMPRESS
public static final int OPTIMIZE_COLORS
public static final int IMGTYPE_JPG
IMGTYPE_JPG: Constant for image type JPEG
public static final int IMGTYPE_PNG
IMGTYPE_PNG: Constant for image type PNG
| Method Detail |
public static SVGDevice getDevice()
public static SVGDevice getDevice(int bgColor)
bgColor - The background color
public static SVGDevice getDevice(int bgColor,
Coordinate viewPos)
bgColor - The background colorviewPos - The view position to use for the SVG
public void initiate()
initiate in interface Devicepublic void dispose()
dispose in interface Devicepublic void setStrokeFormat(StrokeFormat strokeFormat)
setStrokeFormat in interface DevicesetStrokeFormat in class AbstractDevicestrokeFormat - The stroke format to setpublic void setStrokeFormatData(java.lang.Object[] strokeFormatData)
DeviceStrokeFormat rendering data the Device
should use for drawing lines or borders around rectangles and polygons.
When invoking this method the StrokeFormat is used instead of
the color value the Device currently uses. If the
Device should use the current color value, this method has
to be called with a null parameter.
The given array has to consist of three Integer objects.
The meaning of the value is defined by its position in the array. The
following list specifies the valid index positions:
setStrokeFormatData in interface DevicesetStrokeFormatData in class AbstractDeviceDevice.setStrokeFormatData(java.lang.Object[])public void setPaintFormat(PaintFormat paintFormat)
DevicePaintFormat the Device should use
for filling areas. If the current color should be used, this method
has to be called with a null parameter.
setPaintFormat in interface DevicesetPaintFormat in class AbstractDevicepublic void setPaintFormatData(java.lang.Object[] paintFormatData)
DevicePaintFormat rendering data the Device
should use for filling areas.
When invoking this method the PaintFormat is used instead of the
color value the Device> currently uses. If the
Device should use the current color value, this method has
to be called with a null parameter.
Overall eight values of the given array are estimated.
REVIEWJAVADOC: Device.java : what do you mean by "estimated"???
The meaning of each value is defined by its position in the array. The following
table specifies the valid index positions and object types:
| Index | Type |
|---|---|
RenderingData.VALUEINDEX_PAINT_STYLE |
Integer |
RenderingData.VALUEINDEX_PAINT_COLORBACK |
Integer |
RenderingData.VALUEINDEX_PAINT_COLORFORE |
Integer |
RenderingData.VALUEINDEX_PAINT_GRADIENTTYPE |
Integer |
RenderingData.VALUEINDEX_PAINT_PATTERNTYPE |
Integer |
RenderingData.VALUEINDEX_PAINT_TEXTURE |
Texture |
RenderingData.VALUEINDEX_PAINT_TRANSPARENCY |
Integer |
RenderingData.VALUEINDEX_PAINT_TRANSPARENT |
Boolean |
setPaintFormatData in interface DevicesetPaintFormatData in class AbstractDevicepublic void setFontFormat(FontFormat fontFormat)
DeviceFontFormat that will be used for all
subsequent text drawing operations. When the default color and font
of the Device should be used, the method has to be called
with a null parameter.
setFontFormat in interface DevicesetFontFormat in class AbstractDevicepublic void setFontFormatData(java.lang.Object[] fontFormatData)
DeviceFontFormat rendering data that will be used for all
subsequent text drawing operations. When the Device
should use the current color value and the default font of the
device, however, this method has to be called with a null parameter.
At this time, four values of the given array are estimated.
REVIEWJAVADOC: There is that word "estimated" again!!!
The meaning
of each value is defined by its position in the array. The following
list specifies the valid index positions and object types:
| Index | Type |
|---|---|
RenderingData.VALUEINDEX_FONT_SIZE |
Integer |
RenderingData.VALUEINDEX_FONT_WEIGHT |
Integer |
RenderingData.VALUEINDEX_FONT_FAMILY |
String |
RenderingData.VALUEINDEX_FONT_ITALIC |
Boolean |
setFontFormatData in interface DevicesetFontFormatData in class AbstractDevice
public void translate(int x,
int y)
Devicex and y in the actual coordinate of this
device. All coordinates in subsequent calls to drawing methods are
assumed to be relative to the new origin.
translate in interface Devicex - the x coordinate of the new originy - the y coordinate of the new originpublic Transform2D getTransform()
DeviceAffineTransform in the
Device.
getTransform in interface DeviceAffineTransform in the
Device.public void setTransform(Transform2D xform)
DeviceTransform2D in the Device.
setTransform in interface Devicexform - the Transform2D object to be used in the
rendering processpublic void setPaintMode()
Device
setPaintMode in interface Devicepublic void setXORMode(int xorAlternationColor)
setXORMode in interface DevicexorAlternationColor - The xor color to setDevice.setXORMode(int)
public void setClip(int x,
int y,
int width,
int height)
Device
setClip in interface Devicex - the left coordinate of the new clip rectangley - the top coordinate of the new clip rectanglewidth - the extent of the new clip rectangle in x directionheight - the extent of the new clip rectangle in y direction
public void clipRect(int x,
int y,
int width,
int height)
Device
clipRect in interface Devicex - the x coordinate of the rectangle to intersect the clip withy - the y coordinate of the rectangle to intersect the clip withwidth - the width of the rectangle to intersect the clip withheight - the height of the rectangle to intersect the clip with
public boolean hitClip(int x,
int y,
int width,
int height)
Devicetrue if the specified rectangular area intersects
the bounding rectangle of the current clipping area. The coordinates in
the rectangle are relative to the coordinate system origin of this
graphics context.
hitClip in interface Devicex - the x coordinate of the rectangle to test against the clipy - the y coordinate of the rectangle to test against the clipwidth - the width of the rectangle to test against the clipheight - the height of the rectangle to test against the clip
true if the specified rectangular area intersects
the bounding rectangle of the current clipping area.public Boundary getClipBounds()
Device
getClipBounds in interface Devicepublic Boundary getClipBounds(Boundary r)
DeviceDevice.getClipBounds() in that an existing Boundary is
used instead of allocating a new one. This method refers to the user
clip, which is independent of the clipping associated with device bounds
and window visibility. If no clip has previously been set, or if the clip
has been cleared using setClip(null), this method returns
the specified Boundary.
getClipBounds in interface Devicer - the rectangular boundary where the current clipping area
is copied to. Any current values in this rectangle are overwritten.
public void setClipBounds(Boundary boundary)
Device
setClipBounds in interface Deviceboundary - the new bounding rectangle to clip againstpublic void clearClip()
Device
clearClip in interface Device
public void drawLine(int x1,
int y1,
int x2,
int y2)
Devicex1 and y1 to the ending coordinate given
by x2 and y2.
drawLine in interface Devicex1 - the starting coordinate x valuey1 - the starting coordinate y valuex2 - the ending coordinate x valuey2 - the ending coordinate y value
public void drawRect(int flags,
int x,
int y,
int width,
int height)
Devicex and y. The right
coordinates are calculated by x + width and the bottom
coordinates are calculated by y + height.
drawRect in interface Deviceflags - bitwise combined flags that determine what to draw.x - the left coordinate of the rectangle.y - the top coordinate of the rectangle.width - the extent in x direction.height - the extent in y direction.
public void drawRoundRect(int flags,
int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
DeviceStroke- and PaintFormat. The
left and right edges of the rectangle are at x and
x + width, respectively. The top and bottom edges of the
rectangle are at y and y + height.
drawRoundRect in interface Deviceflags - bitwise combined flags that determine what to drawx - the x coordinate of the rectangle to be drawny - the y coordinate of the rectangle to be drawnwidth - the width of the rectangle to be drawnheight - the height of the rectangle to be drawnarcWidth - the horizontal diameter of the arc at the four cornersarcHeight - the vertical diameter of the arc at the four corners
public void clearRect(int x,
int y,
int width,
int height)
Device
clearRect in interface Devicex - the x coordinate of the rectangle to be cleary - the y coordinate of the rectangle to be clearwidth - the width of the rectangle to be clearheight - the height of the rectangle to be clear
public void drawOval(int flags,
int x,
int y,
int width,
int height)
Device
drawOval in interface Deviceflags - bitwise combined flags that determine what to drawx - the x coordinate of the upper left corner of the oval to be
drawny - the y coordinate of the upper left corner of the oval to be
drawnwidth - the width of the oval to be drawnheight - the height of the oval to be drawn
public void drawArc(int flags,
int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
DevicestartAngle and extends for
arcAngle degrees, using the current color of the
Device. Angles are interpreted in such a manner that a
degree of 0 belongs to the 3 o'clock position. A positive value
indicates a counter-clockwise rotation while a negative value
indicates a clockwise rotation. The center of the arc is the center
of the rectangle whose origin is (x, y) and whose size is
specified by the width and height arguments. The resulting arc
covers an area width + 1 pixels wide by height + 1
pixels tall. The angles are specified relative to the non-square
extents of the bounding rectangle such that 45 degrees always falls
on the line from the center of the ellipse to the upper right corner
of the bounding rectangle. As a result, if the bounding rectangle is
noticeably longer in one axis than the other, the angles to the
start and end of the arc segment will be skewed farther along the
longer axis of the bounds.
drawArc in interface Deviceflags - bitwise combined flags that determine what to drawx - the x coordinate of the upper-left corner of the arc to be
drawny - the y coordinate of the upper-left corner of the arc to be
drawnwidth - the width of the arc to be drawnheight - the height of the arc to be drawnstartAngle - the beginning anglearcAngle - the angular extent of the arc, relative to the start
angle
public void drawPolyline(int[] ptX,
int[] ptY,
int ptCount)
Device
drawPolyline in interface DeviceptX - the x coordinates of the pointsptY - the y coordinates of the pointsptCount - the amount of points the polygon consist of
public void drawPolygon(int flags,
int[] ptX,
int[] ptY,
int ptCount)
Device
drawPolygon in interface Deviceflags - bitwise combined flags that determine what to drawptX - the x coordinates of the pointsptY - the y coordinates of the pointsptCount - the amount of points the polygon consist of
public void drawString(java.lang.String str,
int x,
int y)
Device
drawString in interface Devicestr - the string to be drawnx - the x coordinatey - the y coordinatepublic void setIsPrinting(boolean isPrinting)
setIsPrinting in interface Devicepublic boolean isPrinting()
isPrinting in interface Devicepublic void setInhibitLT2RBFlip(boolean inhibitLT2RBFlip)
setInhibitLT2RBFlip in interface Devicepublic boolean isInhibitLT2RBFlip()
isInhibitLT2RBFlip in interface Devicepublic void setInhibitYFlip(boolean inhibitYFlip)
setInhibitYFlip in interface Devicepublic boolean isInhibitYFlip()
isInhibitYFlip in interface Devicepublic void setAntialiasing(boolean antialiasing)
DeviceDevice
setAntialiasing in interface Deviceantialiasing - true indicates that
anti-aliasing should be enabled, false disables it.public boolean isAntialiasing()
Devicetrue if antialising is enabled for
this Device, otherwise false is returned.
isAntialiasing in interface Devicetrue if antialising is enabled for
this Device, otherwise false is returned.public static void setImgTypeForRasters(int imgTypeForRasters)
imgTypeForRasters - The new value to set.public static int getImgTypeForRasters()
public void setOutput(java.io.OutputStream os)
os - The outputstream to usepublic void closeStream()
public void setBackground(int colorRGB)
colorRGB - The background color to setpublic boolean isOptimizing2DMaps()
public boolean isOptimizingStyles()
public boolean isOptimizingColors()
public boolean isOptimizingCompress()
public void setOptimization(int optimizationMask,
boolean enabled)
optimizationMask - The flags to changeenabled - The new state of these itemspublic void setOptimization(int optimizationMask)
optimizationMask - The flags to enable, all others will be removedpublic void setColorTolerance(int tolerance)
tolerance - The tolerance to setpublic void setJPEGForceBaseline(boolean forceBaseline)
forceBaseline - the force baseline option that is used
for the jpg encodingpublic boolean getJPEGForceBaseline()
public float getJPEGQuality()
public void setJPEGQuality(float quality)
quality - the quality setting that is used for JPEG encoding when
storing embedded texturespublic int getColorTolerance()
public void enterLinkGroup(java.lang.String title,
java.lang.String hRef,
java.lang.String targetFrame)
title - The title of the linkhRef - The URL of the linktargetFrame - The target frame to display the link in or null,
to show the target in the current frame.
Use "_new" to show the link in a new windowpublic void leaveLinkGroup()
public boolean isInLinkGroup()
public void enterGroup(java.lang.String name,
java.util.Map attributes)
name - The name of the group to openattributes - The attributes to set
(null is allowed to set no attributes)public void leaveGroup()
public void addCustomInfo(java.lang.String name,
AttributeSet attributes)
name - The name of the info element to addattributes - The attributes to add to the info element
(null is allowed to set no attributes)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||