diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2009-04-08 10:17:09 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2009-04-08 10:17:09 +0000 |
commit | 056e1ebed94379db41ebb2e40cc88a873cfb4411 (patch) | |
tree | d1d01c4b9f9d4c2c2b1db4b705e631d49cf2e6b0 /src/plot.c | |
download | libnsfb-056e1ebed94379db41ebb2e40cc88a873cfb4411.tar.gz libnsfb-056e1ebed94379db41ebb2e40cc88a873cfb4411.tar.bz2 |
initial commit of netsurf framebuffer library
svn path=/trunk/libnsfb/; revision=7060
Diffstat (limited to 'src/plot.c')
-rw-r--r-- | src/plot.c | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/src/plot.c b/src/plot.c new file mode 100644 index 0000000..8f46cfe --- /dev/null +++ b/src/plot.c @@ -0,0 +1,114 @@ +/* public plotter interface */ + +#include <stdbool.h> + +#include "libnsfb.h" +#include "libnsfb_plot.h" +#include "nsfb.h" +#include "nsfb_plot.h" + +/** Sets a clip rectangle for subsequent plots. + * + * Sets a clipping area which constrains all subsequent plotting operations. + * The clipping area must lie within the framebuffer visible screen or false + * will be returned and the new clipping area not set. + */ +bool nsfb_plot_set_clip(nsfb_t *nsfb, nsfb_bbox_t *clip) +{ + return nsfb->plotter_fns->clip(nsfb, clip); +} + +/** Clears plotting area to a flat colour. + */ +bool nsfb_plot_clg(nsfb_t *nsfb, nsfb_colour_t c) +{ + return nsfb->plotter_fns->clg(nsfb, c); +} + +/** Plots a rectangle outline. + * + * The line can be solid, dotted or dashed. Top left corner at (x0,y0) and + * rectangle has given width and height. + */ +bool +nsfb_plot_rectangle(nsfb_t *nsfb, + nsfb_bbox_t *rect, + int line_width, + nsfb_colour_t c, + bool dotted, + bool dashed) +{ + return nsfb->plotter_fns->rectangle(nsfb, rect, line_width, c, dotted, dashed); + +} + +/** Plots a filled rectangle. Top left corner at (x0,y0), bottom + * right corner at (x1,y1). Note: (x0,y0) is inside filled area, + * but (x1,y1) is below and to the right. See diagram below. + */ +bool nsfb_plot_rectangle_fill(nsfb_t *nsfb, nsfb_bbox_t *rect, nsfb_colour_t c) +{ + return nsfb->plotter_fns->fill(nsfb, rect, c); +} + +/** Plots a line. + * + * Draw a line from (x0,y0) to (x1,y1). Coordinates are at centre of line + * width/thickness. + */ +bool nsfb_plot_line(nsfb_t *nsfb, nsfb_bbox_t *line, int line_width, nsfb_colour_t c, bool dotted, bool dashed) +{ + return nsfb->plotter_fns->line(nsfb, line, line_width, c, dotted, dashed); +} + +/** Plots a filled polygon. + * + * Plots a filled polygon with straight lines between points. The lines around + * the edge of the ploygon are not plotted. The polygon is filled with a + * non-zero winding rule. + * + * + */ +bool nsfb_plot_polygon(nsfb_t *nsfb, const int *p, unsigned int n, nsfb_colour_t fill) +{ + return nsfb->plotter_fns->polygon(nsfb, p, n, fill); +} + +/** Plots an arc. + * + * around (x,y), from anticlockwise from angle1 to angle2. Angles are measured + * anticlockwise from horizontal, in degrees. + */ +bool nsfb_plot_arc(nsfb_t *nsfb, int x, int y, int radius, int angle1, int angle2, nsfb_colour_t c) +{ + return nsfb->plotter_fns->arc(nsfb, x, y, radius, angle1, angle2, c); +} + +/** Plots an alpha blended pixel. + * + * plots an alpha blended pixel. + */ +bool nsfb_plot_point(nsfb_t *nsfb, int x, int y, nsfb_colour_t c) +{ + return nsfb->plotter_fns->point(nsfb, x, y, c); +} + +bool nsfb_plot_ellipse(nsfb_t *nsfb, nsfb_bbox_t *ellipse, nsfb_colour_t c) +{ + return nsfb->plotter_fns->ellipse(nsfb, ellipse, c); +} + +bool nsfb_plot_ellipse_fill(nsfb_t *nsfb, nsfb_bbox_t *ellipse, nsfb_colour_t c) +{ + return nsfb->plotter_fns->ellipse_fill(nsfb, ellipse, c); +} + +bool nsfb_plot_copy(nsfb_t *nsfb, int srcx, int srcy, int width, int height, int dstx, int dsty) +{ + return nsfb->plotter_fns->copy(nsfb, srcx, srcy, width, height, dstx, dsty); +} + +bool nsfb_plot_bitmap(nsfb_t *nsfb, nsfb_bbox_t *loc, nsfb_colour_t *pixel, int bmp_width, int bmp_height, int bmp_stride, bool alpha) +{ + return nsfb->plotter_fns->bitmap(nsfb, loc, pixel, bmp_width, bmp_height, bmp_stride, alpha); +} |