TPTP 4.5.0 Platform Project
Public API Specification

org.eclipse.hyades.uml2sd.ui.drawings
Interface IGC

All Known Implementing Classes:
NGC

public interface IGC


Method Summary
 int contentsToViewX(int x)
          Translates the given contents x coordinate into view x coordinate
 int contentsToViewY(int y)
          Translates the given contents y coordinate into view y coordinate
 IColor createColor(int r, int g, int b)
          Creates a color with the given RGB values
 void drawArc(int x, int y, int width, int height, int startAngle, int endAngle)
          Draws the outline of a circular or elliptical arc within the specified rectangular area.
 void drawFocus(int x, int y, int width, int height)
          Draws a rectangle, based on the specified arguments, which has the appearance of the platform's focus rectangle if the platform supports such a notion, and otherwise draws a simple rectangle in the receiver's foreground color.
 void drawImage(IImage image, int _x, int _y, int maxWith, int maxHeight)
          Copies a the source image into a (potentially different sized) rectangular area in the graphical context.
 void drawLine(int x1, int y1, int x2, int y2)
          Draws a line, using the foreground color, between the points (x1, y1) and (x2, y2).
 void drawPolygon(int[] points)
          Draws the closed polygon which is defined by the specified array of integer coordinates, using the receiver's foreground color.
 void drawRectangle(int x, int y, int width, int height)
          Draws the outline of the rectangle specified by the arguments, using the receiver's foreground color.
 void drawText(java.lang.String string, int x, int y)
          Draws the given string, using the receiver's current font and foreground color.
 void drawText(java.lang.String string, int x, int y, boolean trans)
          Draws the given string, using the receiver's current font and foreground color.
 void drawTextTruncated(java.lang.String name, int _x, int _y, int width, int height, boolean trans)
          Draws the given string into the given rectangle (left justify) If the string cannot fit in the rectangle area, the string is truncated.
 void drawTextTruncatedCentred(java.lang.String name, int _x, int _y, int width, int height, boolean trans)
          Draws the given string centered into the given rectangle.
 void fillGradientRectangle(int x, int y, int width, int height, boolean vertical)
          Fills the interior of the specified rectangle with a gradient sweeping from left to right or top to bottom progressing from the graphical context gradient color to its background color.
 void fillOval(int x, int y, int width, int height)
          Fills the interior of an oval, within the specified rectangular area, with the receiver's background color.
 void fillPolygon(int[] points)
          Fills the interior of the closed polygon which is defined by the specified array of integer coordinates, using the receiver's background color.
 void fillRectangle(int x, int y, int width, int height)
          Fills the interior of the rectangle specified by the arguments, using the receiver's background color.
 IColor getBackground()
          Returns current the background color used in the graphical context
 int getContentsX()
          Returns the contents x coordinate that is at the upper left corner of the view
 int getContentsY()
          Returns the contents y coordinate that is at the upper left corner of the view
 int getFontHeight(IFont font)
          Returns the font height given font
 int getFontWidth(IFont font)
          Returns the average character width for the given font
 IColor getForeground()
          Returns current the background color used in the graphical context
 int getLineDashStyle()
          Returns the LineDash style constant
 int getLineDotStyle()
          Returns the LineDotD style contant
 int getLineSolidStyle()
          Returns the LineSolid style constant
 int getLineStyle()
          Returns current the line style used in the graphical context
 int getLineWidth()
          Returns the current graphical context line width used for drawing
 int getVisibleHeight()
          Returns the contents visible height
 int getVisibleWidth()
          Returns the contents visible width
 float getZoom()
          Returns the zoom factor applied in both x and y directions when drawing
 void setBackground(IColor color)
          Set the graphical context foreground color
 void setDrawTextWithFocusStyle(boolean focus)
           
 void setFont(IFont font)
          Set the current font used in the graphical context
 void setForeground(IColor color)
          Set the graphical context background color
 void setGradientColor(IColor color)
          Set the color to use when filling regions using gradient.
 void setLineStyle(int style)
          Set the current line style
 void setLineWidth(int width)
          Set the line width to use for drawing
 int textExtent(java.lang.String name)
          Returns the given string width in pixels
 

Method Detail

setLineStyle

void setLineStyle(int style)
Set the current line style

Parameters:
style - the new line style

getLineStyle

int getLineStyle()
Returns current the line style used in the graphical context

Returns:
the current line style

getContentsX

int getContentsX()
Returns the contents x coordinate that is at the upper left corner of the view

Returns:
the contents x coordinate

getContentsY

int getContentsY()
Returns the contents y coordinate that is at the upper left corner of the view

Returns:
the contents y coordinate

getVisibleWidth

int getVisibleWidth()
Returns the contents visible width

Returns:
the contents width

