?? gdk-graphics-contexts.html
字號(hào):
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"><title>Graphics Contexts</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="GDK Reference Manual"><link rel="up" href="reference.html" title="API Reference"><link rel="prev" href="gdk-Points-Rectangles-and-Regions.html" title="Points, Rectangles and Regions"><link rel="next" href="gdk-Drawing-Primitives.html" title="Drawing Primitives"><meta name="generator" content="GTK-Doc V1.9 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="reference" href="reference.html" title="API Reference"><link rel="index" href="ix01.html" title="Index"><link rel="index" href="ix02.html" title="Index of deprecated symbols"><link rel="index" href="ix03.html" title="Index of new symbols in 2.2"><link rel="index" href="ix04.html" title="Index of new symbols in 2.4"><link rel="index" href="ix05.html" title="Index of new symbols in 2.6"><link rel="index" href="ix06.html" title="Index of new symbols in 2.8"><link rel="index" href="ix07.html" title="Index of new symbols in 2.10"><link rel="index" href="ix08.html" title="Index of new symbols in 2.12"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="gdk-Points-Rectangles-and-Regions.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">GDK Reference Manual</th><td><a accesskey="n" href="gdk-Drawing-Primitives.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr><tr><td colspan="5" class="shortcuts"><nobr><a href="#id3087432" class="shortcut">Top</a>  |  <a href="#id3088490" class="shortcut">Description</a>  |  <a href="#id3088466" class="shortcut">Object Hierarchy</a></nobr></td></tr></table><div class="refentry" lang="en"><a name="gdk-Graphics-Contexts"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><a name="id3087432"></a><span class="refentrytitle">Graphics Contexts</span></h2><p>Graphics Contexts — Objects to encapsulate drawing properties</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><a name="GdkGC"></a><pre class="synopsis">#include <gdk/gdk.h> <a class="link" href="gdk-Graphics-Contexts.html#GdkGC-struct">GdkGC</a>; <a class="link" href="gdk-Graphics-Contexts.html#GdkGCValues">GdkGCValues</a>;enum <a class="link" href="gdk-Graphics-Contexts.html#GdkGCValuesMask">GdkGCValuesMask</a>;enum <a class="link" href="gdk-Graphics-Contexts.html#GdkFunction">GdkFunction</a>;<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a>* <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-new">gdk_gc_new</a> (<a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable);<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a>* <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-new-with-values">gdk_gc_new_with_values</a> (<a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable, <a class="link" href="gdk-Graphics-Contexts.html#GdkGCValues">GdkGCValues</a> *values, <a class="link" href="gdk-Graphics-Contexts.html#GdkGCValuesMask">GdkGCValuesMask</a> values_mask);<a class="link" href="GdkScreen.html" title="GdkScreen">GdkScreen</a>* <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-get-screen">gdk_gc_get_screen</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc);<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a>* <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-ref">gdk_gc_ref</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc);void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-unref">gdk_gc_unref</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc);#define <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-destroy">gdk_gc_destroy</a>void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-values">gdk_gc_set_values</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, <a class="link" href="gdk-Graphics-Contexts.html#GdkGCValues">GdkGCValues</a> *values, <a class="link" href="gdk-Graphics-Contexts.html#GdkGCValuesMask">GdkGCValuesMask</a> values_mask);void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-get-values">gdk_gc_get_values</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, <a class="link" href="gdk-Graphics-Contexts.html#GdkGCValues">GdkGCValues</a> *values);void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-foreground">gdk_gc_set_foreground</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, const <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color);void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-background">gdk_gc_set_background</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, const <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color);void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-rgb-fg-color">gdk_gc_set_rgb_fg_color</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, const <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color);void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-rgb-bg-color">gdk_gc_set_rgb_bg_color</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, const <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> *color);void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-font">gdk_gc_set_font</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, <a class="link" href="gdk-Fonts.html#GdkFont">GdkFont</a> *font);void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-function">gdk_gc_set_function</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, <a class="link" href="gdk-Graphics-Contexts.html#GdkFunction">GdkFunction</a> function);void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-fill">gdk_gc_set_fill</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, <a class="link" href="gdk-Graphics-Contexts.html#GdkFill">GdkFill</a> fill);enum <a class="link" href="gdk-Graphics-Contexts.html#GdkFill">GdkFill</a>;void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-tile">gdk_gc_set_tile</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, <a class="link" href="gdk-Bitmaps-and-Pixmaps.html#GdkPixmap">GdkPixmap</a> *tile);void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-stipple">gdk_gc_set_stipple</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, <a class="link" href="gdk-Bitmaps-and-Pixmaps.html#GdkPixmap">GdkPixmap</a> *stipple);void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-ts-origin">gdk_gc_set_ts_origin</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> x, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> y);void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-clip-origin">gdk_gc_set_clip_origin</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> x, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> y);void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-clip-mask">gdk_gc_set_clip_mask</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, <a class="link" href="gdk-Bitmaps-and-Pixmaps.html#GdkBitmap">GdkBitmap</a> *mask);void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-clip-rectangle">gdk_gc_set_clip_rectangle</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, <a class="link" href="gdk-Points-Rectangles-and-Regions.html#GdkRectangle">GdkRectangle</a> *rectangle);void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-clip-region">gdk_gc_set_clip_region</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, <a class="link" href="gdk-Points-Rectangles-and-Regions.html#GdkRegion">GdkRegion</a> *region);void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-subwindow">gdk_gc_set_subwindow</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, <a class="link" href="gdk-Graphics-Contexts.html#GdkSubwindowMode">GdkSubwindowMode</a> mode);enum <a class="link" href="gdk-Graphics-Contexts.html#GdkSubwindowMode">GdkSubwindowMode</a>;void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-exposures">gdk_gc_set_exposures</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> exposures);void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-line-attributes">gdk_gc_set_line_attributes</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> line_width, <a class="link" href="gdk-Graphics-Contexts.html#GdkLineStyle">GdkLineStyle</a> line_style, <a class="link" href="gdk-Graphics-Contexts.html#GdkCapStyle">GdkCapStyle</a> cap_style, <a class="link" href="gdk-Graphics-Contexts.html#GdkJoinStyle">GdkJoinStyle</a> join_style);enum <a class="link" href="gdk-Graphics-Contexts.html#GdkLineStyle">GdkLineStyle</a>;enum <a class="link" href="gdk-Graphics-Contexts.html#GdkCapStyle">GdkCapStyle</a>;enum <a class="link" href="gdk-Graphics-Contexts.html#GdkJoinStyle">GdkJoinStyle</a>;void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-dashes">gdk_gc_set_dashes</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> dash_offset, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint8">gint8</a> dash_list[], <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> n);void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-copy">gdk_gc_copy</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *dst_gc, <a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *src_gc);void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-colormap">gdk_gc_set_colormap</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a> *colormap);<a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap">GdkColormap</a>* <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-get-colormap">gdk_gc_get_colormap</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc);void <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-offset">gdk_gc_offset</a> (<a class="link" href="gdk-Graphics-Contexts.html#GdkGC">GdkGC</a> *gc, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> x_offset, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> y_offset);</pre></div><div class="refsect1" lang="en"><a name="id3088466"></a><h2>Object Hierarchy</h2><pre class="synopsis"> <ahref="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a> +----GdkGC</pre></div><div class="refsect1" lang="en"><a name="id3088490"></a><h2>Description</h2><p>All drawing operations in GDK take a <em class="firstterm">graphics context</em> (GC) argument. A graphics context encapsulates information aboutthe way things are drawn, such as the foregroundcolor or line width. By using graphics contexts, the number of arguments to each drawing call isgreatly reduced, and communication overhead isminimized, since identical arguments do not needto be passed repeatedly.</p><p>Most values of a graphics context can be set atcreation time by using <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-new-with-values"><code class="function">gdk_gc_new_with_values()</code></a>,or can be set one-by-one using functions suchas <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-set-foreground"><code class="function">gdk_gc_set_foreground()</code></a>. A few of the valuesin the GC, such as the dash pattern, can onlybe set by the latter method.</p></div><div class="refsect1" lang="en"><a name="id3088544"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3088554"></a><h3><a name="GdkGC-struct"></a>GdkGC</h3><a class="indexterm" name="id3088567"></a><pre class="programlisting">typedef struct _GdkGC GdkGC;</pre><p>The <a class="link" href="gdk-Graphics-Contexts.html#GdkGC"><span class="type">GdkGC</span></a> structure represents a graphics context.It is an opaque structure with no user-visibleelements.</p></div><hr><div class="refsect2" lang="en"><a name="id3088591"></a><h3><a name="GdkGCValues"></a>GdkGCValues</h3><a class="indexterm" name="id3088604"></a><pre class="programlisting">typedef struct { GdkColor foreground; GdkColor background; GdkFont *font; GdkFunction function; GdkFill fill; GdkPixmap *tile; GdkPixmap *stipple; GdkPixmap *clip_mask; GdkSubwindowMode subwindow_mode; gint ts_x_origin; gint ts_y_origin; gint clip_x_origin; gint clip_y_origin; gint graphics_exposures; gint line_width; GdkLineStyle line_style; GdkCapStyle cap_style; GdkJoinStyle join_style;} GdkGCValues;</pre><p>The <a class="link" href="gdk-Graphics-Contexts.html#GdkGCValues"><span class="type">GdkGCValues</span></a> structure holds a set of values usedto create or modify a graphics context.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> <em class="structfield"><code>foreground</code></em>;</span></p></td><td>the foreground color. Note that <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-get-values"><code class="function">gdk_gc_get_values()</code></a> only sets the pixel value.</td></tr><tr><td><p><span class="term"><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor">GdkColor</a> <em class="structfield"><code>background</code></em>;</span></p></td><td>the background color. Note that <a class="link" href="gdk-Graphics-Contexts.html#gdk-gc-get-values"><code class="function">gdk_gc_get_values()</code></a> only sets the pixel value.</td></tr><tr><td><p><span class="term"><a class="link" href="gdk-Fonts.html#GdkFont">GdkFont</a> *<em class="structfield"><code>font</code></em>;</span></p></td><td>the default font.</td></tr><tr><td><p><span class="term"><a class="link" href="gdk-Graphics-Contexts.html#GdkFunction">GdkFunction</a> <em class="structfield"><code>function</code></em>;</span></p></td><td>the bitwise operation used when drawing.</td></tr><tr><td><p><span class="term"><a class="link" href="gdk-Graphics-Contexts.html#GdkFill">GdkFill</a> <em class="structfield"><code>fill</code></em>;</span></p></td><td>the fill style.</td></tr><tr><td><p><span class="term"><a class="link" href="gdk-Bitmaps-and-Pixmaps.html#GdkPixmap">GdkPixmap</a> *<em class="structfield"><code>tile</code></em>;</span></p></td><td>the tile pixmap.</td></tr><tr><td><p><span class="term"><a class="link" href="gdk-Bitmaps-and-Pixmaps.html#GdkPixmap">GdkPixmap</a> *<em class="structfield"><code>stipple</code></em>;</span></p></td><td>the stipple bitmap.</td></tr><tr><td><p><span class="term"><a class="link" href="gdk-Bitmaps-and-Pixmaps.html#GdkPixmap">GdkPixmap</a> *<em class="structfield"><code>clip_mask</code></em>;</span></p></td><td>the clip mask bitmap.</td></tr><tr><td><p><span class="term"><a class="link" href="gdk-Graphics-Contexts.html#GdkSubwindowMode">GdkSubwindowMode</a> <em class="structfield"><code>subwindow_mode</code></em>;</span></p></td><td>the subwindow mode.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> <em class="structfield"><code>ts_x_origin</code></em>;</span></p></td><td>the x origin of the tile or stipple.</td></tr><tr><td><p><span class="term"><a
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -