module PF2d::Drawable(T)

Defined in:

pf2d/drawable.cr
pf2d/drawable/draw_circle.cr
pf2d/drawable/draw_curve.cr
pf2d/drawable/draw_line.cr
pf2d/drawable/draw_rect.cr
pf2d/drawable/fill_circle.cr
pf2d/drawable/fill_rect.cr
pf2d/drawable/fill_shape.cr
pf2d/drawable/fill_triangle.cr
pf2d/drawable/paint_triangle.cr

Instance Method Summary

Instance Method Detail

def draw_circle(cx : Int, cy : Int, r : Int, color) #

Draw a circle using Bresenham’s Algorithm


[View source]
def draw_circle(c : Vec, r, color) #

[View source]
def draw_curve(curve : Bezier::Curve, value : T, samples : Int = 100) #

[View source]
def draw_line(x1 : Int, y1 : Int, x2 : Int, y2 : Int, color) #

Draw a line using Bresenham’s Algorithm


[View source]
def draw_line(x1 : Float, y1 : Float, x2 : Float, y2 : Float, color) #

Draw a line using Bresenham’s Algorithm


[View source]
def draw_line(p1 : PF2d::Vec, p2 : PF2d::Vec, color) #

Draw a line using Bresenham’s Algorithm


[View source]
def draw_line(line : PF2d::Line, color) #

Draw a line using Bresenham’s Algorithm


[View source]
abstract def draw_point(x : Number, y : Number, value : T) #

To be implemented by the including class


[View source]
def draw_point(point : PF2d::Vec, value : T) #

[View source]
def draw_rect(x1 : Number, y1 : Number, x2 : Number, y2 : Number, value : T) #

Draws the outline of a rect


[View source]
def draw_rect(p1 : PF2d::Vec, p2 : PF2d::Vec, value : T) #

ditto


[View source]
def draw_rect(rect : PF2d::Rect, value : T) #

ditto


[View source]
def draw_rect(size : PF2d::Vec, value : T) #

ditto


[View source]
def fill_circle(cx : Int, cy : Int, r : Int, color) #

Fill a circle using Bresenham’s Algorithm


[View source]
def fill_circle(c : PF2d::Vec, r : Int, color) #

[View source]
def fill_rect(x1 : Int, y1 : Int, x2 : Int, y2 : Int, color) #

Fill a rect


[View source]
def fill_rect(p1 : PF2d::Vec, p2 : PF2d::Vec, color) #

ditto


[View source]
def fill_shape(points : Enumerable(PF2d::Vec), pixel) #

Fill an abitrary polygon. Expects a clockwise winding of points


[View source]
def fill_shape(*points : PF2d::Vec, pixel) #

Fill an abitrary polygon. Expects a clockwise winding of points


[View source]
def fill_triangle(p1 : PF2d::Vec, p2 : PF2d::Vec, p3 : PF2d::Vec, color) #

Draw a filled in triangle


[View source]
def fill_triangle(points : Enumerable(PF2d::Vec), color) #

ditto


[View source]
def paint_triangle(p1 : PF2d::Vec, p2 : PF2d::Vec, p3 : PF2d::Vec, t1 : PF2d::Vec, t2 : PF2d::Vec, t3 : PF2d::Vec, texture : PF2d::Viewable(T) | Nil, buffer : Drawable(Float), tint : T) #

Draw a textured triangle


[View source]
def scan_line(x : Int, y : Int, width : Int, color) #

Draw a horizontal line of width


[View source]