Search in sources :

Example 1 with ColorToggle

use of spacegraph.space2d.widget.button.ColorToggle in project narchy by automenta.

the class Sketch2DBitmap method menu.

@Override
public Surface menu() {
    ButtonSet<ColorToggle> colorMenu = new ButtonSet<>(ButtonSet.Mode.One, // black
    new ColorToggle(0f, 0, 0), // red
    new ColorToggle(1f, 0, 0), // orange
    new ColorToggle(1f, 0.5f, 0), // yellow
    new ColorToggle(0.75f, 0.75f, 0), // green
    new ColorToggle(0f, 1, 0), // blue
    new ColorToggle(0f, 0, 1), // purple
    new ColorToggle(1f, 0, 1), // gray
    new ColorToggle(0.5f, 0.5f, 0.5f), // white
    new ColorToggle(1f, 1, 1));
    colorMenu.on((cc, e) -> {
        if (e) {
            color(cc.r, cc.g, cc.b);
        }
    });
    Surface toolMenu = grid(new XYSlider().on((_width, _alpha) -> {
        brushWidth = Util.lerp(_width, 0.1f, 3f);
        brushAlpha = Util.lerp(_alpha, 0.1f, 3f);
    }).set(0.5f, 0.75f));
    return grid(colorMenu, toolMenu);
}
Also used : ButtonSet(spacegraph.space2d.widget.tab.ButtonSet) XYSlider(spacegraph.space2d.widget.slider.XYSlider) ColorToggle(spacegraph.space2d.widget.button.ColorToggle) Surface(spacegraph.space2d.Surface)

Aggregations

Surface (spacegraph.space2d.Surface)1 ColorToggle (spacegraph.space2d.widget.button.ColorToggle)1 XYSlider (spacegraph.space2d.widget.slider.XYSlider)1 ButtonSet (spacegraph.space2d.widget.tab.ButtonSet)1