ReactOS  0.4.14-dev-77-gd9e7c48
imageprop.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _IMAGEADJUST
 

Typedefs

typedef struct _IMAGEADJUST IMAGEADJUST
 
typedef struct _IMAGEADJUSTPIMAGEADJUST
 

Functions

INT_PTR CALLBACK ImagePropDialogProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK BrightnessProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK ContrastProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
VOID AdjustBrightness (HBITMAP hOrigBitmap, HBITMAP hNewBitmap, HWND hwnd, HDC hdcMem, INT RedVal, INT GreenVal, INT BlueVal)
 
BOOL DisplayBlackAndWhite (HWND hwnd, HDC hdcMem, HBITMAP hBitmap)
 
BOOL DisplayInvertedColors (HWND hwnd, HDC hdcMem, HBITMAP hBitmap)
 
BOOL DisplayBlur (HWND hwnd, HDC hdcMem, HBITMAP hBitmap)
 
BOOL DisplaySharpness (HWND hwnd, HDC hdcMem, HBITMAP hBitmap)
 

Typedef Documentation

◆ IMAGEADJUST

◆ PIMAGEADJUST

Function Documentation

◆ AdjustBrightness()

VOID AdjustBrightness ( HBITMAP  hOrigBitmap,
HBITMAP  hNewBitmap,
HWND  hwnd,
HDC  hdcMem,
INT  RedVal,
INT  GreenVal,
INT  BlueVal 
)

Definition at line 7 of file brightness.c.

14 {
15  BITMAPINFO bi;
16  BITMAP bitmap;
17  BOOL bRes;
18  DWORD Count = 0;
19  INT i, j;
20  PBYTE pBits;
21  RECT rc;
22 
23  GetObject(hNewBitmap,
24  sizeof(BITMAP),
25  &bitmap);
26 
27  /* Bitmap header */
28  bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
29  bi.bmiHeader.biWidth = bitmap.bmWidth;
30  bi.bmiHeader.biHeight = bitmap.bmHeight;
31  bi.bmiHeader.biPlanes = 1;
32  bi.bmiHeader.biBitCount = 32;
34  bi.bmiHeader.biSizeImage = bitmap.bmWidth * bitmap.bmHeight * 4;
35  bi.bmiHeader.biClrUsed = 0;
37 
38  /* Buffer */
39  pBits = (PBYTE)HeapAlloc(ProcessHeap,
40  0,
41  bitmap.bmWidth * bitmap.bmHeight * 4);
42  if (!pBits)
43  return;
44 
45  /* get the bits from the original bitmap */
46  bRes = GetDIBits(hdcMem,
47  hOrigBitmap,
48  0,
49  bitmap.bmHeight,
50  pBits,
51  &bi,
53 
54  for (i = 0; i < bitmap.bmHeight; i++)
55  {
56  for (j = 0; j < bitmap.bmWidth; j++)
57  {
58  DWORD Val = 0;
59  INT b, g, r;
60 
61  CopyMemory(&Val,
62  &pBits[Count],
63  4);
64 
65  /* Get pixels in reverse order */
66  b = GetRValue(Val);
67  g = GetGValue(Val);
68  r = GetBValue(Val);
69 
70  /* Red */
71  r += RedVal;
72  if (r > 255) r = 255;
73  else if (r < 0) r = 0;
74 
75  /* Green */
76  g += GreenVal;
77  if (g > 255) g = 255;
78  else if (g < 0) g = 0;
79 
80  /* Blue */
81  b += BlueVal;
82  if (b > 255) b = 255;
83  else if (b < 0) b = 0;
84 
85  /* Store in reverse order */
86  Val = RGB(b, g, r);
87  CopyMemory(&pBits[Count],
88  &Val,
89  4);
90 
91  /* RGB color take 4 bytes.The high-order byte must be zero */
92  Count += 4;
93  }
94  }
95 
96  /* Set the new pixel bits */
98  hNewBitmap,
99  0,
100  bRes,
101  pBits,
102  &bi,
104 
106  0,
107  pBits);
108 
110  &rc);
111 
113  &rc,
114  FALSE);
115 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1471
DWORD biClrImportant
Definition: amvideo.idl:40
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define GetRValue(rgb)
Definition: wingdi.h:2930
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
int32_t INT
Definition: typedefs.h:56
#define GetGValue(rgb)
Definition: wingdi.h:2931
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD biCompression
Definition: amvideo.idl:35
#define b
Definition: ke_i.h:79
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
Definition: uimain.c:88
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define RGB(r, g, b)
Definition: wingdi.h:2935
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define CopyMemory
Definition: winbase.h:1633
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD biSizeImage
Definition: amvideo.idl:36
#define GetObject
Definition: wingdi.h:4463
HANDLE ProcessHeap
Definition: servman.c:15
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
Definition: bl.h:1331
int WINAPI GetDIBits(_In_ HDC hdc, _In_ HBITMAP hbm, _In_ UINT start, _In_ UINT cLines, _Out_opt_ LPVOID lpvBits, _At_((LPBITMAPINFOHEADER) lpbmi, _Inout_) LPBITMAPINFO lpbmi, _In_ UINT usage)
#define GetBValue(rgb)
Definition: wingdi.h:2932
static HBITMAP bitmap
Definition: clipboard.c:1344
#define DIB_RGB_COLORS
Definition: wingdi.h:366
int WINAPI SetDIBits(_In_opt_ HDC, _In_ HBITMAP, _In_ UINT, _In_ UINT, _In_ CONST VOID *, _In_ CONST BITMAPINFO *, _In_ UINT)
BYTE * PBYTE
Definition: pedump.c:66
#define BI_RGB
Definition: precomp.h:34
#define HeapFree(x, y, z)
Definition: compat.h:394
HDC hdcMem
Definition: welcome.c:104

