1 #define __NR_PLAIN_STUFF_GDK_C__
3 /*
4 * Miscellaneous simple rendering utilities
5 *
6 * Author:
7 * Lauris Kaplinski <lauris@ximian.com>
8 *
9 * Copyright (C) 2001 Lauris Kaplinski and Ximian, Inc.
10 *
11 * Released under GNU GPL
12 */
14 #include <libnr/nr-pixblock-pattern.h>
15 #include "nr-plain-stuff.h"
16 #include "nr-plain-stuff-gdk.h"
18 void
19 nr_gdk_draw_rgba32_solid (GdkDrawable *drawable, GdkGC *gc, gint x, gint y, gint w, gint h, guint32 rgba)
20 {
21 NRPixBlock pb;
23 nr_pixblock_setup_fast (&pb, NR_PIXBLOCK_MODE_R8G8B8A8N, 0, 0, w, h, FALSE);
25 nr_render_rgba32_rgb (NR_PIXBLOCK_PX (&pb), w, h, pb.rs, x, y, rgba);
26 gdk_draw_rgb_image (drawable, gc, x, y, w, h, GDK_RGB_DITHER_MAX, NR_PIXBLOCK_PX (&pb), pb.rs);
28 nr_pixblock_release (&pb);
29 }
31 void
32 nr_gdk_draw_gray_garbage (GdkDrawable *drawable, GdkGC *gc, gint x, gint y, gint w, gint h)
33 {
34 for (gint yy = y; yy < y + h; yy += 64) {
35 for (gint xx = x; xx < x + w; xx += 64) {
36 NRPixBlock pb;
37 gint ex = MIN (xx + 64, x + w);
38 gint ey = MIN (yy + 64, y + h);
39 nr_pixblock_setup_fast (&pb, NR_PIXBLOCK_MODE_R8G8B8, xx, yy, ex, ey, FALSE);
40 nr_pixblock_render_gray_noise (&pb, NULL);
41 gdk_draw_rgb_image (drawable, gc, xx, yy, ex - xx, ey - yy, GDK_RGB_DITHER_NONE, NR_PIXBLOCK_PX (&pb), pb.rs);
42 nr_pixblock_release (&pb);
43 }
44 }
45 }