Retro Rocket Kernel BASIC-Powered Operating System

Enumerations | Functions
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)

Copyright
  Copyright (c) 2012-2023

## Enumeration Type Documentation

## ◆ coordinate_range_type_t

enum 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_centre | Centre X coordinate
  y_centre | Centre Y coordinate
  radius | Radius of circle
  fill | True to fill the circle, false to just draw the outline
  colour | Colour 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_x | Starting X coordinate
  to_x | Ending X coordinate
  y | Y coordinate
  colour | Colour 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_x | X coordinate of first corner
  from_y | Y coordinate of first corner
  to_x | X coordinate of opposite corner
  to_y | Y coordinate of opposite corner
  colour | colour 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_x | starting X coordinate
  from_y | starting Y coordinate
  to_x | ending X coordinate
  to_y | ending Y coordinate
  colour | RGB 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

  x1 | X coordinate of first corner
  y1 | Y coordinate of first corner
  x2 | X coordinate of second corner
  y2 | Y coordinate of second corner
  x3 | X coordinate of third corner
  y3 | Y coordinate of third corner
  colour | Colour to fill triangle