Referenced by Bri_OnCommand(), and Bri_OnTrackBar().

◆ BrightnessProc()

INT_PTR CALLBACK BrightnessProc ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 313 of file brightness.c.

317 {
318  static PIMAGEADJUST pImgAdj = NULL;
319 
320  switch (message)
321  {
322  case WM_INITDIALOG:
323  {
324  pImgAdj = Bri_OnInitDialog(pImgAdj,
325  hDlg,
326  lParam);
327  if (!pImgAdj)
328  {
329  EndDialog(hDlg, -1);
330  return FALSE;
331  }
332 
333  return TRUE;
334  }
335 
336  case WM_DRAWITEM:
337  {
338  Bri_OnDrawItem(pImgAdj,
339  lParam);
340  return TRUE;
341  }
342 
343  case WM_HSCROLL:
344  {
345  if (LOWORD(wParam) == TB_THUMBTRACK ||
347  {
348  Bri_OnTrackBar(pImgAdj,
349  hDlg);
350  }
351 
352  return TRUE;
353  }
354 
355  case WM_COMMAND:
356  {
357  return Bri_OnCommand(pImgAdj,
358  hDlg,
359  LOWORD(wParam));
360  }
361 
362  case WM_DESTROY:
363  {
364  if (pImgAdj)
365  {
366  if (pImgAdj->hBitmap)
367  DeleteObject(pImgAdj->hBitmap);
368  if (pImgAdj->hPreviewBitmap)
369  DeleteObject(pImgAdj->hPreviewBitmap);
370 
372  0,
373  pImgAdj);
374  }
375  }
376  }
377 
378  return FALSE;
379 }
#define TB_THUMBTRACK
Definition: commctrl.h:2050
Definition: tftpd.h:59
#define TRUE
Definition: types.h:120
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
static VOID Bri_OnTrackBar(PIMAGEADJUST pImgAdj, HWND hDlg)
Definition: brightness.c:222
smooth NULL
Definition: ftsmooth.c:416
#define WM_DESTROY
Definition: winuser.h:1591
static VOID Bri_OnDrawItem(PIMAGEADJUST pImgAdj, LPARAM lParam)
Definition: brightness.c:191
static PIMAGEADJUST Bri_OnInitDialog(PIMAGEADJUST pImgAdj, HWND hDlg, LPARAM lParam)
Definition: brightness.c:119
#define TB_ENDTRACK
Definition: commctrl.h:2053
#define WM_COMMAND
Definition: winuser.h:1722
HANDLE ProcessHeap
Definition: servman.c:15
static BOOL Bri_OnCommand(PIMAGEADJUST pImgAdj, HWND hDlg, UINT uID)
Definition: brightness.c:271
HBITMAP hPreviewBitmap
Definition: imageprop.h:7
#define WM_HSCROLL
Definition: winuser.h:1725
#define WM_DRAWITEM
Definition: winuser.h:1627
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:394
HBITMAP hBitmap
Definition: imageprop.h:6

