/* 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));
- file.read(reinterpret_cast<char *>(data), sizeof (data) * 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();
mask4->fill(255, 255, 255, 70);
image->composite(move(mask4), tvg::CompositeMethod::AlphaMask);
if (canvas->push(move(image)) != tvg::Result::Success) return;
+
+ free(data);
}
//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;
ifstream file(path);
if (!file.is_open()) return ;
- data = (uint32_t*)malloc(sizeof(uint32_t) * (200*300));
- file.read(reinterpret_cast<char *>(data), sizeof (data) * 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 picture = tvg::Picture::gen();