public class WebImage extends Object
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
antiAliased
Use an IndexColorModel.
|
protected static String |
ARG_CANNOT_BE_NULL |
Color |
backgroundColor
Background color for the image.
|
int |
bottomBorder
Height of the image border on the bottom side of the image
|
protected static Color |
DEFAULT_BACKGROUND_COLOR |
protected static String |
DEFAULT_BOLD_TYPEFACE |
protected static Color |
DEFAULT_BORDER_COLOR |
protected static int |
DEFAULT_BORDER_SIZE |
protected static Font |
DEFAULT_FONT |
protected static FontMetrics |
DEFAULT_FONT_METRICS |
protected static int |
DEFAULT_HEIGHT |
protected static String |
DEFAULT_PLAIN_TYPEFACE |
protected static int |
DEFAULT_SHADOW_WIDTH |
protected static Color |
DEFAULT_TEXT_COLOR |
protected static int |
DEFAULT_WIDTH |
Font |
font
Text font.
|
boolean |
frameImage
Draws a two pixel light gray frame at the edge of the image
|
int |
height
Height of the image.
|
protected boolean |
indexColors
Anti-alias shapes and text.
|
int |
leftBorder
Width of the image border on the left side of the image
|
protected Graphics2D |
m_graphics |
int |
rightBorder
Width of the image border on the right side of the image
|
int |
shadowWidth
Width of the shadow around the image.
|
static Font |
SMALL_FONT |
Color |
textColor
Color for text in the image.
|
int |
topBorder
Height of the image border on the top side of the image
|
int |
width
Width of the image.
|
| Modifier | Constructor and Description |
|---|---|
protected |
WebImage(int width,
int height) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
draw(Graphics2D g) |
FontMetrics |
getFontMetrics()
Retrieves the font metrics.
|
Image |
getImage()
Retrieves the image as a java.awt.Image object.
|
protected Point |
getTextCenter(String text) |
protected Point |
getTextCenter(String text,
Rectangle rect) |
protected static Point |
getTextCenter(String text,
Rectangle rect,
FontMetrics metrics) |
static boolean |
isRunnable()
Determine if a graphics environment is available.
|
protected void |
postInit(Graphics2D graphics) |
protected void |
preInit() |
void |
setBorder(int border)
Sets the size of the top, left, right and bottom borders.
|
void |
writeJpegImage(OutputStream stream)
Writes the chart image as a JPEG image.
|
void |
writeJpegImage(String filename)
Writes the chart image as a JPEG image.
|
void |
writePngImage(OutputStream stream)
Writes the chart image as a PNG image.
|
void |
writePngImage(String filename)
Writes the chart image as a PNG image.
|
protected static final String ARG_CANNOT_BE_NULL
protected static final int DEFAULT_HEIGHT
protected static final int DEFAULT_WIDTH
protected static final Color DEFAULT_BACKGROUND_COLOR
protected static final int DEFAULT_BORDER_SIZE
protected static final Color DEFAULT_BORDER_COLOR
protected static final Color DEFAULT_TEXT_COLOR
protected static final int DEFAULT_SHADOW_WIDTH
protected static final String DEFAULT_BOLD_TYPEFACE
protected static final String DEFAULT_PLAIN_TYPEFACE
protected static final Font DEFAULT_FONT
protected static final FontMetrics DEFAULT_FONT_METRICS
public static final Font SMALL_FONT
protected Graphics2D m_graphics
public Font font
public int height
public int width
public int leftBorder
public int topBorder
public int rightBorder
public int bottomBorder
public boolean frameImage
public Color backgroundColor
public Color textColor
public int shadowWidth
protected boolean antiAliased
protected boolean indexColors
protected void draw(Graphics2D g)
protected void preInit()
protected void postInit(Graphics2D graphics)
public void setBorder(int border)
border - The size to set the borders to.#LeftBorderpublic FontMetrics getFontMetrics()
Fontpublic Image getImage()
Imagepublic void writeJpegImage(String filename) throws FileNotFoundException, IOException
filename - The path and filename that specifies where the PNG image should be written.FileNotFoundException - If the filename is not a valid name for a file.IOException - If there is an IO error while writing to the file.IllegalArgumentException - If the filename parameter is null.public void writeJpegImage(OutputStream stream) throws IOException
stream - The java.io.OutputStream to write the PNG image to.IOException - If there is an IO error while streaming the PNG image.IllegalArgumentException - If the stream parameter is null.OutputStreampublic void writePngImage(String filename) throws FileNotFoundException, IOException
filename - The path and filename that specifies where the PNG image should be written.FileNotFoundException - If the filename is not a valid name for a file.IOException - If there is an IO error while writing to the file.IllegalArgumentException - If the filename parameter is null.public void writePngImage(OutputStream stream) throws IOException
stream - The java.io.OutputStream to write the PNG image to.IOException - If there is an IO error while streaming the PNG image.IllegalArgumentException - If the stream parameter is null.OutputStreamprotected static Point getTextCenter(String text, Rectangle rect, FontMetrics metrics)
public static boolean isRunnable()
Copyright © 2008-2013 Red Hat, Inc.. All Rights Reserved.