|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.jagrlib.DefaultProperty
cz.cuni.jagrlib.Piece
cz.cuni.jagrlib.piece.JavaText
public class JavaText
Text drawing using Graphics
implementation.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface cz.cuni.jagrlib.iface.TextRender |
---|
TextRender.TextExtent |
Field Summary | |
---|---|
protected boolean |
actAntialiasing
Use antialiasing? |
protected int |
antialiasing
Antialiasing logic. |
protected static int |
CACHE_GRANUL
Font cache size granularity. |
protected static java.lang.String |
CATEGORY
Object category. |
protected double |
coso
Accelerator: cos( orientation ). |
protected java.awt.Font[] |
fonts
Font slots. |
protected java.awt.Graphics2D |
graphics
Graphics associated with the current surface. |
protected boolean |
chAntialiasing
Change anti-aliasing mode before next text rendering? |
protected static double |
INV255
Multiplier 1 / 255 . |
protected double |
orientation
Actual font orientation. |
static RegPiece |
reg
Static registration instance for this class. |
protected double |
sino
Accelerator: sin( orientation ). |
protected java.awt.image.BufferedImage |
surface
Font rendering surface. |
protected int |
surfaceHei
Actual surface height in pixels (granularity CACHE_GRANUL ). |
protected int |
surfaceWid
Actual surface width in pixels (granularity CACHE_GRANUL ). |
protected static java.lang.String |
TEMPLATE_NAME
Object template identifier. |
Fields inherited from class cz.cuni.jagrlib.Piece |
---|
channels, info, pl, plugs, TEMPLATE_TYPE, userBreak |
Fields inherited from interface cz.cuni.jagrlib.iface.TextRender |
---|
ANTI_DEPEND, ANTI_MODE, ANTI_OFF, ANTI_ON, CREATE_APPROX, CREATE_EXACT, CREATE_FAIL, FONT_BOLD, FONT_DECORATIVE, FONT_ICON, FONT_ITALIC, FONT_MONOSPACED, FONT_SCRIPT, FONT_SERIF, FONT_UNDERLINE, MAX_SLOT, PROP_BITMAP, PROP_FILL, PROP_MONOSPACED, PROP_STROKE |
Fields inherited from interface cz.cuni.jagrlib.iface.Render |
---|
LINE_CAP, LINE_CAP_BUTT, LINE_CAP_ROUND, LINE_CAP_SQUARE, LINE_JOIN, LINE_JOIN_BEVEL, LINE_JOIN_DISJOINT, LINE_JOIN_MITER, LINE_JOIN_OVERLAP, LINE_JOIN_ROUND, LINE_WIDTH, PROJECTION, RENDER_STYLE, RENDER_STYLE_FLAT, RENDER_STYLE_GOURAUD, RENDER_STYLE_LINE, RENDER_STYLE_PHONG, RENDER_STYLE_TEXTURE |
Fields inherited from interface cz.cuni.jagrlib.iface.Property |
---|
LOGGING, STATISTICS, TEXT_DESCRIPTION |
Constructor Summary | |
---|---|
JavaText()
|
Method Summary | |
---|---|
int |
createFont(java.lang.String name,
int style,
double size)
Creates a new font and places it in slot A (actual, working font). |
void |
drawText(double x0,
double y0,
java.lang.String text,
TextRender.TextExtent ext)
Draws the given text. |
double |
fontOrientation(double angle)
Changes the actual font's orientation. |
int |
fontProperties()
Returns properties (flags) of the actual font (slot A). |
java.lang.Object |
get(java.lang.String key)
Gets the given property. |
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. |
protected void |
prepareSurface(int width,
int height)
Asserts enough space for the given text bounds (and clears the surface). |
void |
putFont(int slot)
Puts the actual font (slot A) into the given slot. |
void |
set(java.lang.String key,
java.lang.Object value)
Sets the given property. |
static int |
setTemplate(Template t,
int ord)
General-purpose registration routine. |
TextRender.TextExtent |
textExtent(double x0,
double y0,
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 class cz.cuni.jagrlib.Piece |
---|
className, connect, findPlug, findPlug, getInfo, getInterface, getInterface, getPlug, getReg, init, isCompatible, isCompatible, isConnected, logError, logWarning, myInterface, newInputPlug, newOptOutputPlug, newOutputPlug, newPlug, noTemplates, propBegin, propBounds, propDefault, propEnd, propEnum, propManipulator, propManipulator, setProgressListener, setRegStrings, setTemplateDynamic, stop |
Methods inherited from class cz.cuni.jagrlib.DefaultProperty |
---|
booleanProperty, booleanProperty, colorDoubleProperty, colorProperty, commit, doubleProperty, doubleProperty, doubleProperty, enumProperty, floatProperty, floatProperty, floatProperty, intProperty, intProperty, intProperty, longProperty, longProperty, longProperty, set, stringProperty |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface cz.cuni.jagrlib.iface.Property |
---|
commit |
Field Detail |
---|
protected static final int CACHE_GRANUL
protected static final double INV255
1 / 255
.
protected java.awt.image.BufferedImage surface
protected java.awt.Graphics2D graphics
protected int surfaceWid
CACHE_GRANUL
).
protected int surfaceHei
CACHE_GRANUL
).
protected double orientation
protected double sino
protected double coso
protected boolean actAntialiasing
TextRender.ANTI_MODE
property.
protected boolean chAntialiasing
protected int antialiasing
protected java.awt.Font[] fonts
fonts[0]
.
protected static final java.lang.String TEMPLATE_NAME
protected static final java.lang.String CATEGORY
public static final RegPiece reg
Constructor Detail |
---|
public JavaText()
Method Detail |
---|
protected void prepareSurface(int width, int height)
public int createFont(java.lang.String name, int style, double size)
createFont
in interface TextRender
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).
TextRender.CREATE_*
constants).TextRender.FONT_BOLD
,
TextRender.CREATE_EXACT
,
VCommand.CreateFont
public double fontOrientation(double angle)
fontOrientation
in interface TextRender
angle
- New font orientation (in degrees, counterclockwise).
VCommand.FontOrientation
public void getFont(int slot)
getFont
in interface TextRender
slot
- Slot number (between 0
and MAX_SLOT - 1
).TextRender.MAX_SLOT
,
VCommand.GetFont
public void putFont(int slot)
putFont
in interface TextRender
slot
- Slot number (between 0
and MAX_SLOT - 1
).TextRender.MAX_SLOT
,
VCommand.PutFont
public int fontProperties()
fontProperties
in interface TextRender
PROP_*
constants.TextRender.PROP_STROKE
public void textPath(java.lang.String text)
Does nothing if the actual font has neither TextRender.PROP_STROKE
nor
TextRender.PROP_FILL
capability.
textPath
in interface TextRender
text
- The string to be drawn.textExtent(double, double, java.lang.String, cz.cuni.jagrlib.iface.TextRender.TextExtent)
,
drawText(double, double, java.lang.String, cz.cuni.jagrlib.iface.TextRender.TextExtent)
,
VCommand.MoveTo
,
VectorGraphics.moveTo(double, double)
,
VCommand.TextPath
public void drawText(double x0, double y0, java.lang.String text, TextRender.TextExtent ext)
ext
parameter is not null
, the routine fills
the given TextExtent
object.
Works with both vector and bitmap fonts.
drawText
in interface TextRender
x0
- X coordinate of the starting reference point.y0
- Y coordinate of the starting reference point.text
- The string to be drawn.ext
- The TextExtent
object to be filled (or null
).TextRender.TextExtent
,
textExtent(double, double, java.lang.String, cz.cuni.jagrlib.iface.TextRender.TextExtent)
,
VCommand.DrawText
public TextRender.TextExtent textExtent(double x0, double y0, java.lang.String text, TextRender.TextExtent ext)
textExtent
in interface TextRender
x0
- X coordinate of the starting reference point.y0
- Y coordinate of the starting reference point.text
- The string to be drawn.ext
- The TextExtent
object to be filled (or null
).
TextExtent
object.TextRender.TextExtent
,
drawText(double, double, java.lang.String, cz.cuni.jagrlib.iface.TextRender.TextExtent)
public TextRender.TextExtent getKern(char c1, char c2, TextRender.TextExtent ext)
getKern
in interface TextRender
c1
- First character.c2
- Second character.ext
- The TextExtent
object to be filled (or null
).
TextExtent
object (only dx
and dy
are used).TextRender.TextExtent
,
textExtent(double, double, java.lang.String, cz.cuni.jagrlib.iface.TextRender.TextExtent)
public void set(java.lang.String key, java.lang.Object value)
set
in interface Property
set
in class DefaultProperty
key
- Key string.value
- The new value.Property.commit()
public java.lang.Object get(java.lang.String key)
get
in interface Property
get
in class DefaultProperty
key
- Key string.
null
.public static int setTemplate(Template t, int ord)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |