Search code examples
javagraphicsbufferedimagechangelistener

Changelistener for BufferedImage


Is there a way to track changes in the pixel data of a BufferdImage? I was thinking about something like that:

PixelChangeListener listener = new PixelChangeListener() {
public void pixelchange(Event e) {
    // Get the coordinates in the Image that have been changed:
    int x=e.getX();
    int y=e.getY();
}
};
buffimage.addPixelChangeListener(listener);

If i now use g.drawLine or buffimage.setRGB(x,y,rgb); pixelchange(e) should fire.
Is there a way to do that? :)


Solution

  • There isn't such a listener. But you could extend BufferedImage and add the APIs you need.