cz.cuni.jagrlib.iface
Interface VectorGraphics

All Superinterfaces:
Property

public interface VectorGraphics
extends Property

Vector graphics interface (scalable atomic 2D drawing commands).

Since:
0.02
See Also:
VectorGraphics.java, VectorCommand, VCommand

Field Summary
 
Fields inherited from interface cz.cuni.jagrlib.iface.Property
LOGGING, STATISTICS, TEXT_DESCRIPTION
 
Method Summary
 void arcTo(double x, double y, double r, double alpha, double beta)
          ArcTo(x,y,r,alpha,beta) command.
 void clip()
          Clip command.
 void close()
          Close the current vector-command stream.
 void closePath()
          ClosePath command.
 void command(VectorCommand c)
          Single command processing.
 void commands(java.util.Iterator<VectorCommand> c)
          Multiple command processing.
 void commands(VectorCommand[] c)
          Multiple command processing.
 int createFont(java.lang.String name, int style, double size)
          Creates a new font and places it in slot A (actual, working font).
 void cubicCurveTo(double x1, double y1, double x2, double y2, double x3, double y3)
          CubicCurveTo(x1,y1,x2,y2,x3,y3) command.
 void drawText(java.lang.String text, TextRender.TextExtent ext)
          Draws the given text.
 void fill()
          Fill command.
 double fontOrientation(double angle)
          Changes the actual font's orientation.
 int fontProperties()
          Returns properties (flags) of the actual font (slot A).
 void getFont(int slot)
          Assigns the actual font (slot A) from the given slot.
 TextRender.TextExtent getKern(char c1, char c2, TextRender.TextExtent ext)
          Returns the kerning (space correction) which should be used between two given characters.
 void lineTo(double x, double y)
          LineTo(x,y) command.
 void moveTo(double x, double y)
          MoveTo(x,y) command.
 void newPath()
          NewPath command.
 void open()
          Interface (re-)initialization (new vector-command stream will be produced).
 void popPath()
          PopPath command.
 void pushPath()
          PushPath command.
 void putFont(int slot)
          Puts the actual font (slot A) into the given slot.
 void rArcTo(double x, double y, double r, double alpha, double beta)
          RArcTo(x,y,r,alpha,beta) command.
 void setColor(double[] color)
          SetColor command.
 void setFillCallback(FillCallback callback)
          SetFillCallback command.
 void setFillStyle(int style)
          SetFillStyle command.
 void setLineCallback(StrokeCallback callback)
          SetLineCallback command.
 void setLineStyle(int style)
          SetLineStyle command.
 void setLineWidth(double width)
          SetLineWidth command.
 void stroke()
          Stroke command.
 TextRender.TextExtent textExtent(java.lang.String text, TextRender.TextExtent ext)
          Computes the extent of the given text string (without any output change).
 void textPath(java.lang.String text)
          Generates path of the given text string and appends it to the current path.
 
Methods inherited from interface cz.cuni.jagrlib.iface.Property
commit, get, set
 

Method Detail

open

void open()
Interface (re-)initialization (new vector-command stream will be produced).


close

void close()
Close the current vector-command stream.


newPath

void newPath()
NewPath command.

See Also:
VCommand.NewPath

moveTo

void moveTo(double x,
            double y)
MoveTo(x,y) command.

Parameters:
x - X coordinate.
y - Y coordinate.
See Also:
VCommand.MoveTo

lineTo

void lineTo(double x,
            double y)
LineTo(x,y) command.

Parameters:
x - X coordinate.
y - Y coordinate.
See Also:
VCommand.LineTo

arcTo

void arcTo(double x,
           double y,
           double r,
           double alpha,
           double beta)
ArcTo(x,y,r,alpha,beta) command.

Parameters:
x - X coordinate of arc center.
y - Y coordinate of arc center.
r - Arc radius.
alpha - Starting angle in degrees.
beta - Finishing angle in degrees.
See Also:
VCommand.ArcTo

rArcTo

void rArcTo(double x,
            double y,
            double r,
            double alpha,
            double beta)
RArcTo(x,y,r,alpha,beta) command.

Parameters:
x - X coordinate of arc center.
y - Y coordinate of arc center.
r - Arc radius.
alpha - Starting angle in degrees.
beta - Finishing angle in degrees.
See Also:
VCommand.RArcTo

cubicCurveTo

void cubicCurveTo(double x1,
                  double y1,
                  double x2,
                  double y2,
                  double x3,
                  double y3)
CubicCurveTo(x1,y1,x2,y2,x3,y3) command.

Parameters:
x1 - X coordinate of the 2nd control point.
y1 - Y coordinate of the 2nd control point.
x2 - X coordinate of the 3rd control point.
y2 - Y coordinate of the 3rd control point.
x3 - X coordinate of the 4th control point.
y3 - Y coordinate of the 4th control point.
See Also:
VCommand.CubicCurveTo

closePath

void closePath()
ClosePath command.

See Also:
VCommand.ClosePath

stroke

void stroke()
Stroke command.

See Also:
VCommand.Stroke

fill

void fill()
Fill command.

See Also:
VCommand.Fill

clip

void clip()
Clip command.

See Also:
VCommand.Clip

pushPath

void pushPath()
PushPath command.

See Also:
VCommand.PushPath

