mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-15 12:34:30 +00:00
wasm: Set a GIF background color.
Use a white background by default.
This commit is contained in:
parent
b1c1958c99
commit
750e4d6261
1 changed files with 7 additions and 2 deletions
|
@ -22,8 +22,6 @@
|
||||||
|
|
||||||
#include <thorvg.h>
|
#include <thorvg.h>
|
||||||
#include <emscripten/bind.h>
|
#include <emscripten/bind.h>
|
||||||
#include "tvgIteratorAccessor.h"
|
|
||||||
|
|
||||||
|
|
||||||
using namespace emscripten;
|
using namespace emscripten;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -242,6 +240,13 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//set a white opaque background
|
||||||
|
auto bg = tvg::Shape::gen();
|
||||||
|
bg->fill(255, 255, 255, 255);
|
||||||
|
bg->appendRect(0, 0, ow * scale, oh * scale);
|
||||||
|
|
||||||
|
saver->background(std::move(bg));
|
||||||
|
|
||||||
if (saver->save(std::move(animation), "output.gif", 100, fps) != tvg::Result::Success) {
|
if (saver->save(std::move(animation), "output.gif", 100, fps) != tvg::Result::Success) {
|
||||||
errorMsg = "save(), fail";
|
errorMsg = "save(), fail";
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue