/* Drawing Commands */
/************************************************************************/
-uint32_t *data = nullptr;
-
void tvgDrawCmds(tvg::Canvas* canvas)
{
if (!canvas) return;
colorStops[1] = {1,255,255,255,255};
fill->colorStops(colorStops,2);
shape->fill(move(fill));
-
+
shape->composite(move(mask), tvg::CompositeMethod::AlphaMask);
canvas->push(move(shape));
colorStops1[1] = {1,1,255,255,255};
fill1->colorStops(colorStops1,2);
shape1->fill(move(fill1));
-
+
shape1->composite(move(mask1), tvg::CompositeMethod::AlphaMask);
canvas->push(move(shape1));
colorStops2[1] = {1,255,255,255,255};
fill2->colorStops(colorStops2,2);
shape2->fill(move(fill2));
-
+
shape2->composite(move(mask2), tvg::CompositeMethod::InvAlphaMask);
canvas->push(move(shape2));
colorStops3[1] = {1,1,255,255,255};
fill3->colorStops(colorStops3,2);
shape3->fill(move(fill3));
-
+
shape3->composite(move(mask3), tvg::CompositeMethod::InvAlphaMask);
canvas->push(move(shape3));
//Terminate ThorVG Engine
tvg::Initializer::term(tvg::CanvasEngine::Sw);
- if (data) free(data);
-
} else {
cout << "engine is not supported" << endl;
}
/* Drawing Commands */
/************************************************************************/
-uint32_t *data = nullptr;
-
void tvgDrawCmds(tvg::Canvas* canvas)
{
if (!canvas) return;
//Image
ifstream file(EXAMPLE_DIR"/rawimage_200x300.raw");
if (!file.is_open()) return;
- data = (uint32_t*) malloc(sizeof(uint32_t) * (200 * 300));
+ auto data = (uint32_t*) malloc(sizeof(uint32_t) * (200 * 300));
file.read(reinterpret_cast<char *>(data), sizeof (uint32_t) * 200 * 300);
file.close();
auto image = tvg::Picture::gen();
if (image->load(data, 200, 300, true) != tvg::Result::Success) return;
image->translate(500, 400);
+ free(data);
+
//Mask4
auto mask4 = tvg::Shape::gen();
//Terminate ThorVG Engine
tvg::Initializer::term(tvg::CanvasEngine::Sw);
- if (data) free(data);
-
} else {
cout << "engine is not supported" << endl;
}