Add:Core:Initial support for setting stipple for areas
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Tue, 24 Mar 2009 15:36:04 +0000 (15:36 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Tue, 24 Mar 2009 15:36:04 +0000 (15:36 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit@2170 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/graphics.c
navit/graphics.h
navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c

index fc83291..972c079 100644 (file)
@@ -310,6 +310,19 @@ void graphics_gc_set_background(struct graphics_gc *gc, struct color *c)
        gc->meth.gc_set_background(gc->priv, c);
 }
 
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_gc_set_stipple(struct graphics_gc *gc, struct graphics_image *img) 
+{
+       gc->meth.gc_set_stipple(gc->priv, img ? img->priv : NULL);
+}
+
+
 /**
  * FIXME
  * @param <>
index a7793ba..300c72d 100644 (file)
@@ -86,6 +86,7 @@ struct graphics_gc_methods {
        void (*gc_set_dashes)(struct graphics_gc_priv *gc, int width, int offset, unsigned char dash_list[], int n);
        void (*gc_set_foreground)(struct graphics_gc_priv *gc, struct color *c);
        void (*gc_set_background)(struct graphics_gc_priv *gc, struct color *c);
+       void (*gc_set_stipple)(struct graphics_gc_priv *gc, struct graphics_image_priv *img);
 };
 
 struct graphics_gc {
index 6e3d10f..628ff27 100644 (file)
@@ -88,6 +88,7 @@ struct graphics_priv {
 
 struct graphics_gc_priv {
        GdkGC *gc;
+       GdkPixmap *pixmap;
        struct graphics_priv *gr;
        int level;
        unsigned char r,g,b,a;
@@ -157,12 +158,22 @@ gc_set_background(struct graphics_gc_priv *gc, struct color *c)
        gc_set_color(gc, c, 0);
 }
 
+static void
+gc_set_stipple(struct graphics_gc_priv *gc, struct graphics_image *img)
+{
+       char data[2]={0x2,0x1};
+       gdk_gc_set_fill(gc->gc, GDK_STIPPLED);
+       gc->pixmap=gdk_bitmap_create_from_data(gc->gr->widget->window, data, 2, 2);
+       gdk_gc_set_stipple(gc->gc, gc->pixmap);
+}
+
 static struct graphics_gc_methods gc_methods = {
        gc_destroy,
        gc_set_linewidth,
        gc_set_dashes,
        gc_set_foreground,
-       gc_set_background
+       gc_set_background,
+       gc_set_stipple,
 };
 
 static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth)
@@ -176,6 +187,7 @@ static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics
 }
 
 
+
 static struct graphics_image_priv *
 image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, struct point *hot, int rotation)
 {