JavaFX color picker
$begingroup$
I am making my own JavaFX color picker just for learning more about JavaFX. I am rendering color wheel in JavaFX using WritableImage
and I have renderImage
method to render color wheel in my program. And I am using Slider
to change brightness of the color wheel.
The code is working fine but it's rendering slower. And the other reason I asked this question is also to learn about fast rendering algorithms in Java because if I make something else like Mandelbrot set or If I want to zoom that canvas containing WritableImage
then just using image as resource(As suggested in comment below) won't work.
How can I improve my code to render the color wheel faster?
import javafx.application.Application;
import javafx.beans.Observable;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.control.Slider;
import javafx.scene.image.PixelWriter;
import javafx.scene.image.WritableImage;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import static java.lang.Math.atan2;
import static java.lang.Math.toDegrees;
public class Example extends Application{
private static final int ANTIALIASING_BASE = 3;
private WritableImage writableImage;
private PixelWriter pixelWriter;
private Canvas canvas;
private IntegerProperty w;
private IntegerProperty h;
private Slider slider;
public static void main(String... arguments){
launch(arguments);
}
@Override
public void start(Stage primaryStage){
w = new SimpleIntegerProperty(255 + 42);
h = new SimpleIntegerProperty(360);
slider = new Slider(0, 100, 100);
primaryStage.setWidth(w.get());
primaryStage.setHeight(h.get());
canvas = new Canvas(255, 255);
writableImage = new WritableImage(255, 255);
pixelWriter = writableImage.getPixelWriter();
canvas.getGraphicsContext2D()
.drawImage(writableImage, 0, 0, w.get(), h.get(), 0, 0, w.get(), h.get());
renderImage();
slider.valueProperty().addListener(this::change);
VBox root = new VBox(12.5, canvas, slider);
root.setPadding(new Insets(12.5));
primaryStage.setScene(new Scene(root));
primaryStage.setResizable(false);
primaryStage.show();
}
//method to change brightness using slider
private void change(Observable observable){
writableImage = new WritableImage(255, 255);
pixelWriter = writableImage.getPixelWriter();
canvas.getGraphicsContext2D()
.drawImage(writableImage, 0, 0, w.get(), h.get(), 0, 0, w.get(), h.get());
renderImage();
}
//method that renders color wheel image
private void renderImage(){
for(int x = 0; x < 255; x++){
for(int y = 0; y < 255; y++){
Color c = getAntialiasedPixel(x, y);
if(c.getRed() == 0.0 && c.getGreen() == 0.0 && c.getBlue() == 0.0
&& slider.valueProperty().get() != 0.0){
c = Color.web("#f4f4f4");
}
pixelWriter.setColor(x, y, c);
}
}
}
//method that calculates color
private Color getColor(double x, double y){
double distance = getDistance(x, y);
if(distance > 127.5){
return Color.web("#f4f4f4");
}
double h = getAngle(x, y);
double s = (distance / 127.5);
double b = slider.valueProperty().get() / 100;
return Color.hsb(h, s, b);
}
//method to make color wheel look smoother
private Color getAntialiasedPixel(int x, int y){
double step = 1d / ANTIALIASING_BASE;
double N = ANTIALIASING_BASE * ANTIALIASING_BASE;
double r = 0, g = 0, b = 0;
for(int i = 0; i < ANTIALIASING_BASE; i++){
for(int j = 0; j < ANTIALIASING_BASE; j++){
Color c = getColor(x + step * (i + 0.5) - 0.5,
y + step * (j + 0.5) - 0.5);
r += c.getRed() / N;
g += c.getGreen() / N;
b += c.getBlue() / N;
}
}
return new Color(clamp(r), clamp(g), clamp(b), 1);
}
private double clamp(double val){
return val > 1 ? 1 : val < 0 ? 0 : val;
}
private double getDistance(double x1, double y1){
var y = 127.5 - y1;
var x = 127.5 - x1;
return Math.sqrt(y * y + x * x);
}
private double getAngle(double x1, double y1){
var angle = toDegrees(atan2(y1 - 127.5, x1 - 127.5));
if(angle < 0) angle += 360;
return angle;
}
}
java javafx
New contributor
$endgroup$
add a comment |
$begingroup$
I am making my own JavaFX color picker just for learning more about JavaFX. I am rendering color wheel in JavaFX using WritableImage
and I have renderImage
method to render color wheel in my program. And I am using Slider
to change brightness of the color wheel.
The code is working fine but it's rendering slower. And the other reason I asked this question is also to learn about fast rendering algorithms in Java because if I make something else like Mandelbrot set or If I want to zoom that canvas containing WritableImage
then just using image as resource(As suggested in comment below) won't work.
How can I improve my code to render the color wheel faster?
import javafx.application.Application;
import javafx.beans.Observable;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.control.Slider;
import javafx.scene.image.PixelWriter;
import javafx.scene.image.WritableImage;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import static java.lang.Math.atan2;
import static java.lang.Math.toDegrees;
public class Example extends Application{
private static final int ANTIALIASING_BASE = 3;
private WritableImage writableImage;
private PixelWriter pixelWriter;
private Canvas canvas;
private IntegerProperty w;
private IntegerProperty h;
private Slider slider;
public static void main(String... arguments){
launch(arguments);
}
@Override
public void start(Stage primaryStage){
w = new SimpleIntegerProperty(255 + 42);
h = new SimpleIntegerProperty(360);
slider = new Slider(0, 100, 100);
primaryStage.setWidth(w.get());
primaryStage.setHeight(h.get());
canvas = new Canvas(255, 255);
writableImage = new WritableImage(255, 255);
pixelWriter = writableImage.getPixelWriter();
canvas.getGraphicsContext2D()
.drawImage(writableImage, 0, 0, w.get(), h.get(), 0, 0, w.get(), h.get());
renderImage();
slider.valueProperty().addListener(this::change);
VBox root = new VBox(12.5, canvas, slider);
root.setPadding(new Insets(12.5));
primaryStage.setScene(new Scene(root));
primaryStage.setResizable(false);
primaryStage.show();
}
//method to change brightness using slider
private void change(Observable observable){
writableImage = new WritableImage(255, 255);
pixelWriter = writableImage.getPixelWriter();
canvas.getGraphicsContext2D()
.drawImage(writableImage, 0, 0, w.get(), h.get(), 0, 0, w.get(), h.get());
renderImage();
}
//method that renders color wheel image
private void renderImage(){
for(int x = 0; x < 255; x++){
for(int y = 0; y < 255; y++){
Color c = getAntialiasedPixel(x, y);
if(c.getRed() == 0.0 && c.getGreen() == 0.0 && c.getBlue() == 0.0
&& slider.valueProperty().get() != 0.0){
c = Color.web("#f4f4f4");
}
pixelWriter.setColor(x, y, c);
}
}
}
//method that calculates color
private Color getColor(double x, double y){
double distance = getDistance(x, y);
if(distance > 127.5){
return Color.web("#f4f4f4");
}
double h = getAngle(x, y);
double s = (distance / 127.5);
double b = slider.valueProperty().get() / 100;
return Color.hsb(h, s, b);
}
//method to make color wheel look smoother
private Color getAntialiasedPixel(int x, int y){
double step = 1d / ANTIALIASING_BASE;
double N = ANTIALIASING_BASE * ANTIALIASING_BASE;
double r = 0, g = 0, b = 0;
for(int i = 0; i < ANTIALIASING_BASE; i++){
for(int j = 0; j < ANTIALIASING_BASE; j++){
Color c = getColor(x + step * (i + 0.5) - 0.5,
y + step * (j + 0.5) - 0.5);
r += c.getRed() / N;
g += c.getGreen() / N;
b += c.getBlue() / N;
}
}
return new Color(clamp(r), clamp(g), clamp(b), 1);
}
private double clamp(double val){
return val > 1 ? 1 : val < 0 ? 0 : val;
}
private double getDistance(double x1, double y1){
var y = 127.5 - y1;
var x = 127.5 - x1;
return Math.sqrt(y * y + x * x);
}
private double getAngle(double x1, double y1){
var angle = toDegrees(atan2(y1 - 127.5, x1 - 127.5));
if(angle < 0) angle += 360;
return angle;
}
}
java javafx
New contributor
$endgroup$
$begingroup$
The solution (as in the JavaScript) is to create an image of the color wheel, and render that. One might create the colorwheel in java, but outside the project and store the image as resource in the project.
$endgroup$
– Joop Eggen
13 hours ago
$begingroup$
Okay. but the reason I asked this question is also to learn about fast rendering algorithms in java because if I make something else like Mandelbrot set or If I want to zoom that canvas containingWritableImage
then just using image as resource won't work. I hope you are understanding the problem.
$endgroup$
– thepooran
13 hours ago
$begingroup$
Interlaced JPEG can be hi-res and fast show a lower resolution smaller scaled image. The CSS support of FX might be interesting (gradients). Pixel oriented processing is indeed suboptimal. Will be interesting to see the answers.
$endgroup$
– Joop Eggen
13 hours ago
add a comment |
$begingroup$
I am making my own JavaFX color picker just for learning more about JavaFX. I am rendering color wheel in JavaFX using WritableImage
and I have renderImage
method to render color wheel in my program. And I am using Slider
to change brightness of the color wheel.
The code is working fine but it's rendering slower. And the other reason I asked this question is also to learn about fast rendering algorithms in Java because if I make something else like Mandelbrot set or If I want to zoom that canvas containing WritableImage
then just using image as resource(As suggested in comment below) won't work.
How can I improve my code to render the color wheel faster?
import javafx.application.Application;
import javafx.beans.Observable;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.control.Slider;
import javafx.scene.image.PixelWriter;
import javafx.scene.image.WritableImage;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import static java.lang.Math.atan2;
import static java.lang.Math.toDegrees;
public class Example extends Application{
private static final int ANTIALIASING_BASE = 3;
private WritableImage writableImage;
private PixelWriter pixelWriter;
private Canvas canvas;
private IntegerProperty w;
private IntegerProperty h;
private Slider slider;
public static void main(String... arguments){
launch(arguments);
}
@Override
public void start(Stage primaryStage){
w = new SimpleIntegerProperty(255 + 42);
h = new SimpleIntegerProperty(360);
slider = new Slider(0, 100, 100);
primaryStage.setWidth(w.get());
primaryStage.setHeight(h.get());
canvas = new Canvas(255, 255);
writableImage = new WritableImage(255, 255);
pixelWriter = writableImage.getPixelWriter();
canvas.getGraphicsContext2D()
.drawImage(writableImage, 0, 0, w.get(), h.get(), 0, 0, w.get(), h.get());
renderImage();
slider.valueProperty().addListener(this::change);
VBox root = new VBox(12.5, canvas, slider);
root.setPadding(new Insets(12.5));
primaryStage.setScene(new Scene(root));
primaryStage.setResizable(false);
primaryStage.show();
}
//method to change brightness using slider
private void change(Observable observable){
writableImage = new WritableImage(255, 255);
pixelWriter = writableImage.getPixelWriter();
canvas.getGraphicsContext2D()
.drawImage(writableImage, 0, 0, w.get(), h.get(), 0, 0, w.get(), h.get());
renderImage();
}
//method that renders color wheel image
private void renderImage(){
for(int x = 0; x < 255; x++){
for(int y = 0; y < 255; y++){
Color c = getAntialiasedPixel(x, y);
if(c.getRed() == 0.0 && c.getGreen() == 0.0 && c.getBlue() == 0.0
&& slider.valueProperty().get() != 0.0){
c = Color.web("#f4f4f4");
}
pixelWriter.setColor(x, y, c);
}
}
}
//method that calculates color
private Color getColor(double x, double y){
double distance = getDistance(x, y);
if(distance > 127.5){
return Color.web("#f4f4f4");
}
double h = getAngle(x, y);
double s = (distance / 127.5);
double b = slider.valueProperty().get() / 100;
return Color.hsb(h, s, b);
}
//method to make color wheel look smoother
private Color getAntialiasedPixel(int x, int y){
double step = 1d / ANTIALIASING_BASE;
double N = ANTIALIASING_BASE * ANTIALIASING_BASE;
double r = 0, g = 0, b = 0;
for(int i = 0; i < ANTIALIASING_BASE; i++){
for(int j = 0; j < ANTIALIASING_BASE; j++){
Color c = getColor(x + step * (i + 0.5) - 0.5,
y + step * (j + 0.5) - 0.5);
r += c.getRed() / N;
g += c.getGreen() / N;
b += c.getBlue() / N;
}
}
return new Color(clamp(r), clamp(g), clamp(b), 1);
}
private double clamp(double val){
return val > 1 ? 1 : val < 0 ? 0 : val;
}
private double getDistance(double x1, double y1){
var y = 127.5 - y1;
var x = 127.5 - x1;
return Math.sqrt(y * y + x * x);
}
private double getAngle(double x1, double y1){
var angle = toDegrees(atan2(y1 - 127.5, x1 - 127.5));
if(angle < 0) angle += 360;
return angle;
}
}
java javafx
New contributor
$endgroup$
I am making my own JavaFX color picker just for learning more about JavaFX. I am rendering color wheel in JavaFX using WritableImage
and I have renderImage
method to render color wheel in my program. And I am using Slider
to change brightness of the color wheel.
The code is working fine but it's rendering slower. And the other reason I asked this question is also to learn about fast rendering algorithms in Java because if I make something else like Mandelbrot set or If I want to zoom that canvas containing WritableImage
then just using image as resource(As suggested in comment below) won't work.
How can I improve my code to render the color wheel faster?
import javafx.application.Application;
import javafx.beans.Observable;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.control.Slider;
import javafx.scene.image.PixelWriter;
import javafx.scene.image.WritableImage;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import static java.lang.Math.atan2;
import static java.lang.Math.toDegrees;
public class Example extends Application{
private static final int ANTIALIASING_BASE = 3;
private WritableImage writableImage;
private PixelWriter pixelWriter;
private Canvas canvas;
private IntegerProperty w;
private IntegerProperty h;
private Slider slider;
public static void main(String... arguments){
launch(arguments);
}
@Override
public void start(Stage primaryStage){
w = new SimpleIntegerProperty(255 + 42);
h = new SimpleIntegerProperty(360);
slider = new Slider(0, 100, 100);
primaryStage.setWidth(w.get());
primaryStage.setHeight(h.get());
canvas = new Canvas(255, 255);
writableImage = new WritableImage(255, 255);
pixelWriter = writableImage.getPixelWriter();
canvas.getGraphicsContext2D()
.drawImage(writableImage, 0, 0, w.get(), h.get(), 0, 0, w.get(), h.get());
renderImage();
slider.valueProperty().addListener(this::change);
VBox root = new VBox(12.5, canvas, slider);
root.setPadding(new Insets(12.5));
primaryStage.setScene(new Scene(root));
primaryStage.setResizable(false);
primaryStage.show();
}
//method to change brightness using slider
private void change(Observable observable){
writableImage = new WritableImage(255, 255);
pixelWriter = writableImage.getPixelWriter();
canvas.getGraphicsContext2D()
.drawImage(writableImage, 0, 0, w.get(), h.get(), 0, 0, w.get(), h.get());
renderImage();
}
//method that renders color wheel image
private void renderImage(){
for(int x = 0; x < 255; x++){
for(int y = 0; y < 255; y++){
Color c = getAntialiasedPixel(x, y);
if(c.getRed() == 0.0 && c.getGreen() == 0.0 && c.getBlue() == 0.0
&& slider.valueProperty().get() != 0.0){
c = Color.web("#f4f4f4");
}
pixelWriter.setColor(x, y, c);
}
}
}
//method that calculates color
private Color getColor(double x, double y){
double distance = getDistance(x, y);
if(distance > 127.5){
return Color.web("#f4f4f4");
}
double h = getAngle(x, y);
double s = (distance / 127.5);
double b = slider.valueProperty().get() / 100;
return Color.hsb(h, s, b);
}
//method to make color wheel look smoother
private Color getAntialiasedPixel(int x, int y){
double step = 1d / ANTIALIASING_BASE;
double N = ANTIALIASING_BASE * ANTIALIASING_BASE;
double r = 0, g = 0, b = 0;
for(int i = 0; i < ANTIALIASING_BASE; i++){
for(int j = 0; j < ANTIALIASING_BASE; j++){
Color c = getColor(x + step * (i + 0.5) - 0.5,
y + step * (j + 0.5) - 0.5);
r += c.getRed() / N;
g += c.getGreen() / N;
b += c.getBlue() / N;
}
}
return new Color(clamp(r), clamp(g), clamp(b), 1);
}
private double clamp(double val){
return val > 1 ? 1 : val < 0 ? 0 : val;
}
private double getDistance(double x1, double y1){
var y = 127.5 - y1;
var x = 127.5 - x1;
return Math.sqrt(y * y + x * x);
}
private double getAngle(double x1, double y1){
var angle = toDegrees(atan2(y1 - 127.5, x1 - 127.5));
if(angle < 0) angle += 360;
return angle;
}
}
java javafx
java javafx
New contributor
New contributor
edited 5 mins ago
Jamal♦
30.3k11117227
30.3k11117227
New contributor
asked 14 hours ago
thepooranthepooran
1114
1114
New contributor
New contributor
$begingroup$
The solution (as in the JavaScript) is to create an image of the color wheel, and render that. One might create the colorwheel in java, but outside the project and store the image as resource in the project.
$endgroup$
– Joop Eggen
13 hours ago
$begingroup$
Okay. but the reason I asked this question is also to learn about fast rendering algorithms in java because if I make something else like Mandelbrot set or If I want to zoom that canvas containingWritableImage
then just using image as resource won't work. I hope you are understanding the problem.
$endgroup$
– thepooran
13 hours ago
$begingroup$
Interlaced JPEG can be hi-res and fast show a lower resolution smaller scaled image. The CSS support of FX might be interesting (gradients). Pixel oriented processing is indeed suboptimal. Will be interesting to see the answers.
$endgroup$
– Joop Eggen
13 hours ago
add a comment |
$begingroup$
The solution (as in the JavaScript) is to create an image of the color wheel, and render that. One might create the colorwheel in java, but outside the project and store the image as resource in the project.
$endgroup$
– Joop Eggen
13 hours ago
$begingroup$
Okay. but the reason I asked this question is also to learn about fast rendering algorithms in java because if I make something else like Mandelbrot set or If I want to zoom that canvas containingWritableImage
then just using image as resource won't work. I hope you are understanding the problem.
$endgroup$
– thepooran
13 hours ago
$begingroup$
Interlaced JPEG can be hi-res and fast show a lower resolution smaller scaled image. The CSS support of FX might be interesting (gradients). Pixel oriented processing is indeed suboptimal. Will be interesting to see the answers.
$endgroup$
– Joop Eggen
13 hours ago
$begingroup$
The solution (as in the JavaScript) is to create an image of the color wheel, and render that. One might create the colorwheel in java, but outside the project and store the image as resource in the project.
$endgroup$
– Joop Eggen
13 hours ago
$begingroup$
The solution (as in the JavaScript) is to create an image of the color wheel, and render that. One might create the colorwheel in java, but outside the project and store the image as resource in the project.
$endgroup$
– Joop Eggen
13 hours ago
$begingroup$
Okay. but the reason I asked this question is also to learn about fast rendering algorithms in java because if I make something else like Mandelbrot set or If I want to zoom that canvas containing
WritableImage
then just using image as resource won't work. I hope you are understanding the problem.$endgroup$
– thepooran
13 hours ago
$begingroup$
Okay. but the reason I asked this question is also to learn about fast rendering algorithms in java because if I make something else like Mandelbrot set or If I want to zoom that canvas containing
WritableImage
then just using image as resource won't work. I hope you are understanding the problem.$endgroup$
– thepooran
13 hours ago
$begingroup$
Interlaced JPEG can be hi-res and fast show a lower resolution smaller scaled image. The CSS support of FX might be interesting (gradients). Pixel oriented processing is indeed suboptimal. Will be interesting to see the answers.
$endgroup$
– Joop Eggen
13 hours ago
$begingroup$
Interlaced JPEG can be hi-res and fast show a lower resolution smaller scaled image. The CSS support of FX might be interesting (gradients). Pixel oriented processing is indeed suboptimal. Will be interesting to see the answers.
$endgroup$
– Joop Eggen
13 hours ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "196"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
thepooran is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f212694%2fjavafx-color-picker%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
thepooran is a new contributor. Be nice, and check out our Code of Conduct.
thepooran is a new contributor. Be nice, and check out our Code of Conduct.
thepooran is a new contributor. Be nice, and check out our Code of Conduct.
thepooran is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Code Review Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f212694%2fjavafx-color-picker%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
The solution (as in the JavaScript) is to create an image of the color wheel, and render that. One might create the colorwheel in java, but outside the project and store the image as resource in the project.
$endgroup$
– Joop Eggen
13 hours ago
$begingroup$
Okay. but the reason I asked this question is also to learn about fast rendering algorithms in java because if I make something else like Mandelbrot set or If I want to zoom that canvas containing
WritableImage
then just using image as resource won't work. I hope you are understanding the problem.$endgroup$
– thepooran
13 hours ago
$begingroup$
Interlaced JPEG can be hi-res and fast show a lower resolution smaller scaled image. The CSS support of FX might be interesting (gradients). Pixel oriented processing is indeed suboptimal. Will be interesting to see the answers.
$endgroup$
– Joop Eggen
13 hours ago