Retro Rocket Kernel
BASIC-Powered Operating System
drawing.h File Reference
#include "kernel.h"

Enumerations

enum  coordinate_range_type_t { RANGE_X , RANGE_Y }
 

Functions

void draw_line (int64_t from_x, int64_t from_y, int64_t to_x, int64_t to_y, uint32_t colour)
 Draw a straight line from from_x,from_y to to_x,to_y in the given colour. More...
 
void draw_horizontal_line (int64_t from_x, int64_t to_x, int64_t y, uint32_t colour)
 Draw a horizontal line. More...
 
void draw_horizontal_rectangle (int64_t from_x, int64_t from_y, int64_t to_x, int64_t to_y, uint32_t colour)
 Draw a horizontal rectangle using draw_horizontal_line() More...
 
void draw_triangle (int64_t x1, int64_t y1, int64_t x2, int64_t y2, int64_t x3, int64_t y3, uint32_t colour)
 Draw an arbitrary filled triangle. More...
 
void draw_circle (int64_t x_centre, int64_t y_centre, int64_t radius, bool fill, uint32_t colour)
 Draw a filled or solid circle. More...
 

Detailed Description

Author
Craig Edwards (craig.nosp@m.edwa.nosp@m.rds@b.nosp@m.rain.nosp@m.box.c.nosp@m.c)

Enumeration Type Documentation

◆ coordinate_range_type_t

Enumerator
RANGE_X 
RANGE_Y 

Function Documentation

◆ draw_circle()

void draw_circle ( int64_t  x_centre,
int64_t  y_centre,
int64_t  radius,
bool  fill,
uint32_t  colour 
)

Draw a filled or solid circle.

Note
Filled circles are rendered using horizontal lines via the draw_horizontal_line() function
Parameters
x_centreCentre X coordinate
y_centreCentre Y coordinate
radiusRadius of circle
fillTrue to fill the circle, false to just draw the outline
colourColour of circle to draw

◆ draw_horizontal_line()

void draw_horizontal_line ( int64_t  from_x,
int64_t  to_x,
int64_t  y,
uint32_t  colour 
)

Draw a horizontal line.

Note
If you know the line you want to draw is going to be horizontal this is faster than the bresenham based line drawing offered by draw_line() as its is a simple for() loop.
Parameters
from_xStarting X coordinate
to_xEnding X coordinate
yY coordinate
colourColour to fill the line

◆ draw_horizontal_rectangle()

void draw_horizontal_rectangle ( int64_t  from_x,
int64_t  from_y,
int64_t  to_x,
int64_t  to_y,
uint32_t  colour 
)

Draw a horizontal rectangle using draw_horizontal_line()

Parameters
from_xX coordinate of first corner
from_yY coordinate of first corner
to_xX coordinate of opposite corner
to_yY coordinate of opposite corner
colourcolour to fill the rectangle

◆ draw_line()

void draw_line ( int64_t  from_x,
int64_t  from_y,
int64_t  to_x,
int64_t  to_y,
uint32_t  colour 
)

Draw a straight line from from_x,from_y to to_x,to_y in the given colour.

Parameters
from_xstarting X coordinate
from_ystarting Y coordinate
to_xending X coordinate
to_yending Y coordinate
colourRGB colour to use

◆ draw_triangle()

void draw_triangle ( int64_t  x1,
int64_t  y1,
int64_t  x2,
int64_t  y2,
int64_t  x3,
int64_t  y3,
uint32_t  colour 
)

Draw an arbitrary filled triangle.

Parameters
x1X coordinate of first corner
y1Y coordinate of first corner
x2X coordinate of second corner
y2Y coordinate of second corner
x3X coordinate of third corner
y3Y coordinate of third corner
colourColour to fill triangle