pixel-surround

pixel-surround

Synopsis

                    PixelSurround;
enum                PixelSurroundMode;
PixelSurround *     pixel_surround_new                  (TileManager *tiles,
                                                         gint width,
                                                         gint height,
                                                         PixelSurroundMode mode);
void                pixel_surround_set_bg               (PixelSurround *surround,
                                                         const guchar *bg);
const guchar *      pixel_surround_lock                 (PixelSurround *surround,
                                                         gint x,
                                                         gint y,
                                                         gint *rowstride);
void                pixel_surround_release              (PixelSurround *surround);
void                pixel_surround_destroy              (PixelSurround *surround);

Description

Details

PixelSurround

typedef struct _PixelSurround PixelSurround;


enum PixelSurroundMode

typedef enum {
  PIXEL_SURROUND_SMEAR,
  PIXEL_SURROUND_BACKGROUND
} PixelSurroundMode;

PIXEL_SURROUND_SMEAR

PIXEL_SURROUND_BACKGROUND


pixel_surround_new ()

PixelSurround *     pixel_surround_new                  (TileManager *tiles,
                                                         gint width,
                                                         gint height,
                                                         PixelSurroundMode mode);

PixelSurround provides you a contiguous read-only view of the area surrounding a pixel. It is an efficient pixel access strategy for interpolation algorithms.

tiles :

tile manager

width :

width of surround region

height :

height of surround region

mode :

how to deal with pixels that are not covered by the tile manager

Returns :

a new PixelSurround.

pixel_surround_set_bg ()

void                pixel_surround_set_bg               (PixelSurround *surround,
                                                         const guchar *bg);

This sets the color that the PixelSurround uses when in PIXEL_SURROUND_BACKGROUND mode for pixels that are not covered by the tile manager.

surround :

a PixelSurround

bg :

background color

pixel_surround_lock ()

const guchar *      pixel_surround_lock                 (PixelSurround *surround,
                                                         gint x,
                                                         gint y,
                                                         gint *rowstride);

Gives access to a region of pixels. The upper left corner is specified by the x and y parameters. The size of the region is determined by the dimensions given when creating the surround.

When you don't need to read from the pixels any longer, you should unlock the surround using pixel_surround_unlock(). If you need a different region, just call pixel_surround_lock() again.

surround :

a PixelSurround

x :

X coordinate of upper left corner

y :

Y coordinate of upper left corner

rowstride :

return location for rowstride

Returns :

pointer to pixel data (read-only)

pixel_surround_release ()

void                pixel_surround_release              (PixelSurround *surround);

Unlocks pixels locked by surround. See pixel_surround_lock().

surround :

PixelSurround

pixel_surround_destroy ()

void                pixel_surround_destroy              (PixelSurround *surround);

Unlocks pixels and frees any resources allocated for surround. You must not use surround any longer after calling this function.

surround :

PixelSurround