modify the pixels colors
From: Québec (notAgain_at_enough.ca)
Date: 03/31/04
- Next message: Québec: "Re: modify the pixels colors"
- Previous message: Larry Coon: "Re: Hello World for XSLT"
- Next in thread: Québec: "Re: modify the pixels colors"
- Reply: Québec: "Re: modify the pixels colors"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 30 Mar 2004 21:07:53 -0500
Hi again,
This is I think the last problem I face before my
priceless applet is over.
While pursuing my wonderfull creation here I am
stunned with my colorize method witch is suppose to modify the pixels colors
of an image faster than ImageFilter....
My question is: why does the image dont print?
Jean
public Image colorer(Graphics g2, Image couleur) {
g2.drawImage(couleur,300, 0, null); <<<<<<<<<<< this image is
printed
int w = couleur.getWidth(null);
int h = couleur.getHeight(null);
int buffer[] = new int [w * h];
int new_buffer[] = new int [w * h];
PixelGrabber grabber = new PixelGrabber(couleur, 0, 0, w, h, buffer, 0, w);
try {
grabber.grabPixels();
int ra = 50;
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
if(ra >240)
ra = 50; else ra++;
int tmp = buffer[y * w];
int a = tmp & 0xFF000000;
int r = tmp & 0xFF0000;
int g = (tmp & 0x00FF00) & ra << 11;
int b = tmp & 0xFF;
new_buffer[y * w] = (a <<24 | r << 16 | g << 8 | b);
}
}
} catch (Exception e) {e.printStackTrace();}
Image img = createImage(new MemoryImageSource(w, h, new_buffer, 0, w));
g2.drawImage(img,0, 0, null); <<<<<<<<<<< this image is NOT printed
return img;
}
- Next message: Québec: "Re: modify the pixels colors"
- Previous message: Larry Coon: "Re: Hello World for XSLT"
- Next in thread: Québec: "Re: modify the pixels colors"
- Reply: Québec: "Re: modify the pixels colors"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|