Referenced by MainWndCommand().

◆ ContrastProc()

INT_PTR CALLBACK ContrastProc ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 314 of file contrast.c.

318 {
319  static PIMAGEADJUST pImgAdj = NULL;
320 
321  switch (message)
322  {
323  case WM_INITDIALOG:
324  {
325  pImgAdj = Cont_OnInitDialog(pImgAdj,
326  hDlg,
327  lParam);
328  if (!pImgAdj)
329  {
330  EndDialog(hDlg, -1);
331  return FALSE;
332  }
333 
334  return TRUE;
335  }
336 
337  case WM_DRAWITEM:
338  {
339  Cont_OnDrawItem(pImgAdj,
340  lParam);
341  return TRUE;
342  }
343 
344  case WM_HSCROLL:
345  {
346  if (LOWORD(wParam) == TB_THUMBTRACK ||
348  {
349  Cont_OnTrackBar(pImgAdj,
350  hDlg);
351  }
352 
353  return TRUE;
354  }
355 
356  case WM_COMMAND:
357  {
358  return Cont_OnCommand(pImgAdj,
359  hDlg,
360  LOWORD(wParam));
361  }
362 
363  case WM_DESTROY:
364  {
365  if (pImgAdj)
366  {
367  if (pImgAdj->hBitmap)
368  DeleteObject(pImgAdj->hBitmap);
369  if (pImgAdj->hPreviewBitmap)
370  DeleteObject(pImgAdj->hPreviewBitmap);
371 
373  0,
374  pImgAdj);
375  }
376  }
377  }
378 
379  return FALSE;
380 }
#define TB_THUMBTRACK
Definition: commctrl.h:2050
Definition: tftpd.h:59
#define TRUE
Definition: types.h:120
static BOOL Cont_OnCommand(PIMAGEADJUST pImgAdj, HWND hDlg, UINT uID)
Definition: contrast.c:272
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
smooth NULL
Definition: ftsmooth.c:416
#define WM_DESTROY
Definition: winuser.h:1591
#define TB_ENDTRACK
Definition: commctrl.h:2053
static PIMAGEADJUST Cont_OnInitDialog(PIMAGEADJUST pImgAdj, HWND hDlg, LPARAM lParam)
Definition: contrast.c:120
#define WM_COMMAND
Definition: winuser.h:1722
HANDLE ProcessHeap
Definition: servman.c:15
static VOID Cont_OnDrawItem(PIMAGEADJUST pImgAdj, LPARAM lParam)
Definition: contrast.c:192
HBITMAP hPreviewBitmap
Definition: imageprop.h:7
#define WM_HSCROLL
Definition: winuser.h:1725
#define WM_DRAWITEM
Definition: winuser.h:1627
static VOID Cont_OnTrackBar(PIMAGEADJUST pImgAdj, HWND hDlg)
Definition: contrast.c:223
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:394
HBITMAP hBitmap
Definition: imageprop.h:6

◆ DisplayBlackAndWhite()

BOOL DisplayBlackAndWhite ( HWND  hwnd,
HDC  hdcMem,
HBITMAP  hBitmap 
)

Definition at line 5 of file adjust.c.

