javascript - HTML5 canvas .toDataURL() image has no background color -
problem
when using .todataurl()
method of html5 <canvas>
element background-color
property of element not applied picture.
question
is happenning because background-color
not part of canvas
, dom styling? if so, or else, can workaround this?
fiddle
fiddle play here. base64 string logged console.
additional info
the canvas created svg
using https://code.google.com/p/canvg/
you're correct isn't part of image data, part of styling. easiest way around draw rectangle before drawing svg:
var canvas = document.getelementbyid('test'); var ctx = canvas.getcontext('2d'); ctx.fillstyle = 'green'; ctx.fillrect(0, 0, canvas.width, canvas.height);
Comments
Post a Comment