svn-gvsig-desktop / 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 @ 43230
History | View | Annotate | Download (3.65 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | *
|
||
4 | * Copyright (C) 2007-2013 gvSIG Association.
|
||
5 | *
|
||
6 | * This program is free software; you can redistribute it and/or
|
||
7 | * modify it under the terms of the GNU General Public License
|
||
8 | * as published by the Free Software Foundation; either version 3
|
||
9 | * of the License, or (at your option) any later version.
|
||
10 | *
|
||
11 | * This program is distributed in the hope that it will be useful,
|
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | * GNU General Public License for more details.
|
||
15 | *
|
||
16 | * You should have received a copy of the GNU General Public License
|
||
17 | * along with this program; if not, write to the Free Software
|
||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||
19 | * MA 02110-1301, USA.
|
||
20 | *
|
||
21 | * For any additional information, do not hesitate to contact us
|
||
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | */
|
||
24 | 40435 | jjdelcerro | package org.gvsig.compat.lang; |
25 | |||
26 | import java.awt.Font; |
||
27 | import java.awt.Graphics2D; |
||
28 | import java.awt.image.BufferedImage; |
||
29 | |||
30 | import org.gvsig.compat.print.PrintAttributes; |
||
31 | |||
32 | /**
|
||
33 | * Multi-platform graphic utils interface.
|
||
34 | * This allows platforms with poor java.awt.Graphics2D implementations to
|
||
35 | * share most of the application source code.
|
||
36 | 43228 | fdiaz | *
|
37 | 40435 | jjdelcerro | * @author Juan Lucas Dominguez Rubio jldominguez at prodevelop.es
|
38 | *
|
||
39 | */
|
||
40 | public interface GraphicsUtils { |
||
41 | 43230 | jjdelcerro | |
42 | /**
|
||
43 | * Create a buffered Image of the given size and type.
|
||
44 | * In this context, buffered image means editable image (admits setRGB etc)
|
||
45 | *
|
||
46 | * @param w width in pixels of the requested image
|
||
47 | * @param h height in pixels of the requested image
|
||
48 | * @param type image type (refers to bands, etc. see {@link Image}
|
||
49 | * @return a buffered (editable) image of the desired size and type
|
||
50 | */
|
||
51 | public BufferedImage createBufferedImage(int w, int h, int type); |
||
52 | 43228 | fdiaz | |
53 | 40435 | jjdelcerro | /**
|
54 | * Produces a copy of a buffered image with the same graphic content (pixel color)
|
||
55 | * @param img image to be copied
|
||
56 | * @return new instance of a BufferedImage (editable) with same size, type and graphic content.
|
||
57 | */
|
||
58 | public BufferedImage copyBufferedImage(BufferedImage img); |
||
59 | 43228 | fdiaz | |
60 | 40435 | jjdelcerro | /**
|
61 | * Returns an istance of Font which is the same as the one provided except for the size.
|
||
62 | 43228 | fdiaz | *
|
63 | 40435 | jjdelcerro | * @param srcfont provided font to be used as model
|
64 | 43228 | fdiaz | * @param newheight height in pixels of the new fonr
|
65 | 40435 | jjdelcerro | * @return the new font, same properties as the provided font, but different size
|
66 | */
|
||
67 | public Font deriveFont(Font srcfont, float newheight); |
||
68 | 43228 | fdiaz | |
69 | 40435 | jjdelcerro | /**
|
70 | * Returns device screen DPI (dots per inch)
|
||
71 | 43228 | fdiaz | *
|
72 | 40435 | jjdelcerro | * @return number of pixels per inch in the current screen
|
73 | */
|
||
74 | public int getScreenDPI(); |
||
75 | |||
76 | /**
|
||
77 | * Adds a translation operation to the Graphics2D object's transformation matrix.
|
||
78 | 43228 | fdiaz | *
|
79 | 40435 | jjdelcerro | * @param g Object whose transformation matrix has to be modified
|
80 | 43228 | fdiaz | * @param x horizontal offset of the translation
|
81 | 40435 | jjdelcerro | * @param y vertical offset of the translation
|
82 | */
|
||
83 | public void translate(Graphics2D g, double x, double y); |
||
84 | 43228 | fdiaz | |
85 | 40435 | jjdelcerro | /**
|
86 | * Creates an object that implements the PrintAttributes interface with default/trivial values.
|
||
87 | 43228 | fdiaz | *
|
88 | 40435 | jjdelcerro | * @return an object that implements the PrintAttributes interface with default/trivial values.
|
89 | */
|
||
90 | public PrintAttributes createPrintAttributes();
|
||
91 | 43228 | fdiaz | |
92 | 40435 | jjdelcerro | /**
|
93 | * Sets the rendering hints to the Graphics2D object in a way that is suitable for drawing.
|
||
94 | 43228 | fdiaz | *
|
95 | 40435 | jjdelcerro | * @param g the Graphics2D object whose rendering hints have to be set for drawing
|
96 | */
|
||
97 | public void setRenderingHintsForDrawing(Graphics2D g); |
||
98 | 43228 | fdiaz | |
99 | 40435 | jjdelcerro | /**
|
100 | * Sets the rendering hints to the Graphics2D object in a way that is suitable for printing.
|
||
101 | 43228 | fdiaz | *
|
102 | 40435 | jjdelcerro | * @param g the Graphics2D object whose rendering hints have to be set for printing
|
103 | */
|
||
104 | public void setRenderingHintsForPrinting(Graphics2D g); |
||
105 | } |