andymeneely / squib

A Ruby DSL for prototyping card games.
http://squib.rocks
MIT License
918 stars 67 forks source link

implement circle arc feature #211

Closed sparr closed 7 years ago

sparr commented 7 years ago

Submitting PR without tests to get feedback on implementation before I proceed.

sample script:



Squib::Deck.new(cards: 1, width: 600, height: 600, ) do
    background color: :white
    rect x:100, y:100, width:400, height:400
    circle x:200, y:200, radius:100, fill_color: :red
    circle x:400, y:200, radius:100, fill_color: :red, arc_start: Math::PI, arc_close: true
    circle x:200, y:400, radius:100, fill_color: :red, arc_start: Math::PI*1/4, arc_end: Math::PI*3/4
    circle x:400, y:400, radius:100, fill_color: :red, arc_start: Math::PI*1/4, arc_end: Math::PI*3/4, arc_ccw: true
    save_png
end```
sparr commented 7 years ago

Adding this functionality to ellipse would require using native cairo ellipse drawing (by way of scaling the transform matrix then drawing a circle) instead of the current curve-building method.

Adding this functionality to star or polygon might also be useful.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.4%) to 99.191% when pulling 686da5e226132d75c759ee1cdf959f3d6068bdba on sparr:FEATURE-circle_arc into 566d0dfaca48eb1bde88ad4b474973153ac7ef08 on andymeneely:master.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.4%) to 99.191% when pulling 686da5e226132d75c759ee1cdf959f3d6068bdba on sparr:FEATURE-circle_arc into 566d0dfaca48eb1bde88ad4b474973153ac7ef08 on andymeneely:master.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.4%) to 99.191% when pulling 686da5e226132d75c759ee1cdf959f3d6068bdba on sparr:FEATURE-circle_arc into 566d0dfaca48eb1bde88ad4b474973153ac7ef08 on andymeneely:master.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.4%) to 99.191% when pulling 686da5e226132d75c759ee1cdf959f3d6068bdba on sparr:FEATURE-circle_arc into 566d0dfaca48eb1bde88ad4b474973153ac7ef08 on andymeneely:master.

andymeneely commented 7 years ago

Oh cool! Neat idea. Yeah let's get some tests for it and get it into the sample

sparr commented 7 years ago

Should I try to get it working for ellipses, too? How about stars and polygons?

andymeneely commented 7 years ago

Sure if you want to

sparr commented 7 years ago

Fixed the existing tests. Could use some guidance on where to put new tests and some examples. @andymeneely

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.06%) to 99.58% when pulling a9b05367997fa5d68eaf66cdd68f39f6ce5ad161 on sparr:FEATURE-circle_arc into 566d0dfaca48eb1bde88ad4b474973153ac7ef08 on andymeneely:master.

andymeneely commented 7 years ago

Merged!