gdk-Graphics-Contexts: Graphics Contexts
Description
Objects to encapsulate drawing propertiesMethods and Functions
gdkGCNew(drawable)
gdkGCNewWithValues(object, values)
gdkGCGetScreen(object)
gdkGCSetValues(object, values)
gdkGCGetValues(object)
gdkGCSetForeground(object, color)
gdkGCSetBackground(object, color)
gdkGCSetRgbFgColor(object, color)
gdkGCSetRgbBgColor(object, color)
gdkGCSetFont(object, font)
gdkGCSetFunction(object, fun)
gdkGCSetFill(object, fill)
gdkGCSetTile(object, tile)
gdkGCSetStipple(object, stipple)
gdkGCSetTsOrigin(object, x, y)
gdkGCSetClipOrigin(object, x, y)
gdkGCSetClipMask(object, mask)
gdkGCSetClipRectangle(object, rectangle)
gdkGCSetClipRegion(object, region)
gdkGCSetSubwindow(object, mode)
gdkGCSetExposures(object, exposures)
gdkGCSetLineAttributes(object, line.width, line.style, cap.style, join.style)
gdkGCSetDashes(object, dash.list)
gdkGCCopy(object, src.gc)
gdkGCSetColormap(object, colormap)
gdkGCGetColormap(object)
gdkGCOffset(object, x.offset, y.offset)
gdkGC(drawable)
Hierarchy
GObject
+----GdkGC
Detailed Description
All drawing operations in GDK take a
graphics context (GC) argument.
A graphics context encapsulates information about
the way things are drawn, such as the foreground
color or line width. By using graphics contexts,
the number of arguments to each drawing call is
greatly reduced, and communication overhead is
minimized, since identical arguments do not need
to be passed repeatedly. Most values of a graphics context can be set at
creation time by using gdkGCNewWithValues
,
or can be set one-by-one using functions such
as gdkGCSetForeground
. A few of the values
in the GC, such as the dash pattern, can only
be set by the latter method.Structures
GdkGC
-
The
GdkGC
structure represents a graphics context.
It is an opaque structure with no user-visible
elements. GdkGCValues
-
The
GdkGCValues
structure holds a set of values used
to create or modify a graphics context.
GdkGCValues
is a transparent-type.
foreground
- the foreground color. Note that
gdkGCGetValues
only sets the pixel value. background
- the background color. Note that
gdkGCGetValues
only sets the pixel value. font
- the default font.
function
- the bitwise operation used when drawing.
fill
- the fill style.
tile
- the tile pixmap.
stipple
- the stipple bitmap.
clip_mask
- the clip mask bitmap.
subwindow_mode
- the subwindow mode.
ts_x_origin
- the x origin of the tile or stipple.
ts_y_origin
- the y origin of the tile or stipple.
clip_x_origin
- the x origin of the clip mask.
clip_y_origin
- the y origin of the clip mask.
graphics_exposures
- whether graphics exposures are enabled.
line_width
- the line width.
line_style
- the way dashed lines are drawn.
cap_style
- the way the ends of lines are drawn.
join_style
- the way joins between lines are drawn.
Convenient Construction
gdkGC
is the equivalent of gdkGCNew
.Enums and Flags
GdkGCValuesMask
-
A set of bit flags used to indicate which fields
GdkGCValues
structure are set.
foreground
- the
foreground
is set. background
- the
background
is set. font
- the
font
is set. function
- the
function
is set. fill
- the
fill
is set. tile
- the
tile
is set. stipple
- the
stipple
is set. clip-mask
- the
clip.mask
is set. subwindow
- the
subwindow.mode
is set. ts-x-origin
- the
ts.x.origin
is set. ts-y-origin
- the
ts.y.origin
is set. clip-x-origin
- the
clip.x.origin
is set. clip-y-origin
- the
clip.y.origin
is set. exposures
- the
graphics.exposures
is set. line-width
- the
line.width
is set. line-style
- the
line.style
is set. cap-style
- the
cap.style
is set. join-style
- the
join.style
is set.
GdkFunction
-
Determines how the bit values for the source pixels are combined with
the bit values for destination pixels to produce the final result. The
sixteen values here correspond to the 16 different possible 2x2 truth
tables. Only a couple of these values are usually useful; for colored
images, only
GDK_COPY
, GDK_XOR
and GDK_INVERT
are generally
useful. For bitmaps, GDK_AND
and GDK_OR
are also useful.
copy
dst = src
invert
dst = NOT dst
xor
dst = src XOR dst
clear
dst = 0
and
dst = dst AND src
and-reverse
dst = src AND (NOT dst)
and-invert
dst = (NOT src) AND dst
noop
dst = dst
or
dst = src OR dst
equiv
dst = (NOT src) XOR dst
or-reverse
dst = src OR (NOT dst)
copy-invert
dst = NOT src
or-invert
dst = (NOT src) OR dst
nand
dst = (NOT src) OR (NOT dst)
nor
dst = (NOT src) AND (NOT dst)
set
dst = 1
GdkFill
-
Determines how primitives are drawn.
solid
- draw with the foreground color.
tiled
- draw with a tiled pixmap.
stippled
- draw using the stipple bitmap. Pixels corresponding
to bits in the stipple bitmap that are set will be drawn in the
foreground color; pixels corresponding to bits that are
not set will be left untouched.
opaque-stippled
- draw using the stipple bitmap. Pixels corresponding
to bits in the stipple bitmap that are set will be drawn in the
foreground color; pixels corresponding to bits that are
not set will be drawn with the background color.
GdkSubwindowMode
-
Determines how drawing onto a window will affect child
windows of that window.
clip-by-children
- only draw onto the window itself.
include-inferiors
- draw onto the window and child windows.
GdkLineStyle
-
Determines how lines are drawn.
solid
- lines are drawn solid.
on-off-dash
- even segments are drawn; odd segments are not drawn.
double-dash
- even segments are normally. Odd segments are drawn
in the background color if the fill style is
GDK_SOLID
, or in the background
color masked by the stipple if the fill style is GDK_STIPPLED
.
GdkCapStyle
-
Determines how the end of lines are drawn.
not-last
- the same as
GDK_CAP_BUTT
for lines of non-zero width.
for zero width lines, the final point on the line will not be drawn. butt
- the ends of the lines are drawn squared off and extending
to the coordinates of the end point.
round
- the ends of the lines are drawn as semicircles with the
diameter equal to the line width and centered at the end point.
projecting
- the ends of the lines are drawn squared off and extending
half the width of the line beyond the end point.
GdkJoinStyle
-
Determines how the joins between segments of a polygon are drawn.
miter
- the sides of each line are extended to meet at an angle.
round
- the sides of the two lines are joined by a circular arc.
bevel
- the sides of the two lines are joined by a straight line which
makes an equal angle with each line.