3

Hi all I am calculating a fractal and drawing a bufferedImage based on the number of completedIterations. For the sake of simplicity lets I am coloring the bufferdImage using the completedIterations in this way:

g.setColor(Color.getHSBColor((float) (colorValue - completedIterations), 1F, 1F));

Where colourValue is constant while the image is being generated, lets say in this case it's 0.2.

I have a slider on a JPanel, which when used, changes the colorValue, in the range of 0 to 1. When the colorValue is changed I want to update the BufferedImage in real time, but I don't want to recalculate all the image points as this causes a massive overhead - I just want to recolor the BufferedImage based on the new colorValue.

Can this be done, and if so how would I go about implementing it?

Kind regards

Greg

Greg Peters
  • 119
  • 2
  • 10

1 Answers1

2

You can set individual pixels using setRGB(), as shown here; or adjust multiple pixels using RescaleOp, as shown here.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045