1 #!/usr/bin/env dub
2 /+
3 dub.sdl:
4     name "snippet_dwt_bitmap_v4"
5     dependency "dwt" path="../../../../../../"
6     stringImportPaths "../../../../../res"
7     libs \
8       "atk-1.0" \
9       "cairo" \
10       "dl" \
11       "fontconfig" \
12       "gdk-x11-2.0" \
13       "gdk_pixbuf-2.0" \
14       "glib-2.0" \
15       "gmodule-2.0" \
16       "gnomeui-2" \
17       "gnomevfs-2" \
18       "gobject-2.0" \
19       "gthread-2.0" \
20       "gtk-x11-2.0" \
21       "pango-1.0" \
22       "pangocairo-1.0" \
23       "X11" \
24       "Xcomposite" \
25       "Xcursor" \
26       "Xdamage" \
27       "Xext" \
28       "Xfixes" \
29       "Xi" \
30       "Xinerama" \
31       "Xrandr" \
32       "Xrender" \
33       "Xtst" \
34       platform="linux"
35 +/
36 
37 /**
38  * Author: kntroh
39  * License: CC0(http://creativecommons.org/publicdomain/zero/1.0/)
40  */
41 module org.eclipse.swt.snippets.SnippetDwt1;
42 
43 /**
44  * This program snippet is the test of displaying RLE4 bitmap and V4 Header bitmap.
45  */
46 import org.eclipse.swt.all;
47 import java.io.ByteArrayInputStream;
48 
49 void main() {
50 	auto d = new Display;
51 	auto s = new Shell(d);
52 	s.setLayout(new GridLayout(2, false));
53 
54 	auto l = new Label(s, SWT.NONE);
55 	l.setText("RLE4");
56 
57 	l = new Label(s, SWT.NONE);
58 	auto bin = new ByteArrayInputStream(cast(byte[])import("dwt1_rle4.bmp"));
59 	auto img1 = new Image(d, new ImageData(bin));
60 	l.setImage(img1);
61 
62 	l = new Label(s, SWT.NONE);
63 	l.setText("V4 Header");
64 
65 	l = new Label(s, SWT.NONE);
66 	bin = new ByteArrayInputStream(cast(byte[])import("dwt1_v4.bmp"));
67 	auto img2 = new Image(d, new ImageData(bin));
68 	l.setImage(img2);
69 
70 	s.pack();
71 	s.open();
72 
73 	while (!s.isDisposed())
74 		if (!d.readAndDispatch())
75 			d.sleep();
76 
77 	img1.dispose();
78 	img2.dispose();
79 	d.dispose();
80 }