popPath

void popPath()
PopPath command.

See Also:
VCommand.PopPath

setColor

void setColor(double[] color)
SetColor command.

Parameters:
color - New actual color in Gr[A] or RGB[A] format.
See Also:
VCommand.SetColor

setLineWidth

void setLineWidth(double width)
SetLineWidth command.

Parameters:
width - New line width.
See Also:
VCommand.SetLineWidth

setLineStyle

void setLineStyle(int style)
SetLineStyle command.

Parameters:
style - New line style: use VectorCommand.LINE_* constant.
See Also:
VCommand.SetLineStyle, VectorCommand.LINE_SOLID

setFillStyle

void setFillStyle(int style)
SetFillStyle command.

Parameters:
style - New fill style: use VectorCommand.FILL_* constant.
See Also:
VCommand.SetFillStyle, VectorCommand.FILL_SOLID

setLineCallback

void setLineCallback(StrokeCallback callback)
SetLineCallback command.

Parameters:
callback - Line callback object.
See Also:
VCommand.SetLineStyle, VCommand.SetLineCallback, VectorCommand.LINE_CALLBACK

setFillCallback

void setFillCallback(FillCallback callback)
SetFillCallback command.

Parameters:
callback - File callback object.
See Also:
VCommand.SetFillStyle, VCommand.SetFillCallback, VectorCommand.FILL_CALLBACK

createFont

int createFont(java.lang.String name,
               int style,
               double size)
Creates a new font and places it in slot A (actual, working font).

Parameters:
name - Font name.
style - Font style - used if exact font match was not successful (bitwise OR of TextRender.FONT_* constants).
size - Font size (distance between two regularly spaced text lines).
Returns:
Result code (one of TextRender.CREATE_* constants).
See Also:
TextRender.FONT_BOLD, TextRender.CREATE_EXACT, VCommand.CreateFont

fontOrientation

double fontOrientation(double angle)
Changes the actual font's orientation.

Parameters:
angle - New font orientation (in degrees, counterclockwise).
Returns:
The old orientation.
See Also:
VCommand.FontOrientation

getFont

void getFont(int slot)
Assigns the actual font (slot A) from the given slot.

Parameters:
slot - Slot number (between 0 and TextRender.MAX_SLOT-1).
See Also:
TextRender.MAX_SLOT, VCommand.GetFont

putFont

void putFont(int slot)
Puts the actual font (slot A) into the given slot.

Parameters:
slot - Slot number (between 0 and TextRender.MAX_SLOT-1).
See Also:
TextRender.MAX_SLOT, VCommand.PutFont

fontProperties

int fontProperties()
Returns properties (flags) of the actual font (slot A).

Returns:
Bitwise OR of TextRender.PROP_* constants.
See Also:
TextRender.PROP_STROKE

textPath

void textPath(java.lang.String text)
Generates path of the given text string and appends it to the current path. Uses the current point as starting reference point (current point itself will be updated by this command).

Does nothing if the actual font has neither TextRender.PROP_STROKE nor TextRender.PROP_FILL capability.

Parameters:
text - The string to be drawn.
See Also:
VCommand.TextPath, textExtent(java.lang.String, cz.cuni.jagrlib.iface.TextRender.TextExtent), drawText(java.lang.String, cz.cuni.jagrlib.iface.TextRender.TextExtent), VCommand.MoveTo, moveTo(double, double)

drawText

void drawText(java.lang.String text,
              TextRender.TextExtent ext)
Draws the given text. Starting reference point is taken from the current point. If ext parameter is not null, the routine fills the given TextRender.TextExtent object.

Works with both vector and bitmap fonts.

Parameters:
text - The string to be drawn.
ext - The TextRender.TextExtent object to be filled (or null).
See Also:
TextRender.TextExtent, textExtent(java.lang.String, cz.cuni.jagrlib.iface.TextRender.TextExtent), VCommand.DrawText

textExtent

TextRender.TextExtent textExtent(java.lang.String text,
                                 TextRender.TextExtent ext)
Computes the extent of the given text string (without any output change). Starting reference point is taken from the current point.

Parameters:
text - The string to be drawn.
ext - The TextRender.TextExtent object to be filled (or null).
Returns:
The filled TextRender.TextExtent object.
See Also:
TextRender.TextExtent, drawText(java.lang.String, cz.cuni.jagrlib.iface.TextRender.TextExtent)

getKern

TextRender.TextExtent getKern(char c1,
                              char c2,
                              TextRender.TextExtent ext)
Returns the kerning (space correction) which should be used between two given characters.

Parameters:
c1 - First character.
c2 - Second character.
ext - The TextRender.TextExtent object to be filled (or null).
Returns:
The filled TextRender.TextExtent object (only dx and dy are used).
See Also:
TextRender.TextExtent, textExtent(java.lang.String, cz.cuni.jagrlib.iface.TextRender.TextExtent)

command

void command(VectorCommand c)
Single command processing.

See Also:
commands(VectorCommand[]), commands(Iterator)

commands

void commands(VectorCommand[] c)
Multiple command processing.

See Also:
command(VectorCommand), commands(Iterator)

commands

void commands(java.util.Iterator<VectorCommand> c)
Multiple command processing.

See Also:
command(VectorCommand), commands(VectorCommand[])