]> Pileus Git - ~andy/gtk/commitdiff
Some updates for the drawing section. (#161414, Robert Ancell)
authorMatthias Clasen <mclasen@redhat.com>
Mon, 3 Jan 2005 19:16:20 +0000 (19:16 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Mon, 3 Jan 2005 19:16:20 +0000 (19:16 +0000)
2005-01-03  Matthias Clasen  <mclasen@redhat.com>

* docs/tutorial/gtk-tut.sgml: Some updates for the drawing
section.  (#161414, Robert Ancell)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-6
ChangeLog.pre-2-8
docs/tutorial/gtk-tut.sgml

index 28a555ed090ed57452c8850711936ae155d18582..b596c901f5a6a89f243521bcff2f1cd11afcc38b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2005-01-03  Matthias Clasen  <mclasen@redhat.com>
 
+       * docs/tutorial/gtk-tut.sgml: Some updates for the drawing
+       section.  (#161414, Robert Ancell)
+
        * docs/tutorial/gtk-tut.sgml: Make it build.
 
        * gtk/gtkdialog.c (gtk_dialog_run): Some clarification
index 28a555ed090ed57452c8850711936ae155d18582..b596c901f5a6a89f243521bcff2f1cd11afcc38b 100644 (file)
@@ -1,5 +1,8 @@
 2005-01-03  Matthias Clasen  <mclasen@redhat.com>
 
+       * docs/tutorial/gtk-tut.sgml: Some updates for the drawing
+       section.  (#161414, Robert Ancell)
+
        * docs/tutorial/gtk-tut.sgml: Make it build.
 
        * gtk/gtkdialog.c (gtk_dialog_run): Some clarification
index 28a555ed090ed57452c8850711936ae155d18582..b596c901f5a6a89f243521bcff2f1cd11afcc38b 100644 (file)
@@ -1,5 +1,8 @@
 2005-01-03  Matthias Clasen  <mclasen@redhat.com>
 
+       * docs/tutorial/gtk-tut.sgml: Some updates for the drawing
+       section.  (#161414, Robert Ancell)
+
        * docs/tutorial/gtk-tut.sgml: Make it build.
 
        * gtk/gtkdialog.c (gtk_dialog_run): Some clarification
index 28a555ed090ed57452c8850711936ae155d18582..b596c901f5a6a89f243521bcff2f1cd11afcc38b 100644 (file)
@@ -1,5 +1,8 @@
 2005-01-03  Matthias Clasen  <mclasen@redhat.com>
 
+       * docs/tutorial/gtk-tut.sgml: Some updates for the drawing
+       section.  (#161414, Robert Ancell)
+
        * docs/tutorial/gtk-tut.sgml: Make it build.
 
        * gtk/gtkdialog.c (gtk_dialog_run): Some clarification
index 8ee241f2fceb222b78aa1f297a51438723079a65..6caf78ab575bf7f36b49830a95c94d8c84c03978 100755 (executable)
@@ -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,