1
0

r_bright.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. /*
  2. LICENSE
  3. -------
  4. Copyright 2005 Nullsoft, Inc.
  5. All rights reserved.
  6. Redistribution and use in source and binary forms, with or without modification,
  7. are permitted provided that the following conditions are met:
  8. * Redistributions of source code must retain the above copyright notice,
  9. this list of conditions and the following disclaimer.
  10. * Redistributions in binary form must reproduce the above copyright notice,
  11. this list of conditions and the following disclaimer in the documentation
  12. and/or other materials provided with the distribution.
  13. * Neither the name of Nullsoft nor the names of its contributors may be used to
  14. endorse or promote products derived from this software without specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  16. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  17. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  18. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  19. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  20. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  21. IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. */
  24. #include <windows.h>
  25. #include <stdlib.h>
  26. #include <vfw.h>
  27. #include <commctrl.h>
  28. #include <math.h>
  29. #include "resource.h"
  30. #include "r_defs.h"
  31. #include "../Agave/Language/api_language.h"
  32. #ifndef LASER
  33. #define MOD_NAME "Trans / Brightness"
  34. #define C_THISCLASS C_BrightnessClass
  35. class C_THISCLASS : public C_RBASE2 {
  36. protected:
  37. public:
  38. C_THISCLASS();
  39. virtual ~C_THISCLASS();
  40. virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h);
  41. virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_BRIGHTNESS,desc,128):desc); }
  42. virtual HWND conf(HINSTANCE hInstance, HWND hwndParent);
  43. virtual void load_config(unsigned char *data, int len);
  44. virtual int save_config(unsigned char *data);
  45. virtual int smp_getflags() { return 1; }
  46. virtual int smp_begin(int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h);
  47. virtual void smp_render(int this_thread, int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h);
  48. virtual int smp_finish(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); // return value is that of render() for fbstuff etc
  49. int enabled;
  50. int redp, greenp, bluep;
  51. int blend, blendavg;
  52. int dissoc;
  53. int color;
  54. int exclude;
  55. int distance;
  56. int tabs_needinit;
  57. int green_tab[256];
  58. int red_tab[256];
  59. int blue_tab[256];
  60. };
  61. static C_THISCLASS *g_ConfigThis; // global configuration dialog pointer
  62. static HINSTANCE g_hDllInstance; // global DLL instance pointer (not needed in this example, but could be useful)
  63. C_THISCLASS::~C_THISCLASS()
  64. {
  65. }
  66. // configuration read/write
  67. C_THISCLASS::C_THISCLASS() // set up default configuration
  68. {
  69. tabs_needinit=1;
  70. redp=0;
  71. bluep=0;
  72. greenp=0;
  73. blend=0;
  74. blendavg=1;
  75. enabled=1;
  76. color=0;
  77. exclude=0;
  78. distance = 16;
  79. dissoc=0;
  80. }
  81. #define GET_INT() (data[pos]|(data[pos+1]<<8)|(data[pos+2]<<16)|(data[pos+3]<<24))
  82. void C_THISCLASS::load_config(unsigned char *data, int len) // read configuration of max length "len" from data.
  83. {
  84. int pos=0;
  85. if (len-pos >= 4) { enabled=GET_INT(); pos+=4; }
  86. if (len-pos >= 4) { blend=GET_INT(); pos+=4; }
  87. if (len-pos >= 4) { blendavg=GET_INT(); pos+=4; }
  88. if (len-pos >= 4) { redp=GET_INT(); pos+=4; }
  89. if (len-pos >= 4) { greenp=GET_INT(); pos+=4; }
  90. if (len-pos >= 4) { bluep=GET_INT(); pos+=4; }
  91. if (len-pos >= 4) { dissoc=GET_INT(); pos+=4; }
  92. if (len-pos >= 4) { color=GET_INT(); pos+=4; }
  93. if (len-pos >= 4) { exclude=GET_INT(); pos+=4; }
  94. if (len-pos >= 4) { distance=GET_INT(); pos+=4; }
  95. tabs_needinit=1;
  96. }
  97. #define PUT_INT(y) data[pos]=(y)&255; data[pos+1]=(y>>8)&255; data[pos+2]=(y>>16)&255; data[pos+3]=(y>>24)&255
  98. int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k.
  99. {
  100. int pos=0;
  101. PUT_INT(enabled); pos+=4;
  102. PUT_INT(blend); pos+=4;
  103. PUT_INT(blendavg); pos+=4;
  104. PUT_INT(redp); pos+=4;
  105. PUT_INT(greenp); pos+=4;
  106. PUT_INT(bluep); pos+=4;
  107. PUT_INT(dissoc); pos+=4;
  108. PUT_INT(color); pos+=4;
  109. PUT_INT(exclude); pos+=4;
  110. PUT_INT(distance); pos+=4;
  111. return pos;
  112. }
  113. static __inline int iabs(int v)
  114. {
  115. return (v<0) ? -v : v;
  116. }
  117. static __inline int inRange(int color, int ref, int distance)
  118. {
  119. if (iabs((color & 0xFF) - (ref & 0xFF)) > distance) return 0;
  120. if (iabs(((color) & 0xFF00) - ((ref) & 0xFF00)) > (distance<<8)) return 0;
  121. if (iabs(((color) & 0xFF0000) - ((ref) & 0xFF0000)) > (distance<<16)) return 0;
  122. return 1;
  123. }
  124. static void mmx_brighten_block(int *p, int rm, int gm, int bm, int l)
  125. {
  126. int poo[2]=
  127. {
  128. (bm>>8)|((gm>>8)<<16),
  129. rm>>8
  130. };
  131. __asm
  132. {
  133. mov eax, p
  134. mov ecx, l
  135. movq mm1, [poo]
  136. align 16
  137. mmx_brightblock_loop:
  138. pxor mm0, mm0
  139. punpcklbw mm0, [eax]
  140. pmulhw mm0, mm1
  141. packuswb mm0, mm0
  142. movd [eax], mm0
  143. add eax, 4
  144. dec ecx
  145. jnz mmx_brightblock_loop
  146. emms
  147. };
  148. }
  149. int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h)
  150. {
  151. smp_begin(1,visdata,isBeat,framebuffer,fbout,w,h);
  152. if (isBeat & 0x80000000) return 0;
  153. smp_render(0,1,visdata,isBeat,framebuffer,fbout,w,h);
  154. return smp_finish(visdata,isBeat,framebuffer,fbout,w,h);
  155. }
  156. int C_THISCLASS::smp_begin(int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h)
  157. {
  158. int rm=(int)((1+(redp < 0 ? 1 : 16)*((float)redp/4096))*65536.0);
  159. int gm=(int)((1+(greenp < 0 ? 1 : 16)*((float)greenp/4096))*65536.0);
  160. int bm=(int)((1+(bluep < 0 ? 1 : 16)*((float)bluep/4096))*65536.0);
  161. if (!enabled) return 0;
  162. if (tabs_needinit)
  163. {
  164. int n;
  165. for (n = 0; n < 256; n ++)
  166. {
  167. red_tab[n] = (n*rm)&0xffff0000;
  168. if (red_tab[n]>0xff0000) red_tab[n]=0xff0000;
  169. if (red_tab[n]<0) red_tab[n]=0;
  170. green_tab[n] = ((n*gm)>>8)&0xffff00;
  171. if (green_tab[n]>0xff00) green_tab[n]=0xff00;
  172. if (green_tab[n]<0) green_tab[n]=0;
  173. blue_tab[n] = ((n*bm)>>16)&0xffff;
  174. if (blue_tab[n]>0xff) blue_tab[n]=0xff;
  175. if (blue_tab[n]<0) blue_tab[n]=0;
  176. }
  177. tabs_needinit=0;
  178. }
  179. if (isBeat&0x80000000) return 0;
  180. return max_threads;
  181. }
  182. int C_THISCLASS::smp_finish(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) // return value is that of render() for fbstuff etc
  183. {
  184. return 0;
  185. }
  186. // render function
  187. // render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is
  188. // used when you want to do something that you'd otherwise need to make a copy of the framebuffer.
  189. // w and h are the width and height of the screen, in pixels.
  190. // isBeat is 1 if a beat has been detected.
  191. // visdata is in the format of [spectrum:0,wave:1][channel][band].
  192. void C_THISCLASS::smp_render(int this_thread, int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h)
  193. {
  194. if (!enabled || (isBeat&0x80000000)) return;
  195. if (max_threads < 1) max_threads=1;
  196. int start_l = ( this_thread * h ) / max_threads;
  197. int end_l;
  198. if (this_thread >= max_threads - 1) end_l = h;
  199. else end_l = ( (this_thread+1) * h ) / max_threads;
  200. int outh=end_l-start_l;
  201. if (outh<1) return;
  202. int l=w*outh;
  203. int *p = framebuffer + start_l * w;
  204. if (blend)
  205. {
  206. if (!exclude)
  207. {
  208. while (l--)
  209. {
  210. int pix=*p;
  211. *p++ = BLEND(pix, red_tab[(pix>>16)&0xff] | green_tab[(pix>>8)&0xff] | blue_tab[pix&0xff]);
  212. }
  213. }
  214. else
  215. {
  216. while (l--)
  217. {
  218. int pix=*p;
  219. if (!inRange(pix,color,distance))
  220. {
  221. *p = BLEND(pix, red_tab[(pix>>16)&0xff] | green_tab[(pix>>8)&0xff] | blue_tab[pix&0xff]);
  222. }
  223. p++;
  224. }
  225. }
  226. }
  227. else if (blendavg)
  228. {
  229. if (!exclude)
  230. {
  231. while (l--)
  232. {
  233. int pix=*p;
  234. *p++ = BLEND_AVG(pix, red_tab[(pix>>16)&0xff] | green_tab[(pix>>8)&0xff] | blue_tab[pix&0xff]);
  235. }
  236. }
  237. else
  238. {
  239. while (l--)
  240. {
  241. int pix=*p;
  242. if (!inRange(pix,color,distance))
  243. {
  244. *p = BLEND_AVG(pix, red_tab[(pix>>16)&0xff] | green_tab[(pix>>8)&0xff] | blue_tab[pix&0xff]);
  245. }
  246. p++;
  247. }
  248. }
  249. }
  250. else
  251. {
  252. if (!exclude)
  253. {
  254. #if 1 // def NO_MMX
  255. while (l--)
  256. {
  257. int pix=*p;
  258. *p++ = red_tab[(pix>>16)&0xff] | green_tab[(pix>>8)&0xff] | blue_tab[pix&0xff];
  259. }
  260. #else
  261. mmx_brighten_block(p,rm,gm,bm,l);
  262. #endif
  263. }
  264. else
  265. {
  266. while (l--)
  267. {
  268. int pix=*p;
  269. if (!inRange(pix,color,distance))
  270. {
  271. *p = red_tab[(pix>>16)&0xff] | green_tab[(pix>>8)&0xff] | blue_tab[pix&0xff];
  272. }
  273. p++;
  274. }
  275. }
  276. }
  277. }
  278. // configuration dialog stuff
  279. static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam)
  280. {
  281. switch (uMsg)
  282. {
  283. case WM_INITDIALOG:
  284. SendDlgItemMessage(hwndDlg, IDC_RED, TBM_SETRANGEMIN, TRUE, 0);
  285. SendDlgItemMessage(hwndDlg, IDC_GREEN, TBM_SETRANGEMIN, TRUE, 0);
  286. SendDlgItemMessage(hwndDlg, IDC_BLUE, TBM_SETRANGEMIN, TRUE, 0);
  287. SendDlgItemMessage(hwndDlg, IDC_RED, TBM_SETRANGEMAX, TRUE, 8192);
  288. SendDlgItemMessage(hwndDlg, IDC_GREEN, TBM_SETRANGEMAX, TRUE, 8192);
  289. SendDlgItemMessage(hwndDlg, IDC_BLUE, TBM_SETRANGEMAX, TRUE, 8192);
  290. SendDlgItemMessage(hwndDlg, IDC_RED, TBM_SETTICFREQ, 256, 0);
  291. SendDlgItemMessage(hwndDlg, IDC_GREEN, TBM_SETTICFREQ, 256, 0);
  292. SendDlgItemMessage(hwndDlg, IDC_BLUE, TBM_SETTICFREQ, 256, 0);
  293. SendDlgItemMessage(hwndDlg, IDC_RED, TBM_SETPOS, TRUE, g_ConfigThis->redp+4096);
  294. SendDlgItemMessage(hwndDlg, IDC_GREEN, TBM_SETPOS, TRUE, g_ConfigThis->greenp+4096);
  295. SendDlgItemMessage(hwndDlg, IDC_BLUE, TBM_SETPOS, TRUE, g_ConfigThis->bluep+4096);
  296. SendDlgItemMessage(hwndDlg, IDC_DISTANCE, TBM_SETRANGE, TRUE, MAKELONG(0, 255));
  297. SendDlgItemMessage(hwndDlg, IDC_DISTANCE, TBM_SETPOS, TRUE, g_ConfigThis->distance);
  298. SendDlgItemMessage(hwndDlg, IDC_DISTANCE, TBM_SETTICFREQ, 16, 0);
  299. if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED);
  300. if (g_ConfigThis->exclude) CheckDlgButton(hwndDlg,IDC_EXCLUDE,BST_CHECKED);
  301. if (g_ConfigThis->blend) CheckDlgButton(hwndDlg,IDC_ADDITIVE,BST_CHECKED);
  302. if (g_ConfigThis->blendavg) CheckDlgButton(hwndDlg,IDC_5050,BST_CHECKED);
  303. if (g_ConfigThis->dissoc) CheckDlgButton(hwndDlg,IDC_DISSOC,BST_CHECKED);
  304. if (!g_ConfigThis->blend && !g_ConfigThis->blendavg)
  305. CheckDlgButton(hwndDlg,IDC_REPLACE,BST_CHECKED);
  306. return 1;
  307. case WM_NOTIFY:
  308. {
  309. if (LOWORD(wParam) == IDC_DISTANCE)
  310. {
  311. g_ConfigThis->distance = SendDlgItemMessage(hwndDlg, IDC_DISTANCE, TBM_GETPOS, 0, 0);
  312. }
  313. if (LOWORD(wParam) == IDC_RED)
  314. {
  315. g_ConfigThis->redp = SendDlgItemMessage(hwndDlg, IDC_RED, TBM_GETPOS, 0, 0)-4096;
  316. rred:
  317. g_ConfigThis->tabs_needinit=1;
  318. if (!g_ConfigThis->dissoc)
  319. {
  320. g_ConfigThis->greenp = g_ConfigThis->redp;
  321. SendDlgItemMessage(hwndDlg, IDC_GREEN, TBM_SETPOS, TRUE, g_ConfigThis->greenp+4096);
  322. g_ConfigThis->bluep = g_ConfigThis->redp;
  323. SendDlgItemMessage(hwndDlg, IDC_BLUE, TBM_SETPOS, TRUE, g_ConfigThis->bluep+4096);
  324. }
  325. }
  326. if (LOWORD(wParam) == IDC_GREEN)
  327. {
  328. g_ConfigThis->greenp = SendDlgItemMessage(hwndDlg, IDC_GREEN, TBM_GETPOS, 0, 0)-4096;
  329. rgreen:
  330. g_ConfigThis->tabs_needinit=1;
  331. if (!g_ConfigThis->dissoc)
  332. {
  333. g_ConfigThis->redp = g_ConfigThis->greenp;
  334. SendDlgItemMessage(hwndDlg, IDC_RED, TBM_SETPOS, TRUE, g_ConfigThis->redp+4096);
  335. g_ConfigThis->bluep = g_ConfigThis->greenp;
  336. SendDlgItemMessage(hwndDlg, IDC_BLUE, TBM_SETPOS, TRUE, g_ConfigThis->bluep+4096);
  337. }
  338. }
  339. if (LOWORD(wParam) == IDC_BLUE)
  340. {
  341. g_ConfigThis->bluep = SendDlgItemMessage(hwndDlg, IDC_BLUE, TBM_GETPOS, 0, 0)-4096;
  342. rblue:
  343. g_ConfigThis->tabs_needinit=1;
  344. if (!g_ConfigThis->dissoc)
  345. {
  346. g_ConfigThis->redp = g_ConfigThis->bluep;
  347. SendDlgItemMessage(hwndDlg, IDC_RED, TBM_SETPOS, TRUE, g_ConfigThis->redp+4096);
  348. g_ConfigThis->greenp = g_ConfigThis->bluep;
  349. SendDlgItemMessage(hwndDlg, IDC_GREEN, TBM_SETPOS, TRUE, g_ConfigThis->greenp+4096);
  350. }
  351. }
  352. return 0;
  353. }
  354. case WM_COMMAND:
  355. if (LOWORD(wParam) == IDC_DEFCOL) // handle clicks to nifty color button
  356. {
  357. int *a=&(g_ConfigThis->color);
  358. static COLORREF custcolors[16];
  359. CHOOSECOLOR cs;
  360. cs.lStructSize = sizeof(cs);
  361. cs.hwndOwner = hwndDlg;
  362. cs.hInstance = 0;
  363. cs.rgbResult=((*a>>16)&0xff)|(*a&0xff00)|((*a<<16)&0xff0000);
  364. cs.lpCustColors = custcolors;
  365. cs.Flags = CC_RGBINIT|CC_FULLOPEN;
  366. if (ChooseColor(&cs))
  367. {
  368. *a = ((cs.rgbResult>>16)&0xff)|(cs.rgbResult&0xff00)|((cs.rgbResult<<16)&0xff0000);
  369. g_ConfigThis->color = *a;
  370. }
  371. InvalidateRect(GetDlgItem(hwndDlg,IDC_DEFCOL),NULL,TRUE);
  372. }
  373. if (LOWORD(wParam) == IDC_BRED)
  374. {
  375. g_ConfigThis->redp = 0;
  376. SendDlgItemMessage(hwndDlg, IDC_RED, TBM_SETPOS, TRUE, g_ConfigThis->redp+4096);
  377. goto rred; // gotos are so sweet ;)
  378. }
  379. if (LOWORD(wParam) == IDC_BGREEN)
  380. {
  381. g_ConfigThis->greenp = 0;
  382. SendDlgItemMessage(hwndDlg, IDC_GREEN, TBM_SETPOS, TRUE, g_ConfigThis->greenp+4096);
  383. goto rgreen;
  384. }
  385. if (LOWORD(wParam) == IDC_BBLUE)
  386. {
  387. g_ConfigThis->bluep = 0;
  388. SendDlgItemMessage(hwndDlg, IDC_BLUE, TBM_SETPOS, TRUE, g_ConfigThis->bluep+4096);
  389. goto rblue;
  390. }
  391. if ((LOWORD(wParam) == IDC_CHECK1) ||
  392. (LOWORD(wParam) == IDC_ADDITIVE) ||
  393. (LOWORD(wParam) == IDC_REPLACE) ||
  394. (LOWORD(wParam) == IDC_EXCLUDE) ||
  395. (LOWORD(wParam) == IDC_DISSOC) ||
  396. (LOWORD(wParam) == IDC_5050) )
  397. {
  398. g_ConfigThis->enabled=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0;
  399. g_ConfigThis->exclude=IsDlgButtonChecked(hwndDlg,IDC_EXCLUDE)?1:0;
  400. g_ConfigThis->blend=IsDlgButtonChecked(hwndDlg,IDC_ADDITIVE)?1:0;
  401. g_ConfigThis->blendavg=IsDlgButtonChecked(hwndDlg,IDC_5050)?1:0;
  402. g_ConfigThis->dissoc=IsDlgButtonChecked(hwndDlg,IDC_DISSOC)?1:0;
  403. if (!g_ConfigThis->dissoc)
  404. {
  405. g_ConfigThis->greenp = g_ConfigThis->redp;
  406. SendDlgItemMessage(hwndDlg, IDC_GREEN, TBM_SETPOS, TRUE, g_ConfigThis->greenp+4096);
  407. g_ConfigThis->bluep = g_ConfigThis->redp;
  408. SendDlgItemMessage(hwndDlg, IDC_BLUE, TBM_SETPOS, TRUE, g_ConfigThis->bluep+4096);
  409. }
  410. }
  411. return 0;
  412. case WM_DRAWITEM:
  413. {
  414. DRAWITEMSTRUCT *di=(DRAWITEMSTRUCT *)lParam;
  415. if (di->CtlID == IDC_DEFCOL) // paint nifty color button
  416. {
  417. int w=di->rcItem.right-di->rcItem.left;
  418. int _color=g_ConfigThis->color;
  419. _color = ((_color>>16)&0xff)|(_color&0xff00)|((_color<<16)&0xff0000);
  420. HPEN hPen,hOldPen;
  421. HBRUSH hBrush,hOldBrush;
  422. LOGBRUSH lb={ (COLORREF)BS_SOLID,(COLORREF)_color,(COLORREF)0};
  423. hPen = (HPEN)CreatePen(PS_SOLID,0,_color);
  424. hBrush = CreateBrushIndirect(&lb);
  425. hOldPen=(HPEN)SelectObject(di->hDC,hPen);
  426. hOldBrush=(HBRUSH)SelectObject(di->hDC,hBrush);
  427. Rectangle(di->hDC,di->rcItem.left,di->rcItem.top,di->rcItem.right,di->rcItem.bottom);
  428. SelectObject(di->hDC,hOldPen);
  429. SelectObject(di->hDC,hOldBrush);
  430. DeleteObject(hBrush);
  431. DeleteObject(hPen);
  432. }
  433. }
  434. return 0;
  435. }
  436. return 0;
  437. }
  438. HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible
  439. {
  440. g_ConfigThis = this;
  441. return WASABI_API_CREATEDIALOG(IDD_CFG_BRIGHTNESS,hwndParent,g_DlgProc);
  442. }
  443. // export stuff
  444. C_RBASE *R_Brightness(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description
  445. {
  446. if (desc) { strcpy(desc,MOD_NAME); return NULL; }
  447. return (C_RBASE *) new C_THISCLASS();
  448. }
  449. #else
  450. C_RBASE *R_Brightness(char *desc) { return NULL; }
  451. #endif