Logo Search packages:      
Sourcecode: inkscape version File versions

void nr_pixblock_setup_extern ( NRPixBlock pb,
NR_PIXBLOCK_MODE  mode,
int  x0,
int  y0,
int  x1,
int  y1,
unsigned char *  px,
int  rs,
bool  empty,
bool  clear 
)

Pixbuf initialisation with preset values.

After copying all parameters into the NRPixBlock struct, the pixel buffer is cleared if the clear flag is set.

Parameters:
pb Pointer to the pixbuf struct.
mode Indicates grayscale/RGB/RGBA.
clear True if buffer should be cleared.
Precondition:
x1>=x0 && y1>=y0 && pb!=NULL

Todo:
How do you recognise if

px was an uncleared tiny buffer?

Definition at line 140 of file nr-pixblock.cpp.

Referenced by sp_canvas_paint_single_buffer(), and sp_flood_do_flood_fill().

{
      int w, bpp;

      w = x1 - x0;
      bpp = (mode == NR_PIXBLOCK_MODE_A8) ? 1 : (mode == NR_PIXBLOCK_MODE_R8G8B8) ? 3 : 4;

      pb->size = NR_PIXBLOCK_SIZE_STATIC; 
      pb->mode = mode;
      pb->empty = empty;
      pb->visible_area.x0 = pb->area.x0 = x0;
      pb->visible_area.y0 = pb->area.y0 = y0;
      pb->visible_area.x1 = pb->area.x1 = x1;
      pb->visible_area.y1 = pb->area.y1 = y1;
      pb->data.px = px;
      pb->rs = rs;

        g_assert (pb->data.px != NULL);
      if (clear) {
            if (rs == bpp * w) {
                  /// \todo How do you recognise if 
                        /// px was an uncleared tiny buffer? 
                  if (pb->data.px) 
                        memset (pb->data.px, 0x0, bpp * (y1 - y0) * w);
            } else {
                  int y;
                  for (y = y0; y < y1; y++) {
                        memset (pb->data.px + (y - y0) * rs, 0x0, bpp * w);
                  }
            }
      }
}


Generated by  Doxygen 1.6.0   Back to index