com.kotcrab.vis.ui.widget.color.ColorPicker Java Examples

The following examples show how to use com.kotcrab.vis.ui.widget.color.ColorPicker. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ScreenshotService.java    From talos with Apache License 2.0 5 votes vote down vote up
public static void testForPicker(ColorPicker picker) {
    if(picker.getStage() == null) {
        TalosMain.Instance().setCursor(null);
        return;
    }

    vec.set(Gdx.input.getX(), Gdx.input.getY());
    (picker.getStage().getViewport()).unproject(vec);
    picker.stageToLocalCoordinates(vec);
    boolean hit = vec.x > 0 && vec.y > 0 && vec.x < picker.getWidth() && vec.y < picker.getHeight();

    if(!hit) {
        // should be different icon
        TalosMain.Instance().setCursor(TalosMain.Instance().pickerCursor);

        if (Gdx.input.justTouched()) {
            TalosMain.Instance().Screeshot().take(Gdx.input.getX(), Gdx.input.getY(), new ScreenshotService.ScreenshotListener() {
                @Override
                public void onComplete (Color color) {
                    picker.setColor(color);
                }
            });
        }
    } else {
        // usual icon
        TalosMain.Instance().setCursor(null);
    }
}
 
Example #2
Source File: UIStage.java    From talos with Apache License 2.0 5 votes vote down vote up
public void init () {
	fullScreenTable = new Table();
	fullScreenTable.setFillParent(true);

	stage.addActor(fullScreenTable);

	defaults();
	constructMenu();
	constructTabPane();
	constructSplitPanes();

	initFileChoosers();

	batchConvertDialog = new BatchConvertDialog();
	settingsDialog = new SettingsDialog();

	FileHandle list = Gdx.files.internal("modules.xml");
	XmlReader xmlReader = new XmlReader();
	XmlReader.Element root = xmlReader.parse(list);
	WrapperRegistry.map.clear();
	moduleListPopup = new ModuleListPopup(root);

	colorPicker = new ColorPicker();
	colorPicker.padTop(32);
	colorPicker.padLeft(16);
	colorPicker.setHeight(330);
	colorPicker.setWidth(430);
	colorPicker.padRight(26);
}
 
Example #3
Source File: GradientColorModuleWrapper.java    From talos with Apache License 2.0 5 votes vote down vote up
@Override
protected void configureSlots() {
    addInputSlot("alpha (0 to 1)", InterpolationModule.ALPHA);
    addOutputSlot("output", 0);

    gradientWidget = new GradientWidget(getSkin());
    contentWrapper.add(gradientWidget).expandX().fillX().growX().height(60).padTop(25).padRight(3).padBottom(3);

    leftWrapper.add(new Table()).expandY();
    rightWrapper.add(new Table()).expandY();

    picker = new ColorPicker();

    gradientWidget.setListener(new GradientWidget.GradientWidgetListener() {
        @Override
        public void colorPickerShow(final ColorPoint point) {
            picker.setListener(null);
            picker.setColor(point.color);

            TalosMain.Instance().UIStage().getStage().addActor(picker.fadeIn());

            picker.setListener(new ColorPickerAdapter() {
                @Override
                public void changed(Color newColor) {
                    super.changed(newColor);

                    point.color.set(newColor);
                    gradientWidget.updateGradientData();
                }
            });
        }
    });

    picker.padTop(32);
    picker.padLeft(16);
    picker.setHeight(330);
    picker.setWidth(430);
    picker.padRight(26);
}
 
Example #4
Source File: TestColorPicker.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
public TestColorPicker () {
	super("color picker");

	final Image image = new Image(white);

	picker = new ColorPicker("color picker", new ColorPickerAdapter() {
		@Override
		public void finished (Color newColor) {
			image.setColor(newColor);
		}
	});

	VisTextButton showPickerButton = new VisTextButton("show color picker");
	showPickerButton.addListener(new ChangeListener() {
		@Override
		public void changed (ChangeEvent event, Actor actor) {
			getStage().addActor(picker.fadeIn());
		}
	});

	Color c = new Color(27 / 255.0f, 161 / 255.0f, 226 / 255.0f, 1);
	picker.setColor(c);
	image.setColor(c);

	TableUtils.setSpacingDefaults(this);

	add(showPickerButton);
	add(image).size(32).pad(3);

	pack();
	setPosition(948, 148);
}