static void cdstipple(cdCtxCanvas *ctxcanvas, int n, int m, const unsigned char *stipple) { (void)stipple; (void)m; (void)n; cdinteriorstyle(ctxcanvas, CD_SOLID); }
static int cdbackopacity(cdCtxCanvas *ctxcanvas, int opaque) { ctxcanvas->canvas->back_opacity = opaque; cdinteriorstyle(ctxcanvas, ctxcanvas->canvas->interior_style); cdlinestyle(ctxcanvas, ctxcanvas->canvas->line_style); return opaque; }
static void cdpattern(cdCtxCanvas *ctxcanvas, int n, int m, const long int *pattern) { (void)pattern; (void)m; (void)n; cdinteriorstyle(ctxcanvas, CD_SOLID); }
static void cdpattern(cdCtxCanvas *ctxcanvas, int w, int h, const long int *colors) { int x, y; GdkColor color; if (ctxcanvas->last_pattern == 0 || (ctxcanvas->last_pattern_w != w || ctxcanvas->last_pattern_h != h)) { if (ctxcanvas->last_pattern != 0) { g_object_unref(ctxcanvas->last_pattern); g_object_unref(ctxcanvas->last_pattern_gc); } ctxcanvas->last_pattern = gdk_pixmap_new(ctxcanvas->wnd, w, h, ctxcanvas->depth); if (!ctxcanvas->last_pattern) return; ctxcanvas->last_pattern_gc = gdk_gc_new((GdkDrawable*)ctxcanvas->last_pattern); ctxcanvas->last_pattern_w = w; ctxcanvas->last_pattern_h = h; } for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { color = cdColorToGdk(colors[y*w+x]); gdk_gc_set_rgb_fg_color(ctxcanvas->last_pattern_gc, &color); gdk_draw_point(ctxcanvas->last_pattern, ctxcanvas->last_pattern_gc, x, h-y-1); } } cdinteriorstyle(ctxcanvas, CD_PATTERN); }
static void cdgdkCheckSolidStyle(cdCtxCanvas *ctxcanvas, int set) { if (ctxcanvas->canvas->interior_style == CD_SOLID) return; if (set) gdk_gc_set_fill(ctxcanvas->gc, GDK_SOLID); else cdinteriorstyle(ctxcanvas, ctxcanvas->canvas->interior_style); }
static int cdhatch(cdCtxCanvas *ctxcanvas, int hatch_style) { GdkColor fg, bg; if (ctxcanvas->last_hatch) g_object_unref(ctxcanvas->last_hatch); fg.pixel = 1; bg.pixel = 0; ctxcanvas->last_hatch = gdk_pixmap_create_from_data(ctxcanvas->wnd, hatches[hatch_style], HATCH_WIDTH, HATCH_HEIGHT, 1, &fg, &bg); cdinteriorstyle(ctxcanvas, CD_HATCH); return hatch_style; }
static void cdfrect(cdCtxCanvas *ctxcanvas, double xmin, double xmax, double ymin, double ymax) { double points[4]; points[0] = xmin; points[1] = ymin; points[2] = xmax; points[3] = ymax; cgm_interior_style ( ctxcanvas->cgm, HOLLOW); cgm_rectangle( ctxcanvas->cgm, points); cdinteriorstyle(ctxcanvas, ctxcanvas->canvas->interior_style); setbbox (ctxcanvas, points[0], points[1] ); setbbox (ctxcanvas, points[2], points[1] ); setbbox (ctxcanvas, points[2], points[3] ); setbbox (ctxcanvas, points[0], points[3] ); }
static void cdstipple(cdCtxCanvas *ctxcanvas, int w, int h, const unsigned char *data) { int x, y; if (ctxcanvas->last_stipple == 0 || (ctxcanvas->last_stipple_w != w || ctxcanvas->last_stipple_h != h)) { if (ctxcanvas->last_stipple != 0) { g_object_unref(ctxcanvas->last_stipple); g_object_unref(ctxcanvas->last_stipple_gc); } ctxcanvas->last_stipple = gdk_pixmap_new(ctxcanvas->wnd, w, h, 1); if (!ctxcanvas->last_stipple) return; ctxcanvas->last_stipple_gc = gdk_gc_new((GdkDrawable*)ctxcanvas->last_stipple); ctxcanvas->last_stipple_w = w; ctxcanvas->last_stipple_h = h; } for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { GdkColor clr; if(data[y*w+x]) clr.pixel = 1; else clr.pixel = 0; gdk_gc_set_foreground(ctxcanvas->last_stipple_gc, &clr); gdk_draw_point(ctxcanvas->last_stipple, ctxcanvas->last_stipple_gc, x, h-y-1); } } cdinteriorstyle(ctxcanvas, CD_STIPPLE); }