getVisibleHeight

int getVisibleHeight()
Returns the contents visible height

Returns:
the contents height

contentsToViewX

int contentsToViewX(int x)
Translates the given contents x coordinate into view x coordinate

Parameters:
x - the x coordinate to translate
Returns:
the corresponding view x coordinate

contentsToViewY

int contentsToViewY(int y)
Translates the given contents y coordinate into view y coordinate

Parameters:
y - the y coordinate to translate
Returns:
the corresponding view y coordinate

drawLine

void drawLine(int x1,
              int y1,
              int x2,
              int y2)
Draws a line, using the foreground color, between the points (x1, y1) and (x2, y2).

Parameters:
x1 - the first point's x coordinate
y1 - the first point's y coordinate
x2 - the second point's x coordinate
y2 - the second point's y coordinate

drawRectangle

void drawRectangle(int x,
                   int y,
                   int width,
                   int height)
Draws the outline of the rectangle specified by the arguments, using the receiver's foreground color. The left and right edges of the rectangle are at x and x + width. The top and bottom edges are at y and y + height.

Parameters:
x - the x coordinate of the rectangle to be drawn
y - the y coordinate of the rectangle to be drawn
width - the width of the rectangle to be drawn
height - the height of the rectangle to be drawn

drawFocus

void drawFocus(int x,
               int y,
               int width,
               int height)
Draws a rectangle, based on the specified arguments, which has the appearance of the platform's focus rectangle if the platform supports such a notion, and otherwise draws a simple rectangle in the receiver's foreground color.

Parameters:
x - the x coordinate of the rectangle
y - the y coordinate of the rectangle
width - the width of the rectangle
height - the height of the rectangle

fillPolygon

void fillPolygon(int[] points)
Fills the interior of the closed polygon which is defined by the specified array of integer coordinates, using the receiver's background color. The array contains alternating x and y values which are considered to represent points which are the vertices of the polygon. Lines are drawn between each consecutive pair, and between the first pair and last pair in the array.

Parameters:
points - an array of alternating x and y values which are the vertices of the polygon

drawPolygon

void drawPolygon(int[] points)
Draws the closed polygon which is defined by the specified array of integer coordinates, using the receiver's foreground color. The array contains alternating x and y values which are considered to represent points which are the vertices of the polygon. Lines are drawn between each consecutive pair, and between the first pair and last pair in the array.

Parameters:
points - an array of alternating x and y values which are the vertices of the polygon

fillRectangle

void fillRectangle(int x,
                   int y,
                   int width,
                   int height)
Fills the interior of the rectangle specified by the arguments, using the receiver's background color.

Parameters:
x - the x coordinate of the rectangle to be filled
y - the y coordinate of the rectangle to be filled
width - the width of the rectangle to be filled
height - the height of the rectangle to be filled

fillGradientRectangle

void fillGradientRectangle(int x,
                           int y,
                           int width,
                           int height,
                           boolean vertical)
Fills the interior of the specified rectangle with a gradient sweeping from left to right or top to bottom progressing from the graphical context gradient color to its background color.

Parameters:
x - the x coordinate of the rectangle to be filled
y - the y coordinate of the rectangle to be filled
width - the width of the rectangle to be filled, may be negative (inverts direction of gradient if horizontal)
height - the height of the rectangle to be filled, may be negative (inverts direction of gradient if horizontal)
vertical - if true sweeps from top to bottom, else sweeps from left to right

textExtent

int textExtent(java.lang.String name)
Returns the given string width in pixels

Parameters:
name - the string
Returns:
the string width

drawText

void drawText(java.lang.String string,
              int x,
              int y,
              boolean trans)
Draws the given string, using the receiver's current font and foreground color. Tab expansion and carriage return processing are performed. If trans is true, then the background of the rectangular area where the text is being drawn will not be modified, otherwise it will be filled with the receiver's background color.

Parameters:
string - the string to be drawn
x - the x coordinate of the top left corner of the rectangular area where the text is to be drawn
y - the y coordinate of the top left corner of the rectangular area where the text is to be drawn
trans - if true the background will be transparent, otherwise it will be opaque

drawText

void drawText(java.lang.String string,
              int x,
              int y)
Draws the given string, using the receiver's current font and foreground color. Tab expansion and carriage return processing are performed. The background of the rectangular area where the text is being drawn will be filled with the receiver's background color.

Parameters:
string - the string to be drawn
x - the x coordinate of the top left corner of the rectangular area where the text is to be drawn
y - the y coordinate of the top left corner of the rectangular area where the text is to be drawn

fillOval

void fillOval(int x,
              int y,
              int width,
              int height)
Fills the interior of an oval, within the specified rectangular area, with the receiver's background color.

