~ubuntu-branches/ubuntu/trusty/eclipse-linuxtools/trusty

« back to all changes in this revision

Viewing changes to lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/drawings/IGC.java

  • Committer: Package Import Robot
  • Author(s): tony mancill
  • Date: 2013-05-13 21:43:22 UTC
  • mfrom: (1.2.1) (2.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130513214322-6frgd9du1n0w2uo7
Tags: 1.2.1-1
* Team upload.
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**********************************************************************
2
2
 * Copyright (c) 2005, 2006 IBM Corporation and others.
3
3
 * Copyright (c) 2011, 2012 Ericsson.
4
 
 * 
 
4
 *
5
5
 * All rights reserved.   This program and the accompanying materials
6
6
 * are made available under the terms of the Eclipse Public License v1.0
7
7
 * which accompanies this distribution, and is available at
8
8
 * http://www.eclipse.org/legal/epl-v10.html
9
 
 * 
10
 
 * Contributors: 
 
9
 *
 
10
 * Contributors:
11
11
 * IBM - Initial API and implementation
12
12
 * Bernd Hufmann - Updated for TMF
13
13
 **********************************************************************/
15
15
 
16
16
/**
17
17
 * Interface for a graphical context.
18
 
 * 
 
18
 *
19
19
 * @version 1.0
20
20
 * @author sveyrier
21
 
 * 
 
21
 *
22
22
 */
23
23
public interface IGC {
24
24
 
25
25
    /**
26
26
     * Set the current line style
27
 
     * 
 
27
     *
28
28
     * @param style the new line style
29
29
     */
30
30
    public abstract void setLineStyle(int style);
31
31
 
32
32
    /**
33
33
     * Returns current the line style used in the graphical context
34
 
     * 
 
34
     *
35
35
     * @return the current line style
36
36
     */
37
37
    public abstract int getLineStyle();
38
38
 
39
39
    /**
40
40
     * Returns the contents x coordinate that is at the upper left corner of the view
41
 
     * 
 
41
     *
42
42
     * @return the contents x coordinate
43
43
     */
44
44
    public abstract int getContentsX();
45
45
 
46
46
    /**
47
47
     * Returns the contents y coordinate that is at the upper left corner of the view
48
 
     * 
 
48
     *
49
49
     * @return the contents y coordinate
50
50
     */
51
51
    public abstract int getContentsY();
52
52
 
53
53
    /**
54
54
     * Returns the contents visible width
55
 
     * 
 
55
     *
56
56
     * @return the contents width
57
57
     */
58
58
    public abstract int getVisibleWidth();
59
59
 
60
60
    /**
61
61
     * Returns the contents visible height
62
 
     * 
 
62
     *
63
63
     * @return the contents height
64
64
     */
65
65
    public abstract int getVisibleHeight();
66
66
 
67
67
    /**
68
68
     * Translates the given contents x coordinate into view x coordinate
69
 
     * 
 
69
     *
70
70
     * @param x the x coordinate to translate
71
71
     * @return the corresponding view x coordinate
72
72
     */
74
74
 
75
75
    /**
76
76
     * Translates the given contents y coordinate into view y coordinate
77
 
     * 
 
77
     *
78
78
     * @param y the y coordinate to translate
79
79
     * @return the corresponding view y coordinate
80
80
     */
82
82
 
83
83
    /**
84
84
     * Draws a line, using the foreground color, between the points (x1, y1) and (x2, y2).
85
 
     * 
 
85
     *
86
86
     * @param x1 the first point's x coordinate
87
87
     * @param y1 the first point's y coordinate
88
88
     * @param x2 the second point's x coordinate
93
93
    /**
94
94
     * Draws the outline of the rectangle specified by the arguments, using the receiver's foreground color. The left
95
95
     * and right edges of the rectangle are at x and x + width. The top and bottom edges are at y and y + height.
96
 
     * 
 
96
     *
97
97
     * @param x the x coordinate of the rectangle to be drawn
98
98
     * @param y the y coordinate of the rectangle to be drawn
99
99
     * @param width the width of the rectangle to be drawn
105
105
     * Draws a rectangle, based on the specified arguments, which has the appearance of the platform's focus rectangle
106
106
     * if the platform supports such a notion, and otherwise draws a simple rectangle in the receiver's foreground
107
107
     * color.
108
 
     * 
 
108
     *
109
109
     * @param x the x coordinate of the rectangle
110
110
     * @param y the y coordinate of the rectangle
111
111
     * @param width the width of the rectangle
118
118
     * the receiver's background color. The array contains alternating x and y values which are considered to represent
119
119
     * points which are the vertices of the polygon. Lines are drawn between each consecutive pair, and between the
120
120
     * first pair and last pair in the array.
121
 
     * 
 
121
     *
122
122
     * @param points an array of alternating x and y values which are the vertices of the polygon
123
123
     */
124
124
    public abstract void fillPolygon(int[] points);
128
128
     * foreground color. The array contains alternating x and y values which are considered to represent points which
129
129
     * are the vertices of the polygon. Lines are drawn between each consecutive pair, and between the first pair and
130
130
     * last pair in the array.
131
 
     * 
 
131
     *
132
132
     * @param points an array of alternating x and y values which are the vertices of the polygon
133
133
     */
134
134
    public abstract void drawPolygon(int[] points);
135
135
 
136
136
    /**
137
137
     * Fills the interior of the rectangle specified by the arguments, using the receiver's background color.
138
 
     * 
 
138
     *
139
139
     * @param x the x coordinate of the rectangle to be filled
140
140
     * @param y the y coordinate of the rectangle to be filled
141
141
     * @param width the width of the rectangle to be filled
146
146
    /**
147
147
     * Fills the interior of the specified rectangle with a gradient sweeping from left to right or top to bottom
148
148
     * progressing from the graphical context gradient color to its background color.
149
 
     * 
 
149
     *
150
150
     * @param x the x coordinate of the rectangle to be filled
151
151
     * @param y the y coordinate of the rectangle to be filled
152
152
     * @param width the width of the rectangle to be filled, may be negative (inverts direction of gradient if
159
159
 
160
160
    /**
161
161
     * Returns the given string width in pixels
162
 
     * 
 
162
     *
163
163
     * @param name the string
164
164
     * @return the string width
165
165
     */
169
169
     * Draws the given string, using the receiver's current font and foreground color. Tab expansion and carriage return
170
170
     * processing are performed. If trans is true, then the background of the rectangular area where the text is being
171
171
     * drawn will not be modified, otherwise it will be filled with the receiver's background color.
172
 
     * 
 
172
     *
173
173
     * @param string the string to be drawn
174
174
     * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
175
175
     * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
181
181
     * Draws the given string, using the receiver's current font and foreground color. Tab expansion and carriage return
182
182
     * processing are performed. The background of the rectangular area where the text is being drawn will be filled
183
183
     * with the receiver's background color.
184
 
     * 
 
184
     *
185
185
     * @param string the string to be drawn
186
186
     * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
187
187
     * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
190
190
 
191
191
    /**
192
192
     * Fills the interior of an oval, within the specified rectangular area, with the receiver's background color.
193
 
     * 
 
193
     *
194
194
     * @param x the x coordinate of the upper left corner of the oval to be filled
195
195
     * @param y the y coordinate of the upper left corner of the oval to be filled
196
196
     * @param width the width of the oval to be filled
200
200
 
201
201
    /**
202
202
     * Returns current the background color used in the graphical context
203
 
     * 
 
203
     *
204
204
     * @return the background color
205
205
     */
206
206
    public abstract IColor getBackground();
207
207
 
208
208
    /**
209
209
     * Returns current the background color used in the graphical context
210
 
     * 
 
210
     *
211
211
     * @return the background color
212
212
     */
213
213
    public abstract IColor getForeground();
214
214
 
215
215
    /**
216
216
     * Set the graphical context foreground color
217
 
     * 
 
217
     *
218
218
     * @param color the foreground color
219
219
     */
220
220
    public abstract void setBackground(IColor color);
221
221
 
222
222
    /**
223
223
     * Set the graphical context background color
224
 
     * 
 
224
     *
225
225
     * @param color the background color
226
226
     */
227
227
    public abstract void setForeground(IColor color);
229
229
    /**
230
230
     * Set the color to use when filling regions using gradient. The color will progess from the given color to the
231
231
     * current background color
232
 
     * 
 
232
     *
233
233
     * @param color the gardiient color to use
234
234
     */
235
235
    public abstract void setGradientColor(IColor color);
236
236
 
237
237
    /**
238
238
     * Set the line width to use for drawing
239
 
     * 
 
239
     *
240
240
     * @param width the line width
241
241
     */
242
242
    public abstract void setLineWidth(int width);
243
243
 
244
244
    /**
245
245
     * Returns the current graphical context line width used for drawing
246
 
     * 
 
246
     *
247
247
     * @return the line width
248
248
     */
249
249
    public abstract int getLineWidth();
250
250
 
251
251
    /**
252
252
     * Returns the LineDotD style constant
253
 
     * 
 
253
     *
254
254
     * @return the constant value
255
255
     */
256
256
    public abstract int getLineDotStyle();
257
257
 
258
258
    /**
259
259
     * Returns the LineDash style constant
260
 
     * 
 
260
     *
261
261
     * @return the constant
262
262
     */
263
263
    public abstract int getLineDashStyle();
264
264
 
265
265
    /**
266
266
     * Returns the LineSolid style constant
267
 
     * 
 
267
     *
268
268
     * @return the constant
269
269
     */
270
270
    public abstract int getLineSolidStyle();
273
273
     * Draws the given string centered into the given rectangle. If the string cannot fit in the rectangle area, the
274
274
     * string is truncated. If trans is true, then the background of the rectangular area where the text is being drawn
275
275
     * will not be modified, otherwise it will be filled with the receiver's background color.
276
 
     * 
 
276
     *
277
277
     * @param name the string to draw
278
278
     * @param x the x coordinate of the rectangle to draw the string
279
279
     * @param y the y coordinate of the rectangle to draw the string
287
287
     * Draws the given string into the given rectangle (left justify) If the string cannot fit in the rectangle area,
288
288
     * the string is truncated. If trans is true, then the background of the rectangular area where the text is being
289
289
     * drawn will not be modified, otherwise it will be filled with the receiver's background color.
290
 
     * 
 
290
     *
 
291
     * @param name The text to put in the rectangle
291
292
     * @param x the x coordinate of the rectangle to draw the string
292
293
     * @param y the y coordinate of the rectangle to draw the string
293
294
     * @param width the width of the rectangle to draw the string
300
301
     * Copies a the source image into a (potentially different sized) rectangular area in the graphical context. If the
301
302
     * source image has smaller sizes, then the source area will be stretched to fit the destination area as it is
302
303
     * copied.
303
 
     * 
 
304
     *
304
305
     * @param image the image to draw
305
306
     * @param x the x coordinate in the destination to copy to
306
307
     * @param y the y coordinate in the destination to copy to
316
317
     * value indicates a clockwise rotation. The center of the arc is the center of the rectangle whose origin is (x, y)
317
318
     * and whose size is specified by the width and height arguments. The resulting arc covers an area width + 1 pixels
318
319
     * wide by height + 1 pixels tall.
319
 
     * 
 
320
     *
320
321
     * @param x the x coordinate of the upper-left corner of the arc to be drawn
321
322
     * @param y the y coordinate of the upper-left corner of the arc to be drawn
322
323
     * @param width the width of the arc to be drawn
328
329
 
329
330
    /**
330
331
     * Set the current font used in the graphical context
331
 
     * 
 
332
     *
332
333
     * @param font the font to use
333
334
     */
334
335
    public abstract void setFont(IFont font);
335
336
 
336
337
    /**
337
338
     * Returns the font height given font
338
 
     * 
339
 
     * @param font
 
339
     *
 
340
     * @param font The font to check for
340
341
     * @return the the font height
341
342
     */
342
343
    public abstract int getFontHeight(IFont font);
343
344
 
344
345
    /**
345
346
     * Returns the average character width for the given font
346
 
     * 
347
 
     * @param font
 
347
     *
 
348
     * @param font The font to check for
348
349
     * @return the average width
349
350
     */
350
351
    public abstract int getFontWidth(IFont font);
351
352
 
352
353
    /**
353
354
     * Creates a color with the given RGB values
354
 
     * 
 
355
     *
355
356
     * @param r the red component
356
357
     * @param g the green component
357
358
     * @param b the blue component
361
362
 
362
363
    /**
363
364
     * Returns the zoom factor applied in both x and y directions when drawing
364
 
     * 
 
365
     *
365
366
     * @return the zoom factor
366
367
     */
367
368
    public abstract float getZoom();
368
369
 
369
370
    /**
370
371
     * Draws text with focus style.
371
 
     * 
 
372
     *
372
373
     * @param focus <code>true</code> if item has focus else <code>false</code>
373
374
     */
374
375
    public abstract void setDrawTextWithFocusStyle(boolean focus);