NetSurf
Functions | Variables
bitmap.c File Reference

win32 implementation of the bitmap operations. More...

#include "utils/config.h"
#include <inttypes.h>
#include <sys/types.h>
#include <string.h>
#include <windows.h>
#include "utils/log.h"
#include "netsurf/bitmap.h"
#include "netsurf/plotters.h"
#include "netsurf/content.h"
#include "windows/plot.h"
#include "windows/bitmap.h"
Include dependency graph for bitmap.c:

Go to the source code of this file.

Functions

static void * win32_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...
 
void win32_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 whether a bitmap should be plotted opaque. More...
 
static bool bitmap_get_opaque (void *bitmap)
 Gets whether a bitmap should be plotted opaque. More...
 
static int bitmap_get_width (void *bitmap)
 
static int bitmap_get_height (void *bitmap)
 
struct bitmapbitmap_scale (struct bitmap *prescale, int width, int height)
 
static nserror bitmap_render (struct bitmap *bitmap, struct hlcache_handle *content)
 

Variables

static struct gui_bitmap_table bitmap_table
 
struct gui_bitmap_tablewin32_bitmap_table = &bitmap_table
 

Detailed Description

win32 implementation of the bitmap operations.

Definition in file bitmap.c.

Function Documentation

◆ bitmap_get_buffer()

static unsigned char * bitmap_get_buffer ( void *  bitmap)
static

Return a pointer to the pixel data in a bitmap.

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().

Parameters
bitmapa bitmap, as returned by bitmap_create()
Returns
pointer to the pixel buffer

Definition at line 115 of file bitmap.c.

References bitmap(), NSLOG, and bitmap::pixdata.

Here is the call graph for this function:

◆ bitmap_get_height()

static int bitmap_get_height ( void *  bitmap)
static

Definition at line 224 of file bitmap.c.

References bitmap(), bitmap::height, and NSLOG.

Here is the call graph for this function:

◆ bitmap_get_opaque()

static bool bitmap_get_opaque ( void *  bitmap)
static

Gets whether a bitmap should be plotted opaque.

Parameters
bitmapa bitmap, as returned by bitmap_create()

Definition at line 200 of file bitmap.c.

References bitmap(), NSLOG, and bitmap::opaque.

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 133 of file bitmap.c.

References bitmap(), NSLOG, and bitmap::width.

Here is the call graph for this function:

◆ bitmap_get_width()

static int bitmap_get_width ( void *  bitmap)
static

Definition at line 212 of file bitmap.c.

References bitmap(), NSLOG, and bitmap::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 171 of file bitmap.c.

◆ bitmap_render()

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

Definition at line 269 of file bitmap.c.

References BITMAP_CLEAR, BITMAP_OPAQUE, content_get_width(), content_scaled_redraw(), bitmap::height, height, redraw_context::interactive, max, min, NSERROR_NOMEM, NSERROR_OK, NSLOG, bitmap::opaque, plot_hdc, bitmap::width, width, win32_bitmap_create(), win32_bitmap_destroy(), win_plotters, and bitmap::windib.

Here is the call graph for this function:

◆ bitmap_scale()

struct bitmap * bitmap_scale ( struct bitmap prescale,
int  width,
int  height 
)

Definition at line 236 of file bitmap.c.

References bitmap::height, height, bitmap::pixdata, bitmap::width, and width.

Referenced by plot_alpha_bitmap().

Here is the caller graph for this function:

◆ bitmap_set_opaque()

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

Sets whether a bitmap should be plotted opaque.

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

Definition at line 180 of file bitmap.c.

References bitmap(), NSLOG, and bitmap::opaque.

Here is the call graph for this function:

◆ win32_bitmap_create()

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

Create a bitmap.

Parameters
widthwidth of image in pixels
heightheight of image in pixels
stateflags flags for bitmap creation
Returns
an opaque struct bitmap, or NULL on memory exhaustion

Definition at line 48 of file bitmap.c.

References bitmap(), BITMAP_OPAQUE, bitmap::height, height, NSLOG, bitmap::opaque, bitmap::pbmi, bitmap::pixdata, bitmap::width, width, and bitmap::windib.

Referenced by bitmap_render().

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

◆ win32_bitmap_destroy()

void win32_bitmap_destroy ( void *  bitmap)

Free a bitmap.

Parameters
bitmapa bitmap, as returned by bitmap_create()

Definition at line 151 of file bitmap.c.

References bitmap(), NSLOG, bitmap::pbmi, and bitmap::windib.

Referenced by bitmap_render().

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:
= {
.set_opaque = bitmap_set_opaque,
.get_opaque = bitmap_get_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:171
static size_t bitmap_get_rowstride(void *bitmap)
Find the width of a pixel row in bytes.
Definition: bitmap.c:133
void win32_bitmap_destroy(void *bitmap)
Free a bitmap.
Definition: bitmap.c:151
static nserror bitmap_render(struct bitmap *bitmap, struct hlcache_handle *content)
Definition: bitmap.c:269
static unsigned char * bitmap_get_buffer(void *bitmap)
Return a pointer to the pixel data in a bitmap.
Definition: bitmap.c:115
static void bitmap_set_opaque(void *bitmap, bool opaque)
Sets whether a bitmap should be plotted opaque.
Definition: bitmap.c:180
static void * win32_bitmap_create(int width, int height, enum gui_bitmap_flags flags)
Create a bitmap.
Definition: bitmap.c:48
static bool bitmap_get_opaque(void *bitmap)
Gets whether a bitmap should be plotted opaque.
Definition: bitmap.c:200

Definition at line 325 of file bitmap.c.

◆ win32_bitmap_table

struct gui_bitmap_table* win32_bitmap_table = &bitmap_table

Definition at line 338 of file bitmap.c.

Referenced by WinMain().