KrabCode / LazyGui

GUI library for Processing in which you only mention control elements in draw() at the places you need them.
https://krabcode.github.io/LazyGui/
MIT License
83 stars 4 forks source link

Ensure maximum tint before drawing the GUI on the main canvas #311

Closed KrabCode closed 2 months ago

KrabCode commented 2 months ago

This darkens the GUI when the tint is non-white. Calling tint(255) solves it. But it shouldn't darken the GUI at all, it shouldn't require the user to reset the tint before the end of draw(). Let's reset the tint ourselves while drawing the GUI then.

    public void draw() {
        tint(gui.colorPicker("tint", color(255, 255, 255, 255)).hex);
        image(gui.gradient("gradient"), 0, 0);
    }
KrabCode commented 2 months ago

maybe there's a way to push / pop this? to avoid changing anything on the user's side

KrabCode commented 2 months ago

Yes! Tint can be controlled with pushStyle() and popStyle().

PImage img;

void setup() {
  size(1333, 1000);
  img = loadImage("PXL_20240523_112838077.png");
}

void draw() {
  pushStyle();
  tint(255, 0, 0);
  popStyle();
  image(img, 0, 0);
}