GSDP:GAM100/CProcessing/CP ColorHSV FromColor()

From Inside
< GSDP:GAM100‎ | CProcessing
Revision as of 20:40, 29 June 2020 by >Justin.chambers (New page: {{GSDP:GAM100API.css}} =CP_ColorHSV_FromColor()= ==Description== Converts a CP_Color to a CP_ColorHSV. NOTE: A...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

CP_ColorHSV_FromColor()

Description

Converts a CP_Color to a CP_ColorHSV.

NOTE: All graphics and settings functions within CProcessing expect colors in RGB format (CP_Color). Using HSV (CP_ColorHSV) can enable various graphics effects, but you will need to convert back to RGB (CP_Color) to pass color values to CProcessing functions.

Parameters

CP_ColorHSV_FromColor(CP_Color rgb)

  • rgb - (CP_Color) The RGB value to be convert to HSV.

Example

void update(void)
{
    // Get the frameCount and create a starting color
    int frameCount = CP_System_GetFrameCount();
    CP_Color rgb = CP_Color_Create(255, 0, 0, 255);
    
    // Convert the starting color to HSV
    CP_ColorHSV hsv = CP_ColorHSV_FromColor(rgb);
    
    // Shift the hue of the starting color based on the frameCount
    hsv.h += frameCount * 3;
    
    // Convert back to RBG and set the background color
    CP_Settings_Background(CP_Color_FromColorHSV(hsv));
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>