PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
|
#include <stdint.h>
Go to the source code of this file.
Classes | |
struct | GraphCmd_struct |
Macros | |
#define | GRAPH_MAX_ARGS 9 |
#define | Graph_xa0 0x0 << 0 |
#define | Graph_xa1 0x1 << 0 |
#define | Graph_xa2 0x2 << 0 |
#define | Graph_xa3 0x3 << 0 |
#define | Graph_xa4 0x4 << 0 |
#define | Graph_xa5 0x5 << 0 |
#define | Graph_xa6 0x6 << 0 |
#define | Graph_xa7 0x7 << 0 |
#define | Graph_ya0 0x0 << 3 |
#define | Graph_ya1 0x1 << 3 |
#define | Graph_ya2 0x2 << 3 |
#define | Graph_ya3 0x3 << 3 |
#define | Graph_ya4 0x4 << 3 |
#define | Graph_ya5 0x5 << 3 |
#define | Graph_ya6 0x6 << 3 |
#define | Graph_ya7 0x7 << 3 |
#define | Graph_ya8 0x8 << 3 |
#define | Graph_ya9 0x9 << 3 |
#define | Graph_yaA 0xA << 3 |
#define | Graph_yaB 0xB << 3 |
#define | Graph_yaC 0xC << 3 |
#define | Graph_yaD 0xD << 3 |
#define | Graph_yaE 0xE << 3 |
#define | Graph_yaF 0xF << 3 |
#define | Graph_xb0 0x0 << 7 |
#define | Graph_xb1 0x1 << 7 |
#define | Graph_xb2 0x2 << 7 |
#define | Graph_xb3 0x3 << 7 |
#define | Graph_xb4 0x4 << 7 |
#define | Graph_xb5 0x5 << 7 |
#define | Graph_xb6 0x6 << 7 |
#define | Graph_xb7 0x7 << 7 |
#define | Graph_yb0 0x0 << 10 |
#define | Graph_yb1 0x1 << 10 |
#define | Graph_yb2 0x2 << 10 |
#define | Graph_yb3 0x3 << 10 |
#define | Graph_yb4 0x4 << 10 |
#define | Graph_yb5 0x5 << 10 |
#define | Graph_yb6 0x6 << 10 |
#define | Graph_yb7 0x7 << 10 |
#define | Graph_yb8 0x8 << 10 |
#define | Graph_yb9 0x9 << 10 |
#define | Graph_ybA 0xA << 10 |
#define | Graph_ybB 0xB << 10 |
#define | Graph_ybC 0xC << 10 |
#define | Graph_ybD 0xD << 10 |
#define | Graph_ybE 0xE << 10 |
#define | Graph_ybF 0xF << 10 |
#define | Graph_ax1 0 << 7 |
#define | Graph_ax2 1 << 7 |
#define | Graph_ay1 0 << 8 |
#define | Graph_ay2 1 << 8 |
#define | Graph_ay3 2 << 8 |
#define | Graph_ay4 3 << 8 |
#define | Graph_a0 0x0 << 10 |
#define | Graph_a1 0x1 << 10 |
#define | Graph_a2 0x2 << 10 |
#define | Graph_a3 0x3 << 10 |
#define | Graph_a4 0x4 << 10 |
#define | Graph_a5 0x5 << 10 |
#define | Graph_a6 0x6 << 10 |
#define | Graph_a7 0x7 << 10 |
#define | Graph_a8 0x8 << 10 |
#define | Graph_a9 0x9 << 10 |
#define | Graph_aA 0xA << 10 |
#define | Graph_aB 0xB << 10 |
#define | Graph_aC 0xC << 10 |
#define | Graph_aD 0xD << 10 |
#define | Graph_aE 0xE << 10 |
#define | Graph_aF 0xF << 10 |
#define | Graph_fline 0 << 14 |
#define | Graph_farc 1 << 14 |
#define | Graph_more 1 << 15 |
#define | Graph_fx 3 |
Typedefs | |
typedef enum Graph_enum | GraphCmd_ET |
typedef volatile struct GraphCmd_struct | GraphCmd_ST |
Enumerations | |
enum | Graph_enum { GraphCmd_setup = 1, GraphCmd_color, GraphCmd_width, GraphCmd_plot, GraphCmd_line, GraphCmd_arc, GraphCmd_vec, GraphCmd_vecarc, GraphCmd_pix, GraphCmd_pixarc, GraphCmd_text, GraphCmd_textarc, GraphCmd_textmode, GraphCmd_fill, GraphCmd_loop } |
Functions | |
int | Graph_start (void) |
void | Graph_stop (void) |
void | Graph_setup (uint32_t x_tiles, uint32_t y_tiles, uint32_t x_origin, uint32_t y_origin, uint32_t base_ptr) |
void | Graph_clear (void) |
void | Graph_copy (uint32_t dest_ptr) |
void | Graph_color (uint32_t c) |
void | Graph_width (uint32_t w) |
void | Graph_colorwidth (uint32_t c, uint32_t w) |
void | Graph_plot (uint32_t x, uint32_t y) |
void | Graph_line (uint32_t x, uint32_t y) |
void | Graph_arc (uint32_t x, uint32_t y, uint32_t xr, uint32_t yr, int angle, int anglestep, int steps, int arcmode) |
void | Graph_vec (uint32_t x, uint32_t y, int vecscale, int vecangle, uint16_t *vecdef_ptr) |
void | Graph_vecarc (uint32_t x, uint32_t y, uint32_t xr, uint32_t yr, int angle, int vecscale, int vecangle, uint16_t *vecdef_ptr) |
void | Graph_pix (uint32_t x, uint32_t y, int pixrot, uint16_t *pixdef_ptr) |
void | Graph_pixarc (uint32_t x, uint32_t y, uint32_t xr, uint32_t yr, int angle, int pixrot, uint16_t *pixdef_ptr) |
void | Graph_char (uint32_t x, uint32_t y, char ch) |
void | Graph_text (uint32_t x, uint32_t y, char *string_ptr) |
void | Graph_textarc (uint32_t x, uint32_t y, uint32_t xr, uint32_t yr, int angle, char *string_ptr) |
void | Graph_textmode (uint32_t x_scale, uint32_t y_scale, uint32_t spacing, uint32_t justification) |
void | Graph_box (int x, int y, int box_width, int box_height) |
void | Graph_quad (uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t x3, uint32_t y3, uint32_t x4, uint32_t y4) |
void | Graph_tri (uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t x3, uint32_t y3) |
void | Graph_finish (void) |
void | fill (int x, int y, int da, int db, int db2, int linechange, int lines_minus_1) |
void | justify (char *string_ptr, uint32_t *justptr) |
void | sendCommand (GraphCmd_ET cmd, uint32_t *argptr) |
Graphics driver header & API descriptions. Copyright (c) 2009, Steve Denson See end of file for MIT license terms.
Definition in file Graphics.h.
struct GraphCmd_struct |
Graphics driver interface structure
Definition at line 39 of file Graphics.h.
#define GRAPH_MAX_ARGS 9 |
maximum number of args to pass a command
Definition at line 57 of file Graphics.h.
#define Graph_xa0 0x0 << 0 |
Vector Font Primitives
Definition at line 62 of file Graphics.h.
typedef enum Graph_enum GraphCmd_ET |
Graphics driver interface command enumerations
typedef volatile struct GraphCmd_struct GraphCmd_ST |
Graphics driver interface structure
enum Graph_enum |
Graphics driver interface command enumerations
Definition at line 16 of file Graphics.h.
void fill | ( | int | x, |
int | y, | ||
int | da, | ||
int | db, | ||
int | db2, | ||
int | linechange, | ||
int | lines_minus_1 | ||
) |
private functions
fill blocks
Definition at line 511 of file Graphics.c.
void Graph_arc | ( | uint32_t | x, |
uint32_t | y, | ||
uint32_t | xr, | ||
uint32_t | yr, | ||
int | angle, | ||
int | anglestep, | ||
int | steps, | ||
int | arcmode | ||
) |
Draw an arc x,y - center of arc xr,yr - radii of arc
x | - center x position |
y | - center y position |
xr | - x radius length |
yr | - y radius length |
angle | - initial angle in bits12..0 |
anglestep | - angle step in bits[12..0] |
steps | - number of steps (0 just leaves (x,y) at initial arc position) |
arcmode | - 0: plot point(s) 1: line to point(s) 2: line between points 3: line from point(s) to center |
draw an arc see header for API description.
Definition at line 268 of file Graphics.c.
void Graph_box | ( | int | x, |
int | y, | ||
int | box_width, | ||
int | box_height | ||
) |
Draw a box with round/square corners, according to pixel width
x | - box left |
y | - box box bottom |
box_width | - box left |
box_height | - box box bottom |
draw a box with round/square corners according to pixel width see header for API description.
Definition at line 407 of file Graphics.c.
void Graph_char | ( | uint32_t | x, |
uint32_t | y, | ||
char | ch | ||
) |
Draw char
x | - text position x (see textmode for sizing and justification) |
y | - text position y (see textmode for sizing and justification) |
ch | - char to draw |
draw char at x,y see header for API description.
Definition at line 345 of file Graphics.c.
void Graph_clear | ( | void | ) |
clear bitmap
clear bitmap see header for API description.
Definition at line 178 of file Graphics.c.
void Graph_color | ( | uint32_t | c | ) |
Set pixel color to two-bit pattern
c | - color code in bits[1..0] |
set pixel color to two bit pattern see header for API description.
Definition at line 198 of file Graphics.c.
void Graph_colorwidth | ( | uint32_t | c, |
uint32_t | w | ||
) |
Set pixel color and width
c | - pixel color |
c | - pixel width |
set pixel color and width see header for API description.
Definition at line 236 of file Graphics.c.
void Graph_copy | ( | uint32_t | dest_ptr | ) |
Copy bitmap use for double-buffered display (flicker-free)
@dest_ptr - base address of destination bitmap
copy bitmap - use for double-buffered display see header for API description.
Definition at line 188 of file Graphics.c.
void Graph_finish | ( | void | ) |
Wait for any current graphics command to finish use this to insure that it is safe to manually manipulate the bitmap
make sure last command is done
Definition at line 502 of file Graphics.c.
void Graph_line | ( | uint32_t | x, |
uint32_t | y | ||
) |
Draw a line to point
x,y - endpoint
x | - end point of line (left to right) |
x | - end point of line (top to bottom) |
draw a line to point x,y (from previous x,y?) see header for API description.
Definition at line 257 of file Graphics.c.
void Graph_pix | ( | uint32_t | x, |
uint32_t | y, | ||
int | pixrot, | ||
uint16_t * | pixdef_ptr | ||
) |
Draw a pixel sprite
Pixel sprite definition:
word 'word align, express dimensions and center, define pixels byte xwords, ywords, xorigin, yorigin word %xxxxxxxx,%xxxxxxxx word %xxxxxxxx,%xxxxxxxx word %xxxxxxxx,%xxxxxxxx ...
x | - x center of vector sprite |
y | - y center of vector sprite |
pixrot | - 0: 0°, 1: 90°, 2: 180°, 3: 270°, +4: mirror |
pixdef_ptr | - address of pixel sprite definition |
draw a pixel sprite see header for API description.
Definition at line 316 of file Graphics.c.
void Graph_pixarc | ( | uint32_t | x, |
uint32_t | y, | ||
uint32_t | xr, | ||
uint32_t | yr, | ||
int | angle, | ||
int | pixrot, | ||
uint16_t * | pixdef_ptr | ||
) |
Draw a pixel sprite at an arc position
x | - x center of arc |
y | - y center of arc |
xr | - x radius of arc |
yr | - y radius of arc |
angle | - angle in bits12..0 |
pixrot | - 0: 0°, 1: 90°, 2: 180°, 3: 270°, +4: mirror |
pixdef_ptr | - address of pixel sprite definition |
draw a pixel sprite at an arc position see header for API description.
Definition at line 329 of file Graphics.c.
void Graph_plot | ( | uint32_t | x, |
uint32_t | y | ||
) |
Plot point x,y - point
x | - x position (left to right) |
y | - y position (top to bottom) |
plot a pixel at point x,y see header for API description.
Definition at line 246 of file Graphics.c.
void Graph_quad | ( | uint32_t | x1, |
uint32_t | y1, | ||
uint32_t | x2, | ||
uint32_t | y2, | ||
uint32_t | x3, | ||
uint32_t | y3, | ||
uint32_t | x4, | ||
uint32_t | y4 | ||
) |
Draw a solid quadrilateral vertices must be ordered clockwise or counter-clockwise
x1 | - vertex x1 |
y1 | - vertex y1 |
x2 | - vertex x2 |
y2 | - vertex y2 |
x3 | - vertex x3 |
y3 | - vertex y3 |
x4 | - vertex x4 |
y4 | - vertex y4 |
draw a solid quadrilateral see header for API description.
Definition at line 436 of file Graphics.c.
void Graph_setup | ( | uint32_t | x_tiles, |
uint32_t | y_tiles, | ||
uint32_t | x_origin, | ||
uint32_t | y_origin, | ||
uint32_t | base_ptr | ||
) |
set bitmap parameters
x_tiles | - number of x tiles (tiles are 16x16 pixels each) |
y_tiles | - number of y tiles |
x_origin | - relative-x center pixel |
y_origin | - relative-y center pixel |
base_ptr | - base address of bitmap |
set bitmap parameters see header for API description.
Definition at line 144 of file Graphics.c.
int Graph_start | ( | void | ) |
start graphics driver - starts a cog
start graphics driver see header for API description.
Definition at line 73 of file Graphics.c.
void Graph_stop | ( | void | ) |
stop graphics driver - frees cog
stop graphics driver see header for API description.
Definition at line 130 of file Graphics.c.
void Graph_text | ( | uint32_t | x, |
uint32_t | y, | ||
char * | string_ptr | ||
) |
Draw text
x | - text position x (see textmode for sizing and justification) |
y | - text position y (see textmode for sizing and justification) |
string_ptr | - address of zero-terminated string (it may be necessary to call .finish immediately afterwards to prevent subsequent code from clobbering the string as it is being drawn |
draw text at x,y see header for API description.
Definition at line 356 of file Graphics.c.
void Graph_textarc | ( | uint32_t | x, |
uint32_t | y, | ||
uint32_t | xr, | ||
uint32_t | yr, | ||
int | angle, | ||
char * | string_ptr | ||
) |
Draw text at an arc position
x | - x center of arc |
y | - y center of arc |
xr | - x radius of arc |
yr | - y radius of arc |
angle | - angle in bits12..0 |
string_ptr | - address of zero-terminated string (it may be necessary to call .finish immediately afterwards to prevent subsequent code from clobbering the string as it is being drawn |
draw text at an arc position see header for API description.
Definition at line 373 of file Graphics.c.
void Graph_textmode | ( | uint32_t | x_scale, |
uint32_t | y_scale, | ||
uint32_t | spacing, | ||
uint32_t | justification | ||
) |
Set text size and justification
x_scale | - x character scale, should be 1+ |
y_scale | - y character scale, should be 1+ |
spacing | - character spacing, 6 is normal |
justification | - bits[1..0]: 0..3 = left, center, right, left bits[3..2]: 0..3 = bottom, center, top, bottom |
set text size and justification see header for API description.
Definition at line 393 of file Graphics.c.
void Graph_tri | ( | uint32_t | x1, |
uint32_t | y1, | ||
uint32_t | x2, | ||
uint32_t | y2, | ||
uint32_t | x3, | ||
uint32_t | y3 | ||
) |
Draw a solid triangle vertices must be ordered clockwise or counter-clockwise
x1 | - vertex x1 |
y1 | - vertex y1 |
x2 | - vertex x2 |
y2 | - vertex y2 |
x3 | - vertex x3 |
y3 | - vertex y3 |
Definition at line 442 of file Graphics.c.
void Graph_vec | ( | uint32_t | x, |
uint32_t | y, | ||
int | vecscale, | ||
int | vecangle, | ||
uint16_t * | vecdef_ptr | ||
) |
Draw a vector sprite
Vector sprite definition:
word $8000|$4000+angle 'vector mode + 13-bit angle (mode: $4000=plot, $8000=line) word length 'vector length ... 'more vectors ... word 0 'end of definition
x,y - center of vector sprite
x | - center x position of vector sprite |
y | - center y position of vector sprite |
vecscale | - scale of vector sprite ($100 = 1x) |
vecangle | - rotation angle of vector sprite in bits[12..0] |
vecdef_ptr | - address of vector sprite definition |
draw a vector see header for API description.
Definition at line 285 of file Graphics.c.
void Graph_vecarc | ( | uint32_t | x, |
uint32_t | y, | ||
uint32_t | xr, | ||
uint32_t | yr, | ||
int | angle, | ||
int | vecscale, | ||
int | vecangle, | ||
uint16_t * | vecdef_ptr | ||
) |
draw a vector arc see header for API description.
Definition at line 299 of file Graphics.c.
void Graph_width | ( | uint32_t | w | ) |
Set pixel width actual width is w[3..0] + 1
w | - 0..15 for round pixels, 16..31 for square pixels |
set pixel width - actual width is w[3..0]+1 see header for API description.
Definition at line 207 of file Graphics.c.
void justify | ( | char * | string_ptr, |
uint32_t * | justptr | ||
) |
justify apparently aligns string edges
Definition at line 526 of file Graphics.c.
void sendCommand | ( | GraphCmd_ET | cmd, |
uint32_t * | argptr | ||
) |
send command to driver
cmd | - GraphCmd_ET command |
argptr | - arguments pointer |
Definition at line 565 of file Graphics.c.