ReactOS  0.4.13-dev-551-gf37fb1f
brightness.c File Reference
#include "precomp.h"
Include dependency graph for brightness.c:

Go to the source code of this file.

Macros

#define BASECOLOUR   100
 

Functions

VOID AdjustBrightness (HBITMAP hOrigBitmap, HBITMAP hNewBitmap, HWND hwnd, HDC hdcMem, INT RedVal, INT GreenVal, INT BlueVal)
 
static PIMAGEADJUST Bri_OnInitDialog (PIMAGEADJUST pImgAdj, HWND hDlg, LPARAM lParam)
 
static VOID Bri_OnDrawItem (PIMAGEADJUST pImgAdj, LPARAM lParam)
 
static VOID Bri_OnTrackBar (PIMAGEADJUST pImgAdj, HWND hDlg)
 
static BOOL Bri_OnCommand (PIMAGEADJUST pImgAdj, HWND hDlg, UINT uID)
 
INT_PTR CALLBACK BrightnessProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 

Macro Definition Documentation

◆ BASECOLOUR

#define BASECOLOUR   100

Definition at line 3 of file brightness.c.

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:1454
DWORD biClrImportant
Definition: amvideo.idl:40
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define GetRValue(rgb)
Definition: wingdi.h:2913
_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:2914
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:2918
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:4446
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:2915
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().

◆ Bri_OnCommand()

static BOOL Bri_OnCommand ( PIMAGEADJUST  pImgAdj,
HWND  hDlg,
UINT  uID 
)
static

Definition at line 271 of file brightness.c.

274 {
275  switch (uID)
276  {
277  case IDOK:
278  {
279  HDC hdcMem;
280 
281  hdcMem = GetDC(pImgAdj->Info->ImageEditors->hSelf);
282 
284  pImgAdj->Info->ImageEditors->hBitmap,
285  pImgAdj->Info->ImageEditors->hSelf,
286  hdcMem,
287  pImgAdj->RedVal,
288  pImgAdj->GreenVal,
289  pImgAdj->BlueVal);
290 
291  ReleaseDC(pImgAdj->Info->ImageEditors->hSelf,
292  hdcMem);
293 
294  EndDialog(hDlg,
295  uID);
296 
297  return TRUE;
298  }
299 
300  case IDCANCEL:
301  {
302  EndDialog(hDlg,
303  uID);
304  return TRUE;
305  }
306  }
307 
308  return FALSE;
309 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
VOID AdjustBrightness(HBITMAP hOrigBitmap, HBITMAP hNewBitmap, HWND hwnd, HDC hdcMem, INT RedVal, INT GreenVal, INT BlueVal)
Definition: brightness.c:7
PMAIN_WND_INFO Info
Definition: imageprop.h:4
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HBITMAP hBitmap
Definition: imgedwnd.h:67
INT GreenVal
Definition: imageprop.h:10
INT RedVal
Definition: imageprop.h:9
#define IDCANCEL
Definition: winuser.h:825
PEDIT_WND_INFO ImageEditors
Definition: mainwnd.h:22
HDC hdcMem
Definition: welcome.c:104

Referenced by BrightnessProc().

◆ Bri_OnDrawItem()

static VOID Bri_OnDrawItem ( PIMAGEADJUST  pImgAdj,
LPARAM  lParam 
)
static

Definition at line 191 of file brightness.c.

193 {
194  LPDRAWITEMSTRUCT lpDrawItem;
195  HDC hdcMem;
196 
197  lpDrawItem = (LPDRAWITEMSTRUCT)lParam;
198 
199  hdcMem = CreateCompatibleDC(lpDrawItem->hDC);
200 
201  if(lpDrawItem->CtlID == IDC_PICPREVIEW)
202  {
204  pImgAdj->hPreviewBitmap);
205 
206  BitBlt(lpDrawItem->hDC,
207  pImgAdj->ImageRect.left,
208  pImgAdj->ImageRect.top,
209  pImgAdj->ImageRect.right,
210  pImgAdj->ImageRect.bottom,
211  hdcMem,
212  0,
213  0,
214  SRCCOPY);
215 
216  DeleteDC(hdcMem);
217  }
218 }
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:292
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
RECT ImageRect
Definition: imageprop.h:8
#define IDC_PICPREVIEW
Definition: resource.h:251
BOOL WINAPI DeleteDC(_In_ HDC)
HBITMAP hPreviewBitmap
Definition: imageprop.h:7
LONG bottom
Definition: windef.h:294
LPARAM lParam
Definition: combotst.c:139
#define SRCCOPY
Definition: wingdi.h:332
HDC hdcMem
Definition: welcome.c:104

