NetSurf
Macros | Functions | Variables
bitmap.h File Reference
#include <stdbool.h>
#include <exec/types.h>
#include <proto/graphics.h>
#include <intuition/classusr.h>
#include <libraries/Picasso96.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.

Macros

#define AMI_BITMAP_FORMAT   RGBFB_A8R8G8B8
 
#define AMI_BITMAP_SCALE_ICON   0xFF
 

Functions

struct BitMap * ami_bitmap_get_native (struct bitmap *bitmap, int width, int height, bool palette_mapped, struct BitMap *friendbm)
 
PLANEPTR ami_bitmap_get_mask (struct bitmap *bitmap, int width, int height, struct BitMap *n_bm)
 
Object * ami_datatype_object_from_bitmap (struct bitmap *bitmap)
 
struct bitmapami_bitmap_from_datatype (char *filename)
 
void ami_bitmap_set_url (struct bitmap *bm, struct nsurl *url)
 Set bitmap URL. More...
 
void ami_bitmap_set_title (struct bitmap *bm, const char *title)
 Set bitmap title. More...
 
void ami_bitmap_set_icondata (struct bitmap *bm, ULONG *icondata)
 Set an icondata pointer. More...
 
void ami_bitmap_free_icondata (struct bitmap *bm)
 Free an icondata pointer. More...
 
bool ami_bitmap_is_nativebm (struct bitmap *bm, struct BitMap *nbm)
 Test if a BitMap is owned by a bitmap. More...
 
void ami_bitmap_fini (void)
 Cleanup bitmap allocations. More...
 
void * amiga_bitmap_create (int width, int height, enum gui_bitmap_flags flags)
 Create a bitmap. More...
 
unsigned char * amiga_bitmap_get_buffer (void *bitmap)
 Return a pointer to the pixel data in a bitmap. More...
 
size_t amiga_bitmap_get_rowstride (void *bitmap)
 Find the width of a pixel row in bytes. More...
 
int bitmap_get_width (void *bitmap)
 Return the width of a bitmap. More...
 
int bitmap_get_height (void *bitmap)
 Return the height of a bitmap. More...
 
void amiga_bitmap_destroy (void *bitmap)
 Free a bitmap. More...
 
bool amiga_bitmap_save (void *bitmap, const char *path, unsigned flags)
 Save a bitmap in the platform's native format. More...
 
void amiga_bitmap_modified (void *bitmap)
 The bitmap image has changed, so flush any persistant cache. More...
 
void amiga_bitmap_set_opaque (void *bitmap, bool opaque)
 Sets whether a bitmap should be plotted opaque. More...
 
bool amiga_bitmap_get_opaque (void *bitmap)
 Gets whether a bitmap should be plotted opaque. More...
 

Variables

struct gui_bitmap_tableamiga_bitmap_table
 

Macro Definition Documentation

◆ AMI_BITMAP_FORMAT

#define AMI_BITMAP_FORMAT   RGBFB_A8R8G8B8

Definition at line 30 of file bitmap.h.

◆ AMI_BITMAP_SCALE_ICON

#define AMI_BITMAP_SCALE_ICON   0xFF

Definition at line 31 of file bitmap.h.

Function Documentation

◆ ami_bitmap_fini()

void ami_bitmap_fini ( void  )

Cleanup bitmap allocations.

Definition at line 678 of file bitmap.c.

References ami_memory_itempool_delete, and pool_bitmap.

Referenced by main().

Here is the caller graph for this function:

◆ ami_bitmap_free_icondata()

void ami_bitmap_free_icondata ( struct bitmap bm)

Free an icondata pointer.

Parameters
bma bitmap, as returned by bitmap_create()

This function probably shouldn't be here!

Definition at line 751 of file bitmap.c.

References bitmap::icondata.

Referenced by amiga_icon_free().

Here is the caller graph for this function:

◆ ami_bitmap_from_datatype()

struct bitmap * ami_bitmap_from_datatype ( char *  filename)

Definition at line 407 of file bitmap.c.

References amiga_bitmap_create(), amiga_bitmap_get_buffer(), amiga_bitmap_get_rowstride(), amiga_bitmap_set_opaque(), bitmap_test_opaque(), bitmap::dto, IDoMethod, and PDTA_PromoteMask.

Referenced by ami_theme_throbber_setup().

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

◆ ami_bitmap_get_mask()

PLANEPTR ami_bitmap_get_mask ( struct bitmap bitmap,
int  width,
int  height,
struct BitMap *  n_bm 
)

Definition at line 626 of file bitmap.c.

