-
Notifications
You must be signed in to change notification settings - Fork 72
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
Action as keyword argument #174
Comments
I made some progress with this in on the branch here 58946d3. It's quite a disruptive change, though, so it will need a lot of testing. using Luxor
@draw begin
setopacity(0.7)
squircle(O, 250, 250, action=:stroke)
star(O, 260, 6, 0.4, 0.0, action=:stroke)
for f in (:stroke, :fill, :path, :stroke)
randomhue()
circle(O, 250, action=f)
poly([Point(50x, 60sin(x)) for x in -5:0.1:5], action=f)
rect(O, 200, 200, action=f)
star(O, 100, 6, 0.5, action=f)
ellipse(O, O + (200, 200), 100, action=f)
arc(O, 100, 0, π/2, action=:path)
arc(O, 150, π, 3π/2, action=f)
box(O, 150, 150, action=f)
ngon(O, 150, 15, action=f)
sethue("black")
polycross(O, 200, 6, 0.5, 0.0, action=f)
line(O, O + (200, 200), action=f)
end
end |
Thanks @cormullion I would necessarily change anything from the current version as I don't wanna break things. Just adding versions where it can be used with keyword argument would be nice. Or what is your point on that? |
I've made it possible to do either: circle(O, 105, :stroke)
# or
circle(O, 120, action = :stroke) so all existing code should work, and all these functions can also be used with |
You're awesome thanks! What is the error with |
Thanks! I'm not sure whether It would be very helpful if sometime you could test your current Javis creations against Luxor#master to see whether I'm currently missed any method definitions... |
Works perfectly fine with Javis. Haven't tested the usage of the keyword arguments though. Maybe @TheCedarPrince can use it to test the JImages approach though. |
Thanks - hopefully this won't be a disruptive change! :) |
I'll release v2.16 and see what happens! |
I think it would be great to have a dispatch version of all drawing functions which take an action as a keyword argument.
Then one can easily change the action from
:path
to:clip
as an example for all kinds of different functions without caring about the other positional arguments. That would be for example useful for JuliaAnimators/Javis.jl#399Currently it seems to be the last positional argument at least in
The text was updated successfully, but these errors were encountered: