Drawing a grey-scale image [message #462200] |
Fri, 07 October 2005 22:45 |
Eclipse User |
|
|
|
Originally posted by: waynetg.telkomsa.net
Hi all,
I'm trying to create a grey-scale image (only binary really) but the
constructors only seem to cater for RGB. Heres a section of code.
<code>
int [][] newLines = binarize(lines,height,width,threshold);
RGB[] rgbarr = new RGB[] {new RGB(0,0,0),new RGB(255,255,255)};
PaletteData pal = new PaletteData(rgbarr);
ImageData newId = new ImageData(width,height,1,pal);
for(int i=0;i<height;i++)
{
newId.setPixels(i,0,width,newLines[i],0);
}
img = new Image(disp,newId);
</code>
binarize turns an existing greyscale image into a 2d array of 1s and 0s.
When img is rendered it is almost all black, even without the binarization.
Could anyone point me in the right direction?
Regards
Tshwala
|
|
|
Powered by
FUDForum. Page generated in 0.02635 seconds