References amiga_bitmap_get_buffer(), amiga_bitmap_get_opaque(), bitmap::height, height, bitmap::native_mask, nsoption_int, SetMem, bitmap::width, and width.

Referenced by ami_bitmap(), ami_bitmap_tile(), and gui_window_set_icon().

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

◆ ami_bitmap_get_native()

struct BitMap * ami_bitmap_get_native ( struct bitmap bitmap,
int  width,
int  height,
bool  palette_mapped,
struct BitMap *  friendbm 
)

Definition at line 666 of file bitmap.c.

References ami_bitmap_get_palettemapped(), ami_bitmap_get_truecolour(), height, palette_mapped, and width.

Referenced by ami_bitmap(), ami_bitmap_tile(), ami_theme_throbber_setup(), amiga_icon_from_bitmap(), amiga_icon_superimpose_favicon_internal(), gui_search_web_provider_update(), and gui_window_set_icon().

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

◆ ami_bitmap_is_nativebm()

bool ami_bitmap_is_nativebm ( struct bitmap bm,
struct BitMap *  nbm 
)

Test if a BitMap is owned by a bitmap.

Parameters
bma bitmap, as returned by bitmap_create()
nbma BitMap, as created by AllocBitMap()
Returns
true if the BitMap is owned by the bitmap

Definition at line 757 of file bitmap.c.

References bitmap::nativebm.

Referenced by ami_bitmap(), and ami_bitmap_tile().

Here is the caller graph for this function:

◆ ami_bitmap_set_icondata()

void ami_bitmap_set_icondata ( struct bitmap bm,
ULONG *  icondata 
)

Set an icondata pointer.

Parameters
bma bitmap, as returned by bitmap_create()
icondataa pointer to memory

This function probably shouldn't be here!

Definition at line 746 of file bitmap.c.

References bitmap::icondata.

Referenced by amiga_icon_from_bitmap().

Here is the caller graph for this function:

◆ ami_bitmap_set_title()

void ami_bitmap_set_title ( struct bitmap bm,
const char *  title 
)

Set bitmap title.

Parameters
bma bitmap, as returned by bitmap_create()
titlea pointer to a title string

This is copied by the bitmap object. The title can only ever be set once for a bitmap.

Definition at line 740 of file bitmap.c.

References bitmap::title.

Referenced by ami_file_save(), and HOOKF().

Here is the caller graph for this function:

◆ ami_bitmap_set_url()

void ami_bitmap_set_url ( struct bitmap bm,
struct nsurl url 
)

Set bitmap URL.

Parameters
bma bitmap, as returned by bitmap_create()
urlthe url for the bitmap

A reference will be kept by the bitmap object. The URL can only ever be set once for a bitmap.

Definition at line 734 of file bitmap.c.

References nsurl_ref(), and bitmap::url.

Referenced by ami_file_save(), and HOOKF().

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

◆ ami_datatype_object_from_bitmap()

Object * ami_datatype_object_from_bitmap ( struct bitmap bitmap)

Definition at line 369 of file bitmap.c.

References amiga_bitmap_get_buffer(), amiga_bitmap_get_opaque(), amiga_bitmap_get_rowstride(), bitmap_get_height(), bitmap_get_width(), bitmap::dto, IDoMethod, messages_get(), nsurl_access(), bitmap::title, and bitmap::url.

Referenced by ami_easy_clipboard_bitmap(), and amiga_bitmap_save().

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

◆ amiga_bitmap_create()

void * amiga_bitmap_create ( int  width,
int  height,
enum gui_bitmap_flags  flags 
)

Create a bitmap.

Parameters
widthwidth of image in pixels
heightwidth of image in pixels
flagsflags for bitmap creation
Returns
an opaque struct bitmap, or NULL on memory exhaustion

Definition at line 111 of file bitmap.c.

References AllocSysObjectTags, ami_memory_clear_alloc(), ami_memory_itempool_alloc, ami_memory_itempool_create, AMI_NSBM_NONE, amiga_bitmap_get_buffer(), bitmap(), BITMAP_OPAQUE, bitmap::drawhandle, bitmap::height, height, bitmap::icondata, bitmap::iextmem, bitmap::native, bitmap::native_mask, bitmap::nativebm, bitmap::nativebmheight, bitmap::nativebmwidth, nsoption_bool, bitmap::opaque, bitmap::pixdata, pool_bitmap, bitmap::size, bitmap::title, bitmap::url, bitmap::width, and width.

Referenced by ami_bitmap_from_datatype().

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

◆ amiga_bitmap_destroy()

void amiga_bitmap_destroy ( void *  bitmap)

Free a bitmap.

Parameters
bitmapa bitmap, as returned by bitmap_create()

