import Java.awt.*;
import j ava.awt.image.*;
import j ava.awt.event.*;
public class Rescale extends Frame{
private Bufferedlmage bi;
public Rescale(String s){
super (s) ;
Image img = getToolkit().getlmage("javalogo52x88.gif");
try{
MediaTracker mt = new MediaTracker(this);
mt.addlmage(img, 0);
mt.waitForlD(O);
}
catch(Exception e){}
bi = new Bufferedlmage(img.getWidth(this), img.getHeight(this),
BufferedImage.TYPE_INT_RGB);
Graphics2D big = bi.createGraphics();
big.drawlmage(img, 0, 0, this);
}
public void paint(Graphics g){
Graphics2D g2 = (Graphics2D)g;
int w = getSize().width;
int bw = bi.getWidth(this);
int bh = bi.getHeight(this);
Bufferedlmage bimg =
new Bufferedlmage(bw, bh, BufferedImage.TYPE_INT_RGB);
//——————— Начало определения преобразования --——-———
RescaleOp гор = new RescaleOp(0.5f, 70.Of, null);
rop.filter(bi, bimg);
//——————— Конец определения преобразования ———————
g2.drawlmage(bi, null, 10, 30);
g2.drawlmage(bimg, null, w/2+3, 30);
}
public static void main(String(] args){
Frame f = new Rescale(" Изменение интенсивности");
f.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e) {
System.exit(0);
}
));
f.setSize(300, 200);
f.setvisible(true);
}
}