42 #define VERT_FLAG 0x01
43 #define HORIZ_FLAG 0x02
44 #define LEFT_FLAG 0x04
45 #define RIGHT_FLAG 0x08
53 int flags = 0, oflag = 0;
54 char *infilename = NULL, *out_fname = NULL;
55 FILE *outfile = stdout;
56 int xlen, ylen, i, j, chan;
58 rle_hdr in_hdr, out_hdr;
68 if (
scanargs(argc
, argv
, "% rlhv!- o%-outfile!s infile%s",
69 &flags
, &oflag
, &out_fname
, &infilename
) == 0)
99 xlinewidth = in_hdr
.xmax + 1;
110 rasterbase = (
rle_pixel *) malloc( xlinewidth * ylen * nchan );
112 rastptr = rasterbase;
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;
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];
FILE * rle_open_f(char *prog_name, char *file_name, char *mode)
rle_hdr * rle_hdr_cp(rle_hdr *from_hdr, rle_hdr *to_hdr)
void rle_names(rle_hdr *the_hdr, const char *pgmname, const char *fname, int img_num)
char * cmd_name(char **argv)
void main(int argc, char **argv)
int rle_get_setup(rle_hdr *the_hdr)
int rle_row_alloc(rle_hdr *the_hdr, rle_pixel ***scanp)
int rle_getrow(rle_hdr *the_hdr, scanline)
int rle_get_error(int code, const char *pgmname, const char *fname)
int scanargs(int argc, char **argv, const char *format,...)
void rle_puteof(rle_hdr *the_hdr)
void rle_putrow(rows, int rowlen, rle_hdr *the_hdr)
void rle_addhist(argv, rle_hdr *in_hdr, rle_hdr *out_hdr)
void rle_put_setup(rle_hdr *the_hdr)
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)
#define RLE_CHECK_ALLOC(pgm, ptr, name)