53 int flags = 0,
oflag = 0;
54 char *infilename = NULL, *out_fname = NULL;
56 int xlen, ylen,
i, j, chan;
68 if (
scanargs(argc, argv,
"% rlhv!- o%-outfile!s infile%s",
69 &flags, &
oflag, &out_fname, &infilename) == 0)
95 xlen = in_hdr.
xmax - in_hdr.
xmin + 1;
96 ylen = in_hdr.
ymax - in_hdr.
ymin + 1;
99 xlinewidth = in_hdr.
xmax + 1;
112 rastptr = rasterbase;
118 for (i = in_hdr.
ymin; i <= in_hdr.
ymax; i++)
120 for (chan=0; chan <
nchan; chan++)
122 rows[chan] = rastptr;
124 rastptr = &(rastptr[xlinewidth]);
138 rastptr = &(rasterbase[xlinewidth * (ylen - 1) * nchan]);
140 for (i = out_hdr.
ymin; i <= out_hdr.
ymax; i++)
142 for (chan=0; chan <
nchan; chan++)
144 rows[chan] = &(rastptr[out_hdr.
xmin]);
146 rastptr = &(rastptr[xlinewidth]);
149 rastptr = &(rastptr[ - 2 * nchan * xlinewidth ]);
170 for (chan = 0; chan <
nchan; chan++)
171 rows[chan] = &(temp_line[chan][out_hdr.
xmin]);
173 for (i = 0; i < ylen; i++)
175 rastptr = &(rasterbase[i * xlinewidth *
nchan]);
177 for (chan = 0; chan <
nchan; chan++)
180 &(rastptr[chan * xlinewidth + xlinewidth - xlen]);
181 outpxl = &(temp_line[chan][xlinewidth-1]);
183 for (j = 0; j < xlen; j++)
184 *outpxl-- = *inpxl++;
196 int linebytes, chan_offset;
202 out_hdr.
xmax = in_hdr.
xmin + ylen - 1;
203 out_hdr.
ymax = in_hdr.
ymin + xlen - 1;
205 oxlen = out_hdr.
xmax - out_hdr.
xmin + 1;
206 oylen = out_hdr.
ymax - out_hdr.
ymin + 1;
217 for (chan = 0; chan <
nchan; chan++)
218 rows[chan] = temp_line[chan];
220 linebytes = nchan * xlinewidth;
228 for (i = 0; i < oylen; i++)
230 lineoff = xlinewidth - xlen +
i;
231 for (chan = 0; chan <
nchan; chan++)
234 chan_offset = lineoff + xlinewidth * chan;
235 outptr = temp_line[chan];
236 for (j = oxlen - 1; j >= 0; j--)
238 rasterbase[j * linebytes + chan_offset];
249 for (i = 0; i < oylen; i++)
251 for (chan = 0; chan <
nchan; chan++)
254 chan_offset = xlinewidth * chan + (xlinewidth - 1 -
i);
255 outptr = temp_line[chan];
256 for (j = 0; j < oxlen; j++)
258 *outptr++ = rasterbase[j * linebytes + chan_offset];
int scanargs(int argc, char **argv, const char *format,...)
int rle_row_alloc(rle_hdr *the_hdr, rle_pixel ***scanp)
void rle_putrow(rle_pixel *rows[], int rowlen, rle_hdr *the_hdr)
void rle_addhist(char *argv[], rle_hdr *in_hdr, rle_hdr *out_hdr)
void rle_puteof(rle_hdr *the_hdr)
void rle_names(rle_hdr *the_hdr, const char *pgmname, const char *fname, int img_num)
int rle_get_setup(rle_hdr *the_hdr)
int rle_get_error(int code, const char *pgmname, const char *fname)
rle_hdr * rle_hdr_cp(rle_hdr *from_hdr, rle_hdr *to_hdr)
FILE * rle_open_f(const char *prog_name, const char *f_name, const char *mode)
void rle_put_setup(rle_hdr *the_hdr)
char * cmd_name(char **argv)
int rle_getrow(rle_hdr *the_hdr, rle_pixel *scanline[])
#define RLE_CHECK_ALLOC(pgm, ptr, name)
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)