summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-08-24 08:06:29 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-08-24 08:06:29 +0000
commit15cdb30e3125ce542289fe385f559799e5abf220 (patch)
tree76ff864a119dc14f1ab434d96bef77320229a863 /include
parent729b244809295dad81e0510f9d0bcd7a4c00ec00 (diff)
downloadlibsvgtiny-15cdb30e3125ce542289fe385f559799e5abf220.tar.gz
libsvgtiny-15cdb30e3125ce542289fe385f559799e5abf220.tar.bz2
Beginnings of port to core buildsystem
svn path=/trunk/libsvgtiny/; revision=9419
Diffstat (limited to 'include')
-rw-r--r--include/svgtiny.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/include/svgtiny.h b/include/svgtiny.h
new file mode 100644
index 0000000..133086c
--- /dev/null
+++ b/include/svgtiny.h
@@ -0,0 +1,74 @@
+/*
+ * This file is part of Libsvgtiny
+ * Licensed under the MIT License,
+ * http://opensource.org/licenses/mit-license.php
+ * Copyright 2008 James Bursa <james@semichrome.net>
+ */
+
+#ifndef SVGTINY_H
+#define SVGTINY_H
+
+#include <libxml/parser.h>
+
+typedef int svgtiny_colour;
+#define svgtiny_TRANSPARENT 0x1000000
+#ifdef riscos
+#define svgtiny_RGB(r, g, b) ((b) << 16 | (g) << 8 | (r))
+#define svgtiny_RED(c) ((c) & 0xff)
+#define svgtiny_GREEN(c) (((c) >> 8) & 0xff)
+#define svgtiny_BLUE(c) (((c) >> 16) & 0xff)
+#else
+#define svgtiny_RGB(r, g, b) ((r) << 16 | (g) << 8 | (b))
+#define svgtiny_RED(c) (((c) >> 16) & 0xff)
+#define svgtiny_GREEN(c) (((c) >> 8) & 0xff)
+#define svgtiny_BLUE(c) ((c) & 0xff)
+#endif
+
+struct svgtiny_shape {
+ float *path;
+ unsigned int path_length;
+ char *text;
+ float text_x, text_y;
+ svgtiny_colour fill;
+ svgtiny_colour stroke;
+ int stroke_width;
+};
+
+struct svgtiny_diagram {
+ int width, height;
+
+ struct svgtiny_shape *shape;
+ unsigned int shape_count;
+
+ unsigned short error_line;
+ const char *error_message;
+};
+
+typedef enum {
+ svgtiny_OK,
+ svgtiny_OUT_OF_MEMORY,
+ svgtiny_LIBXML_ERROR,
+ svgtiny_NOT_SVG,
+ svgtiny_SVG_ERROR,
+} svgtiny_code;
+
+enum {
+ svgtiny_PATH_MOVE,
+ svgtiny_PATH_CLOSE,
+ svgtiny_PATH_LINE,
+ svgtiny_PATH_BEZIER,
+};
+
+struct svgtiny_named_color {
+ const char *name;
+ svgtiny_colour color;
+};
+
+
+struct svgtiny_diagram *svgtiny_create(void);
+svgtiny_code svgtiny_parse(struct svgtiny_diagram *diagram,
+ const char *buffer, size_t size, const char *url,
+ int width, int height);
+void svgtiny_free(struct svgtiny_diagram *svg);
+
+#endif