8 {
9  BITMAPINFO bi;
10  BITMAP bitmap;
11  BOOL bRes;
12  DWORD Count = 0;
13  INT i, j;
14  PBYTE pBits;
15  RECT rc;
16 
18  sizeof(BITMAP),
19  &bitmap);
20 
21  /* Bitmap header */
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;
28  bi.bmiHeader.biSizeImage = bitmap.bmWidth * bitmap.bmHeight * 4;
29  bi.bmiHeader.biClrUsed = 0;
31 
32  /* Buffer */
33  pBits = (PBYTE)HeapAlloc(ProcessHeap,
34  0,
35  bitmap.bmWidth * bitmap.bmHeight * 4);
36  if (!pBits)
37  return FALSE;
38 
39  /* get the bits from the original bitmap */
40  bRes = GetDIBits(hdcMem,
41  hBitmap,
42  0,
43  bitmap.bmHeight,
44  pBits,
45  &bi,
47 
48  for (i = 0; i < bitmap.bmHeight; i++)
49  {
50  for (j = 0; j < bitmap.bmWidth; j++)
51  {
52  DWORD Val = 0;
53  INT b, g, r;
54 
55  CopyMemory(&Val,
56  &pBits[Count],
57  4);
58 
59  /* Get pixels in reverse order */
60  b = GetRValue(Val);
61  g = GetGValue(Val);
62  r = GetBValue(Val);
63 
64  /* get the average color value */
65  Val = (r + g + b) / 3;
66 
67  /* assign to RGB color */
68  Val = RGB(Val, Val, Val);
69  CopyMemory(&pBits[Count],
70  &Val,
71  4);
72 
73  Count+=4;
74  }
75  }
76 
77  /* Set the new pixel bits */
79  hBitmap,
80  0,
81  bRes,
82  pBits,
83  &bi,
85 
87  0,
88  pBits);
89 
91  &rc);
92 
94  &rc,
95  FALSE);
96 
97  return TRUE;
98 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1471
DWORD biClrImportant
Definition: amvideo.idl:40
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define GetRValue(rgb)
Definition: wingdi.h:2930
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
int32_t INT
Definition: typedefs.h:56
#define GetGValue(rgb)
Definition: wingdi.h:2931
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD biCompression
Definition: amvideo.idl:35
#define b
Definition: ke_i.h:79
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
Definition: uimain.c:88
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define RGB(r, g, b)
Definition: wingdi.h:2935
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define CopyMemory
Definition: winbase.h:1633
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD biSizeImage
Definition: amvideo.idl:36
#define GetObject
Definition: wingdi.h:4463
HANDLE ProcessHeap
Definition: servman.c:15
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
Definition: bl.h:1331
int WINAPI GetDIBits(_In_ HDC hdc, _In_ HBITMAP hbm, _In_ UINT start, _In_ UINT cLines, _Out_opt_ LPVOID lpvBits, _At_((LPBITMAPINFOHEADER) lpbmi, _Inout_) LPBITMAPINFO lpbmi, _In_ UINT usage)
#define GetBValue(rgb)
Definition: wingdi.h:2932
static HBITMAP bitmap
Definition: clipboard.c:1344
#define DIB_RGB_COLORS
Definition: wingdi.h:366
int WINAPI SetDIBits(_In_opt_ HDC, _In_ HBITMAP, _In_ UINT, _In_ UINT, _In_ CONST VOID *, _In_ CONST BITMAPINFO *, _In_ UINT)
BYTE * PBYTE
Definition: pedump.c:66
#define BI_RGB
Definition: precomp.h:34
static HBITMAP hBitmap
Definition: timezone.c:35
#define HeapFree(x, y, z)
Definition: compat.h:394
HDC hdcMem
Definition: welcome.c:104

Referenced by MainWndCommand().

◆ DisplayBlur()

BOOL DisplayBlur ( HWND  hwnd,
HDC  hdcMem,
HBITMAP  hBitmap 
)

Definition at line 196 of file adjust.c.

