dwt.graphics.ImageLoader.save crashed

Frank Benoit keinfarbton at googlemail.com
Tue Jun 24 13:07:07 PDT 2008


yidabu schrieb:
> when call ImageLoader.save(...), program crashed, 
> 
> Code:
> 
> 
> import dwt.DWT;
> import dwt.graphics.GC;
> import dwt.graphics.Image;
> import dwt.graphics.ImageData;
> import dwt.graphics.ImageLoader;
> import dwt.graphics.Rectangle;
> import dwt.widgets.Display;
> import dwt.widgets.Shell;
> 
> 
> void main() {
>     Display display = new Display();
>     Shell shell = new Shell(display);
>     Image image = new Image(display, 640, 480);
>     Rectangle rect = image.getBounds();
>     GC gc = new GC(image);
>     gc.setBackground(display.getSystemColor(DWT.COLOR_RED));
>     gc.fillOval(rect.x, rect.y, rect.width, rect.height);
>     gc.dispose();
>     ImageLoader loader = new ImageLoader();
>     loader.data = [image.getImageData()];
> 
>     loader.save(r"D:\test.bmp", DWT.IMAGE_BMP); //program crashed here
> 
>     shell.setSize(shell.computeSize(rect.width / 2, rect.height / 2));
>     shell.setText("saved");
>     shell.open();
>     while (!shell.isDisposed()) {
>         if (!display.readAndDispatch())
>             display.sleep();
>     }
>     image.dispose();
>     display.dispose();
> }
> 
> 
> 
> 

Should work now with dwt-win.
Thanks for reporting.



More information about the Digitalmars-d-dwt mailing list