|
NetSurf
|
#include "amiga/os3support.h"#include <stdlib.h>#include <string.h>#include <proto/exec.h>#include <graphics/gfxbase.h>#include <proto/datatypes.h>#include <datatypes/pictureclass.h>#include <proto/dos.h>#include <proto/intuition.h>#include <proto/utility.h>#include <proto/guigfx.h>#include <guigfx/guigfx.h>#include <render/render.h>#include <inline/guigfx.h>#include "assert.h"#include "utils/log.h"#include "utils/nsoption.h"#include "utils/nsurl.h"#include "utils/messages.h"#include "netsurf/bitmap.h"#include "netsurf/content.h"#include "amiga/gui.h"#include "amiga/bitmap.h"#include "amiga/plotters.h"#include "amiga/memory.h"#include "amiga/misc.h"#include "amiga/rtg.h"#include "amiga/schedule.h"Go to the source code of this file.
Data Structures | |
| struct | bitmap |
| RISC OS wimp toolkit bitmap. More... | |
| struct | vertex |
Macros | |
| #define | VTX(I, X, Y, S, T) vtx[I].x = X; vtx[I].y = Y; vtx[I].s = S; vtx[I].t = T; vtx[I].w = 1.0f; |
| #define | VTX_RECT(SX, SY, SW, SH, DX, DY, DW, DH) |
Enumerations | |
| enum | { AMI_NSBM_NONE = 0 , AMI_NSBM_TRUECOLOUR , AMI_NSBM_PALETTEMAPPED } |
Functions | |
| void * | amiga_bitmap_create (int width, int height, enum gui_bitmap_flags flags) |
| Create a bitmap. More... | |
| static void | amiga_bitmap_unmap_buffer (void *p) |
| 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... | |
| 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... | |
| int | bitmap_get_width (void *bitmap) |
| get width of a bitmap. More... | |
| int | bitmap_get_height (void *bitmap) |
| get height of a bitmap. More... | |
| Object * | ami_datatype_object_from_bitmap (struct bitmap *bitmap) |
| struct bitmap * | ami_bitmap_from_datatype (char *filename) |
| static struct BitMap * | ami_bitmap_get_guigfx (struct bitmap *bitmap, int width, int height, struct BitMap *restrict friendbm, int type, colour bg) |
| static struct BitMap * | ami_bitmap_get_generic (struct bitmap *bitmap, int width, int height, struct BitMap *restrict friendbm, int type, colour bg) |
| static struct BitMap * | ami_bitmap_get_truecolour (struct bitmap *bitmap, int width, int height, struct BitMap *friendbm, colour bg) |
| PLANEPTR | ami_bitmap_get_mask (struct bitmap *bitmap, int width, int height, struct BitMap *n_bm) |
| static struct BitMap * | ami_bitmap_get_palettemapped (struct bitmap *bitmap, int width, int height, struct BitMap *friendbm, colour bg) |
| struct BitMap * | ami_bitmap_get_native (struct bitmap *bitmap, int width, int height, bool palette_mapped, struct BitMap *friendbm, colour bg) |
| void | ami_bitmap_fini (void) |
| Cleanup bitmap allocations. More... | |
| static nserror | bitmap_render (struct bitmap *bitmap, struct hlcache_handle *content) |
| 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... | |
Variables | |
| static APTR | pool_bitmap = NULL |
| static bool | guigfx_warned = false |
| static struct gui_bitmap_table | bitmap_table |
| struct gui_bitmap_table * | amiga_bitmap_table = &bitmap_table |
| #define VTX_RECT | ( | SX, | |
| SY, | |||
| SW, | |||
| SH, | |||
| DX, | |||
| DY, | |||
| DW, | |||
| DH | |||
| ) |
| anonymous enum |
| void ami_bitmap_fini | ( | void | ) |
Cleanup bitmap allocations.
Definition at line 748 of file bitmap.c.
References ami_memory_itempool_delete, and pool_bitmap.
Referenced by main().
| void ami_bitmap_free_icondata | ( | struct bitmap * | bm | ) |
Free an icondata pointer.
| bm | a bitmap, as returned by bitmap_create() |
This function probably shouldn't be here!
Definition at line 807 of file bitmap.c.
References bitmap::icondata.
Referenced by amiga_icon_free().
| 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().
|
inlinestatic |
Definition at line 534 of file bitmap.c.
References AMI_BITMAP_FORMAT, ami_bitmap_get_guigfx(), ami_gui_get_screen(), AMI_NSBM_NONE, AMI_NSBM_PALETTEMAPPED, AMI_NSBM_TRUECOLOUR, ami_rtg_allocbitmap(), ami_rtg_freebitmap(), ami_rtg_writepixelarray(), amiga_bitmap_get_buffer(), amiga_bitmap_modified(), bitmap::bg, bitmap::height, height, bitmap::native, bitmap::nativebm, bitmap::nativebmheight, bitmap::nativebmwidth, NSLOG, nsoption_bool, nsoption_int, bitmap::opaque, scrn, type, VTX_RECT, bitmap::width, and width.
Referenced by ami_bitmap_get_palettemapped(), and ami_bitmap_get_truecolour().
|
inlinestatic |
Definition at line 435 of file bitmap.c.
References AMI_BITMAP_FORMAT, ami_gui_get_screen(), AMI_NSBM_PALETTEMAPPED, AMI_NSBM_TRUECOLOUR, ami_rtg_allocbitmap(), amiga_bitmap_get_buffer(), amiga_warn_user(), bitmap::bg, colour_rb_swap, bitmap::drawhandle, guigfx_warned, bitmap::height, height, bitmap::native, bitmap::nativebm, bitmap::nativebmheight, bitmap::nativebmwidth, NS_TRANSPARENT, nsoption_bool, nsoption_int, bitmap::opaque, scrn, type, bitmap::width, and width.
Referenced by ami_bitmap_get_generic().
| PLANEPTR ami_bitmap_get_mask | ( | struct bitmap * | bitmap, |
| int | width, | ||
| int | height, | ||
| struct BitMap * | n_bm | ||
| ) |
Definition at line 696 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().
| struct BitMap * ami_bitmap_get_native | ( | struct bitmap * | bitmap, |
| int | width, | ||
| int | height, | ||
| bool | palette_mapped, | ||
| struct BitMap * | friendbm, | ||
| colour | bg | ||
| ) |
Definition at line 736 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().
|
inlinestatic |
Definition at line 726 of file bitmap.c.
References ami_bitmap_get_generic(), AMI_NSBM_NONE, AMI_NSBM_PALETTEMAPPED, amiga_bitmap_modified(), height, bitmap::native, and width.
Referenced by ami_bitmap_get_native().
|
inlinestatic |
Definition at line 686 of file bitmap.c.
References ami_bitmap_get_generic(), AMI_NSBM_NONE, AMI_NSBM_TRUECOLOUR, amiga_bitmap_modified(), height, bitmap::native, and width.
Referenced by ami_bitmap_get_native().
| bool ami_bitmap_is_nativebm | ( | struct bitmap * | bm, |
| struct BitMap * | nbm | ||
| ) |
Test if a BitMap is owned by a bitmap.
| bm | a bitmap, as returned by bitmap_create() |
| nbm | a BitMap, as created by AllocBitMap() |
Definition at line 813 of file bitmap.c.
References bitmap::nativebm.
Referenced by ami_bitmap(), and ami_bitmap_tile().
| void ami_bitmap_set_icondata | ( | struct bitmap * | bm, |
| ULONG * | icondata | ||
| ) |
Set an icondata pointer.
| bm | a bitmap, as returned by bitmap_create() |
| icondata | a pointer to memory |
This function probably shouldn't be here!
Definition at line 802 of file bitmap.c.
References bitmap::icondata.
Referenced by amiga_icon_from_bitmap().
| void ami_bitmap_set_title | ( | struct bitmap * | bm, |
| const char * | title | ||
| ) |
Set bitmap title.
| bm | a bitmap, as returned by bitmap_create() |
| title | a 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 796 of file bitmap.c.
References bitmap::title.
Referenced by ami_file_save(), and HOOKF().
Set bitmap URL.
| bm | a bitmap, as returned by bitmap_create() |
| url | the 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 790 of file bitmap.c.
References nsurl_ref(), and bitmap::url.
Referenced by ami_file_save(), and HOOKF().
| 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().
| void * amiga_bitmap_create | ( | int | width, |
| int | height, | ||
| enum gui_bitmap_flags | flags | ||
| ) |
Create a bitmap.
| width | width of image in pixels |
| height | width of image in pixels |
| flags | flags for bitmap creation |
Definition at line 112 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().
| void amiga_bitmap_destroy | ( | void * | bitmap | ) |
Free a bitmap.
| bitmap | a bitmap, as returned by bitmap_create() |
Definition at line 214 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().
| unsigned char * amiga_bitmap_get_buffer | ( | void * | bitmap | ) |
Return a pointer to the pixel data in a bitmap.
| bitmap | a bitmap, as returned by bitmap_create() |
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 175 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_guigfx(), ami_bitmap_get_mask(), ami_datatype_object_from_bitmap(), and amiga_bitmap_create().
| bool amiga_bitmap_get_opaque | ( | void * | bitmap | ) |
Gets whether a bitmap should be plotted opaque.
| bitmap | a 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().
| size_t amiga_bitmap_get_rowstride | ( | void * | bitmap | ) |
Find the width of a pixel row in bytes.
| bitmap | a bitmap, as returned by bitmap_create() |
Definition at line 198 of file bitmap.c.
References bitmap(), and bitmap::width.
Referenced by ami_bitmap_from_datatype(), and ami_datatype_object_from_bitmap().
| void amiga_bitmap_modified | ( | void * | bitmap | ) |
The bitmap image has changed, so flush any persistant cache.
| bitmap | a bitmap, as returned by bitmap_create() |
Definition at line 282 of file bitmap.c.
References AMI_NSBM_NONE, ami_rtg_freebitmap(), ami_schedule(), amiga_bitmap_unmap_buffer(), bitmap(), 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().
| bool amiga_bitmap_save | ( | void * | bitmap, |
| const char * | path, | ||
| unsigned | flags | ||
| ) |
Save a bitmap in the platform's native format.
| bitmap | a bitmap, as returned by bitmap_create() |
| path | pathname for file |
| flags | flags controlling how the bitmap is saved. |
Definition at line 257 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().
| void amiga_bitmap_set_opaque | ( | void * | bitmap, |
| bool | opaque | ||
| ) |
Sets whether a bitmap should be plotted opaque.
| bitmap | a bitmap, as returned by bitmap_create() |
| opaque | whether 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().
|
static |
Definition at line 158 of file bitmap.c.
References bitmap::iextmem, NSLOG, nsoption_bool, bitmap::pixdata, and bitmap::size.
Referenced by amiga_bitmap_destroy(), amiga_bitmap_get_buffer(), and amiga_bitmap_modified().
| int bitmap_get_height | ( | void * | bitmap | ) |
get height of a bitmap.
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().
| int bitmap_get_width | ( | void * | bitmap | ) |
get width of a bitmap.
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().
|
static |
Definition at line 754 of file bitmap.c.
References AMI_BITMAP_FORMAT, ami_clearclipreg(), ami_plot_ra_alloc(), ami_plot_ra_free(), ami_plot_ra_get_bitmap(), ami_rtg_readpixelarray(), amiga_bitmap_set_opaque(), amiplot, content_get_width(), content_scaled_redraw(), bitmap::height, redraw_context::interactive, MIN, NSERROR_OK, NSLOG, bitmap::pixdata, and bitmap::width.
| struct gui_bitmap_table* amiga_bitmap_table = &bitmap_table |
|
static |
|
static |
Definition at line 109 of file bitmap.c.
Referenced by ami_bitmap_get_guigfx().
|
static |
Definition at line 108 of file bitmap.c.
Referenced by ami_bitmap_fini(), amiga_bitmap_create(), and amiga_bitmap_destroy().