Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Drawing a grey-scale image
Drawing a grey-scale image [message #462200] Fri, 07 October 2005 22:45
Eclipse UserFriend
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
Previous Topic:Is an editor maximized or not ?
Next Topic:Painting on a GC at a decent speed
Goto Forum:
  


Current Time: Fri Apr 19 23:43:28 GMT 2024

Powered by FUDForum. Page generated in 0.02635 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top