forked from breakintoprogram/pico-mposite
-
Notifications
You must be signed in to change notification settings - Fork 2
/
graphics.h
41 lines (32 loc) · 1.39 KB
/
graphics.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// Title: Pico-mposite Graphics Primitives
// Author: Dean Belfield
// Created: 01/02/2022
// Last Updated: 02/03/2022
//
// Modinfo:
// 07/02/2022: Added support for filled primitives
// 20/02/2022: Added scroll_up, bitmap now initialised in cvideo.c
// 02/03/2022: Added blit
#pragma once
#include <stdbool.h>
#define rgb(r,g,b) (((b&6)<<5)|(g<<3)|r)
struct Line {
int dx, dy, sx, sy, e, xp, yp, h;
bool quad;
};
void cls(unsigned char c);
void scroll_up(unsigned char c, int rows);
void print_char(int x, int y, int c, unsigned char bc, unsigned char fc);
void print_string(int x, int y, char *s, unsigned char bc, unsigned char fc);
void plot(int x, int y, unsigned char c);
void draw_line(int x1, int y1, int x2, int y2, unsigned char c);
void draw_horizontal_line(int y1, int x1, int x2, int c);
void draw_circle(int x, int y, int r, unsigned char c, bool filled);
void draw_polygon(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, unsigned char c, bool filled);
void draw_rect(int x1, int y1, int x2, int y2, unsigned char c, bool filled);
void draw_triangle(int x1, int y1, int x2, int y2, int x3, int y3, unsigned char c, bool filled);
void swap(int *a, int *b);
void init_line(struct Line *line, int x1, int y1, int x2, int y2);
void step_line(struct Line *line);
void blit(const void * data, int sx, int sy, int sw, int sh, int dx, int dy);