How do I check HSL values for a Layer?

0 favourites
  • 3 posts
  • Hi guyz,

    i need to check hsl value for a layer so to control the saturation and luminosity values if they are too low or too high to maintain colors.... is there a way to do that in construct 2 itself or via a plugin?

    I used fx effect hsl value but it only changes the hsl value, i cannot check what is the current hsl for the layer, and i want to keep track of it!

    Pleaaseeee help asap ....

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Anyone ????

    Please help!!!

  • To check the hsl values for a layer would require taking an average of all the pixels and getting it from that. At least that's how I understand it.

    The only reliable way to get all the pixels that I know of is to use the snapshot action to get an image of the screen. Then you could load that image to a Sprite, resize it to 1x1, and paste that to a canvas object (third party plugin that can read pixels from an image). Basically make the canvas object 1x1 in the editor, and position the Sprite object in the same position.

    Finally use the canvas.redAt(0,0) and similar functions to get the rgb average, more or less, of the layer. You can convert the rgb to hsl with algorithms that can be found online.

    Anyways, that probably would work, just not very fast.

    Really though this isn't something easily done in c2 if at all.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)