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

Atari bitmap handling implementation. More...

#include <gem.h>
#include <Hermes/Hermes.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
 RISC OS wimp toolkit bitmap. More...
 

Macros

#define NS_BMP_DEFAULT_BPP   4
 
#define MFDB_FLAG_STAND   0x01
 
#define MFDB_FLAG_ZEROMEM   0x02
 
#define MFDB_FLAG_NOALLOC   0x04
 
#define BITMAP_SHRINK   0
 
#define BITMAP_GROW   1024 /* Don't realloc when bitmap size shrinks */
 
#define BITMAP_CLEAR   2048 /* Zero bitmap memory */
 
#define MFDB_STRIDE(w)   (((w & 15) != 0) ? (w | 15)+1 : w)
 Calculates MFDB compatible rowstride (in number of bits) More...
 
#define MFDB_SIZE(bpp, stride, h)   ( ((stride >> 3) * h) * bpp )
 Calculate size of an mfdb,. More...
 

Functions

int init_mfdb (int bpp, int w, int h, uint32_t flags, MFDB *out)
 setup an MFDB struct and allocate memory for it when it is needed. More...
 
void * atari_bitmap_create (int w, int h, enum gui_bitmap_flags flags)
 Create a bitmap. More...
 
size_t atari_bitmap_get_rowstride (void *bitmap)
 Find the width of a pixel row in bytes. More...
 
void atari_bitmap_destroy (void *bitmap)
 Free a bitmap. More...
 
int atari_bitmap_get_width (void *bitmap)
 Get bitmap width. More...
 
int atari_bitmap_get_height (void *bitmap)
 Get bitmap height. More...
 
bool atari_bitmap_get_opaque (void *bitmap)
 Gets whether a bitmap should be plotted opaque. More...
 
size_t atari_bitmap_buffer_size (void *bitmap)
 
bool atari_bitmap_resize (struct bitmap *img, HermesHandle hermes_h, HermesFormat *fmt, int nw, int nh)
 
void * atari_bitmap_realloc (int w, int h, short bpp, int rowstride, unsigned int state, void *bmp)
 

Variables

struct gui_bitmap_tableatari_bitmap_table
 

Detailed Description

Atari bitmap handling implementation.

Definition in file bitmap.h.

Macro Definition Documentation

◆ BITMAP_CLEAR

#define BITMAP_CLEAR   2048 /* Zero bitmap memory */

Definition at line 39 of file bitmap.h.

◆ BITMAP_GROW

#define BITMAP_GROW   1024 /* Don't realloc when bitmap size shrinks */

Definition at line 38 of file bitmap.h.

◆ BITMAP_SHRINK

#define BITMAP_SHRINK   0

Definition at line 37 of file bitmap.h.

◆ MFDB_FLAG_NOALLOC

#define MFDB_FLAG_NOALLOC   0x04

Definition at line 35 of file bitmap.h.

◆ MFDB_FLAG_STAND

#define MFDB_FLAG_STAND   0x01

Definition at line 33 of file bitmap.h.

◆ MFDB_FLAG_ZEROMEM

#define MFDB_FLAG_ZEROMEM   0x02

Definition at line 34 of file bitmap.h.

◆ MFDB_SIZE

#define MFDB_SIZE (   bpp,
  stride,
 
)    ( ((stride >> 3) * h) * bpp )

Calculate size of an mfdb,.

Parameters
bppBits per pixel.
strideWord aligned rowstride (width) as returned by MFDB_STRIDE,
hHeight in pixels.

Definition at line 55 of file bitmap.h.

◆ MFDB_STRIDE

#define MFDB_STRIDE (   w)    (((w & 15) != 0) ? (w | 15)+1 : w)

Calculates MFDB compatible rowstride (in number of bits)

Definition at line 45 of file bitmap.h.

◆ NS_BMP_DEFAULT_BPP

#define NS_BMP_DEFAULT_BPP   4

Definition at line 30 of file bitmap.h.

Function Documentation

◆ atari_bitmap_buffer_size()

size_t atari_bitmap_buffer_size ( void *  bitmap)

Definition at line 208 of file bitmap.c.

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

Referenced by snapshot_suspend().

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

◆ atari_bitmap_create()

