Skip to main content

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

Hi,

please as this kind of question on the newsgroup. This snippet shows how
to do this:
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet70.java

Tom

Spectre 1337 schrieb:
> 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/
> 
> _______________________________________________
> platform-swt-dev mailing list
> platform-swt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
> 


-- 
B e s t S o l u t i o n . a t                        EDV Systemhaus GmbH
------------------------------------------------------------------------
tom schindl    leiter softwareentwicklung/CSE   mobile  ++43 676 3232147
------------------------------------------------------------------------
eduard-bodem-gasse 8/3    A-6020 innsbruck      fax      ++43 512 935833
http://www.bestsolution.at                      phone    ++43 512 935834

Attachment: signature.asc
Description: OpenPGP digital signature


Back to the top