From: Marco Rubin <20150305+Rubo3@users.noreply.github.com> Date: Sun, 27 Feb 2022 12:01:36 +0000 (+0000) Subject: Add vkvg_has_current_point and vkvg_get_target (#97) X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=f85607edc5ecd61cadcb0670b3bbd9c41cca5a19;p=jp%2Fvkvg.git Add vkvg_has_current_point and vkvg_get_target (#97) * Define vkvg_has_current_point and vkvg_get_target * Declare vkvg_has_current_point and vkvg_get_target --- diff --git a/include/vkvg.h b/include/vkvg.h index 592ad6b..10d9eec 100644 --- a/include/vkvg.h +++ b/include/vkvg.h @@ -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 * diff --git a/src/vkvg_context.c b/src/vkvg_context.c index bae2431..ead2f0e 100644 --- a/src/vkvg_context.c +++ b/src/vkvg_context.c @@ -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; +}