Man Over Board
Loading...
Searching...
No Matches
raster.h File Reference

Provides functions for raster graphics operations. More...

#include "global.h"

Enumerations

enum  BitMapDrawMode { SET , UNSET , SWAP }
 Specifies the mode in which a bitmap should be drawn. More...
 

Functions

void black_screen (Screen *base)
 Clears the entire screen by filling it with black.
 
void white_screen (Screen *base)
 Clears the entire screen by filling it with white.
 
void set_pixel (Screen *base, u16 x, u16 y, Color color)
 Sets a pixel at the specified coordinates to a given color.
 
void drawBitMap (Screen *base, const BitMap *bitmap, u16 x_offset, u16 y_offset, BitMapDrawMode draw_mode)
 Draws a bitmap onto the screen at the specified coordinates.
 
void drawVerticalLine (Screen *base, u16 x_pos, u16 y_start, u16 y_end)
 Draws a vertical line on the screen.
 
void drawHorizontalLine (Screen *base, u16 y_pos, u16 x_start, u16 x_end, BitMapDrawMode mode)
 Draws a horizontal line on the screen.
 

Detailed Description

Provides functions for raster graphics operations.

This header defines functions for manipulating a screen buffer, including pixel drawing, line drawing, and bitmap rendering.

Enumeration Type Documentation

◆ BitMapDrawMode

Specifies the mode in which a bitmap should be drawn.

This enumeration determines whether the bitmap pixels should be set (drawn as active) or unset (removed from the screen).

Enumerator
SET 

Set pixels in the bitmap (turn them on).

UNSET 

Unset pixels in the bitmap (turn them off).

Function Documentation

◆ black_screen()

void black_screen ( Screen * base)

Clears the entire screen by filling it with black.

Parameters
basePointer to the screen buffer.

◆ drawBitMap()

void drawBitMap ( Screen * base,
const BitMap * bitmap,
u16 x_offset,
u16 y_offset,
BitMapDrawMode draw_mode )

Draws a bitmap onto the screen at the specified coordinates.

Parameters
basePointer to the screen buffer.
bitmapPointer to the bitmap to be drawn.
x_offsetX-coordinate of the top-left corner of the bitmap (must be in-bounds).
y_offsetY-coordinate of the top-left corner of the bitmap (must be in-bounds).
draw_modeThe drawing mode (SET or UNSET).

◆ drawHorizontalLine()

void drawHorizontalLine ( Screen * base,
u16 y_pos,
u16 x_start,
u16 x_end,
BitMapDrawMode mode )

Draws a horizontal line on the screen.

Parameters
basePointer to the screen buffer.
y_posY-coordinate of the line (must be in-bounds).
x_startStarting X-coordinate (must be in-bounds, x_start < x_end).
x_endEnding X-coordinate (must be in-bounds).

◆ drawVerticalLine()

void drawVerticalLine ( Screen * base,
u16 x_pos,
u16 y_start,
u16 y_end )

Draws a vertical line on the screen.

Parameters
basePointer to the screen buffer.
x_posX-coordinate of the line (must be in-bounds).
y_startStarting Y-coordinate (must be in-bounds, y_start < y_end).
y_endEnding Y-coordinate (must be in-bounds).

◆ set_pixel()

void set_pixel ( Screen * base,
u16 x,
u16 y,
Color color )

Sets a pixel at the specified coordinates to a given color.

Parameters
basePointer to the screen buffer.
xX-coordinate of the pixel (must be in-bounds & multiple of 8).
yY-coordinate of the pixel (must be in-bounds & multiple of 8).
colorThe color to set the pixel to.

◆ white_screen()

void white_screen ( Screen * base)

Clears the entire screen by filling it with white.

Parameters
basePointer to the screen buffer.