199 {
200  BITMAPINFO bi;
201  BITMAP bitmap;
202  BOOL bRes;
203  DWORD Count = 0;
204  INT i, j;
205  PBYTE pBits, pBitsTemp;
206  RECT rc;
207 
209  sizeof(BITMAP),
210  &bitmap);
211 
212  /* Bitmap header */
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;
219  bi.bmiHeader.biSizeImage = bitmap.bmWidth * bitmap.bmHeight * 4;
220  bi.bmiHeader.biClrUsed = 0;
221  bi.bmiHeader.biClrImportant = 0;
222 
223  /* Buffer */
224  pBits = (PBYTE)HeapAlloc(ProcessHeap,
225  0,
226  bitmap.bmWidth * bitmap.bmHeight * 4);
227  pBitsTemp = (PBYTE)HeapAlloc(ProcessHeap,
228  0,
229  bitmap.bmWidth * bitmap.bmHeight * 4);
230  if (!pBits || !pBitsTemp)
231  return FALSE;
232 
233  /* get the bits from the original bitmap */
234  bRes = GetDIBits(hdcMem,
235  hBitmap,
236  0,
237  bitmap.bmHeight,
238  pBits,
239  &bi,
241 
242  for (i = 0; i < bitmap.bmHeight; i++)
243  {
244  for (j = 0; j < bitmap.bmWidth; j++)
245  {
246  LONG Val = 0;
247  INT b, g, r;
248  INT c1, c2, c3, c4, c5;
249 
250  CopyMemory(&Val,
251  &pBits[Count],
252  4);
253 
254  b = GetRValue(Val);
255  g = GetGValue(Val);
256  r = GetBValue(Val);
257 
258  c1 = r;
259  /* Red */
260  if ((Count < ((bitmap.bmHeight - 1) * bitmap.bmWidth * 4lu)) &&
261  (Count > (bitmap.bmWidth * 4lu)))
262  {
263  CopyMemory(&Val, &pBits[Count - (bitmap.bmWidth * 4)], 4);
264  c2 = GetBValue(Val);
265 
266  CopyMemory(&Val, &pBits[Count + 4], 4);
267  c3 = GetBValue(Val);
268 
269  CopyMemory(&Val, &pBits[(Count + (bitmap.bmWidth * 4))], 4);
270  c4 = GetBValue(Val);
271 
272  CopyMemory(&Val, &pBits[Count - 4], 4);
273  c5 = GetBValue(Val);
274 
275  r = (c1 + c2 + c3 + c4 + c5) / 5;
276  }
277 
278  /* Green */
279  c1 = g;
280  if ((Count < ((bitmap.bmHeight - 1) * bitmap.bmWidth * 4lu)) &&
281  (Count > (bitmap.bmWidth * 4lu)))
282  {
283  CopyMemory(&Val, &pBits[(Count - (bitmap.bmWidth * 4lu))], 4);
284  c2 = GetGValue(Val);
285 
286  CopyMemory(&Val, &pBits[Count + 4], 4);
287  c3 = GetGValue(Val);
288 
289  CopyMemory(&Val, &pBits[(Count + (bitmap.bmWidth * 4lu))], 4);
290  c4 = GetGValue(Val);
291 
292  CopyMemory(&Val, &pBits[Count-4], 4);
293  c5 = GetGValue(Val);
294 
295  g = (c1 + c2 + c3 + c4 + c5) / 5;
296  }
297 
298  /* Blue */
299  c1 = b;
300  if ((Count < ((bitmap.bmHeight - 1) * bitmap.bmWidth * 4lu)) &&
301  (Count > (bitmap.bmWidth * 4lu)))
302  {
303  CopyMemory(&Val, &pBits[(Count - (bitmap.bmWidth * 4l))], 4);
304  c2 = GetRValue(Val);
305 
306  CopyMemory(&Val, &pBits[Count + 4], 4);
307  c3 = GetRValue(Val);
308 
309  CopyMemory(&Val, &pBits[(Count + (bitmap.bmWidth * 4l))], 4);
310  c4 = GetRValue(Val);
311 
312  CopyMemory(&Val, &pBits[Count-4], 4);
313  c5 = GetRValue(Val);
314 
315  b = (c1 + c2 + c3 + c4 + c5) / 5;
316  }
317 
318  Val = RGB(b, g, r);
319 
320  CopyMemory(&pBitsTemp[Count],
321  &Val,
322  4);
323 
324  Count+=4;
325  }
326  }
327 
328  /* Set the new pixel bits */
330  hBitmap,
331  0,
332  bRes,
333  pBitsTemp,
334  &bi,
336 
338  0,
339  pBits);
341  0,
342  pBitsTemp);
343 
345  &rc);
346 
348  &rc,
349  FALSE);
350 
351  return TRUE;
352 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1471
DWORD biClrImportant
Definition: amvideo.idl:40
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define GetRValue(rgb)
Definition: wingdi.h:2930
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
int32_t INT
Definition: typedefs.h:56
#define GetGValue(rgb)
Definition: wingdi.h:2931
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
DWORD biCompression
Definition: amvideo.idl:35
#define b
Definition: ke_i.h:79
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
r l[0]
Definition: byte_order.h:167
Definition: uimain.c:88
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define RGB(r, g, b)
Definition: wingdi.h:2935
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define CopyMemory
Definition: winbase.h:1633
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD biSizeImage
Definition: amvideo.idl:36
#define GetObject
Definition: wingdi.h:4463
HANDLE ProcessHeap
Definition: servman.c:15
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
Definition: bl.h:1331
int WINAPI GetDIBits(_In_ HDC hdc, _In_ HBITMAP hbm, _In_ UINT start, _In_ UINT cLines, _Out_opt_ LPVOID lpvBits, _At_((LPBITMAPINFOHEADER) lpbmi, _Inout_) LPBITMAPINFO lpbmi, _In_ UINT usage)
#define GetBValue(rgb)
Definition: wingdi.h:2932
static HBITMAP bitmap
Definition: clipboard.c:1344
#define DIB_RGB_COLORS
Definition: wingdi.h:366
int WINAPI SetDIBits(_In_opt_ HDC, _In_ HBITMAP, _In_ UINT, _In_ UINT, _In_ CONST VOID *, _In_ CONST BITMAPINFO *, _In_ UINT)
BYTE * PBYTE
Definition: pedump.c:66
#define BI_RGB
Definition: precomp.h:34
static HBITMAP hBitmap
Definition: timezone.c:35
#define HeapFree(x, y, z)
Definition: compat.h:394
HDC hdcMem
Definition: welcome.c:104

