summaryrefslogtreecommitdiff
path: root/include/libnsfb.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/libnsfb.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/libnsfb.h')
-rw-r--r--include/libnsfb.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/include/libnsfb.h b/include/libnsfb.h
new file mode 100644
index 0000000..0af8ab3
--- /dev/null
+++ b/include/libnsfb.h
@@ -0,0 +1,75 @@
+#ifndef _LIBNSFB_H
+#define _LIBNSFB_H 1
+
+#include <stdint.h>
+
+typedef struct nsfb_cursor_s nsfb_cursor_t;
+typedef struct nsfb_s nsfb_t;
+typedef uint32_t nsfb_colour_t;
+
+/* bounding box */
+typedef struct nsfb_bbox_s {
+ int x0;
+ int y0;
+ int x1;
+ int y1;
+} nsfb_bbox_t;
+
+/** The type of frontend for a framebuffer context. */
+enum nsfb_frontend_e {
+ NSFB_FRONTEND_NONE = 0, /* Empty frontend. */
+ NSFB_FRONTEND_SDL,
+ NSFB_FRONTEND_LINUX,
+ NSFB_FRONTEND_VNC,
+ NSFB_FRONTEND_ABLE,
+ NSFB_FRONTEND_RAM,
+};
+
+/** Initialise nsfb context.
+ *
+ * This initialises a framebuffer context.
+ *
+ * @param frontend The type of frontend to create a context for.
+ */
+nsfb_t *nsfb_init(enum nsfb_frontend_e frontend);
+
+/** Initialise selected frontend.
+ *
+ * @param nsfb The context frturned from ::nsfb_init
+ */
+int nsfb_init_frontend(nsfb_t *nsfb);
+
+/** Process input from a frontend.
+ */
+int nsfb_input(nsfb_t *nsfb);
+
+/** Claim an area of screen to be redrawn.
+ *
+ * Informs the nsfb library that an area of screen will be updated by the user
+ * program, used for soft cursor plotting.
+ *
+ * @param box The bounding box of the area which might be altered.
+ */
+int nsfb_claim(nsfb_t *nsfb, nsfb_bbox_t *box);
+
+/** Release an area of screen which has been redrawn.
+ *
+ * Informs the nsfb library that an area of screen has been updated by the user
+ * program. Some frontends only update on area release.
+ *
+ * @param box The bounding box of the area which has been altered.
+ */
+int nsfb_release(nsfb_t *nsfb, nsfb_bbox_t *box);
+
+/** Obtain the geometry of a nsfb context.
+ *
+ * @param width a variable to store the framebuffer width in or NULL
+ * @param height a variable to store the framebuffer height in or NULL
+ * @param bpp a variable to store the framebuffer bpp in or NULL
+ */
+int nsfb_get_geometry(nsfb_t *nsfb, int *width, int *height, int *bpp);
+
+/** Obtain the framebuffer memory base and stride. */
+int nsfb_get_framebuffer(nsfb_t *nsfb, uint8_t **ptr, int *linelen);
+
+#endif