Slide 41
Slide 41 text
14 def write_points_image(path, samples)
15 image = ChunkyPNG::Image.new(WIDTH, HEIGHT, BLACK)
16
17 samples.each_with_index do |sample, i|
20 position = if sample > 0
21 HALFWAY - offset_from_halfway(sample)
22 else
23 HALFWAY + offset_from_halfway(sample)
24 end
25
26 image.rect(i, position, i + 8, position + 8, YELLOW, YELLOW)
27 end
28
29 separator_line(image)
30
31 image.save(path)
32 end