Referenced by MainWndCommand().

◆ DisplayInvertedColors()

BOOL DisplayInvertedColors ( HWND  hwnd,
HDC  hdcMem,
HBITMAP  hBitmap 
)

Definition at line 102 of file adjust.c.

105 {
106  BITMAPINFO bi;
107  BITMAP bitmap;
108  BOOL bRes;
109  DWORD Count = 0;
110  INT i, j;
111  PBYTE pBits;
112  RECT rc;
113 
115  sizeof(BITMAP),
116  &bitmap);
117 
118  /* Bitmap header */
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;
125  bi.bmiHeader.biSizeImage = bitmap.bmWidth * bitmap.bmHeight * 4;
126  bi.bmiHeader.biClrUsed = 0;
127  bi.bmiHeader.biClrImportant = 0;
128 
129  /* Buffer */
130  pBits = (PBYTE)HeapAlloc(ProcessHeap,
131  0,
132  bitmap.bmWidth * bitmap.bmHeight * 4);
133  if (!pBits)
134  return FALSE;
135 
136  /* get the bits from the original bitmap */
137  bRes = GetDIBits(hdcMem,
138  hBitmap,
139  0,
140  bitmap.bmHeight,
141  pBits,
142  &bi,
144 
145  for (i = 0; i < bitmap.bmHeight; i++)
146  {
147  for (j = 0; j < bitmap.bmWidth; j++)
148  {
149  DWORD Val = 0;
150  INT b, g, r;
151 
152  CopyMemory(&Val,
153  &pBits[Count],
154  4);
155 
156  b = 255 - GetRValue(Val);
157  g = 255 - GetGValue(Val);
158  r = 255 - GetBValue(Val);
159 
160  Val = RGB(b, g, r);
161 
162  CopyMemory(&pBits[Count],
163  &Val,
164  4);
165 
166  Count+=4;
167  }
168  }
169 
170  /* Set the new pixel bits */
172  hBitmap,
173  0,
174  bRes,
175  pBits,
176  &bi,
178 
180  0,
181  pBits);
182 
184  &rc);
185 
187  &rc,
188  FALSE);
189 
190  return TRUE;
191 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1471
DWORD biClrImportant
Definition: amvideo.idl:40
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define GetRValue(rgb)
Definition: wingdi.h:2930
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
int32_t INT
Definition: typedefs.h:56
#define GetGValue(rgb)
Definition: wingdi.h:2931
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD biCompression
Definition: amvideo.idl:35
#define b
Definition: ke_i.h:79
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
Definition: uimain.c:88
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define RGB(r, g, b)
Definition: wingdi.h:2935
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define CopyMemory
Definition: winbase.h:1633
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD biSizeImage
Definition: amvideo.idl:36
#define GetObject
Definition: wingdi.h:4463
HANDLE ProcessHeap
Definition: servman.c:15
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
Definition: bl.h:1331
int WINAPI GetDIBits(_In_ HDC hdc, _In_ HBITMAP hbm, _In_ UINT start, _In_ UINT cLines, _Out_opt_ LPVOID lpvBits, _At_((LPBITMAPINFOHEADER) lpbmi, _Inout_) LPBITMAPINFO lpbmi, _In_ UINT usage)
#define GetBValue(rgb)
Definition: wingdi.h:2932
static HBITMAP bitmap
Definition: clipboard.c:1344
#define DIB_RGB_COLORS
Definition: wingdi.h:366
int WINAPI SetDIBits(_In_opt_ HDC, _In_ HBITMAP, _In_ UINT, _In_ UINT, _In_ CONST VOID *, _In_ CONST BITMAPINFO *, _In_ UINT)
BYTE * PBYTE
Definition: pedump.c:66
#define BI_RGB
Definition: precomp.h:34
static HBITMAP hBitmap
Definition: timezone.c:35
#define HeapFree(x, y, z)
Definition: compat.h:394
HDC hdcMem
Definition: welcome.c:104

