canvas dither support - round 3



> I guess with these changes I will not have any objections to the
> patch.  Can you please mail the next revision to gnome-hackers just so
> I can take the final look?

Ok, your changes are incorporated. Below are new patches for the two
files they affected, gnome-canvas.[ch].

-ME

---


Index: gnome-canvas.c
===================================================================
RCS file: /cvs/gnome/gnome-libs/libgnomeui/gnome-canvas.c,v
retrieving revision 1.93.4.13
diff -p -u -r1.93.4.13 gnome-canvas.c
--- gnome-canvas.c	2000/06/29 04:20:38	1.93.4.13
+++ gnome-canvas.c	2000/11/28 18:43:01
@@ -2300,6 +2300,8 @@ gnome_canvas_init (GnomeCanvas *canvas)
 	canvas->pick_event.crossing.x = 0;
 	canvas->pick_event.crossing.y = 0;
 
+	canvas->dither = GDK_RGB_DITHER_NORMAL;
+
 	gtk_layout_set_hadjustment (GTK_LAYOUT (canvas), NULL);
 	gtk_layout_set_vadjustment (GTK_LAYOUT (canvas), NULL);
 
@@ -3272,7 +3274,7 @@ paint (GnomeCanvas *canvas)
 							    (draw_y1 - DISPLAY_Y1 (canvas)
 							     + canvas->zoom_yofs),
 							    width, height,
-							    GDK_RGB_DITHER_NONE,
+							    canvas->dither,
 							    buf.buf,
 							    IMAGE_WIDTH_AA * 3);
 				}
@@ -4136,4 +4138,39 @@ gnome_canvas_set_stipple_origin (GnomeCa
 	g_return_if_fail (gc != NULL);
 
 	gdk_gc_set_ts_origin (gc, -canvas->draw_xofs, -canvas->draw_yofs);
+}
+
+/**
+ * gnome_canvas_set_dither:
+ * @canvas: A canvas.
+ * @dither: Type of dither used to render an antialiased canvas.
+ *
+ * Controls dithered rendering for antialiased canvases. The value of
dither
+ * should be; #GDK_RGB_DITHER_NONE, #GDK_RGB_DITHER_NORMAL, or
+ * #GDK_RGB_DITHER_MAX. The default canvas setting is
#GDK_RGB_DITHER_NORMAL.
+ **/
+void
+gnome_canvas_set_dither (GnomeCanvas *canvas, GdkRgbDither dither)
+{
+	g_return_if_fail (canvas != NULL);
+	g_return_if_fail (GNOME_IS_CANVAS (canvas));
+
+	canvas->dither = dither;
+}
+
+/**
+ * gnome_canvas_get_dither:
+ * @canvas: A canvas.
+ *
+ * Returns the type of dithering used to render an antialiased canvas.
+ * 
+ * Return value: The dither setting.
+ **/
+GdkRgbDither
+gnome_canvas_get_dither (GnomeCanvas *canvas)
+{
+	g_return_val_if_fail (canvas != NULL, GDK_RGB_DITHER_NONE);
+	g_return_val_if_fail (GNOME_IS_CANVAS (canvas), GDK_RGB_DITHER_NONE);
+
+	return canvas->dither;
 }


Index: gnome-canvas.h
===================================================================
RCS file: /cvs/gnome/gnome-libs/libgnomeui/gnome-canvas.h,v
retrieving revision 1.47.4.2
diff -p -u -r1.47.4.2 gnome-canvas.h
--- gnome-canvas.h	2000/06/29 04:20:38	1.47.4.2
+++ gnome-canvas.h	2000/11/28 18:43:09
@@ -465,6 +465,7 @@ struct _GnomeCanvas {
 	/* GC for temporary draw pixmap */
 	GdkGC *pixmap_gc;
 
+
 	/* Whether items need update at next idle loop iteration */
 	unsigned int need_update : 1;
 
@@ -482,6 +483,9 @@ struct _GnomeCanvas {
 
 	/* Whether the canvas is in antialiased mode or not */
 	unsigned int aa : 1;
+
+	/* dither mode for aa drawing */
+	unsigned int dither : 2;
 };
 
 struct _GnomeCanvasClass {
@@ -594,6 +598,15 @@ gulong gnome_canvas_get_color_pixel (Gno
  */
 void gnome_canvas_set_stipple_origin (GnomeCanvas *canvas, GdkGC *gc);
 
+/* Controls the dithering used when the canvase renders.
+ * Only applicable to antialiased canvases - ignored by non-antialiased
canvases.
+ */
+void gnome_canvas_set_dither (GnomeCanvas *canvas, GdkRgbDither
dither);
+
+/* Returns the dither mode of an antialiased canvas.
+ * Only applicable to antialiased canvases - ignored by non-antialiased
canvases.
+ */
+GdkRgbDither gnome_canvas_get_dither (GnomeCanvas *canvas);
 
 END_GNOME_DECLS

_______________________________________________
gnome-hackers mailing list
gnome-hackers gnome org
http://mail.gnome.org/mailman/listinfo/gnome-hackers




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]