Add ellipse method

Also experimenting with using stroke_preserve, which in turn may make the other methods less repetitive.

Closes #66
This commit is contained in:
Andy Meneely
2015-04-30 11:48:21 -04:00
parent 9b4eb7f00b
commit dab544a53b
8 changed files with 81 additions and 2 deletions
+16
View File
@@ -1,5 +1,9 @@
cairo: antialias=(["subpixel"])
cairo: save([])
cairo: set_source_color([:white])
cairo: paint([])
cairo: restore([])
cairo: save([])
cairo: rounded_rectangle([300, 300, 400, 400, 0, 0])
cairo: set_source_color([:red])
cairo: set_line_width([50.0])
@@ -45,4 +49,16 @@ cairo: curve_to([150, 700, 150, 700, 625, 900])
cairo: set_source_color([:burgundy])
cairo: fill([])
cairo: restore([])
cairo: save([])
cairo: move_to([50, 975.0])
cairo: curve_to([50, 950.0, 100.0, 925, 150.0, 925])
cairo: curve_to([200.0, 925, 250, 950.0, 250, 975.0])
cairo: curve_to([250, 1000.0, 200.0, 1025, 150.0, 1025])
cairo: curve_to([100.0, 1025, 50, 1000.0, 50, 975.0])
cairo: set_source_color([:cyan])
cairo: set_line_width([5.0])
cairo: stroke_preserve([])
cairo: set_source_color([:burgundy])
cairo: fill([])
cairo: restore([])
surface: write_to_png(["_output/shape_00.png"])
Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 26 KiB

+1 -1
View File
@@ -102,7 +102,7 @@ def mock_cairo(strio)
update_pango_layout width height show_pango_layout rounded_rectangle
set_line_width stroke fill set_source scale render_rsvg_handle circle
triangle line_to operator= show_page clip transform mask rectangle
reset_clip antialias= curve_to matrix= pango_layout_path).each do |m|
reset_clip antialias= curve_to matrix= pango_layout_path stroke_preserve).each do |m|
allow(cxt).to receive(m) { |*args| strio << scrub_hex("cairo: #{m}(#{args})\n") }
end