xref: /haiku/src/tests/servers/app/drawing_modes/DrawingModes.cpp (revision c90684742e7361651849be4116d0e5de3a817194)
1 #include <Application.h>
2 #include <Bitmap.h>
3 #include <View.h>
4 #include <Window.h>
5 #include <stdio.h>
6 
7 uint32 kBitmapBits[] = {
8 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
9 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
10 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
11 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
12 	0x00777477, 0x00777477, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
13 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
14 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
15 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
16 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
17 	0x00777477, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00111111,
18 	0x00777777, 0x00000000, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
19 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
20 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
21 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
22 	0x00777477, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00111111,
23 	0x00777777, 0x00444444, 0x00000000, 0x00000000, 0x00777477, 0x00777477,
24 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
25 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
26 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
27 	0x00777477, 0x00000000, 0x00000000, 0x00bb0000, 0x00ffffff, 0x00000000,
28 	0x00444444, 0x00777777, 0x00111111, 0x00000000, 0x00000000, 0x00000000,
29 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
30 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
31 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
32 	0x00777477, 0x00777477, 0x00000000, 0x00bb0000, 0x00ee0000, 0x00ee0000,
33 	0x00ff0000, 0x00ffffff, 0x00ee0000, 0x00111111, 0x00000000, 0x00000000,
34 	0x00000000, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
35 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
36 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
37 	0x00777477, 0x00777477, 0x00777477, 0x00000000, 0x00bb0000, 0x00ee0000,
38 	0x00ee0000, 0x00ff0000, 0x00ffffff, 0x00ee0000, 0x00ee0000, 0x00ee0000,
39 	0x00000000, 0x00000000, 0x00000000, 0x00777477, 0x00777477, 0x00777477,
40 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
41 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
42 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00000000, 0x00bb0000,
43 	0x00ee0000, 0x00ee0000, 0x00ff0000, 0x00ffffff, 0x00ee0000, 0x00ee0000,
44 	0x00ee0000, 0x00cc0000, 0x00000000, 0x00000000, 0x00000000, 0x00777477,
45 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
46 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
47 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00000000,
48 	0x00bb0000, 0x00ee0000, 0x00ee0000, 0x00ff0000, 0x00ffffff, 0x00ee0000,
49 	0x00ee0000, 0x00ee0000, 0x00cc0000, 0x00990000, 0x00990000, 0x00000000,
50 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
51 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
52 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
53 	0x00777477, 0x00000000, 0x00ee0000, 0x00ee0000, 0x00ee0000, 0x00ffffff,
54 	0x00ee0000, 0x00ff0000, 0x00cc0000, 0x00cc0000, 0x00990000, 0x00bb0000,
55 	0x00880000, 0x00000000, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
56 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
57 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
58 	0x00777477, 0x00777477, 0x00000000, 0x00ee0000, 0x00ee0000, 0x00ee0000,
59 	0x00ffffff, 0x00ee0000, 0x00ff0000, 0x00cc0000, 0x00cc0000, 0x00990000,
60 	0x00bb0000, 0x00880000, 0x00000000, 0x00777477, 0x00777477, 0x00777477,
61 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
62 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
63 	0x00777477, 0x00777477, 0x00777477, 0x00000000, 0x00ee0000, 0x00ee0000,
64 	0x00ee0000, 0x00ffffff, 0x00ee0000, 0x00ff0000, 0x00cc0000, 0x00cc0000,
65 	0x00990000, 0x00bb0000, 0x00880000, 0x00990000, 0x00000000, 0x00777477,
66 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
67 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
68 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00000000, 0x00ee0000,
69 	0x00ee0000, 0x00ee0000, 0x00ffffff, 0x00ee0000, 0x00ff0000, 0x00cc0000,
70 	0x00cc0000, 0x00990000, 0x00bb0000, 0x00880000, 0x00990000, 0x00000000,
71 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
72 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
73 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
74 	0x00000000, 0x00ee0000, 0x00ff0000, 0x00ffffff, 0x00ee0000, 0x00ee0000,
75 	0x00ee0000, 0x00cc0000, 0x00990000, 0x00bb0000, 0x00880000, 0x00880000,
76 	0x00000000, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
77 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
78 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
79 	0x00777477, 0x00000000, 0x00ee0000, 0x00ee0000, 0x00ffffff, 0x00ee0000,
80 	0x00ff0000, 0x00cc0000, 0x00cc0000, 0x00990000, 0x00bb0000, 0x00880000,
81 	0x00990000, 0x00000000, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
82 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
83 	0x00777477, 0x00777477, 0x00777477, 0x00000000, 0x00000000, 0x00000000,
84 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00ee0000, 0x00ffffff,
85 	0x00ee0000, 0x00ff0000, 0x00cc0000, 0x00cc0000, 0x00990000, 0x00bb0000,
86 	0x00880000, 0x00000000, 0x00000000, 0x00777477, 0x00777477, 0x00777477,
87 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
88 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00000000, 0x00ff6666,
89 	0x00ff6666, 0x00ff6666, 0x00ff6666, 0x00880000, 0x00000000, 0x00ee0000,
90 	0x00ff6666, 0x00000000, 0x00ee0000, 0x00ee0000, 0x00bb0000, 0x00bb0000,
91 	0x00bb0000, 0x00880000, 0x00000000, 0x00777477, 0x00777477, 0x00777477,
92 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
93 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00000000,
94 	0x00ee0000, 0x00ff0000, 0x00ee0000, 0x00880000, 0x00990000, 0x00000000,
95 	0x00ee0000, 0x00ff6666, 0x00880000, 0x00000000, 0x00cc0000, 0x00990000,
96 	0x00bb0000, 0x00880000, 0x00990000, 0x00000000, 0x00777477, 0x00777477,
97 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
98 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
99 	0x00000000, 0x00ee0000, 0x00ff0000, 0x00ee0000, 0x00880000, 0x00990000,
100 	0x00000000, 0x00ee0000, 0x00ff6666, 0x00880000, 0x00000000, 0x00990000,
101 	0x00880000, 0x00880000, 0x00990000, 0x00000000, 0x00000000, 0x00777477,
102 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
103 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
104 	0x00777477, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
105 	0x00000000, 0x00000000, 0x00000000, 0x00ff6666, 0x00880000, 0x00000000,
106 	0x00990000, 0x00880000, 0x00880000, 0x00000000, 0x00000000, 0x00777477,
107 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
108 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
109 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
110 	0x00777477, 0x00777477, 0x00000000, 0x00444444, 0x00ff6666, 0x00880000,
111 	0x00000000, 0x00990000, 0x00880000, 0x00880000, 0x00000000, 0x00ee0000,
112 	0x00000000, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
113 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777777, 0x00777777,
114 	0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777477, 0x00777477,
115 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00000000, 0x00ff6666,
116 	0x00880000, 0x00000000, 0x00000000, 0x00000000, 0x00990000, 0x00000000,
117 	0x00880000, 0x00ee0000, 0x00000000, 0x00777477, 0x00777477, 0x00777477,
118 	0x00777477, 0x00777477, 0x00777777, 0x00777777, 0x00777777, 0x00777777,
119 	0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777,
120 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00000000, 0x00000000,
121 	0x00ff9900, 0x00000000, 0x00000000, 0x00000000, 0x00444444, 0x00000000,
122 	0x00000000, 0x00880000, 0x00990000, 0x00ee0000, 0x00000000, 0x00777477,
123 	0x00777477, 0x00777477, 0x00777777, 0x00777777, 0x00777777, 0x00777777,
124 	0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777,
125 	0x00777777, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00000000,
126 	0x00ff9900, 0x00ff9900, 0x00ffff00, 0x00ffff00, 0x00ffff00, 0x00000000,
127 	0x00444444, 0x00000000, 0x00000000, 0x00880000, 0x00ff0000, 0x00ee0000,
128 	0x00000000, 0x00777477, 0x00777777, 0x00777777, 0x00777777, 0x00777777,
129 	0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777,
130 	0x00777777, 0x00777777, 0x00777777, 0x00777477, 0x00777477, 0x00777477,
131 	0x00000000, 0x00ff9900, 0x00ff9900, 0x00ffff00, 0x00ffff00, 0x00ffff00,
132 	0x00ff9900, 0x00000000, 0x00000000, 0x00777477, 0x00000000, 0x00ee0000,
133 	0x00ff0000, 0x00880000, 0x00000000, 0x00777477, 0x00777777, 0x00777777,
134 	0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777,
135 	0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777477, 0x00777477,
136 	0x00777477, 0x00777477, 0x00000000, 0x00ff9900, 0x00ff9900, 0x00ffff00,
137 	0x00ffff00, 0x00ff9900, 0x00000000, 0x00777777, 0x00777777, 0x00777777,
138 	0x00000000, 0x00ee0000, 0x00990000, 0x00000000, 0x00777777, 0x00777777,
139 	0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777,
140 	0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777477, 0x00777477,
141 	0x00777477, 0x00777477, 0x00777477, 0x00000000, 0x00ff9900, 0x00ff9900,
142 	0x00ffff00, 0x00ff9900, 0x00ff9900, 0x00ff9900, 0x00000000, 0x00777777,
143 	0x00777777, 0x00777777, 0x00000000, 0x00880000, 0x00000000, 0x00777777,
144 	0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777,
145 	0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777477, 0x00777477,
146 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00000000,
147 	0x00ff9900, 0x00ffff00, 0x00ff9900, 0x00ff9900, 0x00ff9900, 0x00000000,
148 	0x00777477, 0x00777477, 0x00777477, 0x00777777, 0x00000000, 0x00000000,
149 	0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777,
150 	0x00777777, 0x00777777, 0x00777777, 0x00777477, 0x00777477, 0x00777477,
151 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
152 	0x00000000, 0x00ff9900, 0x00ffff00, 0x00ff9900, 0x00ff9900, 0x00000000,
153 	0x00000000, 0x00777477, 0x00777777, 0x00777777, 0x00777777, 0x00777777,
154 	0x00000000, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777,
155 	0x00777777, 0x00777777, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
156 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
157 	0x00777477, 0x00777477, 0x00000000, 0x00ffff00, 0x00ff9900, 0x00000000,
158 	0x00000000, 0x00777477, 0x00777777, 0x00777777, 0x00777777, 0x00777777,
159 	0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777,
160 	0x00777777, 0x00777777, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
161 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
162 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00000000, 0x00000000,
163 	0x00000000, 0x00777477, 0x00777477, 0x00777777, 0x00777777, 0x00777777,
164 	0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777,
165 	0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777477, 0x00777477,
166 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
167 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
168 	0x00777477, 0x00777477, 0x00777477, 0x00777777, 0x00777777, 0x00777777,
169 	0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777777, 0x00777477,
170 	0x00777477, 0x00777477, 0x00777777, 0x00777777, 0x00777777, 0x00777777,
171 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
172 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
173 	0x00777477, 0x00777477, 0x00777477, 0x00777777, 0x00777777, 0x00777777,
174 	0x00777777, 0x00777777, 0x00777777, 0x00777477, 0x00777477, 0x00777477,
175 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777777, 0x00777777,
176 	0x00777777, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
177 	0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477, 0x00777477,
178 	0x00777477, 0x00777477, 0x00777477, 0x00777477
179 };
180 
181 class DrawingModeView : public BView {
182 public:
183 							DrawingModeView(BRect frame);
184 virtual						~DrawingModeView();
185 
186 virtual	void				Draw(BRect updateRect);
187 
188 private:
189 		BBitmap *			fBitmap;
190 };
191 
192 
193 class DrawingModeWindow : public BWindow {
194 public:
195 							DrawingModeWindow(BRect frame);
196 
197 private:
198 		DrawingModeView *	fView;
199 };
200 
201 
202 class DrawingModeApp : public BApplication {
203 public:
204 							DrawingModeApp();
205 
206 private:
207 		DrawingModeWindow *	fWindow;
208 };
209 
210 
211 DrawingModeApp::DrawingModeApp()
212 	:	BApplication("application/x.vnd-Haiku.DrawingModeTest")
213 {
214 	fWindow = new DrawingModeWindow(BRect(200, 200, 380, 600));
215 	fWindow->Show();
216 }
217 
218 
219 DrawingModeWindow::DrawingModeWindow(BRect frame)
220 	:	BWindow(frame, "Drawing Modes Test", B_TITLED_WINDOW,
221 			B_QUIT_ON_WINDOW_CLOSE)
222 {
223 	fView = new DrawingModeView(frame.OffsetToSelf(0, 0));
224 	AddChild(fView);
225 	fView->SetViewColor(255, 203, 0);
226 	fView->SetDrawingMode(B_OP_OVER);
227 }
228 
229 
230 DrawingModeView::DrawingModeView(BRect frame)
231 	:	BView(frame, "DrawingModeView", B_FOLLOW_ALL, B_WILL_DRAW),
232 		fBitmap(NULL)
233 {
234 	fBitmap = new BBitmap(BRect(0, 0, 31, 31), B_RGB32);
235 	memcpy(fBitmap->Bits(), kBitmapBits, fBitmap->BitsLength());
236 }
237 
238 
239 DrawingModeView::~DrawingModeView()
240 {
241 	delete fBitmap;
242 }
243 
244 
245 void
246 DrawingModeView::Draw(BRect updateRect)
247 {
248 	SetDrawingMode(B_OP_COPY);
249 	SetLowColor(ViewColor());
250 	FillRect(Bounds(), B_SOLID_LOW);
251 
252 	SetLowColor(255, 0, 0);
253 	SetHighColor(0, 0, 255);
254 
255 	BRect bitmapBounds = fBitmap->Bounds();
256 	int32 imageHeight = bitmapBounds.IntegerHeight() + 10;
257 	int32 imageWidth = bitmapBounds.IntegerWidth() + 10;
258 
259 	struct {
260 		drawing_mode mode;
261 		const char *name;
262 	} drawingModes[] = {
263 		{ B_OP_COPY, "B_OP_COPY" },
264 		{ B_OP_OVER, "B_OP_OVER" },
265 		{ B_OP_ERASE, "B_OP_ERASE" },
266 		{ B_OP_INVERT, "B_OP_INVERT" },
267 		{ B_OP_SELECT, "B_OP_SELECT" },
268 		{ B_OP_ADD, "B_OP_ADD" },
269 		{ B_OP_SUBTRACT, "B_OP_SUBTRACT" },
270 		{ B_OP_BLEND, "B_OP_BLEND" },
271 		{ B_OP_MIN, "B_OP_MIN" },
272 		{ B_OP_MAX, "B_OP_MAX" }
273 	};
274 
275 	int32 modeCount = sizeof(drawingModes) / sizeof(drawingModes[0]);
276 	for (int32 i = 0; i < modeCount; i++) {
277 		if (drawingModes[i].mode == B_OP_SELECT) {
278 			// make the background contain the low and high color to see
279 			// actual effect of B_OP_SELECT
280 			SetDrawingMode(B_OP_COPY);
281 			FillRect(BRect(0, imageHeight * i, imageWidth * 2 - 10,
282 				imageHeight * i + bitmapBounds.Height() / 2), B_SOLID_LOW);
283 			FillRect(BRect(0, imageHeight * i  + bitmapBounds.Height() / 2,
284 				imageWidth * 2 - 10, imageHeight * i + bitmapBounds.Height()),
285 				B_SOLID_HIGH);
286 		} else if (drawingModes[i].mode == B_OP_MAX
287 			|| drawingModes[i].mode == B_OP_MIN) {
288 			// need a darker/lighter color as a background otherwise nothing
289 			// will be selected from the source
290 			SetDrawingMode(B_OP_COPY);
291 			SetHighColor(255, 255, 255);
292 			FillRect(BRect(0, imageHeight * i, imageWidth * 2 - 10,
293 				imageHeight * i + bitmapBounds.Height() / 3), B_SOLID_HIGH);
294 			SetHighColor(128, 128, 128);
295 			FillRect(BRect(0, imageHeight * i  + bitmapBounds.Height() / 3,
296 				imageWidth * 2 - 10, imageHeight * i + bitmapBounds.Height()),
297 				B_SOLID_HIGH);
298 			SetHighColor(0, 0, 0);
299 			FillRect(BRect(0, imageHeight * i  + bitmapBounds.Height() / 3 * 2,
300 				imageWidth * 2 - 10, imageHeight * i + bitmapBounds.Height()),
301 				B_SOLID_HIGH);
302 			SetHighColor(0, 0, 255);
303 		}
304 
305 		SetDrawingMode(drawingModes[i].mode);
306 		DrawBitmap(fBitmap, BPoint(0, imageHeight * i));
307 		FillRect(bitmapBounds.OffsetToCopy(imageWidth,
308 			imageHeight * i), B_MIXED_COLORS);
309 
310 		SetDrawingMode(B_OP_OVER);
311 		DrawString(drawingModes[i].name, BPoint(imageWidth * 2,
312 			imageHeight * i + 20));
313 	}
314 }
315 
316 
317 int
318 main(int argc, const char *argv[])
319 {
320 	DrawingModeApp *app = new DrawingModeApp();
321 	app->Run();
322 	delete app;
323 	return 0;
324 }
325