void * atari_bitmap_create ( int  w,
int  h,
enum gui_bitmap_flags  flags 
)

Create a bitmap.

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

Definition at line 121 of file bitmap.c.

References atari_bitmap_create_ex(), and NS_BMP_DEFAULT_BPP.

Referenced by snapshot_create().

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

◆ atari_bitmap_destroy()

void atari_bitmap_destroy ( void *  bitmap)

Free a bitmap.

Parameters
bitmapa bitmap, as returned by bitmap_create()

Definition at line 231 of file bitmap.c.

References atari_bitmap_destroy(), bitmap(), bitmap::converted, bitmap::native, NSLOG, bitmap::pixdata, and bitmap::resized.

Referenced by atari_bitmap_destroy(), atari_bitmap_resize(), bitmap_convert_tc(), bitmap_modified(), and snapshot_destroy().

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

◆ atari_bitmap_get_height()

int atari_bitmap_get_height ( void *  bitmap)

Get bitmap height.

Parameters
bitmapa bitmap, as returned by bitmap_create()

Definition at line 301 of file bitmap.c.

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

Referenced by atari_bitmap_resize(), bitmap_convert_tc(), and plot_bitmap().

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

◆ atari_bitmap_get_opaque()

bool atari_bitmap_get_opaque ( void *  bitmap)

Gets whether a bitmap should be plotted opaque.

Parameters
bitmapa bitmap, as returned by bitmap_create()

Definition at line 273 of file bitmap.c.

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

Referenced by bitmap_convert_tc().

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

◆ atari_bitmap_get_rowstride()

size_t atari_bitmap_get_rowstride ( void *  bitmap)

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

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

Referenced by ablend_bitmap(), ablend_pixel(), atari_bitmap_resize(), and snapshot_create().

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

◆ atari_bitmap_get_width()

int atari_bitmap_get_width ( void *  bitmap)

Get bitmap width.

Parameters
bitmapa bitmap, as returned by bitmap_create()

Definition at line 287 of file bitmap.c.

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

Referenced by atari_bitmap_resize(), bitmap_convert_tc(), and plot_bitmap().

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

◆ atari_bitmap_realloc()

void * atari_bitmap_realloc ( int  w,
int  h,
short  bpp,
int  rowstride,
unsigned int  state,
void *  bmp 
)

Definition at line 149 of file bitmap.c.

References BITMAP_CLEAR, BITMAP_GROW, bitmap_modified(), bitmap::bpp, bitmap::height, bitmap::pixdata, bitmap::resized, bitmap::rowstride, and bitmap::width.

Referenced by snapshot_create(), and snapshot_suspend().

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

◆ atari_bitmap_resize()

bool atari_bitmap_resize ( struct bitmap img,
HermesHandle  hermes_h,
HermesFormat *  fmt,
int  nw,
int  nh 
)

Definition at line 313 of file bitmap.c.

References atari_bitmap_create_ex(), atari_bitmap_destroy(), atari_bitmap_get_height(), atari_bitmap_get_rowstride(), atari_bitmap_get_width(), BITMAP_OPAQUE, bitmap::bpp, bitmap::height, bitmap::opaque, bitmap::pixdata, bitmap::resized, and bitmap::width.

Referenced by plot_bitmap().

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

◆ init_mfdb()

int init_mfdb ( int  bpp,
int  w,
int  h,
uint32_t  flags,
MFDB *  out 
)

setup an MFDB struct and allocate memory for it when it is needed.

If bpp == 0, this function assumes that the MFDB shall point to the screen and will not allocate any memory (mfdb.fd_addr == 0).

Returns
0 when the memory allocation fails (out of memory), otherwise it returns the size of the mfdb.fd_addr as number of bytes.

Definition at line 41 of file bitmap.c.

References MFDB_FLAG_NOALLOC, MFDB_FLAG_STAND, MFDB_FLAG_ZEROMEM, MFDB_SIZE, and MFDB_STRIDE.

Referenced by plot_blit_mfdb(), snapshot_create_native_mfdb(), and window_place_caret().

Here is the caller graph for this function:

Variable Documentation

◆ atari_bitmap_table

struct gui_bitmap_table* atari_bitmap_table
extern

Definition at line 391 of file bitmap.c.

Referenced by main().