gmlgame-maker-studio-2

Is there any way I can pick a color of a surface using H.S.V?


if mouse_check_button_pressed(mb_left) && pickMode = true 
{
    hue = surface_getpixel ( artSurface [ pages ] , mouse_x , mouse_y ); 
    saturation = surface_getpixel ( artSurface [ pages ] , mouse_x , mouse_y ); 
    value = surface_getpixel ( artSurface [ pages ] , mouse_x , mouse_y );
}

Is there any way I can pick a color of a surface using H.S.V?
It's saying when you press the mouse button and pickMode is on the color will be the color under the mouse coordinates. pickMode is activated by pressing "P".

There are multiple pages so you can animate, which is why the surface is an array. https://paste.mod.gg/teceguqiva.cs


Solution

  • If you wanted to get HSV from a surface pixel, get the pixel color and then use color_* functions on it:

    var col = surface_getpixel ( artSurface [ pages ] , mouse_x , mouse_y );
    var hue = color_get_hue(col);
    var sat = color_get_saturation(col);
    var val = color_get_value(col);