76 bool quirks,
struct content **c)
86 llcache, fallback_charset, quirks);
131 const uint8_t *source_data;
141 (
const char *)source_data,
172 struct svgtiny_diagram *diagram = svg->
diagram;
188#define BGR(c) (((svgtiny_RED((c))) | \
189 (svgtiny_GREEN((c)) << 8) | \
190 (svgtiny_BLUE((c)) << 16)))
192 for (i = 0; i != diagram->shape_count; i++) {
193 if (diagram->shape[i].path) {
195 if (diagram->shape[i].stroke == svgtiny_TRANSPARENT) {
203 diagram->shape[i].stroke_width);
206 if (diagram->shape[i].fill == svgtiny_TRANSPARENT) {
217 diagram->shape[i].path,
218 diagram->shape[i].path_length,
224 }
else if (diagram->shape[i].text) {
225 px = transform[0] * diagram->shape[i].text_x +
226 transform[2] * diagram->shape[i].text_y +
228 py = transform[1] * diagram->shape[i].text_x +
229 transform[3] * diagram->shape[i].text_y +
239 diagram->shape[i].text,
240 strlen(diagram->shape[i].text));
261 int x, y, x0, y0, x1, y1;
268 for (; x0 >
clip->x0; x0 -= data->
width);
281 for (y = y0; y < y1; y += data->
height) {
282 for (x = x0; x < x1; x += data->
width) {
368 *newc = (
struct content *) svg;
void content_destroy(struct content *c)
Destroy and free a content.
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.
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.
void content_broadcast_error(struct content *c, nserror errorcode, const char *msg)
Send an error message to all users.
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.
nserror
Enumeration of error codes.
@ NSERROR_NOMEM
Memory exhaustion.
@ NSERROR_CLONE_FAILED
Failed to clone handle.
Public content interface.
Target independent plotting interface.
static struct llcache_s * llcache
low level cache state
Localised message support (interface).
NetSurf URL handling (interface).
const char * nsurl_access(const nsurl *url)
Access a NetSurf URL object as a string.
plot_font_style_t const *const plot_style_font
#define plot_style_int_to_fixed(v)
@ PLOT_OP_TYPE_NONE
No operation.
@ PLOT_OP_TYPE_SOLID
Solid colour.
#define NS_TRANSPARENT
Transparent colour value.
#define PLOT_STYLE_SCALE
Scaling factor for plot styles.
Interface to utility string handling.
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)
float scale
Scale for redraw (for scaling contents without 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.
Representation of an HTTP parameter.
Handle to low-level cache object.
colour foreground
Colour of text.
plot_style_fixed size
Font size, in pt.
colour background
Background colour to blend to, if appropriate.
Plot style for stroke/fill plotters.
colour fill_colour
Colour of fill.
plot_style_fixed stroke_width
Width of stroke, in pixels.
plot_operation_type_t fill_type
Fill plot type.
colour stroke_colour
Colour of stroke.
plot_operation_type_t stroke_type
Stroke plot type.
nserror(* text)(const struct redraw_context *ctx, const plot_font_style_t *fstyle, int x, int y, const char *text, size_t length)
Text plotting.
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.
const struct plotter_table * plot
Current plot operation table.
struct svgtiny_diagram * diagram
static void svg_destroy(struct content *c)
Destroy a CONTENT_SVG and free all resources it owns.
struct svg_content svg_content
static const char * svg_types[]
static bool svg_convert(struct content *c)
Convert a CONTENT_SVG for display.
CONTENT_FACTORY_REGISTER_TYPES(svg, svg_types, svg_content_handler)
static bool svg_redraw(struct content *c, struct content_redraw_data *data, const struct rect *clip, const struct redraw_context *ctx)
Redraw a CONTENT_SVG.
static void svg_reformat(struct content *c, int width, int height)
Reformat a CONTENT_SVG.
static nserror svg_create_svg_data(svg_content *c)
static bool svg_redraw_internal(svg_content *svg, int x, int y, int width, int height, const struct rect *clip, const struct redraw_context *ctx, float scale, colour background_colour)
Redraw a CONTENT_SVG.
static nserror svg_clone(const struct content *old, struct content **newc)
static bool svg_redraw_tiled_internal(svg_content *svg, struct content_redraw_data *data, const struct rect *clip, const struct redraw_context *ctx)
static const content_handler svg_content_handler
static nserror svg_create(const 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)
Create a CONTENT_SVG.
static content_type svg_content_type(void)
Content for image/svg (interface).
uint32_t colour
Colour type: XBGR.
Interface to a number of general purpose functionality.
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.