From fb0bd7994491da2a7fa6913c5b5666ed49c6e153 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 16 Apr 2015 22:36:29 +0100 Subject: update amiga frontend to use bitmap operation table --- amiga/bitmap.h | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) (limited to 'amiga/bitmap.h') diff --git a/amiga/bitmap.h b/amiga/bitmap.h index 6657d2f8a..63969ecaa 100755 --- a/amiga/bitmap.h +++ b/amiga/bitmap.h @@ -18,7 +18,6 @@ #ifndef AMIGA_BITMAP_H #define AMIGA_BITMAP_H -#include "image/bitmap.h" #include #include @@ -28,6 +27,8 @@ #define AMI_BITMAP_FORMAT RGBFB_R8G8B8A8 #define AMI_BITMAP_FORCE_OVERWRITE 0xFF +struct gui_bitmap_table *amiga_bitmap_table; + struct bitmap { int width; int height; @@ -55,4 +56,81 @@ struct bitmap *ami_bitmap_from_datatype(char *filename); void ami_bitmap_argb_to_rgba(struct bitmap *bm); #endif +/** + * Create a bitmap. + * + * \param width width of image in pixels + * \param height width of image in pixels + * \param state a flag word indicating the initial state + * \return an opaque struct bitmap, or NULL on memory exhaustion + */ +void *amiga_bitmap_create(int width, int height, unsigned int state); + +/** + * Return a pointer to the pixel data in a bitmap. + * + * \param bitmap a bitmap, as returned by bitmap_create() + * \return pointer to the pixel buffer + * + * The pixel data is packed as BITMAP_FORMAT, possibly with padding at the end + * of rows. The width of a row in bytes is given by bitmap_get_rowstride(). + */ +unsigned char *amiga_bitmap_get_buffer(void *bitmap); + +/** + * Find the width of a pixel row in bytes. + * + * \param bitmap a bitmap, as returned by bitmap_create() + * \return width of a pixel row in the bitmap + */ +size_t amiga_bitmap_get_rowstride(void *bitmap); + +/** + * Free a bitmap. + * + * \param bitmap a bitmap, as returned by bitmap_create() + */ +void amiga_bitmap_destroy(void *bitmap); + +/** + * Save a bitmap in the platform's native format. + * + * \param bitmap a bitmap, as returned by bitmap_create() + * \param path pathname for file + * \param flags flags controlling how the bitmap is saved. + * \return true on success, false on error and error reported + */ +bool amiga_bitmap_save(void *bitmap, const char *path, unsigned flags); + +/** + * The bitmap image has changed, so flush any persistant cache. + * + * \param bitmap a bitmap, as returned by bitmap_create() + */ +void amiga_bitmap_modified(void *bitmap); + +/** + * Sets whether a bitmap should be plotted opaque + * + * \param bitmap a bitmap, as returned by bitmap_create() + * \param opaque whether the bitmap should be plotted opaque + */ +void amiga_bitmap_set_opaque(void *bitmap, bool opaque); + +/** + * Tests whether a bitmap has an opaque alpha channel + * + * \param bitmap a bitmap, as returned by bitmap_create() + * \return whether the bitmap is opaque + */ +bool amiga_bitmap_test_opaque(void *bitmap); + +/** + * Gets whether a bitmap should be plotted opaque + * + * \param bitmap a bitmap, as returned by bitmap_create() + */ +bool amiga_bitmap_get_opaque(void *bitmap); + + #endif -- cgit v1.2.3