nr-plain-stuff.cpp revision 9e87caa574d67b9b1aa1015d4faae055336c9d30
#define __NR_PLAIN_STUFF_C__
/*
* Miscellaneous simple rendering utilities
*
* Author:
* Lauris Kaplinski <lauris@ximian.com>
*
* Copyright (C) 2001 Lauris Kaplinski and Ximian, Inc.
*
* Released under GNU GPL
*/
#include <glib/gmessages.h>
#include <libnr/nr-pixops.h>
#include "nr-plain-stuff.h"
#define NR_DEFAULT_CHECKERSIZEP2 2
#define NR_DEFAULT_CHECKERCOLOR0 0xbfbfbfff
#define NR_DEFAULT_CHECKERCOLOR1 0x808080ff
void
{
nr_render_checkerboard_rgb_custom (px, w, h, rs, xoff, yoff, NR_DEFAULT_CHECKERCOLOR0, NR_DEFAULT_CHECKERCOLOR1, NR_DEFAULT_CHECKERSIZEP2);
}
void
nr_render_checkerboard_rgb_custom (guchar *px, gint w, gint h, gint rs, gint xoff, gint yoff, guint32 c0, guint32 c1, gint sizep2)
{
gint x, y, m;
g_return_if_fail (sizep2 >= 0);
xoff &= 0x1ff;
yoff &= 0x1ff;
m = 0x1 << sizep2;
for (y = 0; y < h; y++) {
guchar *p;
p = px;
for (x = 0; x < w; x++) {
*p++ = r0;
*p++ = g0;
*p++ = b0;
} else {
*p++ = r1;
*p++ = g1;
*p++ = b1;
}
}
}
}
void
{
r = NR_RGBA32_R (c);
g = NR_RGBA32_G (c);
b = NR_RGBA32_B (c);
a = NR_RGBA32_A (c);
}