NetSurf
Data Structures | Typedefs | Enumerations | Functions
bitmap.h File Reference

Generic bitmap handling interface. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bitmap_fmt
 Bitmap format specifier. More...
 
struct  gui_bitmap_table
 Bitmap operations. More...
 

Typedefs

typedef struct bitmap_fmt bitmap_fmt_t
 Bitmap format specifier. More...
 

Enumerations

enum  gui_bitmap_flags { BITMAP_NONE = 0 , BITMAP_OPAQUE = (1 << 0) , BITMAP_CLEAR = (1 << 1) }
 Bitmap creation flags. More...
 
enum  bitmap_layout {
  BITMAP_LAYOUT_R8G8B8A8 , BITMAP_LAYOUT_B8G8R8A8 , BITMAP_LAYOUT_A8R8G8B8 , BITMAP_LAYOUT_A8B8G8R8 ,
  BITMAP_LAYOUT_RGBA8888 , BITMAP_LAYOUT_BGRA8888 , BITMAP_LAYOUT_ARGB8888 , BITMAP_LAYOUT_ABGR8888
}
 NetSurf bitmap pixel layout. More...
 

Functions

void bitmap_set_format (const bitmap_fmt_t *bitmap_format)
 Set client bitmap format. More...
 
bool bitmap_test_opaque (void *bitmap)
 Test whether a bitmap is completely opaque (no transparency). More...
 

Detailed Description

Generic bitmap handling interface.

This interface wraps the native platform-specific image format.

Bitmaps are required to be 32bpp with 8-bit components. The components are red, green, blue, and alpha, in client specified order.

The component order may be set in the front ends by calling bitmap_set_format().

Definition in file bitmap.h.

Typedef Documentation

◆ bitmap_fmt_t

typedef struct bitmap_fmt bitmap_fmt_t

Bitmap format specifier.

Enumeration Type Documentation

◆ bitmap_layout

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.

Enumerator
BITMAP_LAYOUT_R8G8B8A8 

Bite-wise RGBA: Byte order: 0xRR, 0xGG, 0xBB, 0xAA.

BITMAP_LAYOUT_B8G8R8A8 

Bite-wise BGRA: Byte order: 0xBB, 0xGG, 0xRR, 0xAA.

BITMAP_LAYOUT_A8R8G8B8 

Bite-wise ARGB: Byte order: 0xAA, 0xRR, 0xGG, 0xBB.

BITMAP_LAYOUT_A8B8G8R8 

Bite-wise ABGR: Byte order: 0xAA, 0xBB, 0xGG, 0xRR.

BITMAP_LAYOUT_RGBA8888 

32-bit RGBA (0xRRGGBBAA).

BITMAP_LAYOUT_BGRA8888 

32-bit BGRA (0xBBGGRRAA).

BITMAP_LAYOUT_ARGB8888 

32-bit ARGB (0xAARRGGBB).

BITMAP_LAYOUT_ABGR8888 

32-bit BGRA (0xAABBGGRR).

Definition at line 48 of file bitmap.h.

◆ gui_bitmap_flags

Bitmap creation flags.

Enumerator
BITMAP_NONE 
BITMAP_OPAQUE 

image is opaque

BITMAP_CLEAR 

memory should be wiped to 0

Definition at line 36 of file bitmap.h.

Function Documentation

◆ bitmap_set_format()

void bitmap_set_format ( const bitmap_fmt_t bitmap_format)

Set client bitmap format.

Set this to ensure that the bitmaps decoded by the core are in the correct format for the front end.

Parameters
[in]bitmap_formatThe bitmap format specification to set.

Definition at line 118 of file bitmap.c.

References bitmap__get_colour_layout(), bitmap__layout_to_str(), bitmap_sanitise_bitmap_layout(), bitmap_fmt::layout, NSLOG, and bitmap_fmt::pma.

Referenced by ami_plot_ra_alloc(), and nsgtk_setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bitmap_test_opaque()

bool bitmap_test_opaque ( void *  bitmap)

Test whether a bitmap is completely opaque (no transparency).

Parameters
[in]bitmapThe bitmap to test.
Returns
Returns true if the bitmap is opaque, false otherwise.

Definition at line 316 of file bitmap.c.

References netsurf_table::bitmap, buffer, gui_bitmap_table::get_buffer, gui_bitmap_table::get_height, gui_bitmap_table::get_rowstride, gui_bitmap_table::get_width, guit, height, and width.

Referenced by ami_bitmap_from_datatype(), gif_create_gif_data(), nspng_convert(), and png_cache_convert().

Here is the caller graph for this function: