examples/chipmunk_and_rmagick.rb
def polygon_image(vertices)
    box_image = Magick::Image.new(EDGE_SIZE  * 2, EDGE_SIZE * 2) { self.background_color = "transparent" }
    gc = Magick::Draw.new
    gc.stroke("red")
    gc.fill("plum")
    draw_vertices = vertices.map { |v| [v.x + EDGE_SIZE, v.y + EDGE_SIZE] }.flatten
    gc.polygon(*draw_vertices)
    gc.draw(box_image)
    return Gosu::Image.new(box_image)
  end
# Produces the image of a polygon.
Produces the image of a polygon.
Produces the image of a polygon .
def polygon_image(vertices)
    box_image = Magick::Image.new(EDGE_SIZE  * 2, EDGE_SIZE * 2) { self.background_color = "transparent" }
    gc = Magick::Draw.new
    gc.stroke("red")
    gc.fill("plum")
    draw_vertices = vertices.map { |v| [v.x + EDGE_SIZE, v.y + EDGE_SIZE] }.flatten
    gc.polygon(*draw_vertices)
    gc.draw(box_image)
    return Gosu::Image.new(box_image)
  end
def polygon_image ( vertices ) box_image = Magick :: Image . new ( EDGE_SIZE * 2 , EDGE_SIZE * 2 ) { self . background_color = "transparent" } gc = Magick :: Draw . new gc . stroke ( "red" ) gc . fill ( "plum" ) draw_vertices = vertices . map { | v | [ v . x + EDGE_SIZE , v . y + EDGE_SIZE ] } . flatten gc . polygon ( * draw_vertices ) gc . draw ( box_image ) return Gosu :: Image . new ( box_image ) end
Produces the image of a polygon.
Produces the image of a polygon .
vertices