diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2009-04-24 13:42:40 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2009-04-24 13:42:40 +0000 |
commit | 3d5b21e1473dbdee6c3df66d9ba2a9d657f1b486 (patch) | |
tree | f88a339bd1510e9cf5cf1a2a33e345dd8014d513 /include/libnsfb_plot_util.h | |
parent | 2b303df06ea14e99e41b118b299bb0bcf58aafd5 (diff) | |
download | libnsfb-3d5b21e1473dbdee6c3df66d9ba2a9d657f1b486.tar.gz libnsfb-3d5b21e1473dbdee6c3df66d9ba2a9d657f1b486.tar.bz2 |
add legacy plotter API
svn path=/trunk/libnsfb/; revision=7304
Diffstat (limited to 'include/libnsfb_plot_util.h')
-rw-r--r-- | include/libnsfb_plot_util.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/include/libnsfb_plot_util.h b/include/libnsfb_plot_util.h new file mode 100644 index 0000000..a1b0159 --- /dev/null +++ b/include/libnsfb_plot_util.h @@ -0,0 +1,40 @@ +/* + * Copyright 2009 Vincent Sanders <vince@simtec.co.uk> + * + * This file is part of libnsfb, http://www.netsurf-browser.org/ + * Licenced under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * + * This is the exported interface for the libnsfb graphics library. + */ + +#ifndef _LIBNSFB_PLOT_UTIL_H +#define _LIBNSFB_PLOT_UTIL_H 1 + + +/* alpha blend two pixels together */ +static inline nsfb_colour_t +nsfb_plot_ablend(nsfb_colour_t pixel, nsfb_colour_t scrpixel) +{ + int opacity = pixel >> 24; + int transp = 0x100 - opacity; + uint32_t rb, g; + + rb = ((pixel & 0xFF00FF) * opacity + + (scrpixel & 0xFF00FF) * transp) >> 8; + g = ((pixel & 0x00FF00) * opacity + + (scrpixel & 0x00FF00) * transp) >> 8; + + return (rb & 0xFF00FF) | (g & 0xFF00); +} + + +bool nsfb_plot_clip(const nsfb_bbox_t * restrict clip, nsfb_bbox_t * restrict rect); + +bool nsfb_plot_clip_ctx(nsfb_t *nsfb, nsfb_bbox_t * restrict rect); + +bool nsfb_plot_clip_line(const nsfb_bbox_t * restrict clip, nsfb_bbox_t * restrict line); + +bool nsfb_plot_clip_line_ctx(nsfb_t *nsfb, nsfb_bbox_t * restrict line); + +#endif /* _LIBNSFB_PLOT_UTIL_H */ |