org.gnu.gdk
Class GC
public
class
GC
extends GObject
All drawing operations in GDK take a GC argument. A graphics context
encapsulates information about the way things are drawn, such as the
foreground color or line width. By using graphics context, the number of
arguments to each drawing call is reduced, and communication overhead is
minimized.
Method Summary |
void | copy(GC source)
Copy the set of values (settings) from another graphics context.
|
int | getClipXOrigin()
Getst he x origin of the clip mask. |
int | getClipYOrigin()
Gets the y origin of the clip mask. |
Colormap | getColormap()
Gets the colormap, if it exists. |
static GC | getDefaultGC(Drawable d)
Convenience method to construct a new GC with default values.
|
Screen | getScreen()
Gets the Screen for which this GC was created. |
int | getTsXOrigin()
Gets the x origin of the tile or stipple. |
int | getTsYOrigin()
Gets the y origin of the tile or stipple. |
void | offset(int xOffset, int yOffset)
Offset attributes such as the clip and tile-stipple origins of the GC so
that drawing at X - x_offset, y - y_offset with the offset GC has the
same effect as drawing at x, y with the original GC.
|
void | setBackground(Color color)
Sets the background color for the graphics context. |
void | setClipMask(Bitmap mask)
Sets the clip mask for a graphics context from a bitmap. |
void | setClipOrigin(int x, int y)
Sets the origin of the clip mask. |
void | setClipRectangle(Rectangle rect)
Sets the clip mask for a graphics context from a rectangle. |
void | setClipRegion(Region reg)
Sets the clip mask for a graphics context from a region. |
void | setColormap(Colormap colormap)
Sets the colormap to the given colormap. |
void | setDashes(int dashOffset, int[] dashList)
Sets the way dashed-lines are drawn. |
void | setExposures(boolean exposures)
Sets whether copying non-visible portions of a drawable using this
graphics context generate exposure events for the corresponding regions
of the destination drawable.
|
void | setFillMode(Fill mode)
Sets the fill mode for the graphic context. |
void | setForeground(Color color)
Sets the foreground color for the graphics context. |
void | setFunction(Function func)
Determines how the current pixel values and the pixel values being drawn
are combined to produce the final pixel values. |
void | setLineAttributes(int lineWidth, LineStyle lineStyle, CapStyle capStyle, JoinStyle joinStyle)
Sets various attributes of how lines are drawn. |
void | setOrigin(int x, int y)
Sets the origin when using tiles or stipples with the GC. |
void | setRGBBackground(Color color)
Sets the background color using an unallocated color. |
void | setRGBForeground(Color color)
Sets the foreground color using an unallocated color. |
void | setStipple(Pixmap stipple)
Sets the stipple bitmap for a graphics context. |
void | setSubwindow(SubwindowMode mode)
Sets how drawing with this GC on a window will affect child windows. |
void | setTile(Pixmap tile)
Sets the tile pixmap for the graphics context. |
public GC(Handle handle)
Deprecated:
Parameters: window
Create a new graphics context with default values.
Parameters: drawable
The created GC must always be used with drawables of the same
depth as this one.
public void copy(
GC source)
Copy the set of values (settings) from another graphics context.
Parameters: source
the source graphics context.
public int getClipXOrigin()
Getst he x origin of the clip mask.
public int getClipYOrigin()
Gets the y origin of the clip mask.
Gets the colormap, if it exists. A GC will have a colormap if the
drawable for which it was created has a colormap, or if a colormap was
set explicitely with setColormap().
Convenience method to construct a new GC with default values.
Parameters: d
Gets the Screen for which this GC was created.
public int getTsXOrigin()
Gets the x origin of the tile or stipple.
public int getTsYOrigin()
Gets the y origin of the tile or stipple.
public void offset(int xOffset, int yOffset)
Offset attributes such as the clip and tile-stipple origins of the GC so
that drawing at X - x_offset, y - y_offset with the offset GC has the
same effect as drawing at x, y with the original GC.
Parameters: xOffset
amount by which to offset the GC in the X direction yOffset
amount by which to offset the GC in the Y direction
public void setBackground(
Color color)
Sets the background color for the graphics context.
public void setClipMask(
Bitmap mask)
Sets the clip mask for a graphics context from a bitmap.
public void setClipOrigin(int x, int y)
Sets the origin of the clip mask. The coordinates are interpreted
relative to the upper-left cornor of the destination drawable of the
current operation.
Sets the clip mask for a graphics context from a rectangle.
public void setClipRegion(
Region reg)
Sets the clip mask for a graphics context from a region.
public void setColormap(
Colormap colormap)
Sets the colormap to the given colormap. The depth of the colormap's
visual must match the depth of the drawable for which the GC was created.
public void setDashes(int dashOffset, int[] dashList)
Sets the way dashed-lines are drawn. Lines will be drawn with alternating
on and off segments of the lengths specified in dash_list. The manner in
which the on and off segments are drawn is determined by the line style.
Parameters: dashOffset
the phase of the pattern for the dashed line-style you want to
see dashList
the dash-list for the dashed line-style you want to set.
See Also: GC
public void setExposures(boolean exposures)
Sets whether copying non-visible portions of a drawable using this
graphics context generate exposure events for the corresponding regions
of the destination drawable.
See Also: Drawable
public void setFillMode(
Fill mode)
Sets the fill mode for the graphic context.
public void setForeground(
Color color)
Sets the foreground color for the graphics context.
Determines how the current pixel values and the pixel values being drawn
are combined to produce the final pixel values.
Sets various attributes of how lines are drawn. See the corresponding
members of GdkGCValues for full explanations of the arguments.
Parameters: lineWidth
the width of lines. lineStyle
the dash-style for lines. capStyle
the manner in which the ends of lines are drawn. joinStyle
the manner in which lines are joined together.
public void setOrigin(int x, int y)
Sets the origin when using tiles or stipples with the GC. The tile or
stipple will be aligned such that the upper left cornor of the tile or
stipple will coincide with this point.
public void setRGBBackground(
Color color)
Sets the background color using an unallocated color. The pixel value for
the color will be determined using GdkRGB. If the colormap has not
previously been initialized for GdkRGB, then for pseudo-color colormaps
(colormaps with a small modifiable number of colors), a colorcube will be
allocated in the colormap.
Calling this function for a GC without a colormap is an error.
public void setRGBForeground(
Color color)
Sets the foreground color using an unallocated color. The pixel value for
the color will be determined using GdkRGB. If the colormap has not
previously been initialized for GdkRGB, then for pseudo-color colormaps
(colormaps with a small modifiable number of colors), a colorcube will be
allocated in the colormap.
Calling this function for a GC without a colormap is an error.
public void setStipple(
Pixmap stipple)
Sets the stipple bitmap for a graphics context. The stipple will only be
used if the fill mode is STIPPLED or OPAQUE_STIPPLED.
Sets how drawing with this GC on a window will affect child windows.
public void setTile(
Pixmap tile)
Sets the tile pixmap for the graphics context. This will only be used if
the fill mode is TILED.