Improve test cases, speed and accuracy.
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / drawings / IGC.java
CommitLineData
73005152
BH
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 $
8 *
9 * Contributors:
10 * IBM - Initial API and implementation
11 * Bernd Hufmann - Updated for TMF
12 **********************************************************************/
13package org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings;
14
15/**
16 * @author sveyrier
17 *
18 */
19public interface IGC {
20
21 /**
22 * Set the current line style
23 *
24 * @param style the new line style
25 */
26 public abstract void setLineStyle(int style);
27
28 /**
29 * Returns current the line style used in the graphical context
30 *
31 * @return the current line style
32 */
33 public abstract int getLineStyle();
34
35 /**
36 * Returns the contents x coordinate that is at the upper left corner of the view
37 *
38 * @return the contents x coordinate
39 */
40 public abstract int getContentsX();
41
42 /**
43 * Returns the contents y coordinate that is at the upper left corner of the view
44 *
45 * @return the contents y coordinate
46 */
47 public abstract int getContentsY();
48
49 /**
50 * Returns the contents visible width
51 *
52 * @return the contents width
53 */
54 public abstract int getVisibleWidth();
55
56 /**
57 * Returns the contents visible height
58 *
59 * @return the contents height
60 */
61 public abstract int getVisibleHeight();
62
63 /**
64 * Translates the given contents x coordinate into view x coordinate
65 *
66 * @param x the x coordinate to translate
67 * @return the corresponding view x coordinate
68 */
69 public abstract int contentsToViewX(int x);
70
71 /**
72 * Translates the given contents y coordinate into view y coordinate
73 *
74 * @param y the y coordinate to translate
75 * @return the corresponding view y coordinate
76 */
77 public abstract int contentsToViewY(int y);
78
79 /**
80 * Draws a line, using the foreground color, between the points (x1, y1) and (x2, y2).
81 *
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
86 */
87 public abstract void drawLine(int x1, int y1, int x2, int y2);
88
89 /**
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.
92 *
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
97 */
98 public abstract void drawRectangle(int x, int y, int width, int height);
99
100 /**
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
103 * color.
104 *
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
109 */
110 public abstract void drawFocus(int x, int y, int width, int height);
111
112 /**
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.
117 *
118 * @param points an array of alternating x and y values which are the vertices of the polygon
119 */
120 public abstract void fillPolygon(int[] points);
121
122 /**
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.
127 *
128 * @param points an array of alternating x and y values which are the vertices of the polygon
129 */
130 public abstract void drawPolygon(int[] points);
131
132 /**
133 * Fills the interior of the rectangle specified by the arguments, using the receiver's background color.
134 *
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
139 */
140 public abstract void fillRectangle(int x, int y, int width, int height);
141
142 /**
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.
145 *
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
149 * horizontal)
150 * @param height the height of the rectangle to be filled, may be negative (inverts direction of gradient if
151 * horizontal)
152 * @param vertical if true sweeps from top to bottom, else sweeps from left to right
153 */
154 public abstract void fillGradientRectangle(int x, int y, int width, int height, boolean vertical);
155
156 /**
157 * Returns the given string width in pixels
158 *
159 * @param name the string
160 * @return the string width
161 */
162 public abstract int textExtent(String name);
163
164 /**
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.
168 *
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
173 */
174 public abstract void drawText(String string, int x, int y, boolean trans);
175
176 /**
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.
180 *
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
184 */
185 public abstract void drawText(String string, int x, int y);
186
187 /**
188 * Fills the interior of an oval, within the specified rectangular area, with the receiver's background color.
189 *
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
194 */
195 public abstract void fillOval(int x, int y, int width, int height);
196
197 /**
198 * Returns current the background color used in the graphical context
199 *
200 * @return the background color
201 */
202 public abstract IColor getBackground();
203
204 /**
205 * Returns current the background color used in the graphical context
206 *
207 * @return the background color
208 */
209 public abstract IColor getForeground();
210
211 /**
212 * Set the graphical context foreground color
213 *
214 * @param color the foreground color
215 */
216 public abstract void setBackground(IColor color);
217
218 /**
219 * Set the graphical context background color
220 *
221 * @param color the background color
222 */
223 public abstract void setForeground(IColor color);
224
225 /**
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
228 *
229 * @param color the gardiient color to use
230 */
231 public abstract void setGradientColor(IColor color);
232
233 /**
234 * Set the line width to use for drawing
235 *
236 * @param width the line width
237 */
238 public abstract void setLineWidth(int width);
239
240 /**
241 * Returns the current graphical context line width used for drawing
242 *
243 * @return the line width
244 */
245 public abstract int getLineWidth();
246
247 /**
248 * Returns the LineDotD style constant
249 *
250 * @return the constant value
251 */
252 public abstract int getLineDotStyle();
253
254 /**
255 * Returns the LineDash style constant
256 *
257 * @return the constant
258 */
259 public abstract int getLineDashStyle();
260
261 /**
262 * Returns the LineSolid style constant
263 *
264 * @return the constant
265 */
266 public abstract int getLineSolidStyle();
267
268 /**
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.
272 *
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
279 */
280 public abstract void drawTextTruncatedCentred(String name, int _x, int _y, int width, int height, boolean trans);
281
282 /**
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.
286 *
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
292 */
293 public abstract void drawTextTruncated(String name, int _x, int _y, int width, int height, boolean trans);
294
295 /**
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
298 * copied.
299 *
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
305 */
306 public abstract void drawImage(IImage image, int _x, int _y, int maxWith, int maxHeight);
307
308 /**
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.
315 *
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
322 */
323 public abstract void drawArc(int x, int y, int width, int height, int startAngle, int endAngle);
324
325 /**
326 * Set the current font used in the graphical context
327 *
328 * @param font the font to use
329 */
330 public abstract void setFont(IFont font);
331
332 /**
333 * Returns the font height given font
334 *
335 * @param font
336 * @return the the font height
337 */
338 public abstract int getFontHeight(IFont font);
339
340 /**
341 * Returns the average character width for the given font
342 *
343 * @param font
344 * @return the average width
345 */
346 public abstract int getFontWidth(IFont font);
347
348 /**
349 * Creates a color with the given RGB values
350 *
351 * @param r the red component
352 * @param g the green component
353 * @param b the blue component
354 * @return the color
355 */
356 public abstract IColor createColor(int r, int g, int b);
357
358 /**
359 * Returns the zoom factor applied in both x and y directions when drawing
360 *
361 * @return the zoom factor
362 */
363 public abstract float getZoom();
364
365 public abstract void setDrawTextWithFocusStyle(boolean focus);
366}
This page took 0.039815 seconds and 5 git commands to generate.