summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2022-03-26 14:15:46 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2022-03-26 15:45:00 +0000
commite9d1a1fa9d698c0f6507f1b2ab719ce0fc5a0550 (patch)
tree63e95fb6eb1c95726d88e2319fcf4c4265283c56 /include
parent6011da798ff305ddee7ef36829f4c8c451cab600 (diff)
downloadnetsurf-e9d1a1fa9d698c0f6507f1b2ab719ce0fc5a0550.tar.gz
netsurf-e9d1a1fa9d698c0f6507f1b2ab719ce0fc5a0550.tar.bz2
Include: Bitmap: Add API for setting core bitmap format.
Diffstat (limited to 'include')
-rw-r--r--include/netsurf/bitmap.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/include/netsurf/bitmap.h b/include/netsurf/bitmap.h
index a5be75d74..da1c284e6 100644
--- a/include/netsurf/bitmap.h
+++ b/include/netsurf/bitmap.h
@@ -61,11 +61,78 @@ enum gui_bitmap_flags {
BITMAP_CLEAR = (1 << 1), /**< memory should be wiped to 0 */
};
+/**
+ * NetSurf bitmap pixel layout.
+ *
+ * All pixels are 32 bits per pixel (bpp). The different layouts allow control
+ * over the ordering of colour channels. All colour channels are 8 bits wide.
+ */
+enum bitmap_layout {
+ /** Bite-wise RGBA: Byte order: 0xRR, 0xGG, 0xBB, 0xAA. */
+ BITMAP_LAYOUT_R8G8B8A8,
+
+ /** Bite-wise BGRA: Byte order: 0xBB, 0xGG, 0xRR, 0xAA. */
+ BITMAP_LAYOUT_B8G8R8A8,
+
+ /** Bite-wise ARGB: Byte order: 0xAA, 0xRR, 0xGG, 0xBB. */
+ BITMAP_LAYOUT_A8R8G8B8,
+
+ /** Bite-wise ABGR: Byte order: 0xAA, 0xBB, 0xGG, 0xRR. */
+ BITMAP_LAYOUT_A8B8G8R8,
+
+ /**
+ * 32-bit RGBA (0xRRGGBBAA).
+ *
+ * * On little endian host, same as \ref BITMAP_LAYOUT_A8B8G8R8.
+ * * On big endian host, same as \ref BITMAP_LAYOUT_R8G8B8A8.
+ */
+ BITMAP_LAYOUT_RGBA8888,
+
+ /**
+ * 32-bit BGRA (0xBBGGRRAA).
+ *
+ * * On little endian host, same as \ref BITMAP_LAYOUT_A8R8G8B8.
+ * * On big endian host, same as \ref BITMAP_LAYOUT_B8G8R8A8.
+ */
+ BITMAP_LAYOUT_BGRA8888,
+
+ /**
+ * 32-bit ARGB (0xAARRGGBB).
+ *
+ * * On little endian host, same as \ref BITMAP_LAYOUT_B8G8R8A8.
+ * * On big endian host, same as \ref BITMAP_LAYOUT_A8R8G8B8.
+ */
+ BITMAP_LAYOUT_ARGB8888,
+
+ /**
+ * 32-bit BGRA (0xAABBGGRR).
+ *
+ * * On little endian host, same as \ref BITMAP_LAYOUT_R8G8B8A8.
+ * * On big endian host, same as \ref BITMAP_LAYOUT_A8B8G8R8.
+ */
+ BITMAP_LAYOUT_ABGR8888,
+};
+
+/** Bitmap format specifier. */
+typedef struct bitmap_fmt {
+ enum bitmap_layout layout; /** Colour component layout. */
+} bitmap_fmt_t;
+
struct content;
struct bitmap;
struct hlcache_handle;
/**
+ * Set client bitmap format.
+ *
+ * Set this to ensure that the bitmaps decoded by the core are in the
+ * correct format for the front end.
+ *
+ * \param[in] bitmap_format The bitmap format specification to set.
+ */
+void bitmap_set_format(const bitmap_fmt_t *bitmap_format);
+
+/**
* Bitmap operations.
*/
struct gui_bitmap_table {