Package org.gvsig.compat.lang
Interface GraphicsUtils
public interface GraphicsUtils
Multi-platform graphic utils interface.
This allows platforms with poor java.awt.Graphics2D implementations to
share most of the application source code.
- Author:
- Juan Lucas Dominguez Rubio jldominguez at prodevelop.es
-
Method Summary
Modifier and TypeMethodDescriptionProduces a copy of a buffered image with the same graphic content (pixel color)createBufferedImage(int w, int h, int type) Create a buffered Image of the given size and type.Creates an object that implements the PrintAttributes interface with default/trivial values.deriveFont(Font srcfont, float newheight) Returns an istance of Font which is the same as the one provided except for the size.intReturns device screen DPI (dots per inch)voidSets the rendering hints to the Graphics2D object in a way that is suitable for drawing.voidSets the rendering hints to the Graphics2D object in a way that is suitable for printing.voidtranslate(Graphics2D g, double x, double y) Adds a translation operation to the Graphics2D object's transformation matrix.
-
Method Details
-
createBufferedImage
Create a buffered Image of the given size and type. In this context, buffered image means editable image (admits setRGB etc)- Parameters:
w- width in pixels of the requested imageh- height in pixels of the requested imagetype- image type (refers to bands, etc. seeinvalid reference
Image- Returns:
- a buffered (editable) image of the desired size and type
-
copyBufferedImage
Produces a copy of a buffered image with the same graphic content (pixel color)- Parameters:
img- image to be copied- Returns:
- new instance of a BufferedImage (editable) with same size, type and graphic content.
-
deriveFont
Returns an istance of Font which is the same as the one provided except for the size.- Parameters:
srcfont- provided font to be used as modelnewheight- height in pixels of the new fonr- Returns:
- the new font, same properties as the provided font, but different size
-
getScreenDPI
int getScreenDPI()Returns device screen DPI (dots per inch)- Returns:
- number of pixels per inch in the current screen
-
translate
Adds a translation operation to the Graphics2D object's transformation matrix.- Parameters:
g- Object whose transformation matrix has to be modifiedx- horizontal offset of the translationy- vertical offset of the translation
-
createPrintAttributes
PrintAttributes createPrintAttributes()Creates an object that implements the PrintAttributes interface with default/trivial values.- Returns:
- an object that implements the PrintAttributes interface with default/trivial values.
-
setRenderingHintsForDrawing
Sets the rendering hints to the Graphics2D object in a way that is suitable for drawing.- Parameters:
g- the Graphics2D object whose rendering hints have to be set for drawing
-
setRenderingHintsForPrinting
Sets the rendering hints to the Graphics2D object in a way that is suitable for printing.- Parameters:
g- the Graphics2D object whose rendering hints have to be set for printing
-