-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
Fill a path with an Image #232
Comments
Yes you can, although it's not perfect yet for complex paths (especially self-intersecting paths fail). You can use the path logical operations for this: p := &canvas.Path{}
// create path
p.Close()
clip := canvas.Circle(5.0)
p = p.And(clip)
ctx.SetFill(canvas.Red)
ctx.DrawPath(x, y, p) Work is not complete on an image fill pattern yet. |
In other words, it is not possible to make a square image into a round image? |
No, not yet. |
Is there an update on this? |
Sorry no update yet. I have very limited time and have just completed the path intersections / path boolean operations code (see https://github.com/tdewolff/canvas/wiki/Boolean-operations). Supporting different types of fill paint is certainly much easier, but I'd like to support images and other (repeatable) paths. This latter is now fixed (see https://github.com/tdewolff/canvas/wiki/Patterns) since the path boolean operations was very buggy and slow, not anymore. Next up are images! I'll post here when there is an update. |
Hi, thanks for creating such an awesome package like this! I want to draw a square image as a circle on a canvas. In JavaScript it would normally look like this:
I have tried several things but I still don't get the same effect.
The text was updated successfully, but these errors were encountered: