JAI and Translating image

G

Grzegorz Wrazen

Hi,

I have some problem connected with translating
BufferedImage by JAI lib. Below is my code:

ParameterBlock pb = new ParameterBlock();
pb.addSource(image); <--my BufferedImage
pb.add(8f);
pb.add(0f);
pb.add(new InterpolationNearest()); // The interpolation

// Create the translate operation
RenderedOp op = JAI.create("translate", pb, null);
image = op.getAsBufferedImage();

// Below I would like to change images.
imageScrollPane.getViewport().remove(imagePanel);
imagePanel = new ImagePanel(image);
imageScrollPane.getViewport().add(imagePanel);
imageScrollPane.getViewport().repaint();

ImagePanel inherited from JPanel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top