Definition at line 213 of file bitmap.c.

References ami_memory_clear_free, ami_memory_itempool_free, ami_rtg_freebitmap(), ami_schedule(), amiga_bitmap_unmap_buffer(), bitmap(), bitmap::drawhandle, FreeSysObject(), bitmap::height, bitmap::iextmem, bitmap::native_mask, bitmap::nativebm, nsoption_bool, nsurl_unref(), bitmap::pixdata, pool_bitmap, bitmap::title, bitmap::url, and bitmap::width.

Referenced by ami_theme_throbber_free().

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

◆ amiga_bitmap_get_buffer()

unsigned char * amiga_bitmap_get_buffer ( void *  bitmap)

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

References ami_schedule(), amiga_bitmap_unmap_buffer(), bitmap(), bitmap::iextmem, NSLOG, nsoption_bool, bitmap::pixdata, and bitmap::size.

Referenced by ami_bitmap_from_datatype(), ami_bitmap_get_generic(), ami_bitmap_get_mask(), ami_datatype_object_from_bitmap(), amiga_bitmap_create(), and bitmap_render().

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

◆ amiga_bitmap_get_opaque()

bool amiga_bitmap_get_opaque ( void *  bitmap)

Gets whether a bitmap should be plotted opaque.

Parameters
bitmapa bitmap, as returned by bitmap_create()

Definition at line 309 of file bitmap.c.

References bitmap(), and bitmap::opaque.

Referenced by ami_bitmap(), ami_bitmap_get_mask(), ami_bitmap_tile(), ami_datatype_object_from_bitmap(), and gui_window_set_icon().

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

◆ amiga_bitmap_get_rowstride()

size_t amiga_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 197 of file bitmap.c.

References bitmap(), and bitmap::width.

Referenced by ami_bitmap_from_datatype(), and ami_datatype_object_from_bitmap().

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

◆ amiga_bitmap_modified()

void amiga_bitmap_modified ( void *  bitmap)

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

Parameters
bitmapa bitmap, as returned by bitmap_create()

Definition at line 280 of file bitmap.c.

References AMI_NSBM_NONE, ami_rtg_freebitmap(), ami_schedule(), amiga_bitmap_unmap_buffer(), bitmap(), bitmap::drawhandle, bitmap::height, bitmap::native, bitmap::native_mask, bitmap::nativebm, and bitmap::width.

Referenced by ami_bitmap_get_generic(), ami_bitmap_get_palettemapped(), and ami_bitmap_get_truecolour().

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

◆ amiga_bitmap_save()

bool amiga_bitmap_save ( void *  bitmap,
const char *  path,
unsigned  flags 
)

Save a bitmap in the platform's native format.

Parameters
bitmapa bitmap, as returned by bitmap_create()
pathpathname for file
flagsflags controlling how the bitmap is saved.
Returns
true on success, false on error and error reported

Definition at line 255 of file bitmap.c.

References AMI_BITMAP_SCALE_ICON, ami_datatype_object_from_bitmap(), bitmap::dto, IDoMethod, path(), and SaveDTObjectA.

Referenced by ami_file_save(), and ami_gui_cache_favicon().

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

◆ amiga_bitmap_set_opaque()

void amiga_bitmap_set_opaque ( void *  bitmap,
bool  opaque 
)

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

References bitmap(), and bitmap::opaque.

Referenced by ami_bitmap_from_datatype(), and bitmap_render().

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

◆ bitmap_get_height()

int bitmap_get_height ( void *  bitmap)

Return the height of a bitmap.

Parameters
bitmapa bitmap, as returned by bitmap_create()
Returns
height in pixels

Return the height of a bitmap.

Definition at line 336 of file bitmap.c.

References bitmap(), and bitmap::height.

Referenced by ami_bitmap_tile(), ami_datatype_object_from_bitmap(), ami_theme_throbber_get_height(), ami_theme_throbber_setup(), and riscos_bitmap_convert_8bpp().

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

◆ bitmap_get_width()

int bitmap_get_width ( void *  bitmap)

Return the width of a bitmap.

Parameters
bitmapa bitmap, as returned by bitmap_create()
Returns
width in pixels

Return the width of a bitmap.

Definition at line 319 of file bitmap.c.

References bitmap(), and bitmap::width.

Referenced by ami_bitmap_tile(), ami_datatype_object_from_bitmap(), ami_theme_throbber_get_width(), ami_theme_throbber_setup(), and riscos_bitmap_convert_8bpp().

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

Variable Documentation

◆ amiga_bitmap_table

struct gui_bitmap_table* amiga_bitmap_table
extern

Definition at line 777 of file bitmap.c.

Referenced by main().