PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Functions | Variables
Graphics.c File Reference
#include <stdio.h>
#include <string.h>
#include <propeller.h>
#include "Graphics.h"
+ Include dependency graph for Graphics.c:

Go to the source code of this file.

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)
 

Variables

uint16_t Graphics_Font []
 
HUBDATA GraphCmd_ST gGraph
 
HUBDATA uint32_t pa [GRAPH_MAX_ARGS]
 
HUBDATA uint32_t Graph_colors []
 
HUBDATA uint8_t Graph_pixels []
 

Detailed Description

Graphics driver ported from Chip Gracy's Graphics.spin Users should comment out unused functions to save code space if necessary. Copyright (c) 2009, Steve Denson See end of file for MIT license terms.

Definition in file Graphics.c.

Function Documentation

◆ fill()

void fill ( int  x,
int  y,
int  da,
int  db,
int  db2,
int  linechange,
int  lines_minus_1 
)

fill blocks

Definition at line 511 of file Graphics.c.

+ Here is the caller graph for this function:

◆ Graph_arc()

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 see header for API description.

Definition at line 268 of file Graphics.c.

◆ Graph_box()

void Graph_box ( int  x,
int  y,
int  box_width,
int  box_height 
)

draw a box with round/square corners according to pixel width see header for API description.

Definition at line 407 of file Graphics.c.

+ Here is the call graph for this function:

◆ Graph_char()

void Graph_char ( uint32_t  x,
uint32_t  y,
char  ch 
)

draw char at x,y see header for API description.

Definition at line 345 of file Graphics.c.

+ Here is the call graph for this function:

◆ Graph_clear()

void Graph_clear ( void  )

clear bitmap see header for API description.

Definition at line 178 of file Graphics.c.

+ Here is the call graph for this function:

◆ Graph_color()

void Graph_color ( uint32_t  c)

set pixel color to two bit pattern see header for API description.

Definition at line 198 of file Graphics.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Graph_colorwidth()

void Graph_colorwidth ( uint32_t  c,
uint32_t  w 
)

set pixel color and width see header for API description.

Definition at line 236 of file Graphics.c.

+ Here is the call graph for this function:

◆ Graph_copy()

void Graph_copy ( uint32_t  dest_ptr)

copy bitmap - use for double-buffered display see header for API description.

Definition at line 188 of file Graphics.c.

+ Here is the call graph for this function:

◆ Graph_finish()

void Graph_finish ( void  )

make sure last command is done

Definition at line 502 of file Graphics.c.

+ Here is the call graph for this function:

◆ Graph_line()

void Graph_line ( uint32_t  x,
uint32_t  y 
)

draw a line to point x,y (from previous x,y?) see header for API description.

Definition at line 257 of file Graphics.c.

◆ Graph_pix()

void Graph_pix ( uint32_t  x,
uint32_t  y,
int  pixrot,
uint16_t *  pixdef_ptr 
)

draw a pixel sprite see header for API description.

Definition at line 316 of file Graphics.c.

◆ Graph_pixarc()

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 see header for API description.

Definition at line 329 of file Graphics.c.

◆ Graph_plot()

void Graph_plot ( uint32_t  x,
uint32_t  y 
)

plot a pixel at point x,y see header for API description.

Definition at line 246 of file Graphics.c.

+ Here is the caller graph for this function:

◆ Graph_quad()

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 see header for API description.

Definition at line 436 of file Graphics.c.

+ Here is the call graph for this function:

◆ Graph_setup()

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 see header for API description.

Definition at line 144 of file Graphics.c.

+ Here is the call graph for this function:

◆ Graph_start()

int Graph_start ( void  )

start graphics driver see header for API description.

Definition at line 73 of file Graphics.c.

◆ Graph_stop()

void Graph_stop ( void  )

stop graphics driver see header for API description.

Definition at line 130 of file Graphics.c.

◆ Graph_text()

void Graph_text ( uint32_t  x,
uint32_t  y,
char string_ptr 
)

draw text at x,y see header for API description.

Definition at line 356 of file Graphics.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Graph_textarc()

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 see header for API description.

Definition at line 373 of file Graphics.c.

+ Here is the call graph for this function:

◆ Graph_textmode()

void Graph_textmode ( uint32_t  x_scale,
uint32_t  y_scale,
uint32_t  spacing,
uint32_t  justification 
)

set text size and justification see header for API description.

Definition at line 393 of file Graphics.c.

◆ Graph_tri()

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

Parameters
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.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Graph_vec()

void Graph_vec ( uint32_t  x,
uint32_t  y,
int  vecscale,
int  vecangle,
uint16_t *  vecdef_ptr 
)

draw a vector see header for API description.

Definition at line 285 of file Graphics.c.

◆ Graph_vecarc()

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.

◆ Graph_width()

void Graph_width ( uint32_t  w)

set pixel width - actual width is w[3..0]+1 see header for API description.

Definition at line 207 of file Graphics.c.

+ Here is the caller graph for this function:

◆ justify()

void justify ( char string_ptr,
uint32_t *  justptr 
)

justify apparently aligns string edges

Definition at line 526 of file Graphics.c.

+ Here is the caller graph for this function:

◆ sendCommand()

void sendCommand ( GraphCmd_ET  cmd,
uint32_t *  argptr 
)

send command to driver

Parameters
cmd- GraphCmd_ET command
argptr- arguments pointer

Definition at line 565 of file Graphics.c.

+ Here is the caller graph for this function:

Variable Documentation

◆ gGraph

Graphics interface control structure

Definition at line 39 of file Graphics.c.

◆ Graph_colors

HUBDATA uint32_t Graph_colors[]
Initial value:
=
{
0x00000000,
0x55555555,
0xAAAAAAAA,
0xFFFFFFFF
}

Color codes

Definition at line 49 of file Graphics.c.

◆ Graph_pixels

HUBDATA uint8_t Graph_pixels[]
Initial value:
=
{
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x05,
0x0A, 0x0A, 0x1A, 0x1A,
0x34, 0x3a, 0x74, 0x74
}

Round pixel recipes

Definition at line 60 of file Graphics.c.

◆ Graphics_Font

uint16_t Graphics_Font[]

'' '' Theory of Operation: '' '' A cog is launched with code contained in Graphics_Array[] which '' processes commands sent by the Graph_* API wrapper functions. '' '' Points, lines, arcs, sprites, text, and polygons are rasterized into '' a specified stretch of memory which serves as a generic bitmap buffer. '' '' The bitmap can be displayed by the TV or VGA driver. '' To date, the C library version has been tested on TV only. '' '' See GraphicsTest.c for usage example. '' Graphics_Font is the character set in separate GraphicsFont.c file

Vector font - standard Graph_ascii characters ($21-$7E)

Definition at line 13 of file GraphicsFont.c.