lttng: Update copyright headers
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / drawings / IGC.java
CommitLineData
73005152 1/**********************************************************************
df0b8ff4
BH
2 * Copyright (c) 2005, 2006 IBM Corporation and others.
3 * Copyright (c) 2011, 2012 Ericsson.
a55887ca 4 *
73005152
BH
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * which accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v10.html
a55887ca
AM
9 *
10 * Contributors:
73005152
BH
11 * IBM - Initial API and implementation
12 * Bernd Hufmann - Updated for TMF
13 **********************************************************************/
14package org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings;
15
16/**
df0b8ff4 17 * Interface for a graphical context.
a55887ca 18 *
df0b8ff4 19 * @version 1.0
73005152 20 * @author sveyrier
a55887ca 21 *
73005152
BH
22 */
23public interface IGC {
24
25 /**
26 * Set the current line style
a55887ca 27 *
73005152
BH
28 * @param style the new line style
29 */
30 public abstract void setLineStyle(int style);
31
32 /**
33 * Returns current the line style used in the graphical context
a55887ca 34 *
73005152
BH
35 * @return the current line style
36 */
37 public abstract int getLineStyle();
38
39 /**
40 * Returns the contents x coordinate that is at the upper left corner of the view
a55887ca 41 *
73005152
BH
42 * @return the contents x coordinate
43 */
44 public abstract int getContentsX();
45
46 /**
47 * Returns the contents y coordinate that is at the upper left corner of the view
a55887ca 48 *
73005152
BH
49 * @return the contents y coordinate
50 */
51 public abstract int getContentsY();
52
53 /**
54 * Returns the contents visible width
a55887ca 55 *
73005152
BH
56 * @return the contents width
57 */
58 public abstract int getVisibleWidth();
59
60 /**
61 * Returns the contents visible height
a55887ca 62 *
73005152
BH
63 * @return the contents height
64 */
65 public abstract int getVisibleHeight();
66
67 /**
68 * Translates the given contents x coordinate into view x coordinate
a55887ca 69 *
73005152
BH
70 * @param x the x coordinate to translate
71 * @return the corresponding view x coordinate
72 */
73 public abstract int contentsToViewX(int x);
74
75 /**
76 * Translates the given contents y coordinate into view y coordinate
a55887ca 77 *
73005152
BH
78 * @param y the y coordinate to translate
79 * @return the corresponding view y coordinate
80 */
81 public abstract int contentsToViewY(int y);
82
83 /**
84 * Draws a line, using the foreground color, between the points (x1, y1) and (x2, y2).
a55887ca 85 *
73005152
BH
86 * @param x1 the first point's x coordinate
87 * @param y1 the first point's y coordinate
88 * @param x2 the second point's x coordinate
89 * @param y2 the second point's y coordinate
90 */
91 public abstract void drawLine(int x1, int y1, int x2, int y2);
92
93 /**
94 * Draws the outline of the rectangle specified by the arguments, using the receiver's foreground color. The left
95 * and right edges of the rectangle are at x and x + width. The top and bottom edges are at y and y + height.
a55887ca 96 *
73005152
BH
97 * @param x the x coordinate of the rectangle to be drawn
98 * @param y the y coordinate of the rectangle to be drawn
99 * @param width the width of the rectangle to be drawn
100 * @param height the height of the rectangle to be drawn
101 */
102 public abstract void drawRectangle(int x, int y, int width, int height);
103
104 /**
105 * Draws a rectangle, based on the specified arguments, which has the appearance of the platform's focus rectangle
106 * if the platform supports such a notion, and otherwise draws a simple rectangle in the receiver's foreground
107 * color.
a55887ca 108 *
73005152
BH
109 * @param x the x coordinate of the rectangle
110 * @param y the y coordinate of the rectangle
111 * @param width the width of the rectangle
112 * @param height the height of the rectangle
113 */
114 public abstract void drawFocus(int x, int y, int width, int height);
115
116 /**
117 * Fills the interior of the closed polygon which is defined by the specified array of integer coordinates, using
118 * the receiver's background color. The array contains alternating x and y values which are considered to represent
119 * points which are the vertices of the polygon. Lines are drawn between each consecutive pair, and between the
120 * first pair and last pair in the array.
a55887ca 121 *
73005152
BH
122 * @param points an array of alternating x and y values which are the vertices of the polygon
123 */
124 public abstract void fillPolygon(int[] points);
125
126 /**
127 * Draws the closed polygon which is defined by the specified array of integer coordinates, using the receiver's
128 * foreground color. The array contains alternating x and y values which are considered to represent points which
129 * are the vertices of the polygon. Lines are drawn between each consecutive pair, and between the first pair and
130 * last pair in the array.
a55887ca 131 *
73005152
BH
132 * @param points an array of alternating x and y values which are the vertices of the polygon
133 */
134 public abstract void drawPolygon(int[] points);
135
136 /**
137 * Fills the interior of the rectangle specified by the arguments, using the receiver's background color.
a55887ca 138 *
73005152
BH
139 * @param x the x coordinate of the rectangle to be filled
140 * @param y the y coordinate of the rectangle to be filled
141 * @param width the width of the rectangle to be filled
142 * @param height the height of the rectangle to be filled
143 */
144 public abstract void fillRectangle(int x, int y, int width, int height);
145
146 /**
147 * Fills the interior of the specified rectangle with a gradient sweeping from left to right or top to bottom
148 * progressing from the graphical context gradient color to its background color.
a55887ca 149 *
73005152
BH
150 * @param x the x coordinate of the rectangle to be filled
151 * @param y the y coordinate of the rectangle to be filled
152 * @param width the width of the rectangle to be filled, may be negative (inverts direction of gradient if
153 * horizontal)
154 * @param height the height of the rectangle to be filled, may be negative (inverts direction of gradient if
155 * horizontal)
156 * @param vertical if true sweeps from top to bottom, else sweeps from left to right
157 */
158 public abstract void fillGradientRectangle(int x, int y, int width, int height, boolean vertical);
159
160 /**
161 * Returns the given string width in pixels
a55887ca 162 *
73005152
BH
163 * @param name the string
164 * @return the string width
165 */
166 public abstract int textExtent(String name);
167
168 /**
169 * Draws the given string, using the receiver's current font and foreground color. Tab expansion and carriage return
170 * processing are performed. If trans is true, then the background of the rectangular area where the text is being
171 * drawn will not be modified, otherwise it will be filled with the receiver's background color.
a55887ca 172 *
73005152
BH
173 * @param string the string to be drawn
174 * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
175 * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
176 * @param trans if true the background will be transparent, otherwise it will be opaque
177 */
178 public abstract void drawText(String string, int x, int y, boolean trans);
179
180 /**
181 * Draws the given string, using the receiver's current font and foreground color. Tab expansion and carriage return
182 * processing are performed. The background of the rectangular area where the text is being drawn will be filled
183 * with the receiver's background color.
a55887ca 184 *
73005152
BH
185 * @param string the string to be drawn
186 * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
187 * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
188 */
189 public abstract void drawText(String string, int x, int y);
190
191 /**
192 * Fills the interior of an oval, within the specified rectangular area, with the receiver's background color.
a55887ca 193 *
73005152
BH
194 * @param x the x coordinate of the upper left corner of the oval to be filled
195 * @param y the y coordinate of the upper left corner of the oval to be filled
196 * @param width the width of the oval to be filled
197 * @param height the width of the oval to be filled
198 */
199 public abstract void fillOval(int x, int y, int width, int height);
200
201 /**
202 * Returns current the background color used in the graphical context
a55887ca 203 *
73005152
BH
204 * @return the background color
205 */
206 public abstract IColor getBackground();
207
208 /**
209 * Returns current the background color used in the graphical context
a55887ca 210 *
73005152
BH
211 * @return the background color
212 */
213 public abstract IColor getForeground();
214
215 /**
216 * Set the graphical context foreground color
a55887ca 217 *
73005152
BH
218 * @param color the foreground color
219 */
220 public abstract void setBackground(IColor color);
221
222 /**
223 * Set the graphical context background color
a55887ca 224 *
73005152
BH
225 * @param color the background color
226 */
227 public abstract void setForeground(IColor color);
228
229 /**
230 * Set the color to use when filling regions using gradient. The color will progess from the given color to the
231 * current background color
a55887ca 232 *
73005152
BH
233 * @param color the gardiient color to use
234 */
235 public abstract void setGradientColor(IColor color);
236
237 /**
238 * Set the line width to use for drawing
a55887ca 239 *
73005152
BH
240 * @param width the line width
241 */
242 public abstract void setLineWidth(int width);
243
244 /**
245 * Returns the current graphical context line width used for drawing
a55887ca 246 *
73005152
BH
247 * @return the line width
248 */
249 public abstract int getLineWidth();
250
251 /**
252 * Returns the LineDotD style constant
a55887ca 253 *
73005152
BH
254 * @return the constant value
255 */
256 public abstract int getLineDotStyle();
257
258 /**
259 * Returns the LineDash style constant
a55887ca 260 *
73005152
BH
261 * @return the constant
262 */
263 public abstract int getLineDashStyle();
264
265 /**
266 * Returns the LineSolid style constant
a55887ca 267 *
73005152
BH
268 * @return the constant
269 */
270 public abstract int getLineSolidStyle();
271
272 /**
273 * Draws the given string centered into the given rectangle. If the string cannot fit in the rectangle area, the
274 * string is truncated. If trans is true, then the background of the rectangular area where the text is being drawn
275 * will not be modified, otherwise it will be filled with the receiver's background color.
a55887ca 276 *
73005152 277 * @param name the string to draw
eb63f5ff
BH
278 * @param x the x coordinate of the rectangle to draw the string
279 * @param y the y coordinate of the rectangle to draw the string
73005152
BH
280 * @param width the width of the rectangle to draw the string
281 * @param height the height of the rectangle to draw the string
282 * @param trans if true the background will be transparent, otherwise it will be opaque
283 */
eb63f5ff 284 public abstract void drawTextTruncatedCentred(String name, int x, int y, int width, int height, boolean trans);
73005152
BH
285
286 /**
287 * Draws the given string into the given rectangle (left justify) If the string cannot fit in the rectangle area,
288 * the string is truncated. If trans is true, then the background of the rectangular area where the text is being
289 * drawn will not be modified, otherwise it will be filled with the receiver's background color.
a55887ca
AM
290 *
291 * @param name The text to put in the rectangle
eb63f5ff
BH
292 * @param x the x coordinate of the rectangle to draw the string
293 * @param y the y coordinate of the rectangle to draw the string
73005152
BH
294 * @param width the width of the rectangle to draw the string
295 * @param height the height of the rectangle to draw the string
296 * @param trans if true the background will be transparent, otherwise it will be opaque
297 */
eb63f5ff 298 public abstract void drawTextTruncated(String name, int x, int y, int width, int height, boolean trans);
73005152
BH
299
300 /**
301 * Copies a the source image into a (potentially different sized) rectangular area in the graphical context. If the
302 * source image has smaller sizes, then the source area will be stretched to fit the destination area as it is
303 * copied.
a55887ca 304 *
73005152 305 * @param image the image to draw
eb63f5ff
BH
306 * @param x the x coordinate in the destination to copy to
307 * @param y the y coordinate in the destination to copy to
73005152
BH
308 * @param maxWith the width in pixels of the destination rectangle
309 * @param maxHeight the height in pixels of the destination rectangle
310 */
eb63f5ff 311 public abstract void drawImage(IImage image, int x, int y, int maxWith, int maxHeight);
73005152
BH
312
313 /**
314 * Draws the outline of a circular or elliptical arc within the specified rectangular area. The resulting arc begins
315 * at startAngle and extends for arcAngle degrees, using the current color. Angles are interpreted such that 0
316 * degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative
317 * value indicates a clockwise rotation. The center of the arc is the center of the rectangle whose origin is (x, y)
318 * and whose size is specified by the width and height arguments. The resulting arc covers an area width + 1 pixels
319 * wide by height + 1 pixels tall.
a55887ca 320 *
73005152
BH
321 * @param x the x coordinate of the upper-left corner of the arc to be drawn
322 * @param y the y coordinate of the upper-left corner of the arc to be drawn
323 * @param width the width of the arc to be drawn
324 * @param height the height of the arc to be drawn
325 * @param startAngle the beginning angle
326 * @param endAngle the ending angle
327 */
328 public abstract void drawArc(int x, int y, int width, int height, int startAngle, int endAngle);
329
330 /**
331 * Set the current font used in the graphical context
a55887ca 332 *
73005152
BH
333 * @param font the font to use
334 */
335 public abstract void setFont(IFont font);
336
337 /**
338 * Returns the font height given font
a55887ca
AM
339 *
340 * @param font The font to check for
73005152
BH
341 * @return the the font height
342 */
343 public abstract int getFontHeight(IFont font);
344
345 /**
346 * Returns the average character width for the given font
a55887ca
AM
347 *
348 * @param font The font to check for
73005152
BH
349 * @return the average width
350 */
351 public abstract int getFontWidth(IFont font);
352
353 /**
354 * Creates a color with the given RGB values
a55887ca 355 *
73005152
BH
356 * @param r the red component
357 * @param g the green component
358 * @param b the blue component
359 * @return the color
360 */
361 public abstract IColor createColor(int r, int g, int b);
362
363 /**
364 * Returns the zoom factor applied in both x and y directions when drawing
a55887ca 365 *
73005152
BH
366 * @return the zoom factor
367 */
368 public abstract float getZoom();
369
df0b8ff4
BH
370 /**
371 * Draws text with focus style.
a55887ca 372 *
df0b8ff4
BH
373 * @param focus <code>true</code> if item has focus else <code>false</code>
374 */
73005152
BH
375 public abstract void setDrawTextWithFocusStyle(boolean focus);
376}
This page took 0.048575 seconds and 5 git commands to generate.