import java.awt.image.*; import java.awt.geom.*; import java.awt.*; import java.applet.*; public class Pildivarvimuutus1 extends Applet{ BufferedImage pilt1=new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB); BufferedImage pilt2=new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB); public Pildivarvimuutus1(){ Graphics g=pilt1.createGraphics(); g.setColor(Color.green); g.fillOval(10, 10, 80, 80); float andmed[][]=new float[][]{ {1, 0, 0}, {0, 1, 0}, // uus roheline = 0*vana punane+1* vana roheline + 0*vana sinine {0, 0, 1} }; BandCombineOp bco=new BandCombineOp( andmed, null ); bco.filter(pilt1.getData(), pilt2.getRaster()); } public void paint(Graphics g){ g.drawImage(pilt1, 25, 50, this); g.drawImage(pilt2, 175, 50, this); } public static void main(String argumendid[]){ Frame f=new Frame("Pildi värvide muutmine"); f.add(new Pildivarvimuutus1()); f.setSize(300, 200); f.setVisible(true); } }