citro2d
Functions
Helper functions

Functions

C2D_CONSTEXPR float C2D_Clamp (float x, float min, float max)
 Clamps a value between bounds. More...
 
C2D_CONSTEXPR u8 C2D_FloatToU8 (float x)
 Converts a float to u8. More...
 
C2D_CONSTEXPR u32 C2D_Color32 (u8 r, u8 g, u8 b, u8 a)
 Builds a 32-bit RGBA color value. More...
 
C2D_CONSTEXPR u32 C2D_Color32f (float r, float g, float b, float a)
 Builds a 32-bit RGBA color value from float values. More...
 
static void C2D_SetImageTint (C2D_ImageTint *tint, C2D_Corner corner, u32 color, float blend)
 Configures one corner of an image tint structure. More...
 
static void C2D_PlainImageTint (C2D_ImageTint *tint, u32 color, float blend)
 Configures an image tint structure with the specified tint parameters applied to all corners. More...
 
static void C2D_AlphaImageTint (C2D_ImageTint *tint, float alpha)
 Configures an image tint structure to just apply transparency to the image. More...
 
static void C2D_TopImageTint (C2D_ImageTint *tint, u32 color, float blend)
 Configures an image tint structure with the specified tint parameters applied to the top side (e.g. More...
 
static void C2D_BottomImageTint (C2D_ImageTint *tint, u32 color, float blend)
 Configures an image tint structure with the specified tint parameters applied to the bottom side (e.g. More...
 
static void C2D_LeftImageTint (C2D_ImageTint *tint, u32 color, float blend)
 Configures an image tint structure with the specified tint parameters applied to the left side (e.g. More...
 
static void C2D_RightImageTint (C2D_ImageTint *tint, u32 color, float blend)
 Configures an image tint structure with the specified tint parameters applied to the right side (e.g. More...
 

Detailed Description

Function Documentation

static void C2D_AlphaImageTint ( C2D_ImageTint tint,
float  alpha 
)
inlinestatic

Configures an image tint structure to just apply transparency to the image.

Parameters
[in]tintImage tint structure
[in]alphaAlpha transparency value to apply to the image
static void C2D_BottomImageTint ( C2D_ImageTint tint,
u32  color,
float  blend 
)
inlinestatic

Configures an image tint structure with the specified tint parameters applied to the bottom side (e.g.

for gradients)

Parameters
[in]tintImage tint structure
[in]colorRGB tint color and Alpha transparency
[in]blendBlending strength of the tint color (0.0~1.0)
C2D_CONSTEXPR float C2D_Clamp ( float  x,
float  min,
float  max 
)

Clamps a value between bounds.

Parameters
[in]xThe value to clamp
[in]minThe lower bound
[in]maxThe upper bound
Returns
The clamped value
C2D_CONSTEXPR u32 C2D_Color32 ( u8  r,
u8  g,
u8  b,
u8  a 
)

Builds a 32-bit RGBA color value.

Parameters
[in]rRed component (0~255)
[in]gGreen component (0~255)
[in]bBlue component (0~255)
[in]aAlpha component (0~255)
Returns
The 32-bit RGBA color value
C2D_CONSTEXPR u32 C2D_Color32f ( float  r,
float  g,
float  b,
float  a 
)

Builds a 32-bit RGBA color value from float values.

Parameters
[in]rRed component (0.0~1.0)
[in]gGreen component (0.0~1.0)
[in]bBlue component (0.0~1.0)
[in]aAlpha component (0.0~1.0)
Returns
The 32-bit RGBA color value
C2D_CONSTEXPR u8 C2D_FloatToU8 ( float  x)

Converts a float to u8.

Parameters
[in]xInput value (0.0~1.0)
Returns
Output value (0~255)
static void C2D_LeftImageTint ( C2D_ImageTint tint,
u32  color,
float  blend 
)
inlinestatic

Configures an image tint structure with the specified tint parameters applied to the left side (e.g.

for gradients)

Parameters
[in]tintImage tint structure
[in]colorRGB tint color and Alpha transparency
[in]blendBlending strength of the tint color (0.0~1.0)
static void C2D_PlainImageTint ( C2D_ImageTint tint,
u32  color,
float  blend 
)
inlinestatic

Configures an image tint structure with the specified tint parameters applied to all corners.

Parameters
[in]tintImage tint structure
[in]colorRGB tint color and Alpha transparency
[in]blendBlending strength of the tint color (0.0~1.0)
static void C2D_RightImageTint ( C2D_ImageTint tint,
u32  color,
float  blend 
)
inlinestatic

Configures an image tint structure with the specified tint parameters applied to the right side (e.g.

for gradients)

Parameters
[in]tintImage tint structure
[in]colorRGB tint color and Alpha transparency
[in]blendBlending strength of the tint color (0.0~1.0)
static void C2D_SetImageTint ( C2D_ImageTint tint,
C2D_Corner  corner,
u32  color,
float  blend 
)
inlinestatic

Configures one corner of an image tint structure.

Parameters
[in]tintImage tint structure
[in]cornerThe corner of the image to tint
[in]colorRGB tint color and Alpha transparency
[in]blendBlending strength of the tint color (0.0~1.0)
static void C2D_TopImageTint ( C2D_ImageTint tint,
u32  color,
float  blend 
)
inlinestatic

Configures an image tint structure with the specified tint parameters applied to the top side (e.g.

for gradients)

Parameters
[in]tintImage tint structure
[in]colorRGB tint color and Alpha transparency
[in]blendBlending strength of the tint color (0.0~1.0)