1
#define __NR_PLAIN_STUFF_C__
4
* Miscellaneous simple rendering utilities
7
* Lauris Kaplinski <lauris@ximian.com>
9
* Copyright (C) 2001 Lauris Kaplinski and Ximian, Inc.
11
* Released under GNU GPL
14
#include <glib/gmessages.h>
15
#include <libnr/nr-pixops.h>
16
#include "nr-plain-stuff.h"
18
#define NR_DEFAULT_CHECKERSIZEP2 2
19
#define NR_DEFAULT_CHECKERCOLOR0 0xbfbfbfff
20
#define NR_DEFAULT_CHECKERCOLOR1 0x808080ff
23
nr_render_checkerboard_rgb (guchar *px, gint w, gint h, gint rs, gint xoff, gint yoff)
25
g_return_if_fail (px != NULL);
27
nr_render_checkerboard_rgb_custom (px, w, h, rs, xoff, yoff, NR_DEFAULT_CHECKERCOLOR0, NR_DEFAULT_CHECKERCOLOR1, NR_DEFAULT_CHECKERSIZEP2);
31
nr_render_checkerboard_rgb_custom (guchar *px, gint w, gint h, gint rs, gint xoff, gint yoff, guint32 c0, guint32 c1, gint sizep2)
37
g_return_if_fail (px != NULL);
38
g_return_if_fail (sizep2 >= 0);
39
g_return_if_fail (sizep2 <= 8);
44
r0 = NR_RGBA32_R (c0);
45
g0 = NR_RGBA32_G (c0);
46
b0 = NR_RGBA32_B (c0);
47
r1 = NR_RGBA32_R (c1);
48
g1 = NR_RGBA32_G (c1);
49
b1 = NR_RGBA32_B (c1);
51
for (y = 0; y < h; y++) {
54
for (x = 0; x < w; x++) {
55
if (((x + xoff) ^ (y + yoff)) & m) {
70
nr_render_rgba32_rgb (guchar *px, gint w, gint h, gint rs, gint xoff, gint yoff, guint32 c)
73
gint a, r, g, b, cr, cg, cb;
75
g_return_if_fail (px != NULL);
82
cr = NR_COMPOSEN11_1111 (r, a, NR_RGBA32_R (NR_DEFAULT_CHECKERCOLOR0));
83
cg = NR_COMPOSEN11_1111 (g, a, NR_RGBA32_G (NR_DEFAULT_CHECKERCOLOR0));
84
cb = NR_COMPOSEN11_1111 (b, a, NR_RGBA32_B (NR_DEFAULT_CHECKERCOLOR0));
85
c0 = (cr << 24) | (cg << 16) | (cb << 8) | 0xff;
87
cr = NR_COMPOSEN11_1111 (r, a, NR_RGBA32_R (NR_DEFAULT_CHECKERCOLOR1));
88
cg = NR_COMPOSEN11_1111 (g, a, NR_RGBA32_G (NR_DEFAULT_CHECKERCOLOR1));
89
cb = NR_COMPOSEN11_1111 (b, a, NR_RGBA32_B (NR_DEFAULT_CHECKERCOLOR1));
90
c1 = (cr << 24) | (cg << 16) | (cb << 8) | 0xff;
92
nr_render_checkerboard_rgb_custom (px, w, h, rs, xoff, yoff, c0, c1, NR_DEFAULT_CHECKERSIZEP2);