Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
cosCrunchUtil.h File Reference

Detailed Description

This file contains utilities for Cosplay Crunch microgames, mostly centered around tinting wsg images.

Go to the source code of this file.

Data Structures

struct  tintColor_t
 A set of colors used to tint a greyscale image. More...
 

Macros

#define PALETTE_LOWLIGHT   c111
 Palette lowlight color to be tinted in grayscale images. See tintPalette()
 
#define PALETTE_BASE   c222
 Palette base color to be tinted in grayscale images. See tintPalette()
 
#define PALETTE_HIGHLIGHT   c444
 Palette hightlight color to be tinted in grayscale images. See tintPalette()
 

Functions

void tintPalette (wsgPalette_t *palette, const tintColor_t *tintColor)
 Modifies a palette to be used for tinting greyscale images. The resulting palette is intended to be used with the wsgPalette* functions.
 
void drawToCanvas (wsg_t canvas, wsg_t wsg, uint16_t x, uint16_t y)
 Draws a wsg image onto another wsg image.
 
void drawToCanvasTint (wsg_t canvas, wsg_t wsg, int32_t x, int32_t y, int32_t rotationDeg, const tintColor_t *tintColor)
 Draws a wsg image drawn in greyscale onto another wsg image, tinting the grayscale pixels. This function can be used to tint a greyscale image in place.
 
void drawToCanvasTile (wsg_t canvas, wsg_t wsg, uint16_t x, uint16_t y)
 Draws a wsg image onto another wsg image without taking transparent pixels into account.
 

Data Structure Documentation

◆ tintColor_t

struct tintColor_t
Data Fields
paletteColor_t lowlight
paletteColor_t base
paletteColor_t highlight

Macro Definition Documentation

◆ PALETTE_LOWLIGHT

#define PALETTE_LOWLIGHT   c111

Palette lowlight color to be tinted in grayscale images. See tintPalette()

◆ PALETTE_BASE

#define PALETTE_BASE   c222

Palette base color to be tinted in grayscale images. See tintPalette()

◆ PALETTE_HIGHLIGHT

#define PALETTE_HIGHLIGHT   c444

Palette hightlight color to be tinted in grayscale images. See tintPalette()

Function Documentation

◆ tintPalette()

void tintPalette ( wsgPalette_t * palette,
const tintColor_t * tintColor )

Modifies a palette to be used for tinting greyscale images. The resulting palette is intended to be used with the wsgPalette* functions.

Parameters
paletteThe palette to be modified
tintColorThe color set to apply to the grey tones of the palette

◆ drawToCanvas()

void drawToCanvas ( wsg_t canvas,
wsg_t wsg,
uint16_t x,
uint16_t y )

Draws a wsg image onto another wsg image.

Parameters
canvasA wsg to draw onto
wsgThe image to draw to the canvas
xx position to draw the wsg
yy position to draw the wsg

◆ drawToCanvasTint()

void drawToCanvasTint ( wsg_t canvas,
wsg_t wsg,
int32_t x,
int32_t y,
int32_t rotationDeg,
const tintColor_t * tintColor )

Draws a wsg image drawn in greyscale onto another wsg image, tinting the grayscale pixels. This function can be used to tint a greyscale image in place.

Parameters
canvasA wsg to draw onto
wsgThe image to draw to the canvas
xx position to draw the wsg
yy position to draw the wsg
rotationDeg
tintColorThe color used to tint a greyscale wsg

◆ drawToCanvasTile()

void drawToCanvasTile ( wsg_t canvas,
wsg_t wsg,
uint16_t x,
uint16_t y )

Draws a wsg image onto another wsg image without taking transparent pixels into account.

Parameters
canvasA wsg to draw onto
wsgThe image to draw to the canvas
xx position to draw the wsg
yy position to draw the wsg