|
ginnOS
The reference: libc, the libraries and the kernel
|
libgfx: round rectangles, borders and soft shadows, drawn as CSS draws them. More...
Functions | |
| void | gfx_fill_round_rect_gradient (gfx_buffer_t *buf, gfx_rect_t r, int32_t radius, gfx_color_t top, gfx_color_t bottom) |
| fill a round rectangle with a vertical gradient from top to bottom, sampled at the pixel centres (as a CSS linear-gradient). | |
| void | gfx_fill_round_rect (gfx_buffer_t *buf, gfx_rect_t r, int32_t radius, gfx_color_t color) |
| fill a rectangle with round corners, with anti-aliased corners (as CSS border-radius). | |
| void | gfx_border_round_rect (gfx_buffer_t *buf, gfx_rect_t r, int32_t radius, int32_t width, gfx_color_t color) |
| the border of a round rectangle: width pixels wide, inside r (as a CSS border with box-sizing: border-box). | |
| void | gfx_box_shadow (gfx_buffer_t *buf, gfx_rect_t box, int32_t radius, const gfx_shadow_t *s) |
| draw a box-shadow of a round box. | |
libgfx: round rectangles, borders and soft shadows, drawn as CSS draws them.
every shape here is a rectangle on whole pixels with a corner radius. a pixel's coverage comes from the distance d from its centre to the edge of the shape (negative inside): 0.5 - d, cut to 0..1. this is the usual anti-aliasing of browsers, so idunn looks close to its reference.
shadows follow CSS box-shadow: the shape is moved by the offset, made larger by the spread, blurred with sigma = blur / 2 (three box blurs, as SVG and Chrome do it), and drawn only outside the box (inside it, for an inset shadow).
| void gfx_fill_round_rect_gradient | ( | gfx_buffer_t * | buf, |
| gfx_rect_t | r, | ||
| int32_t | radius, | ||
| gfx_color_t | top, | ||
| gfx_color_t | bottom ) |
fill a round rectangle with a vertical gradient from top to bottom, sampled at the pixel centres (as a CSS linear-gradient).
| void gfx_fill_round_rect | ( | gfx_buffer_t * | buf, |
| gfx_rect_t | r, | ||
| int32_t | radius, | ||
| gfx_color_t | color ) |
fill a rectangle with round corners, with anti-aliased corners (as CSS border-radius).
| radius | the corner radius (made smaller if the rectangle is small). |
| void gfx_border_round_rect | ( | gfx_buffer_t * | buf, |
| gfx_rect_t | r, | ||
| int32_t | radius, | ||
| int32_t | width, | ||
| gfx_color_t | color ) |
the border of a round rectangle: width pixels wide, inside r (as a CSS border with box-sizing: border-box).
the inside is not touched.
| void gfx_box_shadow | ( | gfx_buffer_t * | buf, |
| gfx_rect_t | box, | ||
| int32_t | radius, | ||
| const gfx_shadow_t * | shadow ) |
draw a box-shadow of a round box.
an outer shadow is drawn only outside the box and an inset one only inside it, as in CSS: draw outer shadows before the box, inset ones after its background.
| box | the border box (an inset shadow: the box inside the border). |