352 static float *rarray= (
float *)0;
353 static float *garray= (
float *)0;
354 static float *barray= (
float *)0;
355 float *rptr, *gptr, *bptr;
357 float px, py, qx, qy, rx, ry;
361 if (
verboseflag) fprintf(stderr,
"Found direct color (3 channel) page\n");
371 !(nx == in_hdr->
xmax - in_hdr->
xmin + 1) ||
372 !(ny == in_hdr->
ymax - in_hdr->
ymin + 1)) {
373 if (rarray) free( (
char *)rarray );
374 if (garray) free( (
char *)garray );
375 if (barray) free( (
char *)barray );
376 nx= in_hdr->
xmax - in_hdr->
xmin + 1;
377 ny= in_hdr->
ymax - in_hdr->
ymin + 1;
378 if ( !(rarray= (
float *)
malloc( nx*ny*
sizeof(
float) )) ) {
379 fprintf(stderr,
"rletocgm: cannot allocate %d floats for red!\n",nx*ny);
382 if ( !(garray= (
float *)
malloc( nx*ny*
sizeof(
float) )) ) {
383 fprintf(stderr,
"rletocgm: cannot allocate %d floats for green!\n",nx*ny);
386 if ( !(barray= (
float *)
malloc( nx*ny*
sizeof(
float) )) ) {
387 fprintf(stderr,
"rletocgm: cannot allocate %d floats for blue!\n",nx*ny);
394 fprintf( stderr,
"rletocgm: Unable to allocate image memory.\n" );
402 for ( y = in_hdr->
ymin; y <= in_hdr->ymax; y++ )
407 for (x=0; x<nx; x++) {
408 *rptr++= (float)rows[0][x]/255.0;
409 *gptr++= (float)rows[1][x]/255.0;
410 *bptr++= (float)rows[2][x]/255.0;
415 wcladc( rarray, garray, barray,
416 &nx, &ny, &px, &py, &qx, &qy, &rx, &ry, &ierr );
418 fprintf(stderr,
"rletocgm: Error writing direct color cell array!\n");
void rle_row_free(rle_hdr *the_hdr, rle_pixel **scanp)
int rle_row_alloc(rle_hdr *the_hdr, rle_pixel ***scanp)
static void begin_direct_page(rle_hdr *in_hdr)
unsigned int rle_getskip(rle_hdr *the_hdr)
static void center_image(rle_hdr *in_hdr, float *px, float *py, float *qx, float *qy, float *rx, float *ry)
int rle_getrow(rle_hdr *the_hdr, rle_pixel *scanline[])