GSDP:GAM100/CProcessing/CP Color FromColorHSV()

From Inside
Jump to navigationJump to search

CP_Color_FromColorHSV()

Description

Converts a CP_ColorHSV to a CP_Color.

NOTE: All graphics and settings functions within CProcessing expect colors in RGB format (CP_Color) so you will be required to convert using this function if you are using HSV (CP_ColorHSV) formats for various effects.

Parameters

CP_Color_FromColorHSV(CP_ColorHSV hsv)

  • hsv - (CP_ColorHSV) The HSV value to be converted to RGB.

Example

void update(void)
{
    // Get the current framecount and set the background to black
    int frameCount = CP_System_GetFrameCount();
    CP_Settings_Background(CP_Color_Create(0, 0, 0, 255));
    
    // Use framecount to slowly change the HSV color through all colors of the rainbow
    CP_ColorHSV hsv = CP_ColorHSV_Create(360 - (frameCount * 3), 100, 50, 255);
    
    // Convert from HSV to RGB to be used as the fill color and draw a rectangle
    CP_Settings_Fill(CP_Color_FromColorHSV(hsv));
    CP_Graphics_DrawRectAdvanced(10, 10, 380, 380, 0, 20);
}

Related