Mercurial > MadButterfly
changeset 597:3300992b29ff openvg
Define mbe_clear() for VG
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Thu, 01 Jul 2010 15:52:29 +0800 |
parents | aaab76730beb |
children | aba62eb9362d |
files | include/mb_graph_engine_openvg.h src/graph_engine_openvg.c |
diffstat | 2 files changed, 21 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/include/mb_graph_engine_openvg.h Thu Jul 01 14:48:57 2010 +0800 +++ b/include/mb_graph_engine_openvg.h Thu Jul 01 15:52:29 2010 +0800 @@ -62,7 +62,6 @@ #define mbe_move_to(canvas, x, y) #define mbe_line_to(canvas, x, y) #define mbe_in_fill(canvas, x, y) (0) -#define mbe_clear(canvas) #define mbe_save(canvas) #define mbe_arc(canvas, x, y, radius, angle_start, angle_stop) @@ -177,6 +176,7 @@ extern mbe_t *mbe_create(mbe_surface_t *surface); extern void mbe_destroy(mbe_t *canvas); extern void mbe_paint(mbe_t *canvas); +extern void mbe_clear(mbe_t *canvas); static void mbe_stroke(mbe_t *canvas) {
--- a/src/graph_engine_openvg.c Thu Jul 01 14:48:57 2010 +0800 +++ b/src/graph_engine_openvg.c Thu Jul 01 15:52:29 2010 +0800 @@ -267,6 +267,7 @@ canvas->src = NULL; canvas->paint = VG_INVALID_HANDLE; + canvas->paint_installed = 0; canvas->tgt = surface; canvas->ctx = ctx; canvas->path = path; @@ -314,3 +315,22 @@ vgSeti(VG_SCISSORING, VG_TRUE); } +void +mbe_clear(mbe_t *canvas) { + VGPaint paint; + + _MK_CURRENT_CTX(canvas); + + paint = vgCreatePaint(); + ASSERT(paint != VG_INVALID_HANDLE); + vgSetColor(paint, 0); + + vgSetPaint(paint, VG_FILL_PATH); + vgSeti(VG_BLEND_MODE, VG_BLEND_SRC); + vgDrawPath(canvas->path, VG_FILL_PATH); + vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER); + + vgDestroyPaint(paint); + + canvas->paint_installed = 0; +}