1 /**********************************************************************
2 * Copyright (c) 2005, 2006, 2011 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 * $Id: IGC.java,v 1.2 2006/09/20 20:56:27 ewchan Exp $
10 * IBM - Initial API and implementation
11 * Bernd Hufmann - Updated for TMF
12 **********************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.drawings
;
19 public interface IGC
{
22 * Set the current line style
24 * @param style the new line style
26 public abstract void setLineStyle(int style
);
29 * Returns current the line style used in the graphical context
31 * @return the current line style
33 public abstract int getLineStyle();
36 * Returns the contents x coordinate that is at the upper left corner of the view
38 * @return the contents x coordinate
40 public abstract int getContentsX();
43 * Returns the contents y coordinate that is at the upper left corner of the view
45 * @return the contents y coordinate
47 public abstract int getContentsY();
50 * Returns the contents visible width
52 * @return the contents width
54 public abstract int getVisibleWidth();
57 * Returns the contents visible height
59 * @return the contents height
61 public abstract int getVisibleHeight();
64 * Translates the given contents x coordinate into view x coordinate
66 * @param x the x coordinate to translate
67 * @return the corresponding view x coordinate
69 public abstract int contentsToViewX(int x
);
72 * Translates the given contents y coordinate into view y coordinate
74 * @param y the y coordinate to translate
75 * @return the corresponding view y coordinate
77 public abstract int contentsToViewY(int y
);
80 * Draws a line, using the foreground color, between the points (x1, y1) and (x2, y2).
82 * @param x1 the first point's x coordinate
83 * @param y1 the first point's y coordinate
84 * @param x2 the second point's x coordinate
85 * @param y2 the second point's y coordinate
87 public abstract void drawLine(int x1
, int y1
, int x2
, int y2
);
90 * Draws the outline of the rectangle specified by the arguments, using the receiver's foreground color. The left
91 * and right edges of the rectangle are at x and x + width. The top and bottom edges are at y and y + height.
93 * @param x the x coordinate of the rectangle to be drawn
94 * @param y the y coordinate of the rectangle to be drawn
95 * @param width the width of the rectangle to be drawn
96 * @param height the height of the rectangle to be drawn
98 public abstract void drawRectangle(int x
, int y
, int width
, int height
);
101 * Draws a rectangle, based on the specified arguments, which has the appearance of the platform's focus rectangle
102 * if the platform supports such a notion, and otherwise draws a simple rectangle in the receiver's foreground
105 * @param x the x coordinate of the rectangle
106 * @param y the y coordinate of the rectangle
107 * @param width the width of the rectangle
108 * @param height the height of the rectangle
110 public abstract void drawFocus(int x
, int y
, int width
, int height
);
113 * Fills the interior of the closed polygon which is defined by the specified array of integer coordinates, using
114 * the receiver's background color. The array contains alternating x and y values which are considered to represent
115 * points which are the vertices of the polygon. Lines are drawn between each consecutive pair, and between the
116 * first pair and last pair in the array.
118 * @param points an array of alternating x and y values which are the vertices of the polygon
120 public abstract void fillPolygon(int[] points
);
123 * Draws the closed polygon which is defined by the specified array of integer coordinates, using the receiver's
124 * foreground color. The array contains alternating x and y values which are considered to represent points which
125 * are the vertices of the polygon. Lines are drawn between each consecutive pair, and between the first pair and
126 * last pair in the array.
128 * @param points an array of alternating x and y values which are the vertices of the polygon
130 public abstract void drawPolygon(int[] points
);
133 * Fills the interior of the rectangle specified by the arguments, using the receiver's background color.
135 * @param x the x coordinate of the rectangle to be filled
136 * @param y the y coordinate of the rectangle to be filled
137 * @param width the width of the rectangle to be filled
138 * @param height the height of the rectangle to be filled
140 public abstract void fillRectangle(int x
, int y
, int width
, int height
);
143 * Fills the interior of the specified rectangle with a gradient sweeping from left to right or top to bottom
144 * progressing from the graphical context gradient color to its background color.
146 * @param x the x coordinate of the rectangle to be filled
147 * @param y the y coordinate of the rectangle to be filled
148 * @param width the width of the rectangle to be filled, may be negative (inverts direction of gradient if
150 * @param height the height of the rectangle to be filled, may be negative (inverts direction of gradient if
152 * @param vertical if true sweeps from top to bottom, else sweeps from left to right
154 public abstract void fillGradientRectangle(int x
, int y
, int width
, int height
, boolean vertical
);
157 * Returns the given string width in pixels
159 * @param name the string
160 * @return the string width
162 public abstract int textExtent(String name
);
165 * Draws the given string, using the receiver's current font and foreground color. Tab expansion and carriage return
166 * processing are performed. If trans is true, then the background of the rectangular area where the text is being
167 * drawn will not be modified, otherwise it will be filled with the receiver's background color.
169 * @param string the string to be drawn
170 * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
171 * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
172 * @param trans if true the background will be transparent, otherwise it will be opaque
174 public abstract void drawText(String string
, int x
, int y
, boolean trans
);
177 * Draws the given string, using the receiver's current font and foreground color. Tab expansion and carriage return
178 * processing are performed. The background of the rectangular area where the text is being drawn will be filled
179 * with the receiver's background color.
181 * @param string the string to be drawn
182 * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
183 * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
185 public abstract void drawText(String string
, int x
, int y
);
188 * Fills the interior of an oval, within the specified rectangular area, with the receiver's background color.
190 * @param x the x coordinate of the upper left corner of the oval to be filled
191 * @param y the y coordinate of the upper left corner of the oval to be filled
192 * @param width the width of the oval to be filled
193 * @param height the width of the oval to be filled
195 public abstract void fillOval(int x
, int y
, int width
, int height
);
198 * Returns current the background color used in the graphical context
200 * @return the background color
202 public abstract IColor
getBackground();
205 * Returns current the background color used in the graphical context
207 * @return the background color
209 public abstract IColor
getForeground();
212 * Set the graphical context foreground color
214 * @param color the foreground color
216 public abstract void setBackground(IColor color
);
219 * Set the graphical context background color
221 * @param color the background color
223 public abstract void setForeground(IColor color
);
226 * Set the color to use when filling regions using gradient. The color will progess from the given color to the
227 * current background color
229 * @param color the gardiient color to use
231 public abstract void setGradientColor(IColor color
);
234 * Set the line width to use for drawing
236 * @param width the line width
238 public abstract void setLineWidth(int width
);
241 * Returns the current graphical context line width used for drawing
243 * @return the line width
245 public abstract int getLineWidth();
248 * Returns the LineDotD style constant
250 * @return the constant value
252 public abstract int getLineDotStyle();
255 * Returns the LineDash style constant
257 * @return the constant
259 public abstract int getLineDashStyle();
262 * Returns the LineSolid style constant
264 * @return the constant
266 public abstract int getLineSolidStyle();
269 * Draws the given string centered into the given rectangle. If the string cannot fit in the rectangle area, the
270 * string is truncated. If trans is true, then the background of the rectangular area where the text is being drawn
271 * will not be modified, otherwise it will be filled with the receiver's background color.
273 * @param name the string to draw
274 * @param _x the _x coordinate of the rectangle to draw the string
275 * @param _y the _y coordinate of the rectangle to draw the string
276 * @param width the width of the rectangle to draw the string
277 * @param height the height of the rectangle to draw the string
278 * @param trans if true the background will be transparent, otherwise it will be opaque
280 public abstract void drawTextTruncatedCentred(String name
, int _x
, int _y
, int width
, int height
, boolean trans
);
283 * Draws the given string into the given rectangle (left justify) If the string cannot fit in the rectangle area,
284 * the string is truncated. If trans is true, then the background of the rectangular area where the text is being
285 * drawn will not be modified, otherwise it will be filled with the receiver's background color.
287 * @param _x the _x coordinate of the rectangle to draw the string
288 * @param _y the _y coordinate of the rectangle to draw the string
289 * @param width the width of the rectangle to draw the string
290 * @param height the height of the rectangle to draw the string
291 * @param trans if true the background will be transparent, otherwise it will be opaque
293 public abstract void drawTextTruncated(String name
, int _x
, int _y
, int width
, int height
, boolean trans
);
296 * Copies a the source image into a (potentially different sized) rectangular area in the graphical context. If the
297 * source image has smaller sizes, then the source area will be stretched to fit the destination area as it is
300 * @param image the image to draw
301 * @param _x the x coordinate in the destination to copy to
302 * @param _y the y coordinate in the destination to copy to
303 * @param maxWith the width in pixels of the destination rectangle
304 * @param maxHeight the height in pixels of the destination rectangle
306 public abstract void drawImage(IImage image
, int _x
, int _y
, int maxWith
, int maxHeight
);
309 * Draws the outline of a circular or elliptical arc within the specified rectangular area. The resulting arc begins
310 * at startAngle and extends for arcAngle degrees, using the current color. Angles are interpreted such that 0
311 * degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative
312 * value indicates a clockwise rotation. The center of the arc is the center of the rectangle whose origin is (x, y)
313 * and whose size is specified by the width and height arguments. The resulting arc covers an area width + 1 pixels
314 * wide by height + 1 pixels tall.
316 * @param x the x coordinate of the upper-left corner of the arc to be drawn
317 * @param y the y coordinate of the upper-left corner of the arc to be drawn
318 * @param width the width of the arc to be drawn
319 * @param height the height of the arc to be drawn
320 * @param startAngle the beginning angle
321 * @param endAngle the ending angle
323 public abstract void drawArc(int x
, int y
, int width
, int height
, int startAngle
, int endAngle
);
326 * Set the current font used in the graphical context
328 * @param font the font to use
330 public abstract void setFont(IFont font
);
333 * Returns the font height given font
336 * @return the the font height
338 public abstract int getFontHeight(IFont font
);
341 * Returns the average character width for the given font
344 * @return the average width
346 public abstract int getFontWidth(IFont font
);
349 * Creates a color with the given RGB values
351 * @param r the red component
352 * @param g the green component
353 * @param b the blue component
356 public abstract IColor
createColor(int r
, int g
, int b
);
359 * Returns the zoom factor applied in both x and y directions when drawing
361 * @return the zoom factor
363 public abstract float getZoom();
365 public abstract void setDrawTextWithFocusStyle(boolean focus
);
This page took 0.040608 seconds and 6 git commands to generate.