summaryrefslogtreecommitdiff
path: root/include/plot_util.h
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2009-04-08 10:17:09 +0000
committerVincent Sanders <vince@netsurf-browser.org>2009-04-08 10:17:09 +0000
commit056e1ebed94379db41ebb2e40cc88a873cfb4411 (patch)
treed1d01c4b9f9d4c2c2b1db4b705e631d49cf2e6b0 /include/plot_util.h
downloadlibnsfb-056e1ebed94379db41ebb2e40cc88a873cfb4411.tar.gz
libnsfb-056e1ebed94379db41ebb2e40cc88a873cfb4411.tar.bz2
initial commit of netsurf framebuffer library
svn path=/trunk/libnsfb/; revision=7060
Diffstat (limited to 'include/plot_util.h')
-rw-r--r--include/plot_util.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/plot_util.h b/include/plot_util.h
new file mode 100644
index 0000000..6565cb1
--- /dev/null
+++ b/include/plot_util.h
@@ -0,0 +1,24 @@
+/* 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);