32#include <proto/exec.h>
33#include <proto/icon.h>
35#include <datatypes/pictureclass.h>
37#include <graphics/blitattr.h>
39#include <workbench/icon.h>
58#define THUMBNAIL_WIDTH 100
59#define THUMBNAIL_HEIGHT 86
62 ULONG trans, ULONG pals1,
struct ColorRegister *pal1,
int alpha);
66typedef struct amiga_icon_content {
75 bool quirks,
struct content **c);
76static bool amiga_icon_convert(
struct content *c);
77static void amiga_icon_destroy(
struct content *c);
78static bool amiga_icon_redraw(
struct content *c,
85static void *amiga_icon_get_internal(
const struct content *c,
void *context)
87 amiga_icon_content *icon_c = (amiga_icon_content *)c;
89 return icon_c->bitmap;
92static bool amiga_icon_is_opaque(
struct content *c)
94 amiga_icon_content *icon_c = (amiga_icon_content *)c;
96 if (icon_c->bitmap != NULL) {
104 .
create = amiga_icon_create,
105 .data_complete = amiga_icon_convert,
106 .destroy = amiga_icon_destroy,
107 .redraw = amiga_icon_redraw,
108 .clone = amiga_icon_clone,
109 .get_internal = amiga_icon_get_internal,
110 .type = amiga_icon_content_type,
111 .is_opaque = amiga_icon_is_opaque,
115static const char *amiga_icon_types[] = {
120 amiga_icon_content_handler)
125 bool quirks,
struct content **c)
127 amiga_icon_content *ai_content;
130 ai_content = calloc(1,
sizeof(amiga_icon_content));
131 if (ai_content == NULL)
134 error =
content__init(&ai_content->base, handler, imime_type, params,
135 llcache, fallback_charset, quirks);
141 *c = (
struct content *)ai_content;
152bool amiga_icon_convert(
struct content *c)
154 amiga_icon_content *icon_c = (amiga_icon_content *)c;
156 struct DiskObject *dobj;
158 unsigned char *imagebufptr = NULL;
164 char *filename = NULL;
167 struct ColorRegister *pal1;
179 p = strstr(filename,
".info");
182 dobj = GetIconTagList(filename, NULL);
194 ICONCTRLA_GetWidth,&
width,
195 ICONCTRLA_GetHeight,&
height,
201 if(dobj) FreeDiskObject(dobj);
206 if (!icon_c->bitmap) {
210 if(dobj) FreeDiskObject(dobj);
218 if(dobj) FreeDiskObject(dobj);
223 ICONCTRLA_GetImageData1, &imagebufptr,
228 IconControl(dobj, ICONCTRLA_GetTransparentColor1, &trans,
229 ICONCTRLA_GetPalette1, &pal1,
230 ICONCTRLA_GetPaletteSize1, &pals1,
241 for (offset = 0; offset < size; offset += 4) {
242 b = imagebufptr[offset+3];
243 g = imagebufptr[offset+2];
244 r = imagebufptr[offset+1];
245 a = imagebufptr[offset];
247 *imagebuf = r << 24 | g << 16 | b << 8 | a;
259 if(dobj) FreeDiskObject(dobj);
272void amiga_icon_destroy(
struct content *c)
274 amiga_icon_content *icon_c = (amiga_icon_content *)c;
276 if (icon_c->bitmap != NULL)
285bool amiga_icon_redraw(
struct content *c,
289 amiga_icon_content *icon_c = (amiga_icon_content *)c;
310 amiga_icon_content *ai;
313 ai = calloc(1,
sizeof(amiga_icon_content));
326 if (amiga_icon_convert(&ai->base) ==
false) {
345 ULONG trans, ULONG pals1,
struct ColorRegister *pal1,
int alpha)
348 struct ColorRegister *
colour;
349 struct ColorMap *cmap;
353 if (alpha==0) alpha=0xff;
356 if (!argbicon)
return(NULL);
358 cmap=GetColorMap(pals1);
366 colour = &pal1[icondata[i]];
368 if(icondata[i] == trans)
381 argbicon[i] = (a << 24) +
393 struct BitMap *bm = NULL;
394 ULONG *icondata1, *icondata2;
398 if(dobj == NULL)
return;
402 ICONCTRLA_GetImageData1,&icondata1,
403 ICONCTRLA_GetImageData2,&icondata2,
404 ICONCTRLA_GetWidth,&
width,
405 ICONCTRLA_GetHeight,&
height,
415 BltBitMapTags(BLITA_SrcX, 0,
417 BLITA_DestX,
width - 16,
422 BLITA_Dest, icondata1,
423 BLITA_SrcType, BLITT_BITMAP,
424 BLITA_DestType, BLITT_ARGB32,
425 BLITA_DestBytesPerRow,
width * 4,
429 BltBitMapTags(BLITA_SrcX, 0,
431 BLITA_DestX,
width - 16,
436 BLITA_Dest, icondata2,
437 BLITA_SrcType, BLITT_BITMAP,
438 BLITA_DestType, BLITT_ARGB32,
439 BLITA_DestBytesPerRow,
width * 4,
448 struct DiskObject *dobj = NULL;
449 ULONG *icondata1, *icondata2;
454 struct ColorRegister *pal1;
455 struct ColorRegister *pal2;
457 if(icon == NULL)
return;
461 dobj = GetIconTags(NULL,
462 ICONGETA_GetDefaultType, WBDRAWER,
467 dobj = GetIconTags(NULL, ICONGETA_GetDefaultName,
type,
468 ICONGETA_GetDefaultType, WBPROJECT,
472 if(dobj == NULL)
return;
476 ICONCTRLA_GetImageData1,&icondata1,
477 ICONCTRLA_GetImageData2,&icondata2,
478 ICONCTRLA_GetWidth,&
width,
479 ICONCTRLA_GetHeight,&
height,
485 IconControl(dobj, ICONCTRLA_GetTransparentColor1, &trans1,
486 ICONCTRLA_GetPalette1, &pal1,
487 ICONCTRLA_GetPaletteSize1, &pals1,
488 ICONCTRLA_GetTransparentColor2, &trans2,
489 ICONCTRLA_GetPalette2, &pal2,
490 ICONCTRLA_GetPaletteSize2, &pals2,
501 ICONCTRLA_SetImageData1, icondata1,
502 ICONCTRLA_SetImageData2, icondata2,
509 PutIconTags(
path, dobj,
510 ICONPUTA_NotifyWorkbench, TRUE, TAG_DONE);
512 FreeDiskObject(dobj);
524 struct DiskObject *dobj;
540 BLITA_SrcType, BLITT_BITMAP,
542 BLITA_DestType, BLITT_ARGB32,
544 BLITA_Dest, icondata,
549 dobj = GetIconTags(NULL, ICONGETA_GetDefaultType, WBPROJECT,
550 ICONGETA_GetDefaultName,
"iconify",
559 ICONCTRLA_SetImageData1, icondata,
560 ICONCTRLA_SetImageData2, NULL,
564 dobj->do_Gadget.UserData = bm;
566 LayoutIconA(dobj, (
struct Screen *)~0UL, NULL);
573 struct bitmap *bm = dobj->do_Gadget.UserData;
575 FreeDiskObject(dobj);
Content handling interface.
void content_destroy(struct content *c)
Destroy and free a content.
void content_broadcast(struct content *c, content_msg msg, const union content_msg_data *data)
Send a message to all users.
void content_set_done(struct content *c)
Put a content in status CONTENT_STATUS_DONE.
nserror content__init(struct content *c, const content_handler *handler, lwc_string *imime_type, const struct http_parameter *params, llcache_handle *llcache, const char *fallback_charset, bool quirks)
nsurl * content_get_url(struct content *c)
Retrieve URL associated with content.
nserror content__clone(const struct content *c, struct content *nc)
Clone a content's data members.
void content_set_ready(struct content *c)
Put a content in status CONTENT_STATUS_READY and unlock the content.
void content_set_status(struct content *c, const char *status_message)
Updates content with new status.
#define CONTENT_FACTORY_REGISTER_TYPES(HNAME, HTYPELIST, HHANDLER)
Protected interface to Content handling.
@ CONTENT_STATUS_READY
Some parts of content still being loaded, but can be displayed.
@ CONTENT_STATUS_DONE
Content has completed all processing.
content_type
The type of a content.
@ CONTENT_IMAGE
All images.
@ CONTENT_MSG_ERROR
error occurred
nserror
Enumeration of error codes.
@ NSERROR_NOMEM
Memory exhaustion.
@ NSERROR_CLONE_FAILED
Failed to clone handle.
void * amiga_bitmap_create(int width, int height, enum gui_bitmap_flags flags)
Create a bitmap.
void ami_bitmap_free_icondata(struct bitmap *bm)
Free an icondata pointer.
struct BitMap * ami_bitmap_get_native(struct bitmap *bitmap, int width, int height, bool palette_mapped, struct BitMap *friendbm, colour bg)
void amiga_bitmap_modified(void *bitmap)
The bitmap image has changed, so flush any persistant cache.
void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata)
Set an icondata pointer.
unsigned char * amiga_bitmap_get_buffer(void *bitmap)
Return a pointer to the pixel data in a bitmap.
void amiga_bitmap_destroy(void *bitmap)
Free a bitmap.
struct netsurf_table * guit
The global interface table.
Interface to core interface table.
struct DiskObject * amiga_icon_from_bitmap(struct bitmap *bm)
void amiga_icon_free(struct DiskObject *dobj)
static ULONG * amiga_icon_convertcolouricon32(UBYTE *icondata, ULONG width, ULONG height, ULONG trans, ULONG pals1, struct ColorRegister *pal1, int alpha)
void amiga_icon_superimpose_favicon(char *path, struct hlcache_handle *icon, char *type)
void amiga_icon_superimpose_favicon_internal(struct hlcache_handle *icon, struct DiskObject *dobj)
Content for image/x-amiga-icon (icon.library interface).
Generic bitmap handling interface.
Public content interface.
struct bitmap * content_get_bitmap(struct hlcache_handle *h)
Retrieve the bitmap contained in an image content.
Target independent plotting interface.
unsigned long bitmap_flags_t
static struct llcache_s * llcache
low level cache state
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
Localised message support (interface).
Minimal compatibility header for AmigaOS 3.
#define ICONCTRLA_GetImageDataFormat
#define ICONCTRLA_SetImageDataFormat
#define IDFMT_PALETTEMAPPED
#define BLITA_UseSrcAlpha
#define IDFMT_DIRECTMAPPED
Interface to utility string handling.
RISC OS wimp toolkit bitmap.
Content operation function table.
nserror(* create)(const struct content_handler *handler, lwc_string *imime_type, const struct http_parameter *params, struct llcache_handle *llcache, const char *fallback_charset, bool quirks, struct content **c)
parameters to content redraw
int height
vertical dimension
bool repeat_y
whether content is tiled in y direction
bool repeat_x
whether content is tiled in x direction
int y
coordinate for top-left of redraw
int x
coordinate for top-left of redraw
colour background_colour
The background colour.
int width
dimensions to render content at (for scaling contents with intrinsic dimensions)
Content which corresponds to a single URL.
int height
Height dimension, if applicable.
int width
Width dimension, if applicable.
content_status status
Current status.
bool(* get_opaque)(void *bitmap)
Get the opacity of a bitmap.
Representation of an HTTP parameter.
Handle to low-level cache object.
struct gui_bitmap_table * bitmap
Bitmap table.
nserror(* bitmap)(const struct redraw_context *ctx, struct bitmap *bitmap, int x, int y, int width, int height, colour bg, bitmap_flags_t flags)
Plot a bitmap.
const struct plotter_table * plot
Current plot operation table.
uint32_t colour
Colour type: XBGR.
Extra data for some content_msg messages.
nserror netsurf_nsurl_to_path(struct nsurl *url, char **path_out)
Create a path from a nsurl.
Default operations table for files.
Option reading and saving interface.
#define nsoption_colour(OPTION)
Get the value of a netsurf colour option.
Interface to a number of general purpose functionality.
static nserror path(const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6])
Plots a path.
static nserror bitmap(const struct redraw_context *ctx, struct bitmap *bitmap, int x, int y, int width, int height, colour bg, bitmap_flags_t flags)
Plot a bitmap.
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.