-
Notifications
You must be signed in to change notification settings - Fork 0
Drawing
The Draw module exposes a series of functions for drawing graphics primitives. The list of graphics primitives currently implemented in SDLCanvas are as follows:
- draw_pixel
- draw_line
- draw_arc
- draw_filled_arc
- draw_circle
- draw_filled_circle
- draw_rect
- draw_filled_rect
Note: None of the graphics primitives implemented in SDLCanvas have anti-aliasing capabilities. For now, this is due to a lack of bindings for the the SDL_gfx C library for Julia.
Note: For clarity, not all variants of each graphics function have been included. Most notably, any of the colour arguments can be provided either as a ColourRGBA
type, a 4-integer tuple Tuple{Int, Int, Int, Int}
as (r, g, b, a) or a 3-integer tuple Tuple{Int, Int, Int}
as (r, g, b) with the alpha value defaulting to 255.
Draws a single pixel at pixel position (x, y)
with the given colour
Draws a straight line from pixel coordinates (x1, y1)
to (x2_y2)
with the given colour
. Possible keyword arguments are:
-
thickness::Int = 1
: The thickness of the line in pixels
draw_arc(window::Window, x::Int, y::Int, r::Int, start_angle::Real, end_angle::Real, colour::ColourRGBA)
Draws an arc centred at pixel coordinates (x, y)
with radius r
with the given colour
. The arc is drawn from start_angle
to end_angle
in a counter-clockwise direction. The start and end angles should be provided in radians between 0 and
Draws a circle centred at pixel coordinates (x, y)
with radius r
with the given colour
.
Draws a rectangle with width w
and height h
with the given colour. The pixel coordinates (x, y)
correspond to the top-left corner of the rectangle.