Fields Summary |
---|
protected static int | INITIAL_STROKE_WIDTH_IMPLDefault stroke width |
protected static int | INITIAL_STROKE_MITER_LIMIT_IMPLDefault miter limit |
protected static int[] | INITIAL_STROKE_DASH_ARRAY_IMPLDefault dash array |
protected static int | INITIAL_STROKE_DASH_OFFSET_IMPLDefault dash offset |
protected static final int | FONT_STYLE_MASK |
protected static final int | FONT_WEIGHT_MASK |
protected static final int | TEXT_ANCHOR_MASK |
protected static final int | STROKE_OPACITY_MASK |
protected static final int | FILL_OPACITY_MASK |
protected static final int | FILL_RULE_MASK |
protected static final int | STROKE_LINE_CAP_MASK |
protected static final int | STROKE_LINE_JOIN_MASK |
protected static final int | VISIBILITY_MASK |
protected static final int | DISPLAY_MASK |
protected static final int | OPACITY_MASK |
protected static final int | FONT_STYLE_NORMAL_IMPL |
protected static final int | FONT_STYLE_ITALIC_IMPL |
protected static final int | FONT_STYLE_OBLIQUE_IMPL |
protected static final int | FONT_WEIGHT_100_IMPL |
protected static final int | FONT_WEIGHT_200_IMPL |
protected static final int | FONT_WEIGHT_300_IMPL |
protected static final int | FONT_WEIGHT_400_IMPL |
protected static final int | FONT_WEIGHT_500_IMPL |
protected static final int | FONT_WEIGHT_600_IMPL |
protected static final int | FONT_WEIGHT_700_IMPL |
protected static final int | FONT_WEIGHT_800_IMPL |
protected static final int | FONT_WEIGHT_900_IMPL |
protected static final int | TEXT_ANCHOR_MIDDLE_IMPL |
protected static final int | TEXT_ANCHOR_START_IMPL |
protected static final int | TEXT_ANCHOR_END_IMPL |
protected static final int | CAP_BUTT_IMPL |
protected static final int | CAP_ROUND_IMPL |
protected static final int | CAP_SQUARE_IMPL |
protected static final int | JOIN_MITER_IMPL |
protected static final int | JOIN_ROUND_IMPL |
protected static final int | JOIN_BEVEL_IMPL |
protected PaintServer | fillColor used for fill operations |
protected PaintServer | strokeColor used for fill operations |
protected RGB | colorContext Color. Corresponds to the concept of
'current color' in CSS |
protected int[] | strokeDashArrayControls the strokeDash pattern for stroke operations.
If the array is null, a solid line is used |
protected int | strokeWidthControls the width of the stroke. 15.16 format. |
protected int | strokeMiterLimitControls the miter limit for stroke operations. 15.16 format. |
protected int | strokeDashOffsetControls the offset in the dash array for
stroke operations. 15.16 format. |
protected String[] | fontFamilyControls the current font family. The font family is
a list, which means that a set of fonts may be used
to render a given text string. The fonts are queried in
order to check which ones can render characters in the
drawn text. |
protected float | fontSizeControls the current font size |
protected int | pack |
protected static final int | INITIAL_FONT_STYLE_IMPL |
protected static final int | INITIAL_FONT_WEIGHT_IMPL |
protected static final int | INITIAL_TEXT_ANCHOR_IMPL |
protected static final int | INITIAL_STROKE_OPACITY_IMPL |
protected static final int | INITIAL_FILL_OPACITY_IMPL |
protected static final int | INITIAL_FILL_RULE_IMPL |
protected static final int | INITIAL_STROKE_LINE_CAP_IMPL |
protected static final int | INITIAL_STROKE_LINE_JOIN_IMPL |
protected static final int | INITIAL_VISIBILITY_IMPL |
protected static final int | INITIAL_DISPLAY_IMPL |
protected static final int | INITIAL_PACK |
protected int | pack2 |
protected static final int | INITIAL_OPACITY_IMPL |
protected static final int | INITIAL_PACK2 |
Methods Summary |
---|
int | computeStrokeDashOffset()Implemnetation: Handles negative strokeDashOffset
if (strokeDashArray == null) {
// The stroke dash offset does not matter, simply return 0
return 0;
}
if (strokeDashOffset >= 0) {
return strokeDashOffset;
}
int length = 0;
for (int i = 0; i < strokeDashArray.length; i++) {
length += strokeDashArray[i];
}
if (length <= 0) {
return 0;
}
int sdo = strokeDashOffset;
while (sdo < 0) {
sdo += length;
}
return sdo;
|
public RGB | getColor()
return this.color;
|
public boolean | getDisplay()
return ((pack & DISPLAY_MASK) == DISPLAY_MASK);
|
public PaintServer | getFill()
return fill;
|
public float | getFillOpacity()
return ((pack & FILL_OPACITY_MASK) >> 7) / 200.0f;
|
int | getFillOpacityImpl()
return (int) (((pack & FILL_OPACITY_MASK) >> 7) * 255f / 200f);
|
public int | getFillRule()
if ((pack & FILL_RULE_MASK) == FILL_RULE_MASK) {
return WIND_EVEN_ODD;
}
return WIND_NON_ZERO;
|
public java.lang.String[] | getFontFamily()
return fontFamily;
|
public float | getFontSize()
return fontSize;
|
public int | getFontStyle()
switch(pack & FONT_STYLE_MASK) {
case FONT_STYLE_NORMAL_IMPL:
return FONT_STYLE_NORMAL;
case FONT_STYLE_ITALIC_IMPL:
return FONT_STYLE_ITALIC;
default:
return FONT_STYLE_OBLIQUE;
}
|
public int | getFontWeight()
switch(pack & FONT_WEIGHT_MASK) {
case FONT_WEIGHT_100_IMPL:
return FONT_WEIGHT_100;
case FONT_WEIGHT_200_IMPL:
return FONT_WEIGHT_200;
case FONT_WEIGHT_300_IMPL:
return FONT_WEIGHT_300;
case FONT_WEIGHT_400_IMPL:
return FONT_WEIGHT_400;
case FONT_WEIGHT_500_IMPL:
return FONT_WEIGHT_500;
case FONT_WEIGHT_600_IMPL:
return FONT_WEIGHT_600;
case FONT_WEIGHT_700_IMPL:
return FONT_WEIGHT_700;
case FONT_WEIGHT_800_IMPL:
return FONT_WEIGHT_800;
default:
return FONT_WEIGHT_900;
}
|
public float | getOpacity()
return (pack2 & OPACITY_MASK) / 200.0f;
|
int | getOpacityImpl()
return (int) ((pack2 & OPACITY_MASK) * 255f / 200f);
|
public PaintServer | getStroke()
return stroke;
|
public float[] | getStrokeDashArray()
if (strokeDashArray == null) {
return null;
}
float[] sda = new float[strokeDashArray.length];
for (int i = 0; i < sda.length; i++) {
sda[i] = strokeDashArray[i] / 65536.0f;
}
return sda;
|
public float | getStrokeDashOffset()
return strokeDashOffset / 65536.0f;
|
public int | getStrokeLineCap()
switch (pack & STROKE_LINE_CAP_MASK) {
case CAP_BUTT_IMPL:
return CAP_BUTT;
case CAP_ROUND_IMPL:
return CAP_ROUND;
default:
return CAP_SQUARE;
}
|
public int | getStrokeLineJoin()
switch (pack & STROKE_LINE_JOIN_MASK) {
case JOIN_MITER_IMPL:
return JOIN_MITER;
case JOIN_ROUND_IMPL:
return JOIN_ROUND;
default:
return JOIN_BEVEL;
}
|
public float | getStrokeMiterLimit()
return strokeMiterLimit / 65536.0f;
|
public float | getStrokeOpacity()
return ((pack & STROKE_OPACITY_MASK) >> 15) / 200.0f;
|
public int | getStrokeOpacityImpl()
return (int) (((pack & STROKE_OPACITY_MASK) >> 15) * 255f / 200f);
|
public float | getStrokeWidth()
return strokeWidth / 65536.0f;
|
public int | getTextAnchor()
switch(pack & TEXT_ANCHOR_MASK) {
case TEXT_ANCHOR_START_IMPL:
return TEXT_ANCHOR_START;
case TEXT_ANCHOR_MIDDLE_IMPL:
return TEXT_ANCHOR_MIDDLE;
default:
return TEXT_ANCHOR_END;
}
|
public boolean | getVisibility()
return ((pack & VISIBILITY_MASK) == VISIBILITY_MASK);
|
public void | reset()Resets context to initial values
this.fill = INITIAL_FILL;
this.stroke = INITIAL_STROKE;
this.color = INITIAL_COLOR;
this.strokeDashArray = INITIAL_STROKE_DASH_ARRAY_IMPL;
this.strokeWidth = INITIAL_STROKE_WIDTH_IMPL;
this.strokeMiterLimit = INITIAL_STROKE_MITER_LIMIT_IMPL;
this.strokeDashOffset = INITIAL_STROKE_DASH_OFFSET_IMPL;
this.fontFamily = INITIAL_FONT_FAMILY;
this.fontSize = INITIAL_FONT_SIZE;
this.pack = INITIAL_PACK;
this.pack2 = INITIAL_PACK2;
|
public void | restore(com.sun.perseus.j2d.RenderContext rcs)
this.fill = rcs.fill;
this.stroke = rcs.stroke;
this.color = rcs.color;
this.strokeDashArray = rcs.strokeDashArray;
this.strokeWidth = rcs.strokeWidth;
this.strokeMiterLimit = rcs.strokeMiterLimit;
this.strokeDashOffset = rcs.strokeDashOffset;
this.fontFamily = rcs.fontFamily;
this.fontSize = rcs.fontSize;
this.pack = rcs.pack;
this.pack2 = rcs.pack2;
|
public com.sun.perseus.j2d.RenderContext | save()
return new RenderContext(this);
|
public void | setColor(RGB newColor)
this.color = newColor;
|
public void | setDisplay(boolean newDisplay)
if (newDisplay) {
pack |= DISPLAY_MASK;
} else {
pack &= ~DISPLAY_MASK;
}
|
public void | setFill(PaintServer newFill)
this.fill = newFill;
|
public void | setFillOpacity(float newFillOpacity)
if (newFillOpacity < 0) {
newFillOpacity = 0;
} else if (newFillOpacity > 1) {
newFillOpacity = 1;
}
pack &= ~FILL_OPACITY_MASK;
pack |= ((((int) (newFillOpacity * 200)) << 7) & FILL_OPACITY_MASK);
|
public void | setFillRule(int newFillRule)
if (newFillRule == WIND_EVEN_ODD) {
pack |= FILL_RULE_MASK;
} else {
pack &= ~FILL_RULE_MASK;
}
|
public void | setFontFamily(java.lang.String[] newFontFamily)
this.fontFamily = newFontFamily;
|
public void | setFontSize(float newFontSize)
this.fontSize = newFontSize;
|
public void | setFontStyle(int newFontStyle)
// Clear font-style.
pack &= ~FONT_STYLE_MASK;
switch(newFontStyle) {
case FONT_STYLE_NORMAL:
pack |= FONT_STYLE_NORMAL_IMPL;
break;
case FONT_STYLE_ITALIC:
pack |= FONT_STYLE_ITALIC_IMPL;
break;
default:
pack |= FONT_STYLE_OBLIQUE_IMPL;
break;
}
|
public void | setFontWeight(int newFontWeight)
// Clear font-weight
pack &= ~FONT_WEIGHT_MASK;
switch(newFontWeight) {
case FONT_WEIGHT_100:
pack |= FONT_WEIGHT_100_IMPL;
break;
case FONT_WEIGHT_200:
pack |= FONT_WEIGHT_200_IMPL;
break;
case FONT_WEIGHT_300:
pack |= FONT_WEIGHT_300_IMPL;
break;
case FONT_WEIGHT_400:
pack |= FONT_WEIGHT_400_IMPL;
break;
case FONT_WEIGHT_500:
pack |= FONT_WEIGHT_500_IMPL;
break;
case FONT_WEIGHT_600:
pack |= FONT_WEIGHT_600_IMPL;
break;
case FONT_WEIGHT_700:
pack |= FONT_WEIGHT_700_IMPL;
break;
case FONT_WEIGHT_800:
pack |= FONT_WEIGHT_800_IMPL;
break;
default:
pack |= FONT_WEIGHT_900_IMPL;
break;
}
|
public void | setOpacity(float newOpacity)
if (newOpacity < 0) {
newOpacity = 0;
} else if (newOpacity > 1) {
newOpacity = 1;
}
pack2 &= ~OPACITY_MASK;
pack2 |= (((int) (newOpacity * 200)) & OPACITY_MASK);
|
public void | setStroke(PaintServer newStroke)
this.stroke = newStroke;
|
public void | setStrokeDashArray(float[] newStrokeDashArray)
if (newStrokeDashArray == null) {
strokeDashArray = null;
} else {
strokeDashArray = new int[newStrokeDashArray.length];
for (int i = 0; i < strokeDashArray.length; i++) {
strokeDashArray[i] = (int) (newStrokeDashArray[i] * 65536);
}
}
|
public void | setStrokeDashOffset(float newStrokeDashOffset)
strokeDashOffset = (int) (newStrokeDashOffset * 65536);
|
public void | setStrokeLineCap(int newStrokeLineCap)
// Clear stroke-linecap
pack &= ~STROKE_LINE_CAP_MASK;
switch (newStrokeLineCap) {
case CAP_BUTT:
pack |= CAP_BUTT_IMPL;
break;
case CAP_ROUND:
pack |= CAP_ROUND_IMPL;
break;
default:
pack |= CAP_SQUARE_IMPL;
break;
}
|
public void | setStrokeLineJoin(int newStrokeLineJoin)
// Clear stroke-linejoin
pack &= ~STROKE_LINE_JOIN_MASK;
switch (newStrokeLineJoin) {
case JOIN_MITER:
pack |= JOIN_MITER_IMPL;
break;
case JOIN_ROUND:
pack |= JOIN_ROUND_IMPL;
break;
default:
pack |= JOIN_BEVEL_IMPL;
break;
}
|
public void | setStrokeMiterLimit(float newStrokeMiterLimit)
strokeMiterLimit = (int) (newStrokeMiterLimit * 65536);
|
public void | setStrokeOpacity(float newStrokeOpacity)
if (newStrokeOpacity < 0) {
newStrokeOpacity = 0;
} else if (newStrokeOpacity > 1) {
newStrokeOpacity = 1;
}
pack &= ~STROKE_OPACITY_MASK;
pack |= ((((int) (newStrokeOpacity * 200)) << 15) & STROKE_OPACITY_MASK);
|
public void | setStrokeWidth(float newStrokeWidth)
strokeWidth = (int) (newStrokeWidth * 65536);
|
public void | setTextAnchor(int newTextAnchor)
// Clear text-anchor.
pack &= ~TEXT_ANCHOR_MASK;
switch(newTextAnchor) {
case TEXT_ANCHOR_START:
pack |= TEXT_ANCHOR_START_IMPL;
break;
case TEXT_ANCHOR_MIDDLE:
pack |= TEXT_ANCHOR_MIDDLE_IMPL;
break;
default:
pack |= TEXT_ANCHOR_END_IMPL;
break;
}
|
public void | setVisibility(boolean newVisibility)
if (newVisibility) {
pack |= VISIBILITY_MASK;
} else {
pack &= ~VISIBILITY_MASK;
}
|