diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2010-01-06 22:26:55 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2010-01-06 22:26:55 +0000 |
commit | fd3c7753435658a6aeebf1b68d18178a6c7cf57d (patch) | |
tree | f17b620b6f7831476cae8d4f97ca8c2f9cbaa7b5 /include | |
parent | dfc3faf3fdf331e806cf43971c2251e65111f065 (diff) | |
download | libnsfb-fd3c7753435658a6aeebf1b68d18178a6c7cf57d.tar.gz libnsfb-fd3c7753435658a6aeebf1b68d18178a6c7cf57d.tar.bz2 |
add bezier curve plotters
svn path=/trunk/libnsfb/; revision=9794
Diffstat (limited to 'include')
-rw-r--r-- | include/libnsfb.h | 20 | ||||
-rw-r--r-- | include/libnsfb_plot.h | 4 | ||||
-rw-r--r-- | include/nsfb_plot.h | 10 |
3 files changed, 34 insertions, 0 deletions
diff --git a/include/libnsfb.h b/include/libnsfb.h index 5975768..41490ad 100644 --- a/include/libnsfb.h +++ b/include/libnsfb.h @@ -15,9 +15,29 @@ typedef struct nsfb_cursor_s nsfb_cursor_t; typedef struct nsfb_s nsfb_t; + +/** representation of a colour. + * + * The colour value comprises of four components arranged in the order ABGR: + * bits 24-31 are the alpha value and represent the opacity. 0 is + * transparent i.e. there would be no change in the target surface if + * this colour were to be used and 0xFF is opaque. + * + * bits 16-23 are the Blue component of the colour. + * + * bits 8-15 are the Green component of the colour. + * + * bits 0-7 are the Red component of the colour. + */ typedef uint32_t nsfb_colour_t; typedef struct nsfb_event_s nsfb_event_t; +/** co-ordinate for plotting operations */ +typedef struct nsfb_point_s { + int x; + int y; +} nsfb_point_t; + /** bounding box for plotting operations */ typedef struct nsfb_bbox_s { int x0; diff --git a/include/libnsfb_plot.h b/include/libnsfb_plot.h index 45aad28..1d420b0 100644 --- a/include/libnsfb_plot.h +++ b/include/libnsfb_plot.h @@ -78,6 +78,10 @@ bool nsfb_plot_arc(nsfb_t *nsfb, int x, int y, int radius, int angle1, int angle */ bool nsfb_plot_point(nsfb_t *nsfb, int x, int y, nsfb_colour_t c); +bool nsfb_plot_cubic_bezier(nsfb_t *nsfb, nsfb_bbox_t *curve, nsfb_point_t *ctrla, nsfb_point_t *ctrlb, nsfb_colour_t c); + +bool nsfb_plot_quadratic_bezier(nsfb_t *nsfb, nsfb_bbox_t *curve, nsfb_point_t *ctrla, nsfb_colour_t cl); + /** copy an area of screen * * Copy an area of the display. diff --git a/include/nsfb_plot.h b/include/nsfb_plot.h index 790a923..52af7cd 100644 --- a/include/nsfb_plot.h +++ b/include/nsfb_plot.h @@ -83,6 +83,14 @@ typedef bool (nsfb_plotfn_glyph1_t)(nsfb_t *nsfb, nsfb_bbox_t *loc, const uint8_ */ typedef bool (nsfb_plotfn_readrect_t)(nsfb_t *nsfb, nsfb_bbox_t *rect, nsfb_colour_t *buffer); +/** Plot quadratic bezier spline + */ +typedef bool (nsfb_plotfn_quadratic_bezier_t)(nsfb_t *nsfb, nsfb_bbox_t *curve, nsfb_point_t *ctrla, nsfb_colour_t c); + +/** Plot cubic bezier spline + */ +typedef bool (nsfb_plotfn_cubic_bezier_t)(nsfb_t *nsfb, nsfb_bbox_t *curve, nsfb_point_t *ctrla, nsfb_point_t *ctrlb, nsfb_colour_t c); + /** plotter function table. */ typedef struct nsfb_plotter_fns_s { nsfb_plotfn_clg_t *clg; @@ -101,6 +109,8 @@ typedef struct nsfb_plotter_fns_s { nsfb_plotfn_glyph8_t *glyph8; nsfb_plotfn_glyph1_t *glyph1; nsfb_plotfn_readrect_t *readrect; + nsfb_plotfn_quadratic_bezier_t *quadratic; + nsfb_plotfn_cubic_bezier_t *cubic; } nsfb_plotter_fns_t; |