Revision 43228 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.compat/org.gvsig.compat.api/src/main/java/org/gvsig/compat/lang/GraphicsUtils.java
GraphicsUtils.java | ||
---|---|---|
25 | 25 |
|
26 | 26 |
import java.awt.Font; |
27 | 27 |
import java.awt.Graphics2D; |
28 |
import java.awt.Image; |
|
29 | 28 |
import java.awt.image.BufferedImage; |
30 | 29 |
|
31 | 30 |
import org.gvsig.compat.print.PrintAttributes; |
... | ... | |
34 | 33 |
* Multi-platform graphic utils interface. |
35 | 34 |
* This allows platforms with poor java.awt.Graphics2D implementations to |
36 | 35 |
* share most of the application source code. |
37 |
*
|
|
36 |
* |
|
38 | 37 |
* @author Juan Lucas Dominguez Rubio jldominguez at prodevelop.es |
39 | 38 |
* |
40 | 39 |
*/ |
41 | 40 |
public interface GraphicsUtils { |
42 |
|
|
41 |
|
|
43 | 42 |
/** |
44 |
* Create a buffered Image of the given size and type. |
|
45 |
* In this context, buffered image means editable image (admits setRGB etc) |
|
46 |
* |
|
47 |
* @param w width in pixels of the requested image |
|
48 |
* @param h height in pixels of the requested image |
|
49 |
* @param type image type (refers to bands, etc. see {@link Image} |
|
50 |
* @return a buffered (editable) image of the desired size and type |
|
51 |
*/ |
|
52 |
public BufferedImage createBufferedImage(int w, int h, int type); |
|
53 |
|
|
54 |
/** |
|
55 | 43 |
* Produces a copy of a buffered image with the same graphic content (pixel color) |
56 | 44 |
* @param img image to be copied |
57 | 45 |
* @return new instance of a BufferedImage (editable) with same size, type and graphic content. |
58 | 46 |
*/ |
59 | 47 |
public BufferedImage copyBufferedImage(BufferedImage img); |
60 |
|
|
48 |
|
|
61 | 49 |
/** |
62 | 50 |
* Returns an istance of Font which is the same as the one provided except for the size. |
63 |
*
|
|
51 |
* |
|
64 | 52 |
* @param srcfont provided font to be used as model |
65 |
* @param newheight height in pixels of the new fonr
|
|
53 |
* @param newheight height in pixels of the new fonr |
|
66 | 54 |
* @return the new font, same properties as the provided font, but different size |
67 | 55 |
*/ |
68 | 56 |
public Font deriveFont(Font srcfont, float newheight); |
69 |
|
|
57 |
|
|
70 | 58 |
/** |
71 | 59 |
* Returns device screen DPI (dots per inch) |
72 |
*
|
|
60 |
* |
|
73 | 61 |
* @return number of pixels per inch in the current screen |
74 | 62 |
*/ |
75 | 63 |
public int getScreenDPI(); |
76 | 64 |
|
77 | 65 |
/** |
78 | 66 |
* Adds a translation operation to the Graphics2D object's transformation matrix. |
79 |
*
|
|
67 |
* |
|
80 | 68 |
* @param g Object whose transformation matrix has to be modified |
81 |
* @param x horizontal offset of the translation
|
|
69 |
* @param x horizontal offset of the translation |
|
82 | 70 |
* @param y vertical offset of the translation |
83 | 71 |
*/ |
84 | 72 |
public void translate(Graphics2D g, double x, double y); |
85 |
|
|
73 |
|
|
86 | 74 |
/** |
87 | 75 |
* Creates an object that implements the PrintAttributes interface with default/trivial values. |
88 |
*
|
|
76 |
* |
|
89 | 77 |
* @return an object that implements the PrintAttributes interface with default/trivial values. |
90 | 78 |
*/ |
91 | 79 |
public PrintAttributes createPrintAttributes(); |
92 |
|
|
80 |
|
|
93 | 81 |
/** |
94 | 82 |
* Sets the rendering hints to the Graphics2D object in a way that is suitable for drawing. |
95 |
*
|
|
83 |
* |
|
96 | 84 |
* @param g the Graphics2D object whose rendering hints have to be set for drawing |
97 | 85 |
*/ |
98 | 86 |
public void setRenderingHintsForDrawing(Graphics2D g); |
99 |
|
|
87 |
|
|
100 | 88 |
/** |
101 | 89 |
* Sets the rendering hints to the Graphics2D object in a way that is suitable for printing. |
102 |
*
|
|
90 |
* |
|
103 | 91 |
* @param g the Graphics2D object whose rendering hints have to be set for printing |
104 | 92 |
*/ |
105 | 93 |
public void setRenderingHintsForPrinting(Graphics2D g); |
Also available in: Unified diff