examples/graphics.rb in hexapdf-0.4.0 vs examples/graphics.rb in hexapdf-0.5.0
- old
+ new
@@ -100,13 +100,13 @@
end
canvas.translate(490, 0) do
canvas.line_width(1)
[[[1, 1]],
- [[3, 1]],
- [[3, 3]],
- [[5, 1, 1, 1, 1, 1]],
+ [[3, 1]],
+ [[3, 3]],
+ [[5, 1, 1, 1, 1, 1]],
[[3, 5], 6]].each_with_index do |(value, phase), index|
canvas.line_dash_pattern(value, phase || 0)
canvas.line(20 * index, 0, 20 * index, 100)
canvas.stroke
end
@@ -138,11 +138,11 @@
canvas.arc(250, 50, a: 10, start_angle: -60, end_angle: 115)
canvas.arc(300, 50, a: 40, b: 20, start_angle: -60, end_angle: 115)
canvas.arc(380, 50, a: 40, b: 20, start_angle: -60, end_angle: 115, inclination: 45)
canvas.fill
- arc = canvas.graphic_object(:arc, cx: 450, cy: 50, a: 30, b: 30,
+ arc = canvas.graphic_object(:arc, cx: 450, cy: 50, a: 30, b: 30,
start_angle: -30, end_angle: 105)
canvas.fill_color(0.4, 0.3, 0.4)
canvas.move_to(450, 50)
canvas.line_to(*arc.start_point)
arc.curves.each {|c| canvas.curve_to(*c)}
@@ -194,13 +194,14 @@
# fill nonzero and stroke, close fill even-odd and stroke, clip even-odd, clip
# nonzero
canvas.translate(0, 190) do
canvas.fill_color(0.3, 0.7, 0.7)
- [[:stroke], [:close_stroke], [:fill, :nonzero], [:fill, :even_odd],
- [:fill_stroke, :nonzero], [:fill_stroke, :even_odd],
- [:close_fill_stroke, :nonzero], [:close_fill_stroke, :even_odd],
- ].each_with_index do |op, index|
+ [
+ [:stroke], [:close_stroke], [:fill, :nonzero], [:fill, :even_odd],
+ [:fill_stroke, :nonzero], [:fill_stroke, :even_odd],
+ [:close_fill_stroke, :nonzero], [:close_fill_stroke, :even_odd]
+ ].each_with_index do |op, index|
row = (1 - (index / 4))
column = index % 4
x = 50 + 80 * column
y = 80 * row
canvas.transform(0.6, 0, 0, 0.6, x, y) do