public class nUIChartRenderer
extends java.lang.Object
Constructor and Description |
---|
nUIChartRenderer() |
Modifier and Type | Method and Description |
---|---|
static void |
createBuffer(int width,
int height,
int color)
Create the initial buffer to render to (all rendering calls are done to an internal int[] array, and an Image is only created when complete).
|
static void |
drawArc(float cx,
float cy,
float radius,
float startAngle,
float arcAngle)
Convenience method.
|
static void |
drawArc(float cx,
float cy,
float radius,
float startAngle,
float arcAngle,
boolean anti_alias)
Convenience method.
|
static void |
drawArc(float cx,
float cy,
float radius,
float startAngle,
float arcAngle,
float line_thickness)
Convenience method.
|
static void |
drawArc(float cx,
float cy,
float radius,
float startAngle,
float arcAngle,
float line_thickness,
boolean anti_alias)
Render an outlined arc with defined radii, angle, line thickness and anti-alias setting using the current foreground colour.
|
static void |
drawLine(float x1,
float y1,
float x2,
float y2)
Convenience method.
|
static void |
drawLine(float x1,
float y1,
float x2,
float y2,
boolean anti_alias)
Convenience method.
|
static void |
drawLine(float x1,
float y1,
float x2,
float y2,
float line_thickness)
Convenience method.
|
static void |
drawLine(float x1,
float y1,
float x2,
float y2,
float line_thickness,
boolean anti_alias)
Renders a line with defined 'end points', thickness and anti-alias setting using the current foreground color.
|
static void |
drawPointMarker(float x,
float y,
float size)
Convenience method.
|
static void |
drawPointMarker(float x,
float y,
float size,
int marker_type)
Renders a point marker of a particular type
|
static void |
drawRect(float x,
float y,
float width,
float height)
Convenience method.
|
static void |
drawRect(float x,
float y,
float width,
float height,
boolean anti_alias)
Convenience method.
|
static void |
drawRect(float x,
float y,
float width,
float height,
float line_thickness)
Convenience method.
|
static void |
drawRect(float x,
float y,
float width,
float height,
float line_thickness,
boolean anti_alias)
Renders an outlined rectangle with defined line thickness and anti-alias setting using the current foreground color.
|
static void |
drawString(java.lang.String s,
int x,
int y)
Convenience method.
|
static void |
drawString(java.lang.String s,
int x,
int y,
int transform)
Render a string using the current font and foreground color at a particular location and rotation.
|
static void |
fillArc(float cx,
float cy,
float inner_radius,
float outer_radius,
float startAngle,
float arcAngle)
Convenience method.
|
static void |
fillArc(float cx,
float cy,
float inner_radius,
float outer_radius,
float startAngle,
float arcAngle,
boolean anti_alias)
Render a filled arc with defined radii, angle and anti-alias setting using the current foreground colour.
|
static void |
fillHTrapezoid(float x11,
float x12,
float y1,
float x21,
float x22,
float y2)
Convenience method.
|
static void |
fillHTrapezoid(float x11,
float x12,
float y1,
float x21,
float x22,
float y2,
boolean anti_alias)
Render a filled horizontal trapezoid (top/bottom sides at perfectly horizontal) with defined anti-alias setting using the current foreground color.
|
static void |
fillRect(float x,
float y,
float width,
float height)
Convenience method.
|
static void |
fillRect(float x,
float y,
float width,
float height,
boolean anti_alias)
Renders a filled rectangle with defined anti-alias setting using the current foreground color.
|
static void |
fillVTrapezoid(float x1,
float y11,
float y12,
float x2,
float y21,
float y22)
Convenience method.
|
static void |
fillVTrapezoid(float x1,
float y11,
float y12,
float x2,
float y21,
float y22,
boolean anti_alias)
Render a filled vertical trapezoid (left/right sides at perfectly vertical) with defined anti-alias setting using the current foreground color.
|
static int |
fontHeight()
Gets the height of the current font.
|
static void |
freeBuffer()
Frees the associated int[] buffer object from memory (cleanup).
|
static int |
getColor()
Gets the foreground color.
|
static int |
getStyle()
Gets the current "fill" rendering style.
|
static javax.microedition.lcdui.Image |
renderBufferToImage()
Generate the lcdui Image object from the buffer in its current state.
|
static void |
setClip(int x1,
int y1,
int x2,
int y2)
Sets a clipping rectangle to act on subsequent render calls.
|
static void |
setColor(int color)
Sets the foreground color to use on subsequent render calls.
|
static void |
setFont(int face,
int style,
int size)
Sets the font to use for subsequent drawString calls.
|
static void |
setStyle(int style)
Sets the rendering style to influence all subsequent "fill" methods.
|
static void |
setTopBotColorYRange(float ty,
float by)
Sets the top-most and bottom-most colors to be used by the fill technique, given set vertical bounds.
|
static int |
stringWidth(java.lang.String s)
Calculates the width of a particular string if rendered using the currently selected font.
|
public static void createBuffer(int width, int height, int color)
width
- Width in pixelsheight
- Height in pixelscolor
- AARRGGBB color to set all pixels topublic static javax.microedition.lcdui.Image renderBufferToImage()
public static void freeBuffer()
public static void setClip(int x1, int y1, int x2, int y2)
x1
- X position in pixels of top-lefty1
- Y position in pixels of top-leftx2
- X position in pixels of bottom-righty2
- Y position in pixels of bottom-rightpublic static void setColor(int color)
color
- AARRGGBB color value to usepublic static int getColor()
public static void setFont(int face, int style, int size)
face
- lcdui.Font face value to usestyle
- lcdui.Font style value to usesize
- lcdui.Font size value to useFont
public static int fontHeight()
public static void drawString(java.lang.String s, int x, int y)
public static void drawString(java.lang.String s, int x, int y, int transform)
s
- String to drawx
- X position in pixels of the top left of this stringy
- Y position in pixels of the top left of this stringtransform
- One of lcdui.Sprite.TRANS_NONE, TRANS_ROT90 or TRANS_ROT270public static int stringWidth(java.lang.String s)
s
- String to calculate width ofpublic static void setStyle(int style)
style
- One of nUIChartImage.RENDER_STYLE_FLAT or RENDER_STYLE_GRADIENTpublic static int getStyle()
public static void drawPointMarker(float x, float y, float size)
public static void drawPointMarker(float x, float y, float size, int marker_type)
x
- X position in pixels of the centrey
- Y position in pixels of the centresize
- Diameter in pixels (roughly - square is drawn this size, other markers are scaled appropriately to look balanced alongside)marker_type
- One of the nUITwoAxisChart.POINT_MARKER_ typespublic static void drawLine(float x1, float y1, float x2, float y2)
public static void drawLine(float x1, float y1, float x2, float y2, float line_thickness)
public static void drawLine(float x1, float y1, float x2, float y2, boolean anti_alias)
public static void drawLine(float x1, float y1, float x2, float y2, float line_thickness, boolean anti_alias)
x1
- X position in pixels of start pointy1
- Y position in pixels of start pointx2
- X position in pixels of end pointy2
- Y position in pixels of end pointline_thickness
- Thickness in pixels (<1.0f will be interpreted as 1.0f)anti_alias
- Should the line be anti-aliasedpublic static void fillRect(float x, float y, float width, float height)
public static void fillRect(float x, float y, float width, float height, boolean anti_alias)
x
- X position in pixels of top-lefty
- Y position in pixels of top-leftwidth
- Width in pixelsheight
- Height in pixelsanti_alias
- Should the rectangle be anti-aliasedpublic static void drawRect(float x, float y, float width, float height)
public static void drawRect(float x, float y, float width, float height, float line_thickness)
public static void drawRect(float x, float y, float width, float height, boolean anti_alias)
public static void drawRect(float x, float y, float width, float height, float line_thickness, boolean anti_alias)
x
- X position in pixels of top-lefty
- Y position in pixels of top-leftwidth
- Width in pixelsheight
- Height in pixelsline_thickness
- Thickness in pixels (<1.0f will be interpreted as 1.0f)anti_alias
- Should the rectangle be anti-aliasedpublic static void fillArc(float cx, float cy, float inner_radius, float outer_radius, float startAngle, float arcAngle)
public static void fillArc(float cx, float cy, float inner_radius, float outer_radius, float startAngle, float arcAngle, boolean anti_alias)
cx
- X position in pixels of the centrecy
- Y position in pixels of the centreinner_radius
- Inner radius in pixelsouter_radius
- Outer radius in pixelsstartAngle
- Start angle in degreesarcAngle
- Angle of arc in degreesanti_alias
- Should the arc be anti-aliasedpublic static void drawArc(float cx, float cy, float radius, float startAngle, float arcAngle)
public static void drawArc(float cx, float cy, float radius, float startAngle, float arcAngle, float line_thickness)
public static void drawArc(float cx, float cy, float radius, float startAngle, float arcAngle, boolean anti_alias)
public static void drawArc(float cx, float cy, float radius, float startAngle, float arcAngle, float line_thickness, boolean anti_alias)
cx
- X position in pixels of the centrecy
- Y position in pixels of the centreradius
- Radius in pixelsstartAngle
- Start angle in degreesarcAngle
- Angle of arc in degreesline_thickness
- Thickness in pixels (<1.0f will be interpreted as 1.0f)anti_alias
- Should the arc be anti-aliasedpublic static void fillVTrapezoid(float x1, float y11, float y12, float x2, float y21, float y22)
public static void fillVTrapezoid(float x1, float y11, float y12, float x2, float y21, float y22, boolean anti_alias)
x1
- X position in pixels of the left edgey11
- Y position in pixels of the first 'left edge' pointy12
- Y position in pixels of the second 'left edge' pointx2
- X position in pixels of the right edgey21
- Y position in pixels of the first 'right edge' pointy22
- Y position in pixels of the second 'right edge' pointanti_alias
- Should the trapezoid be anti-aliasedpublic static void fillHTrapezoid(float x11, float x12, float y1, float x21, float x22, float y2)
public static void fillHTrapezoid(float x11, float x12, float y1, float x21, float x22, float y2, boolean anti_alias)
x11
- X position in pixels of the first 'top edge' pointx12
- X position in pixels of the second 'top edge' pointy1
- Y position in pixels of the top edgex21
- X position in pixels of the first 'bottom edge' pointx22
- X position in pixels of the second 'bottom edge' pointy2
- Y position in pixels of the bottom edgeanti_alias
- Should the trapezoid be anti-aliasedpublic static void setTopBotColorYRange(float ty, float by)
ty
- Y position in pixels to represent the top-most colour (light in gradient mode)by
- Y position in pixels to represent the bottom-most colour (dark in gradient mode)