Graphics Contexts
Objects to encapsulate drawing properties
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 gdk_gc_new_with_values(),
or can be set one-by-one using functions such
as gdk_gc_set_foreground(). A few of the values
in the GC, such as the dash pattern, can only
be set by the latter method.
The #GdkGC structure represents a graphics context.
It is an opaque structure with no user-visible
elements.
The #GdkGCValues structure holds a set of values used
to create or modify a graphics context.
@foreground: the foreground color. Note that gdk_gc_get_values()
only sets the pixel value.
@background: the background color. Note that gdk_gc_get_values()
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.
A set of bit flags used to indicate which fields
#GdkGCValues structure are set.
@GDK_GC_FOREGROUND: the @foreground is set.
@GDK_GC_BACKGROUND: the @background is set.
@GDK_GC_FONT: the @font is set.
@GDK_GC_FUNCTION: the @function is set.
@GDK_GC_FILL: the @fill is set.
@GDK_GC_TILE: the @tile is set.
@GDK_GC_STIPPLE: the @stipple is set.
@GDK_GC_CLIP_MASK: the @clip_mask is set.
@GDK_GC_SUBWINDOW: the @subwindow_mode is set.
@GDK_GC_TS_X_ORIGIN: the @ts_x_origin is set.
@GDK_GC_TS_Y_ORIGIN: the @ts_y_origin is set.
@GDK_GC_CLIP_X_ORIGIN: the @clip_x_origin is set.
@GDK_GC_CLIP_Y_ORIGIN: the @clip_y_origin is set.
@GDK_GC_EXPOSURES: the @graphics_exposures is set.
@GDK_GC_LINE_WIDTH: the @line_width is set.
@GDK_GC_LINE_STYLE: the @line_style is set.
@GDK_GC_CAP_STYLE: the @cap_style is set.
@GDK_GC_JOIN_STYLE: the @join_style is set.
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.
@GDK_COPY: dst = src
@GDK_INVERT: dst = NOT dst
@GDK_XOR: dst = src XOR dst
@GDK_CLEAR: dst = 0
@GDK_AND: dst = dst AND src
@GDK_AND_REVERSE: dst = src AND (NOT dst)
@GDK_AND_INVERT: dst = (NOT src) AND dst
@GDK_NOOP: dst = dst
@GDK_OR: dst = src OR dst
@GDK_EQUIV: dst = (NOT src) XOR dst
@GDK_OR_REVERSE: dst = src OR (NOT dst)
@GDK_COPY_INVERT: dst = NOT src
@GDK_OR_INVERT: dst = (NOT src) OR dst
@GDK_NAND: dst = (NOT src) OR (NOT dst)
@GDK_NOR: dst = (NOT src) AND (NOT dst)
@GDK_SET: dst = 1
@drawable:
@Returns:
@drawable:
@values:
@values_mask:
@Returns:
@gc:
@Returns:
@gc:
@Returns:
@gc:
This function is obsolete and should not be used.
@Deprecated: Use g_object_unref() instead
@gc: a #GdkGC.
@gc:
@values:
@values_mask:
@gc:
@values:
@gc:
@color:
@gc:
@color:
@gc:
@color:
@gc:
@color:
@gc:
@font:
@gc:
@function:
@gc:
@fill:
Determines how primitives are drawn.
@GDK_SOLID: draw with the foreground color.
@GDK_TILED: draw with a tiled pixmap.
@GDK_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.
@GDK_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.
@gc:
@tile:
@gc:
@stipple:
@gc:
@x:
@y:
@gc:
@x:
@y:
@gc:
@mask:
@gc:
@rectangle:
@gc:
@region:
@gc:
@mode:
Determines how drawing onto a window will affect child
windows of that window.
@GDK_CLIP_BY_CHILDREN: only draw onto the window itself.
@GDK_INCLUDE_INFERIORS: draw onto the window and child windows.
@gc:
@exposures:
@gc:
@line_width:
@line_style:
@cap_style:
@join_style:
Determines how lines are drawn.
@GDK_LINE_SOLID: lines are drawn solid.
@GDK_LINE_ON_OFF_DASH: even segments are drawn; odd segments are not drawn.
@GDK_LINE_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.
Determines how the end of lines are drawn.
@GDK_CAP_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.
@GDK_CAP_BUTT: the ends of the lines are drawn squared off and extending
to the coordinates of the end point.
@GDK_CAP_ROUND: the ends of the lines are drawn as semicircles with the
diameter equal to the line width and centered at the end point.
@GDK_CAP_PROJECTING: the ends of the lines are drawn squared off and extending
half the width of the line beyond the end point.
Determines how the joins between segments of a polygon are drawn.
@GDK_JOIN_MITER: the sides of each line are extended to meet at an angle.
@GDK_JOIN_ROUND: the sides of the two lines are joined by a circular arc.
@GDK_JOIN_BEVEL: the sides of the two lines are joined by a straight line which
makes an equal angle with each line.
@gc:
@dash_offset:
@dash_list:
@n:
@dst_gc:
@src_gc:
@gc:
@colormap:
@gc:
@Returns:
@gc:
@x_offset:
@y_offset: