Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] SWT/GC Problem: Drawing Functions don't Draw!

Hello,

I'm trying to write a simple program that fills a pixel image with a color and saves it to the hard disk. Unfortunately fillRectangle doesn't seem to do anything. I've tried the other draw* and fill* functions as well but they all have absolutely no effect on the image. The saved image is black when it should be green.


ImageData id = new ImageData( 100, 100, 24, new PaletteData( 0xFF0000, 0x00FF00, 0x0000FF ) );

// draw image
Image i = new Image( null, id );
GC gc = new GC( i );

gc.setBackground( new Color( gc.getDevice(), 0, 255, 0 ) );
gc.fillRectangle( 0, 0, id.width, id.height );

i.dispose();
gc.dispose();

// save image
ImageLoader il = new ImageLoader();

il.data = new ImageData[]{ id };
il.save( "test.bmp", SWT.IMAGE_BMP );


Surely this can't be a very complicated problem. I would appreciate a prompt solution very much! Thanks.

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/



Back to the top