]> O.S.I.I.S - jp/vkvg.git/commitdiff
Add vkvg_has_current_point and vkvg_get_target (#97)
authorMarco Rubin <20150305+Rubo3@users.noreply.github.com>
Sun, 27 Feb 2022 12:01:36 +0000 (12:01 +0000)
committerGitHub <noreply@github.com>
Sun, 27 Feb 2022 12:01:36 +0000 (13:01 +0100)
* Define vkvg_has_current_point and vkvg_get_target

* Declare vkvg_has_current_point and vkvg_get_target

include/vkvg.h
src/vkvg_context.c

index 592ad6b3cd07334f017e5f9636c9d10d60ae1290..10d9eec78d0f99571b156f8c5740841df14d33af 100644 (file)
@@ -1423,6 +1423,19 @@ vkvg_fill_rule_t vkvg_get_fill_rule (VkvgContext ctx);
 vkvg_public
 VkvgPattern vkvg_get_source (VkvgContext ctx);
 
+vkvg_public
+VkvgSurface vkvg_get_target (VkvgContext ctx);
+
+/**
+ * @brief Returns whether a current point is defined on the current path.
+ * See @ref vkvg_get_current_point() for details on the current point.
+ *
+ * @param ctx a valig vkvg @ref context
+ * @return bool whether a current point is defined
+ **/
+vkvg_public
+bool vkvg_has_current_point (VkvgContext ctx);
+
 /**
  * @brief
  *
index bae24317ea96d0d8863dc3efed6c7c92c57289da..ead2f0ef1e2ebf307dbb9a35c5f6f86b42d790ad 100644 (file)
@@ -520,6 +520,11 @@ void vkvg_move_to (VkvgContext ctx, float x, float y)
        _finish_path(ctx);
        _add_point (ctx, x, y);
 }
+bool vkvg_has_current_point (VkvgContext ctx) {
+       if (ctx->status)
+               return false;
+       return !_current_path_is_empty(ctx);
+}
 void vkvg_get_current_point (VkvgContext ctx, float* x, float* y) {
        if (_current_path_is_empty(ctx)) {
                *x = *y = 0;
@@ -1581,3 +1586,9 @@ void vkvg_ellipse (VkvgContext ctx, float radiusX, float radiusY, float x, float
        vkvg_curve_to (ctx, topLeftX, topLeftY, bottomLeftX, bottomLeftY, bottomCenterX, bottomCenterY);
        vkvg_close_path (ctx);
 }
+
+VkvgSurface vkvg_get_target (VkvgContext ctx) {
+       if (ctx->status)
+               return NULL;
+       return ctx->pSurf;
+}