22 #define min(a, b) ((a) < (b) ? (a) : (b))
25 #define max(a, b) ((a) > (b) ? (a) : (b))
35 static double scale(
double k,
const int src[2],
const int dst[2])
41 static int scale_fwd_y(
int sy)
43 return (
int)floor(scale(sy,
src[1],
dst[1]) + 0.5);
46 static int scale_rev_x(
int dx)
48 return (
int)floor(scale(dx + 0.5,
dst[0],
src[0]));
51 static int next_row(
int sy,
int dy)
56 int y = scale_fwd_y(sy);
64 static void alloc_buffers(
void)
70 trans =
G_realloc(trans, nalloc *
sizeof(
int));
85 d[0][0] = (int)floor(fd[0][0] + 0.5);
86 d[0][1] = (int)floor(fd[0][1] + 0.5);
87 d[1][0] = (int)floor(fd[1][0] + 0.5);
88 d[1][1] = (int)floor(fd[1][1] + 0.5);
90 ncols = d[0][1] - d[0][0];
92 memcpy(
src, s,
sizeof(
src));
93 memcpy(
dst, d,
sizeof(
dst));
98 for (i = 0; i < ncols; i++)
99 trans[i] = scale_rev_x(d[0][0] + i);
112 const unsigned char *grn,
const unsigned char *blu,
113 const unsigned char *nul)
115 int d_y0 = scale_fwd_y(row + 0);
116 int d_y1 = scale_fwd_y(row + 1);
117 int d_rows = d_y1 - d_y0;
125 return next_row(row, d_y1);
127 for (
x = x0;
x < x1;
x++) {
128 int xx =
dst[0][0] +
x;
132 if (masked && nul && nul[j])
137 for (y = y0; y < y1; y++) {
146 return next_row(row, d_y1);
unsigned int png_get_color(int r, int g, int b, int a)
#define UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
int PNG_raster(UNUSED int n, int row, const unsigned char *red, const unsigned char *grn, const unsigned char *blu, const unsigned char *nul)
Draw raster row.
void PNG_begin_raster(int mask, int s[2][2], double fd[2][2])
Start drawing raster.
GRASS png display driver - header file.