*
* vkvg_status_t is used to indicates errors that can occur when using vkvg. Several vkvg function directely
* return result, but when using a @ref context, the last error is stored in the context and can be accessed
- * with #vkvg_status.
+ * with @ref vkvg_status().
*
* As soon as a status is not success, further operations will be canceled.
*/
*/
vkvg_public
void vkvg_destroy (VkvgContext ctx);
+/**
+ * @brief Get context status
+ *
+ * Get the current context status.
+ *
+ * @param ctx The vkvg context to query the status for.
+ */
+vkvg_public
+vkvg_status_t vkvg_status (VkvgContext ctx);
/**
* @brief Increment by one the reference count on this context.
* @param ctx The context to increment the reference count for.
* @param y The y coordinate of the top left corner of the rectangle to emit.
* @param w The width in pixel of the rectangle to draw.
* @param h The height in pixel of the rectangle to draw.
+ * @return VKVG_STATUS_SUCCESS or VKVG_STATUS_INVALID_RECT if width or height is equal to 0.
*/
vkvg_public
-void vkvg_rectangle(VkvgContext ctx, float x, float y, float w, float h);
+vkvg_status_t vkvg_rectangle(VkvgContext ctx, float x, float y, float w, float h);
/**
* @brief Stroke command
*
free(ctx);
}
+vkvg_status_t vkvg_status (VkvgContext ctx) {
+ return ctx->status;
+}
VkvgContext vkvg_reference (VkvgContext ctx) {
ctx->references++;
return ctx;
//_record_draw_cmd(ctx);
}
-void vkvg_rectangle (VkvgContext ctx, float x, float y, float w, float h){
+vkvg_status_t vkvg_rectangle (VkvgContext ctx, float x, float y, float w, float h){
if (ctx->status)
- return;
+ return ctx->status;
_finish_path (ctx);
- if (w <= 0 || h <= 0) {
- ctx->status = VKVG_STATUS_INVALID_RECT;
- return;
- }
+ if (w <= 0 || h <= 0)
+ return VKVG_STATUS_INVALID_RECT;
_add_point (ctx, x, y);
_add_point (ctx, x + w, y);
ctx->pathes[ctx->pathPtr] |= PATH_CLOSED_BIT;
_finish_path(ctx);
+ return VKVG_STATUS_SUCCESS;
}
static const VkClearAttachment clearStencil = {VK_IMAGE_ASPECT_STENCIL_BIT, 1, {{{0}}}};
static const VkClearAttachment clearColorAttach = {VK_IMAGE_ASPECT_COLOR_BIT, 0, {{{0}}}};