canvas2svg
canvas2svg copied to clipboard
shadowColor method missing
Looks like ctx.shadowColor isn't implemented in the latest version of the library. If anyone wants to add this, I'll pay a bounty.
I have tried to add support for a drop-shadow filter ( https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/filter ) :
ctx.prototype.__applyFilter = function () {
var filter = this.filter;
if (filter != null) {
var match = /^drop-shadow\(([^p]+)px\s+([^p]+)px\s+([^p]+)px\s+([\s\S]+?)\)$/.exec(filter);
if (match != null) {
var dx = match[1];
var dy = match[2];
var stdDeviation = Number.parseFloat(match[3]) / 2;
var floodColor = match[4];
var feDropShadowElement = this.__createElement("feDropShadow", {
dx: dx,
dy: dy,
stdDeviation: stdDeviation,
"flood-color": floodColor
}, false);
var id = randomString(this.__ids);
var filterElement = this.__createElement("filter", {
id: id
}, false);
filterElement.appendChild(feDropShadowElement);
this.__defs.appendChild(filterElement);
this.__currentElement.setAttribute('filter', format("url(#{id})", {id:id}));
}
}
};
Nice, DM me on Discord Zamiel#8743
@Zamiell i don't know how to use Discord, do you want to ask something?
Was gonna offer to pay you
@Zamiell , thanks, glad to see this, but no need I have some money