5 DisplayBlackAndWhite(HWND hwnd
,
22 bi
.bmiHeader
.biSize
= sizeof(bi
.bmiHeader
);
23 bi
.bmiHeader
.biWidth
= bitmap
.bmWidth
;
24 bi
.bmiHeader
.biHeight
= bitmap
.bmHeight
;
25 bi
.bmiHeader
.biPlanes
= 1;
26 bi
.bmiHeader
.biBitCount
= 32;
27 bi
.bmiHeader
.biCompression
= BI_RGB
;
28 bi
.bmiHeader
.biSizeImage
= bitmap
.bmWidth
* bitmap
.bmHeight
* 4;
29 bi
.bmiHeader
.biClrUsed
= 0;
30 bi
.bmiHeader
.biClrImportant
= 0;
33 pBits
= (PBYTE
)HeapAlloc(ProcessHeap
,
35 bitmap
.bmWidth
* bitmap
.bmHeight
* 4);
39 /* get the bits from the original bitmap */
40 bRes
= GetDIBits(hdcMem
,
48 for (i
= 0; i
< bitmap
.bmHeight
; i
++)
50 for (j
= 0; j
< bitmap
.bmWidth
; j
++)
59 /* Get pixels in reverse order */
64 /* get the average color value */
65 Val
= (r
+ g
+ b
) / 3;
67 /* assign to RGB color */
68 Val
= RGB(Val
, Val
, Val
);
69 CopyMemory(&pBits
[Count
],
77 /* Set the new pixel bits */
102 DisplayInvertedColors(HWND hwnd
,
119 bi
.bmiHeader
.biSize
= sizeof(bi
.bmiHeader
);
120 bi
.bmiHeader
.biWidth
= bitmap
.bmWidth
;
121 bi
.bmiHeader
.biHeight
= bitmap
.bmHeight
;
122 bi
.bmiHeader
.biPlanes
= 1;
123 bi
.bmiHeader
.biBitCount
= 32;
124 bi
.bmiHeader
.biCompression
= BI_RGB
;
125 bi
.bmiHeader
.biSizeImage
= bitmap
.bmWidth
* bitmap
.bmHeight
* 4;
126 bi
.bmiHeader
.biClrUsed
= 0;
127 bi
.bmiHeader
.biClrImportant
= 0;
130 pBits
= (PBYTE
)HeapAlloc(ProcessHeap
,
132 bitmap
.bmWidth
* bitmap
.bmHeight
* 4);
136 /* get the bits from the original bitmap */
137 bRes
= GetDIBits(hdcMem
,
145 for (i
= 0; i
< bitmap
.bmHeight
; i
++)
147 for (j
= 0; j
< bitmap
.bmWidth
; j
++)
156 b
= 255 - GetRValue(Val
);
157 g
= 255 - GetGValue(Val
);
158 r
= 255 - GetBValue(Val
);
162 CopyMemory(&pBits
[Count
],
170 /* Set the new pixel bits */
179 HeapFree(ProcessHeap
,
196 DisplayBlur(HWND hwnd
,
205 PBYTE pBits
, pBitsTemp
;
213 bi
.bmiHeader
.biSize
= sizeof(bi
.bmiHeader
);
214 bi
.bmiHeader
.biWidth
= bitmap
.bmWidth
;
215 bi
.bmiHeader
.biHeight
= bitmap
.bmHeight
;
216 bi
.bmiHeader
.biPlanes
= 1;
217 bi
.bmiHeader
.biBitCount
= 32;
218 bi
.bmiHeader
.biCompression
= BI_RGB
;
219 bi
.bmiHeader
.biSizeImage
= bitmap
.bmWidth
* bitmap
.bmHeight
* 4;
220 bi
.bmiHeader
.biClrUsed
= 0;
221 bi
.bmiHeader
.biClrImportant
= 0;
224 pBits
= (PBYTE
)HeapAlloc(ProcessHeap
,
226 bitmap
.bmWidth
* bitmap
.bmHeight
* 4);
227 pBitsTemp
= (PBYTE
)HeapAlloc(ProcessHeap
,
229 bitmap
.bmWidth
* bitmap
.bmHeight
* 4);
230 if (!pBits
|| !pBitsTemp
)
233 /* get the bits from the original bitmap */
234 bRes
= GetDIBits(hdcMem
,
242 for (i
= 0; i
< bitmap
.bmHeight
; i
++)
244 for (j
= 0; j
< bitmap
.bmWidth
; j
++)
248 INT c1
, c2
, c3
, c4
, c5
;
260 if ((Count
< ((bitmap
.bmHeight
- 1) * bitmap
.bmWidth
* 4lu)) &&
261 (Count
> (bitmap
.bmWidth
* 4lu)))
263 CopyMemory(&Val
, &pBits
[Count
- (bitmap
.bmWidth
* 4)], 4);
266 CopyMemory(&Val
, &pBits
[Count
+ 4], 4);
269 CopyMemory(&Val
, &pBits
[(Count
+ (bitmap
.bmWidth
* 4))], 4);
272 CopyMemory(&Val
, &pBits
[Count
- 4], 4);
275 r
= (c1
+ c2
+ c3
+ c4
+ c5
) / 5;
280 if ((Count
< ((bitmap
.bmHeight
- 1) * bitmap
.bmWidth
* 4lu)) &&
281 (Count
> (bitmap
.bmWidth
* 4lu)))
283 CopyMemory(&Val
, &pBits
[(Count
- (bitmap
.bmWidth
* 4lu))], 4);
286 CopyMemory(&Val
, &pBits
[Count
+ 4], 4);
289 CopyMemory(&Val
, &pBits
[(Count
+ (bitmap
.bmWidth
* 4lu))], 4);
292 CopyMemory(&Val
, &pBits
[Count
-4], 4);
295 g
= (c1
+ c2
+ c3
+ c4
+ c5
) / 5;
300 if ((Count
< ((bitmap
.bmHeight
- 1) * bitmap
.bmWidth
* 4lu)) &&
301 (Count
> (bitmap
.bmWidth
* 4lu)))
303 CopyMemory(&Val
, &pBits
[(Count
- (bitmap
.bmWidth
* 4l))], 4);
306 CopyMemory(&Val
, &pBits
[Count
+ 4], 4);
309 CopyMemory(&Val
, &pBits
[(Count
+ (bitmap
.bmWidth
* 4l))], 4);
312 CopyMemory(&Val
, &pBits
[Count
-4], 4);
315 b
= (c1
+ c2
+ c3
+ c4
+ c5
) / 5;
320 CopyMemory(&pBitsTemp
[Count
],
328 /* Set the new pixel bits */
337 HeapFree(ProcessHeap
,
340 HeapFree(ProcessHeap
,
357 DisplaySharpness(HWND hwnd
,
366 PBYTE pBits
, pBitsTemp
;
374 bi
.bmiHeader
.biSize
= sizeof(bi
.bmiHeader
);
375 bi
.bmiHeader
.biWidth
= bitmap
.bmWidth
;
376 bi
.bmiHeader
.biHeight
= bitmap
.bmHeight
;
377 bi
.bmiHeader
.biPlanes
= 1;
378 bi
.bmiHeader
.biBitCount
= 32;
379 bi
.bmiHeader
.biCompression
= BI_RGB
;
380 bi
.bmiHeader
.biSizeImage
= bitmap
.bmWidth
* bitmap
.bmHeight
* 4;
381 bi
.bmiHeader
.biClrUsed
= 0;
382 bi
.bmiHeader
.biClrImportant
= 0;
385 pBits
= (PBYTE
)HeapAlloc(ProcessHeap
,
387 bitmap
.bmWidth
* bitmap
.bmHeight
* 4);
388 pBitsTemp
= (PBYTE
)HeapAlloc(ProcessHeap
,
390 bitmap
.bmWidth
* bitmap
.bmHeight
* 4);
391 if (!pBits
|| !pBitsTemp
)
394 /* get the bits from the original bitmap */
395 bRes
= GetDIBits(hdcMem
,
403 for (i
= 0; i
< bitmap
.bmHeight
; i
++)
405 for (j
= 0; j
< bitmap
.bmWidth
; j
++)
409 INT c1
, c2
, c3
, c4
, c5
;
421 if ((Count
< ((bitmap
.bmHeight
- 1) * bitmap
.bmWidth
* 4lu)) &&
422 (Count
> (bitmap
.bmWidth
* 4lu)))
424 CopyMemory(&Val
, &pBits
[Count
- (bitmap
.bmWidth
* 4l)], 4);
427 CopyMemory(&Val
, &pBits
[Count
+ 4], 4);
430 CopyMemory(&Val
, &pBits
[(Count
+ (bitmap
.bmWidth
* 4l))], 4);
433 CopyMemory(&Val
, &pBits
[Count
- 4], 4);
436 r
= (c1
* 5) - (c2
+ c3
+ c4
+ c5
);
441 if ((Count
< ((bitmap
.bmHeight
- 1)* bitmap
.bmWidth
* 4lu)) &&
442 (Count
> (bitmap
.bmWidth
* 4lu)))
444 CopyMemory(&Val
, &pBits
[(Count
- (bitmap
.bmWidth
* 4l))], 4);
447 CopyMemory(&Val
, &pBits
[Count
+ 4], 4);
450 CopyMemory(&Val
, &pBits
[(Count
+ (bitmap
.bmWidth
* 4l))], 4);
453 CopyMemory(&Val
, &pBits
[Count
- 4], 4);
456 g
= (c1
* 5) - (c2
+ c3
+ c4
+ c5
);
461 if ((Count
< ((bitmap
.bmHeight
- 1) * bitmap
.bmWidth
* 4lu)) &&
462 (Count
> (bitmap
.bmWidth
* 4lu)))
464 CopyMemory(&Val
, &pBits
[(Count
- (bitmap
.bmWidth
* 4l))], 4);
467 CopyMemory(&Val
, &pBits
[Count
+ 4], 4);
470 CopyMemory(&Val
, &pBits
[(Count
+(bitmap
.bmWidth
* 4l))], 4);
473 CopyMemory(&Val
, &pBits
[Count
- 4], 4);
476 b
= (c1
* 5) - (c2
+ c3
+ c4
+ c5
);
480 if (r
> 255) r
= 255;
484 if (g
> 255) g
= 255;
488 if (b
> 255) b
= 255;
493 CopyMemory(&pBitsTemp
[Count
],
501 /* Set the new pixel bits */
510 HeapFree(ProcessHeap
,
513 HeapFree(ProcessHeap
,