⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sec-gc.html

📁 gtk_text program sample&eg
💻 HTML
📖 第 1 页 / 共 3 页
字号:
      </p>      <p>        The <span class="STRUCTNAME">line_style</span> field can        have one of three values:      </p>      <ul>        <li>          <p>            <span class="STRUCTNAME">GDK_LINE_SOLID</span> is the            default; a solid line.&#13;          </p>        </li>        <li>          <p>            <span class="STRUCTNAME">GDK_LINE_ON_OFF_DASH</span>            draws a dashed line with the foreground color, leaving            the "off" parts of the dash blank.&#13;          </p>        </li>        <li>          <p>            <span class="STRUCTNAME">GDK_LINE_DOUBLE_DASH</span>            draws a dashed line in the foreground color, but the            "off" parts of the dash are drawn in the background            color.&#13;          </p>        </li>      </ul>      <p>        Dashes are specified with <tt class="FUNCTION">        gdk_gc_set_dashes()</tt>; <span class="STRUCTNAME">        GdkGCValues</span> does not include a field for this. <tt        class="FUNCTION">gdk_gc_set_dashes()</tt> accepts three        arguments:      </p>      <ul>        <li>          <p>            <span class="STRUCTNAME">dash_list</span> is an array            of dash lengths. Even-indexed lengths are "on" dashes;            these are drawn in the foreground color. Odd-indexed            lengths are "off" dashes; they are not drawn or drawn            in the background color, depending on <span class=             "STRUCTNAME">line_style</span>. 0 is not a permitted            value; all lengths must be positive.&#13;          </p>        </li>        <li>          <p>            <span class="STRUCTNAME">dash_offset</span> is the            index of the first pixel to use in the dash list. That            is, if the dash list specifies 5 pixels "on" and 5            "off", and the offset is 3, the line will begin in the            middle of the "on" dash.&#13;          </p>        </li>        <li>          <p>            <span class="STRUCTNAME">n</span> is simply the number            of elements in <span class="STRUCTNAME">            dash_list</span>.&#13;          </p>        </li>      </ul>      <p>        You might set a whimsical dash pattern this way, for        example:      </p>      <table border="0" bgcolor="#E0E0E0" width="100%">        <tr>          <td><pre class="PROGRAMLISTING">&#13;  gchar dash_list[] = { 5, 5, 3, 3, 1, 1, 3, 3 };  gdk_gc_set_dashes(gc, 0, dash_list, sizeof(dash_list));&#13;</pre>          </td>        </tr>      </table>      <p>        The default dash list is <span class="STRUCTNAME">{4,        4}</span> with an offset of 0.      </p>      <p>        <a href="sec-gc.html#FIG-DASHRAW">Figure 13</a> shows some        dashed lines drawn with <span class="STRUCTNAME">        GDK_LINE_DOUBLE_DASH</span>. The graphics context's        foreground color is black, and its background color is a        light gray. The first five lines are the default <span        class="STRUCTNAME">{4, 4}</span> dash pattern with offsets        of 0, 1, 2, 3, and 4. Remember that 0 is the default. <a        href="sec-gc.html#FIG-DASHES-DEFAULT">Figure 14</a> shows a        magnified view of these five lines. The last line is the        whimsical dash pattern mentioned above; it's shown        magnified in <a href="sec-gc.html#FIG-DASHES-WHIMSICAL">        Figure 15</a>.      </p>      <div class="FIGURE">        <a name="FIG-DASHRAW"></a>        <p>          <img src="figures/dashes-raw.png">        </p>        <p>          <b>Figure 13. Five dashed lines, with <span class=           "STRUCTNAME">GDK_LINE_DOUBLE_DASH</span></b>        </p>      </div>      <div class="FIGURE">        <a name="FIG-DASHES-DEFAULT"></a>        <p>          <img src="figures/dashes-default.png">        </p>        <p>          <b>Figure 14. Default dash pattern, with varied          offsets</b>        </p>      </div>      <div class="FIGURE">        <a name="FIG-DASHES-WHIMSICAL"></a>        <p>          <img src="figures/dashes-whimsical.png">        </p>        <p>          <b>Figure 15. A complex dash pattern</b>        </p>      </div>      <p>        <span class="STRUCTNAME">cap_style</span> determines how X        draws line endpoints (or dash endpoints, if a line is        dashed). It has four possible values:      </p>      <ul>        <li>          <p>            <span class="STRUCTNAME">GDK_CAP_BUTT</span> is the            default; it means that lines have square ends (as you            might expect). &#13;          </p>        </li>        <li>          <p>            <span class="STRUCTNAME">GDK_CAP_NOT_LAST</span>            specifies that the last pixel is skipped for one-pixel            lines. It is otherwise the same as <span class=             "STRUCTNAME">GDK_CAP_BUTT</span>.&#13;          </p>        </li>        <li>          <p>            <span class="STRUCTNAME">GDK_CAP_ROUND</span> draws a            small arc on the end of the line, extending beyond the            line's endpoint. The center of the arc is on the            endpoint, and the radius of the arc is one-half the            width of the line. For one-pixel lines, it has no            effect (since there is no way to draw a one-pixel-wide            arc).&#13;          </p>        </li>        <li>          <p>            <span class="STRUCTNAME">GDK_CAP_PROJECTING</span>            extends the line past its endpoint by one-half its            width. It has no effect on one-pixel lines.&#13;          </p>        </li>      </ul>      <p>        The <span class="STRUCTNAME">join_style</span> parameter        affects how lines are connected to one another, when        drawing a polygon or drawing multiple lines in one function        call. If you think of lines as long, thin rectangles, it is        clear that they do not connect smoothly; there is a "notch"        where the two endpoints come together. The three join        styles fill in this notch:      </p>      <ul>        <li>          <p>            <span class="STRUCTNAME">GDK_JOIN_MITER</span> is the            default; it draws a sharp angle where the lines            intersect.&#13;          </p>        </li>        <li>          <p>            <span class="STRUCTNAME">GDK_JOIN_ROUND</span> creates            rounded corners by drawing an arc in the notch.&#13;          </p>        </li>        <li>          <p>            <span class="STRUCTNAME">GDK_JOIN_BEVEL</span> creates            a flat corner, filling the notch with the smallest            possible shape.&#13;          </p>        </li>      </ul>      <div class="FIGURE">        <a name="FL-GDKGC"></a>        <div class="FUNCSYNOPSIS">          <a name="FL-GDKGC.SYNOPSIS"></a>          <table border="0" bgcolor="#E0E0E0" width="100%">            <tr>              <td><pre class="FUNCSYNOPSISINFO">#include &lt;gdk/gdk.h&gt;</pre>              </td>            </tr>          </table>          <p>            <code><code class="FUNCDEF">GdkGC* <tt class=            "FUNCTION">gdk_gc_new</tt></code>(GdkWindow* <tt class=             "PARAMETER"><i>window</i></tt>);</code>          </p>          <p>            <code><code class="FUNCDEF">GdkGC* <tt class=            "FUNCTION">            gdk_gc_new_with_values</tt></code>(GdkWindow* <tt            class="PARAMETER"><i>window</i></tt>, GdkGCValues* <tt            class="PARAMETER"><i>values</i></tt>, GdkGCValuesMask            <tt class="PARAMETER"><i>values_mask</i></tt>);</code>          </p>          <p>            <code><code class="FUNCDEF">void <tt class="FUNCTION">            gdk_gc_set_dashes</tt></code>(GdkGC* <tt class=             "PARAMETER"><i>gc</i></tt>, gint <tt class="PARAMETER">            <i>dash_offset</i></tt>, gchar <tt class="PARAMETER">            <i>dash_list</i></tt>, gint <tt class="PARAMETER"><i>            n</i></tt>);</code>          </p>          <p>            <code><code class="FUNCDEF">void <tt class="FUNCTION">            gdk_gc_unref</tt></code>(GdkGC* <tt class="PARAMETER">            <i>gc</i></tt>);</code>          </p>        </div>        <p>          <b>Figure 16. <span class="STRUCTNAME">GdkGC</span></b>        </p>      </div>      <div class="TABLE">        <a name="TAB-GDKGC"></a>        <p>          <b>Table 6. GC Attributes</b>        </p>        <table border="1" bgcolor="#E0E0E0" cellspacing="0"        cellpadding="4" class="CALSTABLE">          <tr>            <th align="LEFT" valign="TOP">              Attribute            </th>            <th align="LEFT" valign="TOP">              <span class="STRUCTNAME">GdkGCValuesMask</span>            </th>            <th align="LEFT" valign="TOP">              Modifying Function            </th>            <th align="LEFT" valign="TOP">              Default Value            </th>          </tr>          <tr>            <td align="LEFT" valign="TOP">              GdkColor foreground            </td>            <td align="LEFT" valign="TOP">              <span class="STRUCTNAME">GDK_GC_FOREGROUND</span>            </td>            <td align="LEFT" valign="TOP">              <tt class="FUNCTION">gdk_gc_set_foreground()</tt>            </td>            <td align="LEFT" valign="TOP">              black            </td>          </tr>          <tr>            <td align="LEFT" valign="TOP">              GdkColor background            </td>            <td align="LEFT" valign="TOP">              <span class="STRUCTNAME">GDK_GC_BACKGROUND</span>            </td>            <td align="LEFT" valign="TOP">              <tt class="FUNCTION">gdk_gc_set_background()</tt>            </td>            <td align="LEFT" valign="TOP">              white            </td>          </tr>          <tr>            <td align="LEFT" valign="TOP">              GdkFont *font

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -