Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shadowColor method missing #72

Open
Tracked by #13
Zamiell opened this issue May 7, 2019 · 5 comments
Open
Tracked by #13

shadowColor method missing #72

Zamiell opened this issue May 7, 2019 · 5 comments

Comments

@Zamiell
Copy link

Zamiell commented May 7, 2019

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.

@Yaffle
Copy link

Yaffle commented Nov 12, 2019

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}));
            }
        }
    };

@Zamiell
Copy link
Author

Zamiell commented Feb 28, 2021

Nice, DM me on Discord Zamiel#8743

@Yaffle
Copy link

Yaffle commented Mar 1, 2021

@Zamiell i don't know how to use Discord, do you want to ask something?

@Zamiell
Copy link
Author

Zamiell commented Mar 1, 2021

Was gonna offer to pay you

@Yaffle
Copy link

Yaffle commented Mar 1, 2021

@Zamiell , thanks, glad to see this, but no need I have some money

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants