orcus
Data Structures | Enumerations | Functions | Variables
2d.h File Reference

2D accelerator More...

#include <stdint.h>
#include <rgb.h>

Data Structures

struct  Graphic
 Defines a graphic, be it on or off-screen. More...
 
struct  RasterPattern
 Defines the pattern setup for raster operations. More...
 
struct  Rect
 Defines a rectangular area. More...
 

Macros

#define ROP_DPSao   0xEA
 Pre-defined GDI ternary raster operation, the full list can be found on the Microsoft website.
 
#define ROP_PATCOPY   0xF0
 Pre-defined GDI ternary raster operation, the full list can be found on the Microsoft website.
 
#define ROP_SPno   0xCF
 Pre-defined GDI ternary raster operation, the full list can be found on the Microsoft website.
 
#define ROP_SRCCOPY   0xCC
 Pre-defined GDI ternary raster operation, the full list can be found on the Microsoft website.
 

Enumerations

enum  Angle { DEG0 = 0 , DEG90 = 1 , DEG180 = 2 , DEG270 = 3 }
 Rotation angle. More...
 

Functions

void rgbBlit (Graphic *src, Rect *srcRect, Graphic *dest, int x, int y, bool enableTransparency)
 Configure a blit raster operation. More...
 
void rgbBlit1bpp (Graphic *src, Rect *srcRect, Graphic *dest, int x, int y, bool enableTransparency, uint16_t fgCol, uint16_t bgCol)
 Configure a 1bpp blit raster operation. More...
 
void rgbPatternFill (Graphic *dest, Rect *region, RasterPattern *pattern, bool enableTransparency)
 Configure a pattern fill raster operation. More...
 
bool rgbRasterIsRunning ()
 Check if a raster operation is currently being run. More...
 
void rgbRasterOp (Graphic *src, Rect *srcRect, Graphic *dest, Rect *destRect, uint8_t rasterOp, RasterPattern *pattern, bool enableTransparency, uint16_t srcFgCol, uint16_t srcBgCol)
 Configure a raster operation. More...
 
void rgbRasterRun ()
 Start running pre-configured raster operation. More...
 
void rgbRasterWaitComplete ()
 Wait until the current raster operation has completed. More...
 
void rgbRotBlit (Graphic *src, Rect *srcRect, Graphic *dest, int x, int y, Angle angle)
 Configure a rotation blit operation. More...
 
bool rgbRotIsRunning ()
 Check if a rotation operation is currently being run. More...
 
void rgbRotRun ()
 Start running pre-configured rotation operation. More...
 
void rgbRotWaitComplete ()
 Wait until the current rotation operation has completed. More...
 
void rgbSetTransparencyColour (uint16_t colour)
 Set the transparent colour. More...
 
void rgbSolidFill (Graphic *dest, Rect *region, uint16_t colour)
 Configure a solid fill raster operation. More...
 

Variables

volatile uint32_t * pattern
 Pointer to start of pattern graphic data. More...
 

Enumeration Type Documentation

◆ Angle

enum Angle
Enumerator
DEG0 

0 degrees of rotation

DEG90 

90 degrees of rotation

DEG180 

180 degrees of rotation

DEG270 

270 degrees of rotation

Function Documentation

◆ rgbBlit()

void rgbBlit ( Graphic src,
Rect srcRect,
Graphic dest,
int  x,
int  y,
bool  enableTransparency 
)

Configure a blit raster operation.

Parameters
srcSource graphic to copy
srcRectArea of source graphic to copy
destDestination graphic to copy onto
xX-coordinate of upper left hand corner of where the source graphic should be drawn on the destination
yY-coordinate of upper left hand corner of where the source graphic should be drawn on the destination
enableTransparencyThe transparent colour will be omitted from the copy if true
See also
rgbSetTransparencyColour

◆ rgbBlit1bpp()

void rgbBlit1bpp ( Graphic src,
Rect srcRect,
Graphic dest,
int  x,
int  y,
bool  enableTransparency,
uint16_t  fgCol,
uint16_t  bgCol 
)

Configure a 1bpp blit raster operation. Where the source image is 1bpp, the 2d accelerator will convert it to the destination format by using the supplied foreground and background colours.

Parameters
srcSource graphic to copy
srcRectArea of source graphic to copy
destDestination graphic to copy onto
xX-coordinate of upper left hand corner of where the source graphic should be drawn on the destination
yY-coordinate of upper left hand corner of where the source graphic should be drawn on the destination
enableTransparencyThe transparent colour will be omitted from the copy if true
fgColForeground colour in the destination format
bgColBackground colour in the destination format
See also
rgbSetTransparencyColour

◆ rgbPatternFill()

void rgbPatternFill ( Graphic dest,
Rect region,
RasterPattern pattern,
bool  enableTransparency 
)

Configure a pattern fill raster operation, where a region on the destination will be filled with the repeated pattern.

Parameters
destDestination graphic to fill
regionRegion of destination to fill
patternConfiguration of pattern to fill with
enableTransparencyThe transparent colour will be omitted from the fill

◆ rgbRasterIsRunning()

bool rgbRasterIsRunning ( )

Check if a raster operation is currently being run.

Returns
true if a raster operation is currently being run, false otherwise

◆ rgbRasterOp()

void rgbRasterOp ( Graphic src,
Rect srcRect,
Graphic dest,
Rect destRect,
uint8_t  rasterOp,
RasterPattern pattern,
bool  enableTransparency,
uint16_t  srcFgCol,
uint16_t  srcBgCol 
)

Configure a raster operation. This is a lower level function which is used by all the other raster functions, one can use this to configure a custom ternary raster operation which can combine source, pattern and destination pixels in a variety of ways (see the Microsoft documentation for full details on GDI ternary raster operations).

Parameters
srcSource graphic to copy (NULL if not used)
srcRectArea of source graphic to copy (NULL if not used)
destDestination graphic to render onto
destRectArea of destination graphic to render onto
patternConfiguration of pattern (NULL if not used)
enableTransparencyThe transparent colour will be omitted from the copy if true
srcFgColForeground colour to use when expanding 1bpp source, in the destination format
srcBgColBackground colour to use when expanding 1bpp source, in the destination format
See also
rgbSetTransparencyColour
ROP_PATCOPY

◆ rgbRasterRun()

void rgbRasterRun ( )

Start running pre-configured raster operation.

◆ rgbRasterWaitComplete()

void rgbRasterWaitComplete ( )

Wait until the current raster operation has completed.

◆ rgbRotBlit()

void rgbRotBlit ( Graphic src,
Rect srcRect,
Graphic dest,
int  x,
int  y,
Angle  angle 
)

Configure a rotation blit operation.

Parameters
srcSource graphic to copy
srcRectArea of source graphic to copy
destDestination graphic to copy onto
xX-coordinate of upper left hand corner of where the source graphic should be drawn on the destination
yY-coordinate of upper left hand corner of where the source graphic should be drawn on the destination
angleThe angle to rotate the source image by when drawing onto the destination

◆ rgbRotIsRunning()

bool rgbRotIsRunning ( )

Check if a rotation operation is currently being run.

Returns
true if a rotation operation is currently being run, false otherwise

◆ rgbRotRun()

void rgbRotRun ( )

Start running pre-configured rotation operation.

◆ rgbRotWaitComplete()

void rgbRotWaitComplete ( )

Wait until the current rotation operation has completed.

◆ rgbSetTransparencyColour()

void rgbSetTransparencyColour ( uint16_t  colour)

Sets the colour to be considered transparent in a source when performing a raster operation - this colour will be omitted. By default this is set to magenta (0xF81F in RGB565).

◆ rgbSolidFill()

void rgbSolidFill ( Graphic dest,
Rect region,
uint16_t  colour 
)

Configure a solid fill raster operation.

Parameters
destDestination graphic to fill
regionRegion of destination to fill
colourColour to fill area with in destination format

Variable Documentation

◆ pattern

pattern
extern

Pointer to the start of the 8x8 graphic data. This is 128B long to accommodate an 8x8 RGB565 pattern.