Closed aeris170 closed 2 years ago
I don't understand? What did you mean by fgColor(foreground color)?
I don't understand? What did you mean by fgColor(foreground color)?
I would like to change the color of rendered bitmap image. I have my SVG's as black on top of transparent, is it possible to render them with a different color? Like, red or white or blue?
is it possible to render them with a different color? Like, red or white or blue?
Yes.. backgroundColor
the third parameter in Document::renderToBitmap
is there for you.
Bitmap renderToBitmap(std::uint32_t width = 0, std::uint32_t height = 0, std::uint32_t backgroundColor = 0x00000000) const;
backgroundColor
format is 0xRRGGBBAA
Name | HexCode | BackgroundColor |
---|---|---|
Red | #FF0000 | 0xFF0000FF |
Breen | #00FF00 | 0x00FF00FF |
Blue | #0000FF | 0x0000FFFF |
Yellow | #FFFF00 | 0xFFFF00FF |
White | #FFFFFF | 0xFFFFFFFF |
Pink | #FFC0CB | 0xFFC0CBFF |
black
background<svg id="svg1" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
<circle id="circle1" cx="100" cy="100" r="80" fill="green"/>
</svg>
yellow
background colorauto bitmap = document->renderToBitmap(0, 0, 0xFFFF00FF);
red
background colorauto bitmap = document->renderToBitmap(0, 0, 0xFF0000FF);
pink
background colorauto bitmap = document->renderToBitmap(0, 0, 0xFFC0CBFF);
I understand, my initial question was probably not well formulated. I wanted to change the color of "green circle" in the example you provided. Now I see how I can. Since SVG are just markup (I just discovered this, thanks to you), I can loop every every child of
I'm rendering an SVG with the example code yoou provided and it works great, but I would like to alter the output color of the rendered SVG. Is this possible? I'd expect something along the lines of: