24#ifndef NETSURF_PLOT_STYLE_H
25#define NETSURF_PLOT_STYLE_H
29#include <libwapcaplet/libwapcaplet.h>
33#define WIDGET_BASEC 0xd9d9d9
36#define WIDGET_BLOBC 0x000000
39#define NS_TRANSPARENT 0x01000000
42#define PLOT_STYLE_RADIX (10)
45#define PLOT_STYLE_SCALE (1 << PLOT_STYLE_RADIX)
51#define plot_style_int_to_fixed(v) ((v) << PLOT_STYLE_RADIX)
54#define plot_style_fixed_to_int(v) ((v) >> PLOT_STYLE_RADIX)
57#define plot_style_fixed_to_float(v) (((float)v) / PLOT_STYLE_SCALE)
60#define plot_style_fixed_to_double(v) (((double)v) / PLOT_STYLE_SCALE)
128#define half_darken_colour(c1) \
129 ((((7 * (c1 & 0xff00ff)) >> 3) & 0xff00ff) | \
130 (((7 * (c1 & 0x00ff00)) >> 3) & 0x00ff00))
133#define darken_colour(c1) \
134 ((((3 * (c1 & 0xff00ff)) >> 2) & 0xff00ff) | \
135 (((3 * (c1 & 0x00ff00)) >> 2) & 0x00ff00))
138#define double_darken_colour(c1) \
139 ((((9 * (c1 & 0xff00ff)) >> 4) & 0xff00ff) | \
140 (((9 * (c1 & 0x00ff00)) >> 4) & 0x00ff00))
144#define half_lighten_colour(c1) \
145 (((((7 * (c1 & 0xff00ff)) >> 3) + 0x200020) & 0xff00ff) | \
146 ((((7 * (c1 & 0x00ff00)) >> 3) + 0x002000) & 0x00ff00))
150#define lighten_colour(c1) \
151 (((((3 * (c1 & 0xff00ff)) >> 2) + 0x400040) & 0xff00ff) | \
152 ((((3 * (c1 & 0x00ff00)) >> 2) + 0x004000) & 0x00ff00))
156#define double_lighten_colour(c1) \
157 (((((9 * (c1 & 0xff00ff)) >> 4) + 0x700070) & 0xff00ff) | \
158 ((((9 * (c1 & 0x00ff00)) >> 4) + 0x007000) & 0x00ff00))
163#define blend_colour(c0, c1) \
164 (((((c0 & 0xff00ff) + (c1 & 0xff00ff)) >> 1) & 0xff00ff) | \
165 ((((c0 & 0x00ff00) + (c1 & 0x00ff00)) >> 1) & 0x00ff00))
181#define colour_lightness(c0) \
182 ((((c0 & 0x0000ff) * 77) >> 8) + \
183 (((c0 & 0x00ff00) * 151) >> 16) + \
184 (((c0 & 0xff0000) * 30) >> 24))
188#define colour_to_bw_nearest(c0) \
189 ((colour_lightness(c0) > (0xff / 2)) ? 0xffffff : 0x000000)
193#define colour_to_bw_furthest(c0) \
194 ((colour_lightness(c0) > (0xff / 2)) ? 0x000000 : 0xffffff)
198#define mix_colour(c0, c1, p) \
199 ((((((c1 & 0xff00ff) * (255 - p)) + \
200 ((c0 & 0xff00ff) * ( p)) ) >> 8) & 0xff00ff) | \
201 (((((c1 & 0x00ff00) * (255 - p)) + \
202 ((c0 & 0x00ff00) * ( p)) ) >> 8) & 0x00ff00))
205#define red_from_colour(c) \
209#define green_from_colour(c) \
213#define blue_from_colour(c) \
217#define colour_rb_swap(c) \
218 (((0x000000ff & c) << 16) | \
219 ((0x0000ff00 & c) ) | \
220 ((0x00ff0000 & c) >> 16))
252 return (msk[comp] & l) | (~msk[comp] & d);
plot_style_t * plot_style_fill_white
plot_style_t const *const plot_style_broken_object
plot_style_t const *const plot_style_margin_edge
plot_font_style_t const *const plot_style_font
plot_style_t const *const plot_style_content_edge
plot_colour_component
Colour components.
@ PLOT_COLOUR_COMPONENT_RED
@ PLOT_COLOUR_COMPONENT_GREEN
@ PLOT_COLOUR_COMPONENT_BLUE
@ PLOT_COLOUR_COMPONENT_ALPHA
plot_style_t * plot_style_fill_wbasec
struct plot_style_s plot_style_t
Plot style for stroke/fill plotters.
#define lighten_colour(c1)
plot_style_t * plot_style_stroke_darkwbasec
plot_style_t * plot_style_caret
#define darken_colour(c1)
plot_operation_type_t
Type of plot operation.
@ PLOT_OP_TYPE_NONE
No operation.
@ PLOT_OP_TYPE_DASH
Dashed plot.
@ PLOT_OP_TYPE_DOT
Dotted plot.
@ PLOT_OP_TYPE_SOLID
Solid colour.
plot_style_t * plot_style_fill_red
plot_style_t const *const plot_style_padding_edge
plot_font_flags_t
Font plot flags.
plot_style_t * plot_style_fill_wblobc
#define double_lighten_colour(c1)
plot_font_generic_family_t
Generic font family type.
@ PLOT_FONT_FAMILY_CURSIVE
@ PLOT_FONT_FAMILY_COUNT
Number of generic families.
@ PLOT_FONT_FAMILY_SANS_SERIF
@ PLOT_FONT_FAMILY_FANTASY
@ PLOT_FONT_FAMILY_MONOSPACE
plot_font_style_t const *const plot_fstyle_broken_object
plot_style_t * plot_style_fill_black
static colour colour_engorge_component(colour col, bool dark, enum plot_colour_component comp)
Engorge a particular colour channel.
plot_style_t * plot_style_stroke_lightwbasec
struct plot_font_style plot_font_style_t
Font style for plotting.
plot_style_t * plot_style_fill_lightwbasec
#define double_darken_colour(c1)
plot_style_t * plot_style_stroke_wblobc
plot_style_t * plot_style_fill_darkwbasec
plot_font_generic_family_t family
Generic family to plot with.
colour foreground
Colour of text.
lwc_string *const * families
Array of pointers to font families.
plot_font_flags_t flags
Font flags.
plot_style_fixed size
Font size, in pt.
colour background
Background colour to blend to, if appropriate.
int weight
Font weight: value in range [100,900] as per CSS.
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.
uint32_t colour
Colour type: XBGR.