Anonymous
×
Create a new article
Write your page title here:
We currently have 399 articles on Inside. Type your article name above or click on one of the titles below and start writing!



    Inside

    GSDP:GAM100/CProcessing/CP ColorHSV FromColor()

    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