summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2005-01-03 19:16:20 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2005-01-03 19:16:20 +0000
commit6803d93d38eb7f1cf09b89eeaf0cb414ab001d15 (patch)
treebf80961b53a51ca84d2099fdeceed225e82bc2a0 /docs
parent600e5b47219b21ec64c4fef1a88feca03b86aa29 (diff)
downloadgdk-pixbuf-6803d93d38eb7f1cf09b89eeaf0cb414ab001d15.tar.gz
Some updates for the drawing section. (#161414, Robert Ancell)
2005-01-03 Matthias Clasen <mclasen@redhat.com> * docs/tutorial/gtk-tut.sgml: Some updates for the drawing section. (#161414, Robert Ancell)
Diffstat (limited to 'docs')
-rwxr-xr-xdocs/tutorial/gtk-tut.sgml56
1 files changed, 35 insertions, 21 deletions
diff --git a/docs/tutorial/gtk-tut.sgml b/docs/tutorial/gtk-tut.sgml
index 8ee241f2f..6caf78ab5 100755
--- a/docs/tutorial/gtk-tut.sgml
+++ b/docs/tutorial/gtk-tut.sgml
@@ -12772,7 +12772,7 @@ static gboolean
configure_event( GtkWidget *widget, GdkEventConfigure *event )
{
if (pixmap)
- gdk_pixmap_unref(pixmap);
+ g_object_unref(pixmap);
pixmap = gdk_pixmap_new(widget->window,
widget->allocation.width,
@@ -12801,12 +12801,12 @@ to redraw by using the event->area field of the exposure event):</para>
static gboolean
expose_event( GtkWidget *widget, GdkEventExpose *event )
{
- gdk_draw_pixmap(widget->window,
- widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
- pixmap,
- event->area.x, event->area.y,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
+ gdk_draw_drawable(widget->window,
+ widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+ pixmap,
+ event->area.x, event->area.y,
+ event->area.x, event->area.y,
+ event->area.width, event->area.height);
return FALSE;
}
@@ -12818,28 +12818,36 @@ large number of calls in GTK's GDK library for drawing on
<emphasis>drawables</emphasis>. A drawable is simply something that can be drawn
upon. It can be a window, a pixmap, or a bitmap (a black and white
image). We've already seen two such calls above,
-<literal>gdk_draw_rectangle()</literal> and <literal>gdk_draw_pixmap()</literal>. The
+<literal>gdk_draw_rectangle()</literal> and <literal>gdk_draw_drawable()</literal>. The
complete list is:</para>
<programlisting role="C">
+gdk_draw_point ()
gdk_draw_line ()
gdk_draw_rectangle ()
gdk_draw_arc ()
gdk_draw_polygon ()
-gdk_draw_string ()
-gdk_draw_text ()
gdk_draw_pixmap ()
gdk_draw_bitmap ()
gdk_draw_image ()
gdk_draw_points ()
gdk_draw_segments ()
+gdk_draw_lines ()
+gdk_draw_pixbuf ()
+gdk_draw_glyphs ()
+gdk_draw_layout_line ()
+gdk_draw_layout ()
+gdk_draw_layout_line_with_colors ()
+gdk_draw_layout_with_colors ()
+gdk_draw_glyphs_transformed ()
+gdk_draw_glyphs_trapezoids ()
</programlisting>
<para>See the reference documentation or the header file
-<literal>&lt;gdk/gdk.h&gt;</literal> for further details on these functions.
+<literal>&lt;gdk/gdkdrawable.h&gt;</literal> for further details on these functions.
These functions all share the same first two arguments. The first
argument is the drawable to draw upon, the second argument is a
-<emphasis>graphics context</emphasis> (GC). </para>
+<emphasis>graphics context</emphasis> (GC).</para>
<para>A graphics context encapsulates information about things such as
foreground and background color and line width. GDK has a full set of
@@ -12887,11 +12895,13 @@ draw_brush (GtkWidget *widget, gdouble x, gdouble y)
update_rect.width = 10;
update_rect.height = 10;
gdk_draw_rectangle (pixmap,
- widget->style->black_gc,
- TRUE,
+ widget->style->black_gc,
+ TRUE,
update_rect.x, update_rect.y,
update_rect.width, update_rect.height);
- gtk_widget_draw (widget, &amp;update_rect);
+ gtk_widget_queue_draw_area (widget,
+ update_rect.x, update_rect.y,
+ update_rect.width, update_rect.height);
}
</programlisting>
@@ -12899,14 +12909,18 @@ draw_brush (GtkWidget *widget, gdouble x, gdouble y)
we call the function:</para>
<programlisting role="C">
-void gtk_widget_draw (GtkWidget *widget,
- GdkRectangle *area);
+void gtk_widget_queue_draw_area (GtkWidget *widget,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
</programlisting>
-<para>which notifies X that the area given by the <literal>area</literal> parameter
+<para>which notifies X that the area given by the <literal>x</literal>,
+<literal>y</literal>, <literal>width</literal> and <literal>height</literal> parameters
needs to be updated. X will eventually generate an expose event
(possibly combining the areas passed in several calls to
-<literal>gtk_widget_draw()</literal>) which will cause our expose event handler
+<literal>gtk_widget_queue_draw_area()</literal>) which will cause our expose event handler
to copy the relevant portions to the screen.</para>
<para>We have now covered the entire drawing program except for a few
@@ -15743,8 +15757,8 @@ static void draw_brush( GtkWidget *widget,
update_rect.x, update_rect.y,
update_rect.width, update_rect.height);
gtk_widget_queue_draw_area (widget,
- update_rect.x, update_rect.y,
- update_rect.width, update_rect.height);
+ update_rect.x, update_rect.y,
+ update_rect.width, update_rect.height);
}
static gboolean button_press_event( GtkWidget *widget,