summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/libnsfb_plot.h16
-rw-r--r--include/plot.h (renamed from include/nsfb_plot.h)6
-rw-r--r--include/plotters.h1
-rw-r--r--src/16bpp_plotters.c3
-rw-r--r--src/32bpp_plotters.c3
-rw-r--r--src/8bpp_plotters.c3
-rw-r--r--src/cursor.c2
-rw-r--r--src/frontend.c2
-rw-r--r--src/frontend_linux.c4
-rw-r--r--src/frontend_sdl.c3
-rw-r--r--src/plot.c8
-rw-r--r--src/plotters.c3
12 files changed, 39 insertions, 15 deletions
diff --git a/include/libnsfb_plot.h b/include/libnsfb_plot.h
index ef53934..af1768e 100644
--- a/include/libnsfb_plot.h
+++ b/include/libnsfb_plot.h
@@ -45,6 +45,20 @@ typedef struct nsfb_plot_pen_s {
nsfb_colour_t fill_colour; /**< Colour of fill */
} nsfb_plot_pen_t;
+/** path operation type. */
+typedef enum nsfb_plot_pathop_type_e {
+ NFSB_PLOT_PATHOP_MOVE,
+ NFSB_PLOT_PATHOP_LINE,
+ NFSB_PLOT_PATHOP_QUAD,
+ NFSB_PLOT_PATHOP_CUBIC,
+} nsfb_plot_pathop_type_t;
+
+/** path element */
+typedef struct nsfb_plot_pathop_s {
+ nsfb_plot_pathop_type_t operation;
+ nsfb_point_t point;
+} nsfb_plot_pathop_t;
+
/** Sets a clip rectangle for subsequent plots.
*
* Sets a clipping area which constrains all subsequent plotting operations.
@@ -122,6 +136,8 @@ bool nsfb_plot_cubic_bezier(nsfb_t *nsfb, nsfb_bbox_t *curve, nsfb_point_t *ctrl
bool nsfb_plot_quadratic_bezier(nsfb_t *nsfb, nsfb_bbox_t *curve, nsfb_point_t *ctrla, nsfb_colour_t cl);
+bool nsfb_plot_path(nsfb_t *nsfb, int pathc, nsfb_plot_pathop_t *pathop, nsfb_plot_pen_t *pen);
+
/** copy an area of screen
*
* Copy an area of the display.
diff --git a/include/nsfb_plot.h b/include/plot.h
index 8b39cc5..8894c7a 100644
--- a/include/nsfb_plot.h
+++ b/include/plot.h
@@ -90,6 +90,9 @@ typedef bool (nsfb_plotfn_quadratic_bezier_t)(nsfb_t *nsfb, nsfb_bbox_t *curve,
*/
typedef bool (nsfb_plotfn_cubic_bezier_t)(nsfb_t *nsfb, nsfb_bbox_t *curve, nsfb_point_t *ctrla, nsfb_point_t *ctrlb, nsfb_colour_t c);
+/** plot path */
+typedef bool (nsfb_plotfn_path_t)(nsfb_t *nsfb, int pathc, nsfb_plot_pathop_t *pathop, nsfb_plot_pen_t *pen);
+
/** plotter function table. */
typedef struct nsfb_plotter_fns_s {
nsfb_plotfn_clg_t *clg;
@@ -110,6 +113,9 @@ typedef struct nsfb_plotter_fns_s {
nsfb_plotfn_readrect_t *readrect;
nsfb_plotfn_quadratic_bezier_t *quadratic;
nsfb_plotfn_cubic_bezier_t *cubic;
+ nsfb_plotfn_path_t *path;
} nsfb_plotter_fns_t;
+bool select_plotters(nsfb_t *nsfb);
+
diff --git a/include/plotters.h b/include/plotters.h
deleted file mode 100644
index dc4648b..0000000
--- a/include/plotters.h
+++ /dev/null
@@ -1 +0,0 @@
-bool select_plotters(nsfb_t *nsfb);
diff --git a/src/16bpp_plotters.c b/src/16bpp_plotters.c
index a223e23..b9ff186 100644
--- a/src/16bpp_plotters.c
+++ b/src/16bpp_plotters.c
@@ -15,8 +15,7 @@
#include "libnsfb_plot_util.h"
#include "nsfb.h"
-#include "nsfb_plot.h"
-#include "plotters.h"
+#include "plot.h"
static inline uint16_t *get_xy_loc(nsfb_t *nsfb, int x, int y)
{
diff --git a/src/32bpp_plotters.c b/src/32bpp_plotters.c
index d86821c..243cdb4 100644
--- a/src/32bpp_plotters.c
+++ b/src/32bpp_plotters.c
@@ -15,8 +15,7 @@
#include "libnsfb_plot_util.h"
#include "nsfb.h"
-#include "nsfb_plot.h"
-#include "plotters.h"
+#include "plot.h"
static inline uint32_t *
get_xy_loc(nsfb_t *nsfb, int x, int y)
diff --git a/src/8bpp_plotters.c b/src/8bpp_plotters.c
index ec72174..b29d241 100644
--- a/src/8bpp_plotters.c
+++ b/src/8bpp_plotters.c
@@ -17,8 +17,7 @@
#include "libnsfb_plot_util.h"
#include "nsfb.h"
-#include "nsfb_plot.h"
-#include "plotters.h"
+#include "plot.h"
static inline uint8_t *get_xy_loc(nsfb_t *nsfb, int x, int y)
{
diff --git a/src/cursor.c b/src/cursor.c
index 98bd07b..f1a3b58 100644
--- a/src/cursor.c
+++ b/src/cursor.c
@@ -7,7 +7,7 @@
#include "nsfb.h"
#include "cursor.h"
-#include "nsfb_plot.h"
+#include "plot.h"
#include "frontend.h"
bool nsfb_cursor_init(nsfb_t *nsfb)
diff --git a/src/frontend.c b/src/frontend.c
index 630def9..17d6113 100644
--- a/src/frontend.c
+++ b/src/frontend.c
@@ -13,7 +13,7 @@
#include <string.h>
#include "frontend.h"
-#include "plotters.h"
+#include "plot.h"
#define MAX_FRONTENDS 16
diff --git a/src/frontend_linux.c b/src/frontend_linux.c
index d80fc43..e65c888 100644
--- a/src/frontend_linux.c
+++ b/src/frontend_linux.c
@@ -12,9 +12,11 @@
#include "libnsfb.h"
#include "libnsfb_event.h"
#include "libnsfb_plot.h"
+
#include "nsfb.h"
+#include "plot.h"
#include "frontend.h"
-#include "plotters.h"
+
#define UNUSED(x) ((x) = (x))
diff --git a/src/frontend_sdl.c b/src/frontend_sdl.c
index 359728c..cc83a4e 100644
--- a/src/frontend_sdl.c
+++ b/src/frontend_sdl.c
@@ -17,8 +17,7 @@
#include "nsfb.h"
#include "frontend.h"
-#include "plotters.h"
-#include "nsfb_plot.h"
+#include "plot.h"
#include "cursor.h"
enum nsfb_key_code_e sdl_nsfb_map[] = {
diff --git a/src/plot.c b/src/plot.c
index 90404cc..4de25c9 100644
--- a/src/plot.c
+++ b/src/plot.c
@@ -4,8 +4,9 @@
#include "libnsfb.h"
#include "libnsfb_plot.h"
+
#include "nsfb.h"
-#include "nsfb_plot.h"
+#include "plot.h"
/** Sets a clip rectangle for subsequent plots.
*
@@ -161,3 +162,8 @@ bool nsfb_plot_quadratic_bezier(nsfb_t *nsfb, nsfb_bbox_t *curve, nsfb_point_t *
{
return nsfb->plotter_fns->quadratic(nsfb, curve, ctrla, c);
}
+
+bool nsfb_plot_path(nsfb_t *nsfb, int pathc, nsfb_plot_pathop_t *pathop, nsfb_plot_pen_t *pen)
+{
+ return nsfb->plotter_fns->path(nsfb, pathc, pathop, pen);
+}
diff --git a/src/plotters.c b/src/plotters.c
index 91c3b7b..d04559e 100644
--- a/src/plotters.c
+++ b/src/plotters.c
@@ -21,8 +21,7 @@
#include "libnsfb_plot_util.h"
#include "nsfb.h"
-#include "nsfb_plot.h"
-#include "plotters.h"
+#include "plot.h"
#include "frontend.h"
extern const nsfb_plotter_fns_t _nsfb_1bpp_plotters;