src/lib/pngtile.h
changeset 6 766df7c9b90d
parent 5 4b440fa03183
child 7 997906f5fd2d
equal deleted inserted replaced
5:4b440fa03183 6:766df7c9b90d
     4 /**
     4 /**
     5  * @file
     5  * @file
     6  *
     6  *
     7  * Tile-based access to large PNG images.
     7  * Tile-based access to large PNG images.
     8  */
     8  */
       
     9 #include <stddef.h>
     9 
    10 
    10 /**
    11 /**
    11  * "Global" context shared between images
    12  * "Global" context shared between images
    12  */
    13  */
    13 struct pt_ctx;
    14 struct pt_ctx;
    15 /**
    16 /**
    16  * Per-image state
    17  * Per-image state
    17  */
    18  */
    18 struct pt_image;
    19 struct pt_image;
    19 
    20 
       
    21 /** Bitmask for pt_image_open modes */
    20 enum pt_image_mode {
    22 enum pt_image_mode {
    21     PT_IMG_READ     = 0x01,
    23     /** Update cache if needed */
    22     PT_IMG_WRITE    = 0x02,
    24     PT_IMG_WRITE    = 0x01,
       
    25 
       
    26     /** Accept stale cache */
       
    27     PT_IMG_STALE    = 0x02,
       
    28 };
       
    29 
       
    30 /** Metadata info for image */
       
    31 struct pt_image_info {
       
    32     /** Dimensions of image */
       
    33     size_t width, height;   
    23 };
    34 };
    24 
    35 
    25 
    36 
    26 int pt_ctx_new (struct pt_ctx **ctx_ptr);
    37 int pt_ctx_new (struct pt_ctx **ctx_ptr);
    27 
    38 
    34  * @param mode combination of PT_IMG_* flags
    45  * @param mode combination of PT_IMG_* flags
    35  */
    46  */
    36 int pt_image_open (struct pt_image **image_ptr, struct pt_ctx *ctx, const char *png_path, int cache_mode);
    47 int pt_image_open (struct pt_image **image_ptr, struct pt_ctx *ctx, const char *png_path, int cache_mode);
    37 
    48 
    38 /**
    49 /**
       
    50  * Get the image's metadata
       
    51  */
       
    52 int pt_image_info (struct pt_image *image, struct pt_image_info **info_ptr);
       
    53 
       
    54 /**
    39  * Check the given image's cache is stale - in other words, the image needs to be updated.
    55  * Check the given image's cache is stale - in other words, the image needs to be updated.
    40  */
    56  */
    41 int pt_image_stale (struct pt_image *image);
    57 int pt_image_stale (struct pt_image *image);
    42 
    58 
    43 /**
    59 /**
    44  * Update the given image's cache.
    60  * Update the given image's cache.
    45  */
    61  */
    46 int pt_image_update (struct pt_image *image);
    62 int pt_image_update (struct pt_image *image);
    47 
    63 
       
    64 /**
       
    65  * Release the given pt_image without any clean shutdown
       
    66  */
       
    67 void pt_image_destroy (struct pt_image *image);
       
    68 
    48 #endif
    69 #endif