1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Drawing Pixels</title><meta name="generator" content="DocBook XSL Stylesheets V1.64.1"><link rel="home" href="index.html" title="Programming with gtkmm2"><link rel="up" href="ch14.html" title="Chapter14.The Drawing Area Widget"><link rel="previous" href="ch14.html" title="Chapter14.The Drawing Area Widget"><link rel="next" href="ch14s03.html" title="Drawing Lines"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Drawing Pixels</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch14.html">Prev</a></td><th width="60%" align="center">Chapter14.The Drawing Area Widget</th><td width="20%" align="right"><a accesskey="n" href="ch14s03.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2515856"></a>Drawing Pixels</h2></div></div><div></div></div><p>
You can draw individual pixels with the two methods <tt class="function">Gdk::Drawable::draw_point()</tt> and <tt class="function">
Gdk::Drawable::draw_points()</tt>. All drawing methods take a <tt class="classname">Gdk::GC</tt> as their first
argument, except where noted. The other two arguments to <tt class="function">draw_point()</tt> are the x coordinate
(horizontal position relative to the left edge of the widget, starting at 0), and the y coordinate (vertical position
relative to the top of the widget, starting at 0). <tt class="function">draw_points()</tt> takes two arguments, the
<tt class="classname">Gdk::GC</tt> and a collection of <tt class="classname">Gdk::Points</tt>. The second argument can be any kind
of standard container, such as a <tt class="classname">std::vector<Gdk::Point></tt>. So for example
<tt class="function">draw_point()</tt> could be used like this:
</p><pre class="programlisting">get_window()->draw_point(some_gc, 20, 20);</pre><p>
But <tt class="function">draw_points()</tt> is a bit more complicated and might be used like this:
</p><pre class="programlisting">
std::vector<Gdk::Point> points_array;
points_array.push_back(Gdk::Point(10, 10));
points_array.push_back(Gdk::Point(20, 20));
draw_points(some_gc, points_array); //One way to draw the two points.
</pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch14.html">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="ch14.html">Up</a></td><td width="40%" align="right"><a accesskey="n" href="ch14s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter14.The Drawing Area Widget</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">Drawing Lines</td></tr></table></div></body></html>
|