13 mask_name[strlen(mask_name) - 2] =
'g';
15 mask = fopen(mask_name,
"wb");
17 G_fatal_error(
"cairo: couldn't open mask file %s", mask_name);
24 for (y = 0; y <
height; y++) {
25 const unsigned int *row = (
const unsigned int *)(
grid + y *
stride);
27 for (x = 0; x <
width; x++) {
28 unsigned int c = row[x];
29 int a = (c >> 24) & 0xFF;
30 int r = (c >> 16) & 0xFF;
31 int g = (c >> 8) & 0xFF;
32 int b = (c >> 0) & 0xFF;
34 if (a > 0 && a < 0xFF) {
40 fputc((
unsigned char)r, output);
41 fputc((
unsigned char)g, output);
42 fputc((
unsigned char)b, output);
43 fputc((
unsigned char)a, mask);
void G_free(void *buf)
Free allocated memory.
char * G_store(const char *s)
Copy string to allocated memory.
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
void output(const char *fmt,...)