Referenced by BrightnessProc().

◆ Bri_OnInitDialog()

static PIMAGEADJUST Bri_OnInitDialog ( PIMAGEADJUST  pImgAdj,
HWND  hDlg,
LPARAM  lParam 
)
static

Definition at line 119 of file brightness.c.

122 {
123  pImgAdj = (IMAGEADJUST*) HeapAlloc(ProcessHeap,
124  0,
125  sizeof(IMAGEADJUST));
126  if (!pImgAdj)
127  return NULL;
128 
129 
130  pImgAdj->Info = (PMAIN_WND_INFO)lParam;
131  if (!pImgAdj->Info->ImageEditors)
132  goto fail;
133 
134 
135  pImgAdj->hPicPrev = GetDlgItem(hDlg, IDC_PICPREVIEW);
136  GetClientRect(pImgAdj->hPicPrev,
137  &pImgAdj->ImageRect);
138 
139  /* Make a static copy of the main image */
140  pImgAdj->hBitmap = (HBITMAP) CopyImage(pImgAdj->Info->ImageEditors->hBitmap,
141  IMAGE_BITMAP,
142  pImgAdj->ImageRect.right,
143  pImgAdj->ImageRect.bottom,
145  if (!pImgAdj->hBitmap)
146  goto fail;
147 
148  /* Make a copy which will be updated */
149  pImgAdj->hPreviewBitmap = (HBITMAP) CopyImage(pImgAdj->Info->ImageEditors->hBitmap,
150  IMAGE_BITMAP,
151  pImgAdj->ImageRect.right,
152  pImgAdj->ImageRect.bottom,
154  if (!pImgAdj->hPreviewBitmap)
155  goto fail;
156 
157 
158  pImgAdj->RedVal = pImgAdj->BlueVal = pImgAdj->GreenVal = 0;
159 
160  /* setup dialog */
161  SendDlgItemMessage(hDlg,
162  IDC_BRI_FULL,
163  BM_SETCHECK,
164  BST_CHECKED,
165  0);
166  SendDlgItemMessage(hDlg,
168  TBM_SETRANGE,
169  TRUE,
170  (LPARAM)MAKELONG(0, 200));
171  SendDlgItemMessage(hDlg,
173  TBM_SETPOS,
174  TRUE,
175  (LPARAM)BASECOLOUR);
176  SetDlgItemText(hDlg,
177  IDC_BRI_EDIT,
178  _T("100"));
179 
180  return pImgAdj;
181 
182 fail:
184  0,
185  pImgAdj);
186  return NULL;
187 }
#define TRUE
Definition: types.h:120
#define TBM_SETRANGE
Definition: commctrl.h:2009
#define IDC_BRI_FULL
Definition: resource.h:256
#define TBM_SETPOS
Definition: commctrl.h:2008
#define SendDlgItemMessage
Definition: winuser.h:5708
LONG right
Definition: windef.h:293
HWND hPicPrev
Definition: imageprop.h:5
RECT ImageRect
Definition: imageprop.h:8
PMAIN_WND_INFO Info
Definition: imageprop.h:4
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:1956
#define MAKELONG(a, b)
Definition: typedefs.h:248
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define BM_SETCHECK
Definition: winuser.h:1882
#define _T(x)
Definition: vfdio.h:22
#define BASECOLOUR
Definition: brightness.c:3
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
struct _MAIN_WND_INFO * PMAIN_WND_INFO
#define SetDlgItemText
Definition: winuser.h:5715
#define IDC_PICPREVIEW
Definition: resource.h:251
HBITMAP hBitmap
Definition: imgedwnd.h:67
HANDLE ProcessHeap
Definition: servman.c:15
#define IDC_BRI_TRACKBAR
Definition: resource.h:261
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define IDC_BRI_EDIT
Definition: resource.h:260
#define LR_CREATEDIBSECTION
Definition: winuser.h:1088
HBITMAP hPreviewBitmap
Definition: imageprop.h:7
INT GreenVal
Definition: imageprop.h:10
#define IMAGE_BITMAP
Definition: winuser.h:211
INT RedVal
Definition: imageprop.h:9
#define BST_CHECKED
Definition: winuser.h:197
LONG bottom
Definition: windef.h:294
static HBITMAP
Definition: button.c:44
LPARAM lParam
Definition: combotst.c:139
PEDIT_WND_INFO ImageEditors
Definition: mainwnd.h:22
#define HeapFree(x, y, z)
Definition: compat.h:394
HBITMAP hBitmap
Definition: imageprop.h:6

Referenced by BrightnessProc().

◆ Bri_OnTrackBar()

static VOID Bri_OnTrackBar ( PIMAGEADJUST  pImgAdj,
HWND  hDlg 
)
static

Definition at line 222 of file brightness.c.

224 {
225  HDC hdcMem;
226  DWORD TrackPos;
227 
228  TrackPos = (DWORD)SendDlgItemMessage(hDlg,
230  TBM_GETPOS,
231  0,
232  0);
233 
234  SetDlgItemInt(hDlg,
235  IDC_BRI_EDIT,
236  TrackPos,
237  FALSE);
238 
240  {
241  pImgAdj->RedVal = pImgAdj->GreenVal = pImgAdj->BlueVal = TrackPos - BASECOLOUR;
242  }
243  else if (IsDlgButtonChecked(hDlg, IDC_BRI_RED) == BST_CHECKED)
244  {
245  pImgAdj->RedVal = TrackPos - BASECOLOUR;
246  }
247  else if (IsDlgButtonChecked(hDlg, IDC_BRI_GREEN) == BST_CHECKED)
248  {
249  pImgAdj->GreenVal = TrackPos - BASECOLOUR;
250  }
251  else if (IsDlgButtonChecked(hDlg, IDC_BRI_BLUE) == BST_CHECKED)
252  {
253  pImgAdj->BlueVal = TrackPos - BASECOLOUR;
254  }
255 
256  hdcMem = GetDC(pImgAdj->hPicPrev);
257 
258  AdjustBrightness(pImgAdj->hBitmap,
259  pImgAdj->hPreviewBitmap,
260  pImgAdj->hPicPrev,
261  hdcMem,
262  pImgAdj->RedVal,
263  pImgAdj->GreenVal,
264  pImgAdj->BlueVal);
265 
266  ReleaseDC(pImgAdj->hPicPrev, hdcMem);
267 }
#define IDC_BRI_GREEN
Definition: resource.h:258
HDC WINAPI GetDC(_In_opt_ HWND)
#define IDC_BRI_RED
Definition: resource.h:257
static HDC
Definition: imagelist.c:92
#define IDC_BRI_FULL
Definition: resource.h:256
#define SendDlgItemMessage
Definition: winuser.h:5708
#define DWORD
Definition: nt_native.h:44
HWND hPicPrev
Definition: imageprop.h:5
VOID AdjustBrightness(HBITMAP hOrigBitmap, HBITMAP hNewBitmap, HWND hwnd, HDC hdcMem, INT RedVal, INT GreenVal, INT BlueVal)
Definition: brightness.c:7
#define TBM_GETPOS
Definition: commctrl.h:2003
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define IDC_BRI_BLUE
Definition: resource.h:259
#define BASECOLOUR
Definition: brightness.c:3
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
#define IDC_BRI_TRACKBAR
Definition: resource.h:261
#define IDC_BRI_EDIT
Definition: resource.h:260
HBITMAP hPreviewBitmap
Definition: imageprop.h:7
INT GreenVal
Definition: imageprop.h:10
INT RedVal
Definition: imageprop.h:9
#define BST_CHECKED
Definition: winuser.h:197
HBITMAP hBitmap
Definition: imageprop.h:6
HDC hdcMem
Definition: welcome.c:104

Referenced by BrightnessProc().

◆ 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:1716
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:1719
#define WM_DRAWITEM
Definition: winuser.h:1627
#define WM_INITDIALOG
Definition: winuser.h:1715
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().