wasm: Set a GIF background color.

Use a white background by default.
This commit is contained in:
Hermet Park 2023-11-13 20:32:48 +09:00
parent b1c1958c99
commit 750e4d6261

View file

@ -22,8 +22,6 @@
#include <thorvg.h>
#include <emscripten/bind.h>
#include "tvgIteratorAccessor.h"
using namespace emscripten;
using namespace std;
@ -242,6 +240,13 @@ public:
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) {
errorMsg = "save(), fail";
return false;