23#ifdef WITH_AMIGA_DATATYPES
29#include <proto/datatypes.h>
31#include <proto/intuition.h>
32#include <datatypes/pictureclass.h>
33#include <intuition/classusr.h>
53 bool quirks,
struct content **c);
54static bool amiga_dt_picture_convert(
struct content *c);
56static void amiga_dt_picture_destroy(
struct content *c);
59 .
create = amiga_dt_picture_create,
60 .data_complete = amiga_dt_picture_convert,
61 .destroy = amiga_dt_picture_destroy,
63 .clone = amiga_dt_picture_clone,
69struct amiga_dt_picture_content {
74nserror amiga_dt_picture_init(
void)
76 struct DataType *dt, *prevdt = NULL;
79 struct Node *node = NULL;
81 while((dt = ObtainDataType(DTST_RAM, NULL,
83 DTA_GroupID, GID_PICTURE,
86 if(prevdt) ReleaseDataType(prevdt);
95 lwc_string_data(
type),
96 &amiga_dt_picture_content_handler);
102 }
while (node != NULL);
106 ReleaseDataType(prevdt);
114 bool quirks,
struct content **c)
116 struct amiga_dt_picture_content *adt;
119 adt = calloc(1,
sizeof(
struct amiga_dt_picture_content));
124 llcache, fallback_charset, quirks);
135static Object *amiga_dt_picture_newdtobject(
struct amiga_dt_picture_content *adt)
140 if(adt->dto == NULL) {
143 adt->dto = NewDTObject(NULL,
144 DTA_SourceType, DTST_MEMORY,
145 DTA_SourceAddress, data,
146 DTA_SourceSize,
size,
147 DTA_GroupID, GID_PICTURE,
148 PDTA_DestMode, PMODE_V43,
156static char *amiga_dt_picture_datatype(
struct content *c)
161 char *filetype = NULL;
165 if((dt = ObtainDataType(DTST_MEMORY, NULL,
166 DTA_SourceAddress, data,
167 DTA_SourceSize, size,
168 DTA_GroupID, GID_PICTURE,
170 filetype = strdup(dt->dtn_Header->dth_Name);
174 if(filetype == NULL) filetype = strdup(
"DataTypes");
178static struct bitmap *amiga_dt_picture_cache_convert(
struct content *c)
180 NSLOG(netsurf, INFO,
"amiga_dt_picture_cache_convert");
186 struct amiga_dt_picture_content *adt = (
struct amiga_dt_picture_content *)c;
188 if((dto = amiga_dt_picture_newdtobject(adt)))
201 bm_buffer, PBPAFMT_RGBA,
207 DisposeDTObject(dto);
215bool amiga_dt_picture_convert(
struct content *c)
217 NSLOG(netsurf, INFO,
"amiga_dt_picture_convert");
222 struct BitMapHeader *bmh;
225 if((dto = amiga_dt_picture_newdtobject((
struct amiga_dt_picture_content *)c))) {
226 if(GetDTAttrs(dto, PDTA_BitMapHeader, &bmh, TAG_DONE)) {
227 width = (int)bmh->bmh_Width;
228 height = (
int)bmh->bmh_Height;
239 if((filetype = amiga_dt_picture_datatype(c))) {
242 filetype, c->width, c->height);
263 NSLOG(netsurf, INFO,
"amiga_dt_picture_clone");
265 adt = calloc(1,
sizeof(
struct content));
278 if (amiga_dt_picture_convert(adt) ==
false) {
289static void amiga_dt_picture_destroy(
struct content *c)
291 struct amiga_dt_picture_content *adt = (
struct amiga_dt_picture_content *)c;
293 DisposeDTObject(adt->dto);
struct Node * ami_mime_from_datatype(struct DataType *dt, lwc_string **mimetype, struct Node *start_node)
Return a MIME Type matching a DataType.
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.
bool content__set_title(struct content *c, const char *title)
Set title associated with content.
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)
const uint8_t * content__get_source_data(struct content *c, size_t *size)
Retrieve source of 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.
nserror content_factory_register_handler(const char *mime_type, const content_handler *handler)
Register a handler with the content factory.
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_MSG_ERROR
error occurred
nserror
Enumeration of error codes.
@ NSERROR_NOMEM
Memory exhaustion.
@ NSERROR_CLONE_FAILED
Failed to clone handle.
size_t amiga_bitmap_get_rowstride(void *bitmap)
Find the width of a pixel row in bytes.
void * amiga_bitmap_create(int width, int height, enum gui_bitmap_flags flags)
Create a bitmap.
void amiga_bitmap_set_opaque(void *bitmap, bool opaque)
Sets whether a bitmap should be plotted opaque.
unsigned char * amiga_bitmap_get_buffer(void *bitmap)
Return a pointer to the pixel data in a bitmap.
content_type image_cache_content_type(void)
void * image_cache_get_internal(const struct content *c, void *context)
bool image_cache_redraw(struct content *c, struct content_redraw_data *data, const struct rect *clip, const struct redraw_context *ctx)
Generic content redraw callback.
void image_cache_destroy(struct content *content)
nserror image_cache_add(struct content *content, struct bitmap *bitmap, image_cache_convert_fn *convert)
adds an image content to be cached.
The image content handler intermediate image cache.
Generic bitmap handling interface.
bool bitmap_test_opaque(void *bitmap)
Test whether a bitmap is completely opaque (no transparency).
Target independent plotting interface.
static struct llcache_s * llcache
low level cache state
nsurl * llcache_handle_get_url(const llcache_handle *handle)
Retrieve the post-redirect URL of a low-level cache object.
Low-level resource cache (interface)
#define NSLOG(catname, level, logmsg, args...)
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
char * messages_get_buff(const char *key,...)
Formatted message from a key in the global message hash.
Localised message support (interface).
const char * nsurl_access_leaf(const nsurl *url)
Access a URL's path leaf as a string.
Minimal compatibility header for AmigaOS 3.
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)
Content which corresponds to a single URL.
int height
Height dimension, if applicable.
int width
Width dimension, if applicable.
content_status status
Current status.
unsigned int size
Estimated size of all data associated with this content.
Representation of an HTTP parameter.
Handle to low-level cache object.
Extra data for some content_msg messages.
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.