NetSurf
Functions | Variables
bitmap.c File Reference

Framebuffer implementation of generic bitmap interface. More...

#include <inttypes.h>
#include <sys/types.h>
#include <stdbool.h>
#include <assert.h>
#include <libnsfb.h>
#include <libnsfb_plot.h>
#include "utils/log.h"
#include "utils/utils.h"
#include "netsurf/bitmap.h"
#include "netsurf/plotters.h"
#include "netsurf/content.h"
#include "framebuffer/gui.h"
#include "framebuffer/fbtk.h"
#include "framebuffer/framebuffer.h"
#include "framebuffer/bitmap.h"
Include dependency graph for bitmap.c:

Go to the source code of this file.

Functions

static void * bitmap_create (int width, int height, enum gui_bitmap_flags flags)
 Create a bitmap. More...
 
static unsigned char * bitmap_get_buffer (void *bitmap)
 Return a pointer to the pixel data in a bitmap. More...
 
static size_t bitmap_get_rowstride (void *bitmap)
 Find the width of a pixel row in bytes. More...
 
static void bitmap_destroy (void *bitmap)
 Free a bitmap. More...
 
static void bitmap_modified (void *bitmap)
 The bitmap image has changed, so flush any persistant cache. More...
 
static void bitmap_set_opaque (void *bitmap, bool opaque)
 Sets wether a bitmap should be plotted opaque. More...
 
bool framebuffer_bitmap_get_opaque (void *bitmap)
 Gets weather a bitmap should be plotted opaque. More...
 
static int bitmap_get_width (void *bitmap)
 
static int bitmap_get_height (void *bitmap)
 
static nserror bitmap_render (struct bitmap *bitmap, struct hlcache_handle *content)
 Render content into a bitmap. More...
 

Variables

static struct gui_bitmap_table bitmap_table
 
struct gui_bitmap_tableframebuffer_bitmap_table = &bitmap_table
 

Detailed Description

Framebuffer implementation of generic bitmap interface.

Definition in file bitmap.c.

Function Documentation

◆ bitmap_create()

static void * bitmap_create ( int  width,
int  height,
enum gui_bitmap_flags  flags 
)
static

Create a bitmap.

Parameters
widthwidth of image in pixels
heightwidth of image in pixels
statea flag word indicating the initial state
Returns
an opaque struct bitmap, or NULL on memory exhaustion

Definition at line 50 of file bitmap.c.

References BITMAP_OPAQUE, height, and width.

◆ bitmap_destroy()

static void bitmap_destroy ( void *  bitmap)
static

Free a bitmap.

Parameters
bitmapa bitmap, as returned by bitmap_create()

Definition at line 120 of file bitmap.c.

References bitmap().

Here is the call graph for this function:

◆ bitmap_get_buffer()

static unsigned char * bitmap_get_buffer ( void *  bitmap)
static

Return a pointer to the pixel data in a bitmap.

Parameters
bitmapa bitmap, as returned by bitmap_create()
Returns
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().

Definition at line 83 of file bitmap.c.

References bitmap().

Here is the call graph for this function:

◆ bitmap_get_height()

static int bitmap_get_height ( void *  bitmap)
static

Definition at line 190 of file bitmap.c.

References bitmap(), and height.

Here is the call graph for this function:

◆ bitmap_get_rowstride()

static size_t bitmap_get_rowstride ( void *  bitmap)
static

Find the width of a pixel row in bytes.

Parameters
bitmapa bitmap, as returned by bitmap_create()
Returns
width of a pixel row in the bitmap

Definition at line 102 of file bitmap.c.

References bitmap().

Here is the call graph for this function:

◆ bitmap_get_width()

static int bitmap_get_width ( void *  bitmap)
static

Definition at line 178 of file bitmap.c.

References bitmap(), and width.

Here is the call graph for this function:

◆ bitmap_modified()

static void bitmap_modified ( void *  bitmap)
static

The bitmap image has changed, so flush any persistant cache.

Parameters
bitmapa bitmap, as returned by bitmap_create()

Definition at line 135 of file bitmap.c.

◆ bitmap_render()

static nserror bitmap_render ( struct bitmap bitmap,
struct hlcache_handle content 
)
static

Render content into a bitmap.

Parameters
bitmapthe bitmap to draw to
contentcontent structure to render
Returns
true on success and bitmap updated else false

Definition at line 210 of file bitmap.c.

References content_get_width(), content_scaled_redraw(), fb_plotters, framebuffer_set_surface(), height, redraw_context::interactive, max, min, NSERROR_NOMEM, NSERROR_OK, NSLOG, and width.

Here is the call graph for this function:

◆ bitmap_set_opaque()

static void bitmap_set_opaque ( void *  bitmap,
bool  opaque 
)
static

Sets wether a bitmap should be plotted opaque.

Parameters
bitmapa bitmap, as returned by bitmap_create()
opaquewhether the bitmap should be plotted opaque

Definition at line 144 of file bitmap.c.

References bitmap().

Here is the call graph for this function:

◆ framebuffer_bitmap_get_opaque()

bool framebuffer_bitmap_get_opaque ( void *  bitmap)

Gets weather a bitmap should be plotted opaque.

Parameters
bitmapa bitmap, as returned by bitmap_create()

Definition at line 163 of file bitmap.c.

References bitmap().

Referenced by framebuffer_plot_bitmap().

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

Variable Documentation

◆ bitmap_table

struct gui_bitmap_table bitmap_table
static
Initial value:
= {
.create = bitmap_create,
.destroy = bitmap_destroy,
.set_opaque = bitmap_set_opaque,
.get_buffer = bitmap_get_buffer,
.get_rowstride = bitmap_get_rowstride,
.get_width = bitmap_get_width,
.get_height = bitmap_get_height,
.modified = bitmap_modified,
.render = bitmap_render,
}
int bitmap_get_width(void *bitmap)
get width of a bitmap.
Definition: bitmap.c:319
int bitmap_get_height(void *bitmap)
get height of a bitmap.
Definition: bitmap.c:336
static void bitmap_modified(void *bitmap)
The bitmap image has changed, so flush any persistant cache.
Definition: bitmap.c:135
static size_t bitmap_get_rowstride(void *bitmap)
Find the width of a pixel row in bytes.
Definition: bitmap.c:102
static nserror bitmap_render(struct bitmap *bitmap, struct hlcache_handle *content)
Render content into a bitmap.
Definition: bitmap.c:210
static unsigned char * bitmap_get_buffer(void *bitmap)
Return a pointer to the pixel data in a bitmap.
Definition: bitmap.c:83
static void bitmap_set_opaque(void *bitmap, bool opaque)
Sets wether a bitmap should be plotted opaque.
Definition: bitmap.c:144
static void * bitmap_create(int width, int height, enum gui_bitmap_flags flags)
Create a bitmap.
Definition: bitmap.c:50
bool framebuffer_bitmap_get_opaque(void *bitmap)
Gets weather a bitmap should be plotted opaque.
Definition: bitmap.c:163
static void bitmap_destroy(void *bitmap)
Free a bitmap.
Definition: bitmap.c:120

Definition at line 272 of file bitmap.c.

◆ framebuffer_bitmap_table

struct gui_bitmap_table* framebuffer_bitmap_table = &bitmap_table

Definition at line 285 of file bitmap.c.

Referenced by main().