96 enum css_border_style_e style,
103 unsigned int light = side;
123 case CSS_BORDER_STYLE_DOTTED:
126 case CSS_BORDER_STYLE_DASHED:
127 rect.
x0 = (p[0] + p[2]) / 2;
128 rect.
y0 = (p[1] + p[3]) / 2;
129 rect.
x1 = (p[4] + p[6]) / 2;
130 rect.
y1 = (p[5] + p[7]) / 2;
134 case CSS_BORDER_STYLE_SOLID:
137 if (rectangular || thickness == 1) {
143 (p[4] - p[6] != 0)) {
153 if ((side ==
LEFT) &&
154 (p[1] - p[3] != 0)) {
169 case CSS_BORDER_STYLE_DOUBLE:
172 z[2] = (p[0] * 2 + p[2]) / 3;
173 z[3] = (p[1] * 2 + p[3]) / 3;
174 z[4] = (p[6] * 2 + p[4]) / 3;
175 z[5] = (p[7] * 2 + p[5]) / 3;
182 z[2] = (p[2] * 2 + p[0]) / 3;
183 z[3] = (p[3] * 2 + p[1]) / 3;
184 z[4] = (p[4] * 2 + p[6]) / 3;
185 z[5] = (p[5] * 2 + p[7]) / 3;
192 case CSS_BORDER_STYLE_GROOVE:
195 case CSS_BORDER_STYLE_RIDGE:
206 if ((rectangular || thickness == 2) && thickness != 1) {
213 rect.
x0 = (p[0] + p[2]) / 2;
214 rect.
y0 = (p[1] + p[3]) / 2;
220 rect.
x1 = (p[0] + p[2]) / 2;
221 rect.
y1 = (p[1] + p[3]) / 2;
235 rect.
x1 = (p[6] + p[4]) / 2;
236 rect.
y1 = (p[7] + p[5]) / 2;
238 rect.
x0 = (p[6] + p[4]) / 2;
239 rect.
y0 = (p[7] + p[5]) / 2;
247 }
else if (thickness == 1) {
257 rect.
x1 = ((side ==
TOP) && (p[4] - p[6] != 0)) ?
269 rect.
y1 = ((side ==
LEFT) && (p[1] - p[3] != 0)) ?
282 z[2] = (p[0] + p[2]) / 2;
283 z[3] = (p[1] + p[3]) / 2;
284 z[4] = (p[6] + p[4]) / 2;
285 z[5] = (p[7] + p[5]) / 2;
288 res = ctx->
plot->
polygon(ctx, plot_style_bdr_in, z, 4);
302 case CSS_BORDER_STYLE_INSET:
303 light = (light + 2) % 4;
305 case CSS_BORDER_STYLE_OUTSET:
331 if ((rectangular || thickness == 2) && thickness != 1) {
338 rect.
x0 = (p[0] + p[2]) / 2;
339 rect.
y0 = (p[1] + p[3]) / 2;
345 rect.
x1 = (p[0] + p[2]) / 2;
346 rect.
y1 = (p[1] + p[3]) / 2;
360 rect.
x1 = (p[6] + p[4]) / 2;
361 rect.
y1 = (p[7] + p[5]) / 2;
363 rect.
x0 = (p[6] + p[4]) / 2;
364 rect.
y0 = (p[7] + p[5]) / 2;
372 }
else if (thickness == 1) {
382 rect.
x1 = ((side ==
TOP) && (p[4] - p[6] != 0)) ?
393 rect.
y1 = ((side ==
LEFT) && (p[1] - p[3] != 0)) ?
407 z[2] = (p[0] + p[2]) / 2;
408 z[3] = (p[1] + p[3]) / 2;
409 z[4] = (p[6] + p[4]) / 2;
410 z[5] = (p[7] + p[5]) / 2;
413 res = ctx->
plot->
polygon(ctx, plot_style_bdr_in, z, 4);
421 res = ctx->
plot->
polygon(ctx, plot_style_bdr_out, z, 4);
459 unsigned int i, side;
462 bool square_end_1 =
false;
463 bool square_end_2 =
false;
466 x = x_parent +
box->
x;
467 y = y_parent +
box->
y;
490 p[0] = x - left; p[1] = y - top;
492 p[4] = x + p_width; p[5] = y + p_height;
493 p[6] = x + p_width + right; p[7] = y + p_height + bottom;
495 for (i = 0; i != 4; i++) {
506 square_end_1 = (top == 0);
507 square_end_2 = (bottom == 0);
509 z[0] = p[0]; z[1] = p[7];
510 z[2] = p[2]; z[3] = p[5];
511 z[4] = p[2]; z[5] = p[3];
512 z[6] = p[0]; z[7] = p[1];
538 square_end_1 && square_end_2,
547 square_end_1 = (top == 0);
548 square_end_2 = (bottom == 0);
550 z[0] = p[6]; z[1] = p[1];
551 z[2] = p[4]; z[3] = p[3];
552 z[4] = p[4]; z[5] = p[5];
553 z[6] = p[6]; z[7] = p[7];
579 square_end_1 && square_end_2,
588 if (
clip->y0 > p[3]) {
595 square_end_1 = (left == 0);
596 square_end_2 = (right == 0);
598 z[0] = p[2]; z[1] = p[3];
599 z[2] = p[0]; z[3] = p[1];
600 z[4] = p[6]; z[5] = p[1];
601 z[6] = p[4]; z[7] = p[3];
627 square_end_1 && square_end_2,
636 if (
clip->y1 < p[5]) {
643 square_end_1 = (left == 0);
644 square_end_2 = (right == 0);
646 z[0] = p[4]; z[1] = p[5];
647 z[2] = p[6]; z[3] = p[7];
648 z[4] = p[0]; z[5] = p[7];
649 z[6] = p[2]; z[7] = p[5];
675 square_end_1 && square_end_2,
743 p[0] = b.
x0; p[1] = b.
y0;
744 p[2] = first ? b.
x0 + left : b.
x0; p[3] = b.
y0 + top;
745 p[4] = last ? b.
x1 - right : b.
x1; p[5] = b.
y1 - bottom;
746 p[6] = b.
x1; p[7] = b.
y1;
751 square_end_1 = (top == 0);
752 square_end_2 = (bottom == 0);
758 z[0] = p[0]; z[1] = p[7];
759 z[2] = p[2]; z[3] = p[5];
760 z[4] = p[2]; z[5] = p[3];
761 z[6] = p[0]; z[7] = p[1];
786 square_end_1 && square_end_2,
795 square_end_1 = (top == 0);
796 square_end_2 = (bottom == 0);
802 z[0] = p[6]; z[1] = p[1];
803 z[2] = p[4]; z[3] = p[3];
804 z[4] = p[4]; z[5] = p[5];
805 z[6] = p[6]; z[7] = p[7];
830 square_end_1 && square_end_2,
839 square_end_1 = (left == 0);
840 square_end_2 = (right == 0);
845 z[0] = p[2]; z[1] = p[3];
846 z[2] = p[0]; z[3] = p[1];
847 z[4] = p[6]; z[5] = p[1];
848 z[6] = p[4]; z[7] = p[3];
875 square_end_1 && square_end_2,
884 square_end_1 = (left == 0);
885 square_end_2 = (right == 0);
890 z[0] = p[4]; z[1] = p[5];
891 z[2] = p[6]; z[3] = p[7];
892 z[4] = p[0]; z[5] = p[7];
893 z[6] = p[2]; z[7] = p[5];
920 square_end_1 && square_end_2,
nserror
Enumeration of error codes.
#define nscss_color_is_transparent(color)
Determine if a CSS color primitive is transparent.
#define nscss_color_to_ns(c)
Convert a CSS color to a NetSurf colour primitive.
Target independent plotting interface.
#define PLOT_STYLE_RADIX
22:10 fixed point
#define lighten_colour(c1)
#define darken_colour(c1)
@ PLOT_OP_TYPE_DASH
Dashed plot.
@ PLOT_OP_TYPE_DOT
Dotted plot.
@ PLOT_OP_TYPE_SOLID
Solid colour.
#define double_lighten_colour(c1)
#define NS_TRANSPARENT
Transparent colour value.
#define double_darken_colour(c1)
Private data for text/html content.
static plot_style_t plot_style_fillbdr_dlight
static nserror html_redraw_border_plot(const int side, const int *p, colour c, enum css_border_style_e style, int thickness, bool rectangular, const struct rect *clip, const struct redraw_context *ctx)
Draw one border.
bool html_redraw_borders(struct box *box, int x_parent, int y_parent, int p_width, int p_height, const struct rect *clip, float scale, const struct redraw_context *ctx)
Draw borders for a box.
static plot_style_t plot_style_fillbdr_light
static plot_style_t plot_style_bdr
static plot_style_t plot_style_fillbdr
static plot_style_t plot_style_fillbdr_ddark
static plot_style_t plot_style_fillbdr_dark
bool html_redraw_inline_borders(struct box *box, struct rect b, const struct rect *clip, float scale, bool first, bool last, const struct redraw_context *ctx)
Draw an inline's borders.
static nserror plot_clipped_rectangle(const struct redraw_context *ctx, const plot_style_t *style, const struct rect *clip, struct rect *rect)
enum css_border_style_e style
border-style
css_color c
border-color value
int width
border-width (pixels)
struct box_border border[4]
Border: TOP, RIGHT, BOTTOM, LEFT.
css_computed_style * style
Style for this box.
int x
Coordinate of left padding edge relative to parent box, or relative to ancestor that contains this bo...
int y
Coordinate of top padding edge, relative as for x.
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(* line)(const struct redraw_context *ctx, const plot_style_t *pstyle, const struct rect *line)
Plots a line.
nserror(* polygon)(const struct redraw_context *ctx, const plot_style_t *pstyle, const int *p, unsigned int n)
Plot a polygon.
nserror(* rectangle)(const struct redraw_context *ctx, const plot_style_t *pstyle, const struct rect *rectangle)
Plots a rectangle.
const struct plotter_table * plot
Current plot operation table.
uint32_t colour
Colour type: XBGR.
Interface to a number of general purpose functionality.
#define fallthrough
switch fall through
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.