private void updateColorPalette() { int width = hueResolution != -1 ? hueResolution : saturationResolution; int height = brightnessResolution != -1 ? brightnessResolution : saturationResolution; WritableImage image = new WritableImage(width, height); PixelWriter pw = image.getPixelWriter(); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { pw.setColor(x, y, getColorAtLocation(x, y)); } } if (PRINT_PALETTE) { // save for testing purposes try { ImageIO.write(SwingFXUtils.fromFXImage(image, null), "png", new File("palette.png")); } catch (IOException ex) { } } colorPalette = image; }
private void updateColorPalette() { int width = hueResolution != -1 ? hueResolution : saturationResolution; int height = brightnessResolution != -1 ? brightnessResolution : saturationResolution; WritableImage image = new WritableImage(width, height); PixelWriter pw = image.getPixelWriter(); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { pw.setColor(x, y, getColorAtLocation(x, y)); } } if (PRINT_PALETTE) { // save for testing purposes try { ImageIO.write(SwingFXUtils.fromFXImage(image, null), "png", new File("palette.png")); } catch (IOException ex) { } } colorPalette = image; }