-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Partial drawing of any Object #469
Partial drawing of any Object #469
Conversation
Codecov Report
@@ Coverage Diff @@
## main #469 +/- ##
==========================================
- Coverage 96.47% 95.18% -1.29%
==========================================
Files 35 36 +1
Lines 1617 1829 +212
==========================================
+ Hits 1560 1741 +181
- Misses 57 88 +31
Continue to review full report at Codecov.
|
i'm thinking of writing some tests ,
|
This looks really solid! |
if you meant something like this ... using Javis
using Animations
video=Video(600,600)
nframes=100
Background(1:nframes, (args...)-> background("black"))
obj = Object(JCircle(O,100,color="white"))
obj2= Object(JRect(O+100,60.0,90.0,color="orange",action=:fill))
act!(obj,Action(1:nframes,linear(),show_creation()))
act!(obj2,Action(1:nframes,linear(),show_creation()))
render(video, pathname="circle_line_rect.gif") anything that ultimately calls luxors strokepath/strokepreserve/fillpath/fillpreserve to draw on the canvas will be covered by this |
Currently we only test reference images and I think that works quite well. If there is anything you can test without images it's always appreciate but often it can't be done. |
const dp_state = DrawPartialState([0], 0, 0, true, [], 0) | ||
|
||
""" | ||
pathtopoly(co_state::Symbol) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will change this to dispatch on value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what symbol should we use though ?
@@ -0,0 +1,474 @@ | |||
import Cassette: @context, prehook, overdub |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should move imports into Javis.jl
#polydistance(poly) returns Vector{Float64} | ||
#polydistances.(many_polys) returns Vector{Vector{Float64}} | ||
#stroke_polydists is a vector of this ^, i.e Vector{Vector{Vector{Float64}}} | ||
stroke_polydists::Vector{Vector{Vector{Float64}}} #accumulates polydistances |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was added to improve performance , but i'm not seeing any improvement , maybe i'm doing something wrong ?
(dp_state.target_len_partial - dp_state.cur_len_partial) / | ||
nextpolylength | ||
poly(polyportion(poly_i, frac, closed = co, pdist = pdist_i)) | ||
#poly(polyportion(poly_i, frac, closed = co)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there seems to be no difference in performance if i switch this line for the line above (with pdist = pdist_i
) ;
atleast for the example i tried (hilbert curve)
we would expect passing the polydistances to polyportion to make it faster .
#hue | ||
#="""for some reason parsing colors fails to furthur overdub , so we just | ||
return as is"""=# | ||
function overdub(c::ctx_strokelength, ::typeof(Colors.parse), args...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Colors.parse simply doesn't play well with Cassette , might be something related to this JuliaLabs/Cassette.jl#130
WOW, THIS IS ABSOLUTELY BEAUTIFUL!!! |
feature merged in #482 |
PR Checklist
If you are contributing to
Javis.jl
, please make sure you are able to check off each item on this list:CHANGELOG.md
with whatever changes/features I added with this PR?will add later
Project.toml
+ set an upper bound of the dependency (if applicable)?test
directory (if applicable)?Link to relevant issue(s)
Closes #
#218
How did you address these issues with this PR? What methods did you use?
This PR introduces the "show_creation" function for
Action
;Using Cassette we intercept any call to strokepath , strokepreserve , fillpath and fillpreserve .
they are replaced with custom set of strokes that stroke the path/fill upto a particular fraction.
for example , this bit of code makes ...
will give ...