Parameters:
x - the x coordinate of the upper left corner of the oval to be filled
y - the y coordinate of the upper left corner of the oval to be filled
width - the width of the oval to be filled
height - the width of the oval to be filled

getBackground

IColor getBackground()
Returns current the background color used in the graphical context

Returns:
the background color

getForeground

IColor getForeground()
Returns current the background color used in the graphical context

Returns:
the background color

setBackground

void setBackground(IColor color)
Set the graphical context foreground color

Parameters:
color - the foreground color

setForeground

void setForeground(IColor color)
Set the graphical context background color

Parameters:
color - the background color

setGradientColor

void setGradientColor(IColor color)
Set the color to use when filling regions using gradient. The color will progess from the given color to the current background color

Parameters:
color - the gardiient color to use

setLineWidth

void setLineWidth(int width)
Set the line width to use for drawing

Parameters:
width - the line width

getLineWidth

int getLineWidth()
Returns the current graphical context line width used for drawing

Returns:
the line width

getLineDotStyle

int getLineDotStyle()
Returns the LineDotD style contant

Returns:
the constant value

getLineDashStyle

int getLineDashStyle()
Returns the LineDash style constant

Returns:
the constant

getLineSolidStyle

int getLineSolidStyle()
Returns the LineSolid style constant

Returns:
the constant

drawTextTruncatedCentred

void drawTextTruncatedCentred(java.lang.String name,
                              int _x,
                              int _y,
                              int width,
                              int height,
                              boolean trans)
Draws the given string centered into the given rectangle. If the string cannot fit in the rectangle area, the string is truncated. If trans is true, then the background of the rectangular area where the text is being drawn will not be modified, otherwise it will be filled with the receiver's background color.

Parameters:
name - the string to draw
_x - the _x coordinate of the rectangle to draw the string
_y - the _y coordinate of the rectangle to draw the string
width - the width of the rectangle to draw the string
height - the height of the rectangle to draw the string
trans - if true the background will be transparent, otherwise it will be opaque

drawTextTruncated

void drawTextTruncated(java.lang.String name,
                       int _x,
                       int _y,
                       int width,
                       int height,
                       boolean trans)
Draws the given string into the given rectangle (left justify) If the string cannot fit in the rectangle area, the string is truncated. If trans is true, then the background of the rectangular area where the text is being drawn will not be modified, otherwise it will be filled with the receiver's background color.

Parameters:
_x - the _x coordinate of the rectangle to draw the string
_y - the _y coordinate of the rectangle to draw the string
width - the width of the rectangle to draw the string
height - the height of the rectangle to draw the string
trans - if true the background will be transparent, otherwise it will be opaque

drawImage

void drawImage(IImage image,
               int _x,
               int _y,
               int maxWith,
               int maxHeight)
Copies a the source image into a (potentially different sized) rectangular area in the graphical context. If the source image has smaller sizes, then the source area will be stretched to fit the destination area as it is copied.

Parameters:
image - the image to draw
_x - the x coordinate in the destination to copy to
_y - the y coordinate in the destination to copy to
maxWith - the width in pixels of the destination rectangle
maxHeight - the height in pixels of the destination rectangle

drawArc

void drawArc(int x,
             int y,
             int width,
             int height,
             int startAngle,
             int endAngle)
Draws the outline of a circular or elliptical arc within the specified rectangular area. The resulting arc begins at startAngle and extends for arcAngle degrees, using the current color. Angles are interpreted such that 0 degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative value indicates a clockwise rotation. The center of the arc is the center of the rectangle whose origin is (x, y) and whose size is specified by the width and height arguments. The resulting arc covers an area width + 1 pixels wide by height + 1 pixels tall.

Parameters:
x - the x coordinate of the upper-left corner of the arc to be drawn
y - the y coordinate of the upper-left corner of the arc to be drawn
width - the width of the arc to be drawn
height - the height of the arc to be drawn
startAngle - the beginning angle
endAngle - the ending angle

setFont

void setFont(IFont font)
Set the current font used in the graphical context

Parameters:
font - the font to use

getFontHeight

int getFontHeight(IFont font)
Returns the font height given font

Parameters:
font -
Returns:
the the font height

getFontWidth

int getFontWidth(IFont font)
Returns the average character width for the given font

Parameters:
font -
Returns:
the average width

createColor

IColor createColor(int r,
                   int g,
                   int b)
Creates a color with the given RGB values

Parameters:
r - the red component
g - the green component
b - the blue component
Returns:
the color

getZoom

float getZoom()
Returns the zoom factor applied in both x and y directions when drawing

Returns:
the zoom factor

setDrawTextWithFocusStyle

void setDrawTextWithFocusStyle(boolean focus)

TPTP 4.5.0 Platform Project
Public API Specification