NetSurf
Data Structures | Functions | Variables
bitmap.h File Reference

Internal core bitmap interface. More...

#include <nsutils/endian.h>
#include "netsurf/types.h"
#include "netsurf/bitmap.h"
Include dependency graph for bitmap.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bitmap_colour_layout
 Pixel format: colour component order. More...
 

Functions

static colour bitmap_pixel_to_colour (const uint8_t *pixel)
 Convert a bitmap pixel to a NetSurf colour (0xAARRGGBB). More...
 
static enum bitmap_layout bitmap_sanitise_bitmap_layout (enum bitmap_layout layout)
 Sanitise bitmap pixel component layout. More...
 
void bitmap_format_convert (void *bitmap, const bitmap_fmt_t *from, const bitmap_fmt_t *to)
 Convert bitmap from one format to another. More...
 
static void bitmap_format_to_client (void *bitmap, const bitmap_fmt_t *current_fmt)
 Convert a bitmap to the client bitmap format. More...
 
static void bitmap_format_from_client (void *bitmap, const bitmap_fmt_t *target_fmt)
 Convert a bitmap to the client bitmap format. More...
 

Variables

bitmap_fmt_t bitmap_fmt
 The client bitmap format. More...
 
struct bitmap_colour_layout bitmap_layout
 The client bitmap colour channel layout. More...
 

Detailed Description

Internal core bitmap interface.

Definition in file bitmap.h.

Function Documentation

◆ bitmap_format_convert()

void bitmap_format_convert ( void *  bitmap,
const bitmap_fmt_t from,
const bitmap_fmt_t to 
)

Convert bitmap from one format to another.

Note that both formats should be sanitised.

Parameters
[in]bitmapThe bitmap to convert.
[in]fromThe current bitmap format specifier.
[in]toThe bitmap format to convert to.

Definition at line 278 of file bitmap.c.

References netsurf_table::bitmap, bitmap__format_convert(), bitmap__format_convert_from_pma(), bitmap__format_convert_to_pma(), bitmap__get_colour_layout(), buffer, from, gui_bitmap_table::get_buffer, gui_bitmap_table::get_height, gui_bitmap_table::get_opaque, gui_bitmap_table::get_rowstride, gui_bitmap_table::get_width, guit, height, bitmap_fmt::layout, NSLOG, bitmap_fmt::pma, to, and width.

Referenced by bitmap_format_from_client(), and bitmap_format_to_client().

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

◆ bitmap_format_from_client()

static void bitmap_format_from_client ( void *  bitmap,
const bitmap_fmt_t target_fmt 
)
inlinestatic

Convert a bitmap to the client bitmap format.

Parameters
[in]bitmapThe bitmap to convert.
[in]target_fmtThe target bitmap format specifier.

Definition at line 135 of file bitmap.h.

References bitmap_format_convert(), bitmap_sanitise_bitmap_layout(), bitmap_fmt::layout, bitmap_fmt::pma, and to.

Here is the call graph for this function:

◆ bitmap_format_to_client()

static void bitmap_format_to_client ( void *  bitmap,
const bitmap_fmt_t current_fmt 
)
inlinestatic

Convert a bitmap to the client bitmap format.

Parameters
[in]bitmapThe bitmap to convert.
[in]current_fmtThe current bitmap format specifier.

Definition at line 117 of file bitmap.h.

References bitmap_format_convert(), bitmap_sanitise_bitmap_layout(), from, bitmap_fmt::layout, and bitmap_fmt::pma.

Referenced by jpegxl_cache_convert(), nsbmp_redraw(), nsico__decode(), nspng_convert(), nssprite_convert(), png_cache_convert(), rsvg_cache_convert(), rsvg_convert(), and webp_cache_convert().

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

◆ bitmap_pixel_to_colour()

static colour bitmap_pixel_to_colour ( const uint8_t *  pixel)
inlinestatic

Convert a bitmap pixel to a NetSurf colour (0xAARRGGBB).

The bitmap must be in the client format.

Parameters
[in]Pointerto a pixel in the bitmap's pixel data.
Returns
The corresponding NetSurf colour.

Definition at line 53 of file bitmap.h.

Referenced by image_bitmap_plot().

Here is the caller graph for this function:

◆ bitmap_sanitise_bitmap_layout()

static enum bitmap_layout bitmap_sanitise_bitmap_layout ( enum bitmap_layout  layout)
inlinestatic

Sanitise bitmap pixel component layout.

Map endian-dependant layouts to byte-wise layout for the host.

Parameters
[in]layoutLayout to convert.
Returns
sanitised layout.

Definition at line 69 of file bitmap.h.

References BITMAP_LAYOUT_A8B8G8R8, BITMAP_LAYOUT_A8R8G8B8, BITMAP_LAYOUT_ABGR8888, BITMAP_LAYOUT_ARGB8888, BITMAP_LAYOUT_B8G8R8A8, BITMAP_LAYOUT_BGRA8888, BITMAP_LAYOUT_R8G8B8A8, and BITMAP_LAYOUT_RGBA8888.

Referenced by bitmap_format_from_client(), bitmap_format_to_client(), and bitmap_set_format().

Here is the caller graph for this function:

Variable Documentation

◆ bitmap_fmt

The client bitmap format.

Definition at line 34 of file bitmap.c.

◆ bitmap_layout

The client bitmap colour channel layout.

Definition at line 37 of file bitmap.c.