Utah Raster Toolkit  9999-git
URT Development version (post-3.1b)
Functions
rle_rawrow.c File Reference
#include "rle.h"
#include "rle_raw.h"
Include dependency graph for rle_rawrow.c:

Go to the source code of this file.

Functions

void rle_rawtorow (rle_hdr *the_hdr, rle_op **raw, int *nraw, rle_pixel **outrows)
 

Function Documentation

void rle_rawtorow ( rle_hdr the_hdr,
rle_op **  raw,
int nraw,
rle_pixel **  outrows 
)

Definition at line 31 of file rle_rawrow.c.

36 {
37  register int i, j;
38  register rle_pixel * outptr;
39  int chan;
40 
41  for (chan = -the_hdr->alpha; chan < the_hdr->ncolors; chan++)
42  if ( RLE_BIT( *the_hdr, chan ) )
43  {
44  if ( chan >= 0 && the_hdr->background == 2 && the_hdr->bg_color &&
45  the_hdr->bg_color[chan] != 0 )
46  {
47  j = the_hdr->bg_color[chan];
48  for ( i = the_hdr->xmin,
49  outptr = &outrows[chan][the_hdr->xmin];
50  i <= the_hdr->xmax;
51  i++, outptr++ )
52  *outptr = j;
53  }
54  else
55  bzero( (char *)&outrows[chan][the_hdr->xmin],
56  the_hdr->xmax - the_hdr->xmin + 1 );
57 
58  for( i = 0; i < nraw[chan]; i++ )
59  {
60  outptr = &(outrows[chan][raw[chan][i].xloc]);
61  switch (raw[chan][i].opcode)
62  {
63  case RByteDataOp:
64  bcopy( (char *)raw[chan][i].u.pixels, (char *)outptr,
65  raw[chan][i].length );
66  break;
67 
68  case RRunDataOp:
69  for ( j = raw[chan][i].length; j > 0; j--)
70  *(outptr++) = (rle_pixel) raw[chan][i].u.run_val;
71  break;
72  }
73  }
74  }
75 }
#define RRunDataOp
Definition: rle_code.h:41
int xmin
Definition: rle.h:100
int length
Definition: rle_raw.h:51
int * bg_color
Definition: rle.h:100
int run_val
Definition: rle_raw.h:54
int xloc
Definition: rle_raw.h:50
int xmax
Definition: rle.h:100
int background
Definition: rle.h:100
rle_pixel * pixels
Definition: rle_raw.h:53
unsigned char rle_pixel
Definition: rle.h:56
int i
Definition: rletorla.c:82
int alpha
Definition: rle.h:100
rle_pixel ** outrows
Definition: painttorle.c:43
#define RByteDataOp
Definition: rle_code.h:40
#define RLE_BIT(glob, bit)
Definition: rle.h:126