summaryrefslogtreecommitdiff
path: root/image/bitmap.h
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-04-13 23:19:04 +0100
committerVincent Sanders <vince@kyllikki.org>2015-04-13 23:19:04 +0100
commitf37e52c39475e6efd3740c5ae1ec4f290662928f (patch)
tree88d01618e903975743a3cb74bff9bf8df54c2a45 /image/bitmap.h
parent7a28131e4953934150967eb7886bc06678e249e8 (diff)
downloadnetsurf-f37e52c39475e6efd3740c5ae1ec4f290662928f.tar.gz
netsurf-f37e52c39475e6efd3740c5ae1ec4f290662928f.tar.bz2
Move bitmap operations into an operation table.
The generic bitmap handlers provided by each frontend are called back from the core and therefore should be in an operation table. This was one of the very few remaining interfaces stopping the core code from being split into a library.
Diffstat (limited to 'image/bitmap.h')
-rw-r--r--image/bitmap.h77
1 files changed, 59 insertions, 18 deletions
diff --git a/image/bitmap.h b/image/bitmap.h
index 193249259..459a50a73 100644
--- a/image/bitmap.h
+++ b/image/bitmap.h
@@ -53,31 +53,72 @@
#ifndef _NETSURF_IMAGE_BITMAP_H_
#define _NETSURF_IMAGE_BITMAP_H_
-#include <stdbool.h>
-#include <stdlib.h>
-
#define BITMAP_NEW 0
#define BITMAP_OPAQUE (1 << 0) /** image is opaque */
#define BITMAP_MODIFIED (1 << 1) /** buffer has been modified */
#define BITMAP_CLEAR_MEMORY (1 << 2) /** memory should be wiped */
struct content;
-
-/** An opaque image. */
struct bitmap;
-void *bitmap_create(int width, int height, unsigned int state);
-void bitmap_set_opaque(void *bitmap, bool opaque);
-bool bitmap_test_opaque(void *bitmap);
-bool bitmap_get_opaque(void *bitmap);
-unsigned char *bitmap_get_buffer(void *bitmap);
-size_t bitmap_get_rowstride(void *bitmap);
-size_t bitmap_get_bpp(void *bitmap);
-void bitmap_destroy(void *bitmap);
-bool bitmap_save(void *bitmap, const char *path, unsigned flags);
-void bitmap_modified(void *bitmap);
-
-int bitmap_get_width(void *bitmap);
-int bitmap_get_height(void *bitmap);
+/**
+ * Bitmap operations.
+ */
+struct gui_bitmap_table {
+ /* Mandantory entries */
+
+ /**
+ * Create a new bitmap
+ */
+ void *(*create)(int width, int height, unsigned int state);
+
+ /**
+ * Destroy a bitmap
+ */
+ void (*destroy)(void *bitmap);
+
+ /**
+ * Set the opacity of a bitmap
+ */
+ void (*set_opaque)(void *bitmap, bool opaque);
+
+ /**
+ * Get the opacity of a bitmap
+ */
+ bool (*get_opaque)(void *bitmap);
+
+ /**
+ */
+ bool (*test_opaque)(void *bitmap);
+
+ /**
+ */
+ unsigned char *(*get_buffer)(void *bitmap);
+
+ /**
+ */
+ size_t (*get_rowstride)(void *bitmap);
+
+ /**
+ */
+ int (*get_width)(void *bitmap);
+
+ /**
+ */
+ int (*get_height)(void *bitmap);
+
+ /**
+ */
+ size_t (*get_bpp)(void *bitmap);
+
+ /**
+ */
+ bool (*save)(void *bitmap, const char *path, unsigned flags);
+
+ /**
+ * Marks a bitmap as modified.
+ */
+ void (*modified)(void *bitmap);
+};
#endif