summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2018-01-29 00:02:37 +0000
committerVincent Sanders <vince@kyllikki.org>2018-01-29 00:02:37 +0000
commit6b16f2446bb381be3de54d9edfe9088a8363df70 (patch)
tree3d13fbd5d0053b720b56256027d2c8a4aa13129e /include
parent887175cabfbf3cea833583834937eadf9654e07a (diff)
downloadlibnspdf-6b16f2446bb381be3de54d9edfe9088a8363df70.tar.gz
libnspdf-6b16f2446bb381be3de54d9edfe9088a8363df70.tar.bz2
extend page interface with render context
Diffstat (limited to 'include')
-rw-r--r--include/nspdf/page.h55
1 files changed, 54 insertions, 1 deletions
diff --git a/include/nspdf/page.h b/include/nspdf/page.h
index 8c1d7fc..f8c280e 100644
--- a/include/nspdf/page.h
+++ b/include/nspdf/page.h
@@ -19,8 +19,61 @@
struct nspdf_doc;
+/**
+ * Type of plot operation
+ */
+enum nspdf_style_operation {
+ NSPDF_OP_TYPE_NONE = 0, /**< No operation */
+ NSPDF_OP_TYPE_SOLID, /**< Solid colour */
+ NSPDF_OP_TYPE_DOT, /**< Dotted plot */
+ NSPDF_OP_TYPE_DASH, /**< Dashed plot */
+};
+
+
+/**
+ * Plot style for stroke/fill plotters
+ */
+typedef struct nspdf_style {
+ enum nspdf_style_operation stroke_type; /**< Stroke plot type */
+ int stroke_width; /**< Width of stroke, in pixels */
+ uint32_t stroke_colour; /**< Colour of stroke XBGR */
+
+ enum nspdf_style_operation fill_type; /**< Fill plot type */
+ uint32_t fill_colour; /**< Colour of fill XBGR */
+} nspdf_style;
+
+
+enum nspdf_path_command {
+ NSPDF_PATH_MOVE = 0,
+ NSPDF_PATH_CLOSE,
+ NSPDF_PATH_LINE,
+ NSPDF_PATH_BEZIER,
+};
+
+struct nspdf_render_ctx {
+ const void *ctx; /**< context passed to drawing functions */
+
+ float device_space[6]; /* user space to device space transformation matrix */
+
+ /**
+ * Plots a path.
+ *
+ * Path plot consisting of lines and cubic Bezier curves. Line and fill
+ * colour is controlled by the style. All elements of the path are in
+ * device space.
+ *
+ * \param style Style controlling the path plot.
+ * \param p elements of path
+ * \param n nunber of elements on path
+ * \param transform A transform to apply to the path.
+ * \param ctx The drawing context.
+ * \return NSERROR_OK on success else error code.
+ */
+ nspdferror (*path)(const struct nspdf_style *style, const float *p, unsigned int n, const float transform[6], const void *ctx);
+};
+
nspdferror nspdf_page_count(struct nspdf_doc *doc, unsigned int *pages_out);
-nspdferror nspdf_page_render(struct nspdf_doc *doc, unsigned int page_num);
+nspdferror nspdf_page_render(struct nspdf_doc *doc, unsigned int page_num, struct nspdf_render_ctx* render_ctx);
#endif /* NSPDF_META_H_ */