dwt.graphics.ImageLoader.save crashed

yidabu yidabu.spam at gmail.com
Sun Jun 22 22:00:24 PDT 2008


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();
}




-- 
yidabu <yidabu.spam at gmail.com>
http://www.dsource.org/projects/dwin

D 语言-中文(D Chinese):
http://www.d-programming-language-china.org/
http://bbs.d-programming-language-china.org/
http://dwin.d-programming-language-china.org/
http://scite4d.d-programming-language-china.org/




More information about the Digitalmars-d-dwt mailing list