Referenced by MainWndCommand().

◆ DisplaySharpness()

BOOL DisplaySharpness ( HWND  hwnd,
HDC  hdcMem,
HBITMAP  hBitmap 
)

Definition at line 357 of file adjust.c.

360 {
361  BITMAPINFO bi;
362  BITMAP bitmap;
363  BOOL bRes;
364  DWORD Count = 0;
365  INT i, j;
366  PBYTE pBits, pBitsTemp;
367  RECT rc;
368 
370  sizeof(BITMAP),
371  &bitmap);
372 
373  /* Bitmap header */
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;
380  bi.bmiHeader.biSizeImage = bitmap.bmWidth * bitmap.bmHeight * 4;
381  bi.bmiHeader.biClrUsed = 0;
382  bi.bmiHeader.biClrImportant = 0;
383 
384  /* Buffer */
385  pBits = (PBYTE)HeapAlloc(ProcessHeap,
386  0,
387  bitmap.bmWidth * bitmap.bmHeight * 4);
388  pBitsTemp = (PBYTE)HeapAlloc(ProcessHeap,
389  0,
390  bitmap.bmWidth * bitmap.bmHeight * 4);
391  if (!pBits || !pBitsTemp)
392  return FALSE;
393 
394  /* get the bits from the original bitmap */
395  bRes = GetDIBits(hdcMem,
396  hBitmap,
397  0,
398  bitmap.bmHeight,
399  pBits,
400  &bi,
402 
403  for (i = 0; i < bitmap.bmHeight; i++)
404  {
405  for (j = 0; j < bitmap.bmWidth; j++)
406  {
407  LONG Val = 0;
408  INT b, g, r;
409  INT c1, c2, c3, c4, c5;
410 
411  CopyMemory(&Val,
412  &pBits[Count],
413  4);
414 
415  b = GetRValue(Val);
416  g = GetGValue(Val);
417  r = GetBValue(Val);
418 
419  c1 = r;
420  /* Red */
421  if ((Count < ((bitmap.bmHeight - 1) * bitmap.bmWidth * 4lu)) &&
422  (Count > (bitmap.bmWidth * 4lu)))
423  {
424  CopyMemory(&Val, &pBits[Count - (bitmap.bmWidth * 4l)], 4);
425  c2 = GetBValue(Val);
426 
427  CopyMemory(&Val, &pBits[Count + 4], 4);
428  c3 = GetBValue(Val);
429 
430  CopyMemory(&Val, &pBits[(Count + (bitmap.bmWidth * 4l))], 4);
431  c4 = GetBValue(Val);
432 
433  CopyMemory(&Val, &pBits[Count - 4], 4);
434  c5 = GetBValue(Val);
435 
436  r = (c1 * 5) - (c2 + c3 + c4 + c5);
437  }
438 
439  /* Green */
440  c1 = g;
441  if ((Count < ((bitmap.bmHeight - 1)* bitmap.bmWidth * 4lu)) &&
442  (Count > (bitmap.bmWidth * 4lu)))
443  {
444  CopyMemory(&Val, &pBits[(Count - (bitmap.bmWidth * 4l))], 4);
445  c2 = GetGValue(Val);
446 
447  CopyMemory(&Val, &pBits[Count + 4], 4);
448  c3 = GetGValue(Val);
449 
450  CopyMemory(&Val, &pBits[(Count + (bitmap.bmWidth * 4l))], 4);
451  c4 = GetGValue(Val);
452 
453  CopyMemory(&Val, &pBits[Count - 4], 4);
454  c5 = GetGValue(Val);
455 
456  g = (c1 * 5) - (c2 + c3 + c4 + c5);
457  }
458 
459  /* Blue */
460  c1 = b;
461  if ((Count < ((bitmap.bmHeight - 1) * bitmap.bmWidth * 4lu)) &&
462  (Count > (bitmap.bmWidth * 4lu)))
463  {
464  CopyMemory(&Val, &pBits[(Count - (bitmap.bmWidth * 4l))], 4);
465  c2 = GetRValue(Val);
466 
467  CopyMemory(&Val, &pBits[Count + 4], 4);
468  c3 = GetRValue(Val);
469 
470  CopyMemory(&Val, &pBits[(Count+(bitmap.bmWidth * 4l))], 4);
471  c4 = GetRValue(Val);
472 
473  CopyMemory(&Val, &pBits[Count - 4], 4);
474  c5 = GetRValue(Val);
475 
476  b = (c1 * 5) - (c2 + c3 + c4 + c5);
477  }
478 
479  /* Red */
480  if (r > 255) r = 255;
481  if (r < 0) r = 0;
482 
483  /* Green */
484  if (g > 255) g = 255;
485  if (g < 0)g = 0;
486 
487  /* Blue */
488  if (b > 255) b = 255;
489  if (b < 0) b = 0;
490 
491  Val = RGB(b, g, r);
492 
493  CopyMemory(&pBitsTemp[Count],
494  &Val,
495  4);
496 
497  Count+=4;
498  }
499  }
500 
501  /* Set the new pixel bits */
503  hBitmap,
504  0,
505  bRes,
506  pBitsTemp,
507  &bi,
509 
511  0,
512  pBits);
514  0,
515  pBitsTemp);
516 
518  &rc);
519 
521  &rc,
522  FALSE);
523 
524  return TRUE;
525 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1471
DWORD biClrImportant
Definition: amvideo.idl:40
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define GetRValue(rgb)
Definition: wingdi.h:2930
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
int32_t INT
Definition: typedefs.h:56
#define GetGValue(rgb)
Definition: wingdi.h:2931
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
DWORD biCompression
Definition: amvideo.idl:35
#define b
Definition: ke_i.h:79
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
r l[0]
Definition: byte_order.h:167
Definition: uimain.c:88
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define RGB(r, g, b)
Definition: wingdi.h:2935
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define CopyMemory
Definition: winbase.h:1633
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD biSizeImage
Definition: amvideo.idl:36
#define GetObject
Definition: wingdi.h:4463
HANDLE ProcessHeap
Definition: servman.c:15
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
Definition: bl.h:1331
int WINAPI GetDIBits(_In_ HDC hdc, _In_ HBITMAP hbm, _In_ UINT start, _In_ UINT cLines, _Out_opt_ LPVOID lpvBits, _At_((LPBITMAPINFOHEADER) lpbmi, _Inout_) LPBITMAPINFO lpbmi, _In_ UINT usage)
#define GetBValue(rgb)
Definition: wingdi.h:2932
static HBITMAP bitmap
Definition: clipboard.c:1344
#define DIB_RGB_COLORS
Definition: wingdi.h:366
int WINAPI SetDIBits(_In_opt_ HDC, _In_ HBITMAP, _In_ UINT, _In_ UINT, _In_ CONST VOID *, _In_ CONST BITMAPINFO *, _In_ UINT)
BYTE * PBYTE
Definition: pedump.c:66
#define BI_RGB
Definition: precomp.h:34
static HBITMAP hBitmap
Definition: timezone.c:35
#define HeapFree(x, y, z)
Definition: compat.h:394
HDC hdcMem
Definition: welcome.c:104

Referenced by MainWndCommand().

◆ ImagePropDialogProc()

INT_PTR CALLBACK ImagePropDialogProc ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)