tile-pyramid

tile-pyramid

Synopsis

                    TilePyramid;
TilePyramid *       tile_pyramid_new                    (GimpImageType type,
                                                         gint width,
                                                         gint height);
void                tile_pyramid_destroy                (TilePyramid *pyramid);
gint                tile_pyramid_get_level              (gint width,
                                                         gint height,
                                                         gdouble scale);
TileManager *       tile_pyramid_get_tiles              (TilePyramid *pyramid,
                                                         gint level,
                                                         gboolean *is_premult);
void                tile_pyramid_invalidate_area        (TilePyramid *pyramid,
                                                         gint x,
                                                         gint y,
                                                         gint width,
                                                         gint height);
void                tile_pyramid_set_validate_proc      (TilePyramid *pyramid,
                                                         TileValidateProc proc,
                                                         gpointer user_data);
gint                tile_pyramid_get_width              (const TilePyramid *pyramid);
gint                tile_pyramid_get_height             (const TilePyramid *pyramid);
gint                tile_pyramid_get_bpp                (const TilePyramid *pyramid);
gint64              tile_pyramid_get_memsize            (const TilePyramid *pyramid);

Description

Details

TilePyramid

typedef struct _TilePyramid TilePyramid;


tile_pyramid_new ()

TilePyramid *       tile_pyramid_new                    (GimpImageType type,
                                                         gint width,
                                                         gint height);

Creates a new TilePyramid, managing a set of tile-managers where each level is a sized-down version of the level below.

This only works correctly if you set a validate procedure using tile_pyramid_set_validate_proc() and invalidate areas. With some small changes, it could be made to work for non-validating tile managers also. But currently only the projection uses it.

Only the bottom-most tile-manager is allocated at this point. Upper levels are created only if they are requested.

type :

type of pixel data stored in the pyramid

width :

bottom level width

height :

bottom level height

Returns :

a newly allocate TilePyramid

tile_pyramid_destroy ()

void                tile_pyramid_destroy                (TilePyramid *pyramid);

Destroys resources allocated for pyramid and unrefs all contained tile-managers.

pyramid :

a TilePyramid

tile_pyramid_get_level ()

gint                tile_pyramid_get_level              (gint width,
                                                         gint height,
                                                         gdouble scale);

Calculates the optimal level to request from a TilePyramid in order to display at a certain scale.

width :

width of the bottom level

height :

height of the bottom level

scale :

zoom ratio

Returns :

the level to use for scale

tile_pyramid_get_tiles ()

TileManager *       tile_pyramid_get_tiles              (TilePyramid *pyramid,
                                                         gint level,
                                                         gboolean *is_premult);

Gives access to the TileManager at level of the pyramid.

pyramid :

a TilePyramid

level :

level, typically obtained using tile_pyramid_get_level()

is_premult :

location to store whether the pixel data has the alpha channel pre-multiplied or not

Returns :

pointer to a TileManager

tile_pyramid_invalidate_area ()

void                tile_pyramid_invalidate_area        (TilePyramid *pyramid,
                                                         gint x,
                                                         gint y,
                                                         gint width,
                                                         gint height);

Invalidates the tiles in the given area on all levels.

pyramid :

a TilePyramid

tile_pyramid_set_validate_proc ()

void                tile_pyramid_set_validate_proc      (TilePyramid *pyramid,
                                                         TileValidateProc proc,
                                                         gpointer user_data);

Sets a validation procedure on the bottom-most tile manager.

pyramid :

a TilePyramid

proc :

a function to validate the bottom level tiles

user_data :

data to pass to the validation proc

tile_pyramid_get_width ()

gint                tile_pyramid_get_width              (const TilePyramid *pyramid);

pyramid :

a TilePyramid

Returns :

the width of the pyramid's bottom level

tile_pyramid_get_height ()

gint                tile_pyramid_get_height             (const TilePyramid *pyramid);

pyramid :

a TilePyramid

Returns :

the height of the pyramid's bottom level

tile_pyramid_get_bpp ()

gint                tile_pyramid_get_bpp                (const TilePyramid *pyramid);

pyramid :

a TilePyramid

Returns :

the number of bytes per pixel stored in the pyramid

tile_pyramid_get_memsize ()

gint64              tile_pyramid_get_memsize            (const TilePyramid *pyramid);

pyramid :

a TilePyramid

Returns :

size of memory allocated for the pyramid