module

CrImage::Operation::Draw

Draws shapes in the image

Taking sample image:

Woman with black turtleneck and white background
image.draw_square(40, 30, 80, 80, CrImage::Color.of("#00f"))
image.draw_circle(80, 70, 40, CrImage::Color.of("#00f"))
image.draw_line(50, 50, 70, 90, CrImage::Color.of("#0f0"))
Woman with blue box drawn around face Woman with blue circle drawn around face Woman with green line across face

Can also use the fill: true parameter to fill in the drawn shapes

Instance methods

draw_circle(x : Int, y : Int, radius : Int, color : Color, *, fill : Bool = false) : self

Draw a circle centered at x, y with radius

Source
draw_circle(region : Region, radius : Int, color : Color, *, fill : Bool = false) : self

Draw a circle around the region's center (see Region#center)

Source
draw_circle!(center_x : Int, center_y : Int, radius : Int, color : Color, *, fill : Bool = false) : self
Source
draw_circle!(region : Region, color : Color, *, fill : Bool = false, radius : Int32 | Nil = nil) : self

Draw a circle around the region's center (see Region#center)

Source
draw_line(x1 : Int32, y1 : Int32, x2 : Int32, y2 : Int32, color : Color) : self
Source
draw_line!(x1 : Int32, y1 : Int32, x2 : Int32, y2 : Int32, color : Color) : self

Implementation of http://www.edepot.com/linec.html

Source
draw_square(x : Int, y : Int, box_width : Int, box_height : Int, color : Color, *, fill : Bool = false) : self
Source
draw_square(region : Region, color : Color, *, fill : Bool = false) : self
Source
draw_square!(x : Int, y : Int, box_width : Int, box_height : Int, color : Color, *, fill : Bool = false) : self
Source
draw_square!(region : Region, color : Color, *, fill : Bool = false) : self
Source