9 static int r_shift, g_shift, b_shift, a_shift;
10 static int Red[256], Grn[256], Blu[256];
12 static void set_color(
int i,
int red,
int grn,
int blu)
20 static void init_colors_rgb(
void)
36 static void init_colors_indexed(
void)
47 set_color(n_pixels++, 0, 0, 0);
49 for (
r = 0;
r < 6;
r++) {
50 for (
g = 0;
g < 6;
g++) {
51 for (
b = 0;
b < 6;
b++) {
52 int red =
r * 0xFF / 5;
53 int grn =
g * 0xFF / 5;
54 int blu =
b * 0xFF / 5;
56 set_color(n_pixels++, red, grn, blu);
61 while (n_pixels < 256)
62 set_color(n_pixels++, 0, 0, 0);
64 for (i = 0; i < 256; i++) {
78 init_colors_indexed();
81 static int get_color_rgb(
int r,
int g,
int b,
int a)
83 return (
r << r_shift) + (
g << g_shift) + (
b << b_shift) + (a << a_shift);
86 static int get_color_indexed(
int r,
int g,
int b,
int a)
94 static void get_pixel_rgb(
unsigned int pixel,
int *
r,
int *
g,
int *
b,
int *a)
96 *
r = (pixel >> r_shift) & 0xFF;
97 *
g = (pixel >> g_shift) & 0xFF;
98 *
b = (pixel >> b_shift) & 0xFF;
99 *a = (pixel >> a_shift) & 0xFF;
102 static void get_pixel_indexed(
unsigned int pixel,
int *
r,
int *
g,
int *
b,
115 get_pixel_rgb(pixel,
r,
g,
b, a);
117 get_pixel_indexed(pixel,
r,
g,
b, a);
123 ? get_color_rgb(
r,
g,
b, a)
124 : get_color_indexed(
r,
g,
b, a);
unsigned int png_get_color(int r, int g, int b, int a)
void png_init_color_table(void)
void png_get_pixel(unsigned int pixel, int *r, int *g, int *b, int *a)
void int G_is_little_endian(void)
Tests for little ENDIAN.
GRASS png display driver - header file.
unsigned char palette[256][4]