8 static int r_shift, g_shift, b_shift, a_shift;
9 static int Red[256], Grn[256], Blu[256];
11 static void set_color(
int i,
int red,
int grn,
int blu)
19 static void init_colors_rgb(
void)
35 static void init_colors_indexed(
void)
46 set_color(n_pixels++, 0, 0, 0);
48 for (
r = 0;
r < 6;
r++) {
49 for (
g = 0;
g < 6;
g++) {
50 for (
b = 0;
b < 6;
b++) {
51 int red =
r * 0xFF / 5;
52 int grn =
g * 0xFF / 5;
53 int blu =
b * 0xFF / 5;
55 set_color(n_pixels++, red, grn, blu);
60 while (n_pixels < 256)
61 set_color(n_pixels++, 0, 0, 0);
63 for (i = 0; i < 256; i++) {
77 init_colors_indexed();
80 static int get_color_rgb(
int r,
int g,
int b,
int a)
82 return (
r << r_shift) + (
g << g_shift) + (
b << b_shift) + (a << a_shift);
85 static int get_color_indexed(
int r,
int g,
int b,
int a)
93 static void get_pixel_rgb(
unsigned int pixel,
int *
r,
int *
g,
int *
b,
int *a)
95 *
r = (pixel >> r_shift) & 0xFF;
96 *
g = (pixel >> g_shift) & 0xFF;
97 *
b = (pixel >> b_shift) & 0xFF;
98 *a = (pixel >> a_shift) & 0xFF;
101 static void get_pixel_indexed(
unsigned int pixel,
int *
r,
int *
g,
int *
b,
113 get_pixel_rgb(pixel,
r,
g,
b, a);
115 get_pixel_indexed(pixel,
r,
g,
b, a);
121 : 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]