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

ctx.fill("evenodd") doesn't work + fix #62

Open
Tracked by #13
murkle opened this issue Oct 23, 2017 · 3 comments
Open
Tracked by #13

ctx.fill("evenodd") doesn't work + fix #62

murkle opened this issue Oct 23, 2017 · 3 comments

Comments

@murkle
Copy link

murkle commented Oct 23, 2017

ctx.fill("evenodd") doesn't take account of the parameter. Simple fix is to change method to

    ctx.prototype.fill = function (fillRule) {
        if (this.__currentElement.nodeName === "path") {
            this.__currentElement.setAttribute("paint-order", "stroke fill markers");
            if (fillRule == "evenodd") {
            	this.__currentElement.setAttribute("fill-rule", "evenodd");
            } 
        }
        this.__applyCurrentDefaultPath();
        this.__applyStyleToCurrentElement("fill");
    };
@samuilJsMan
Copy link

samuilJsMan commented Dec 20, 2024

i was bored and tried some modernArt stuff and find out that evenodd problem still exist
two image below: working as canvas, but not as SVG
Screenshot 2024-12-20 133452
Screenshot 2024-12-20 133510

ctx.fillStyle = "rgb(16, 28, 201)";
ctx.beginPath();
ctx.moveTo(467, 283);
ctx.arc(350, 350, 135, -Math.PI / 6, Math.PI / 12);
ctx.lineTo(584, 486);
ctx.lineTo(528, 322);
ctx.arc(350, 350, 180, -Math.PI / 21, Math.PI / 10.5);
ctx.lineTo(554, 445);
ctx.lineTo(557, 438);
ctx.fill("evenodd")
ctx.closePath();
ctx.stroke();

maybe i do something wrong? who knows

@murkle
Copy link
Author

murkle commented Dec 20, 2024

@samuilJsMan try with this version https://github.com/zenozeng/svgcanvas

@samuilJsMan
Copy link

i tried and it's interesting, somehow i have same issue, i more and more think that i did something wrong rather than 2 authors

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