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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -