Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

wmicon.c File Reference

#include "precomp.h"

Go to the source code of this file.

Defines

#define SetBestStretchMode(hdc, bpp, fHT)
#define GetCWidth(cxOrg, lrF, cxDes)   (cxOrg ? cxOrg : ((lrF & DI_DEFAULTSIZE) ? SYSMET(CXICON) : cxDes))
#define GetCHeight(cyOrg, lrF, cyDes)   (cyOrg ? cyOrg : ((lrF & DI_DEFAULTSIZE) ? SYSMET(CYICON) : cyDes))

Functions

BOOL BltIcon (HDC hdc, int x, int y, int cx, int cy, HDC hdcSrc, PCURSOR pcur, BOOL fMask, LONG rop)
BOOL _DrawIconEx (HDC hdc, int x, int y, PCURSOR pcur, int cx, int cy, UINT istepIfAniCur, HBRUSH hbr, UINT diFlags)


Define Documentation

#define GetCHeight (  cyOrg,
lrF,
cyDes   )     (cyOrg ? cyOrg : ((lrF & DI_DEFAULTSIZE) ? SYSMET(CYICON) : cyDes))
 

Definition at line 23 of file wmicon.c.

Referenced by _DrawIconEx().

#define GetCWidth (  cxOrg,
lrF,
cxDes   )     (cxOrg ? cxOrg : ((lrF & DI_DEFAULTSIZE) ? SYSMET(CXICON) : cxDes))
 

Definition at line 20 of file wmicon.c.

Referenced by _DrawIconEx().

#define SetBestStretchMode (  hdc,
bpp,
fHT   ) 
 

Value:

GreSetStretchBltMode(hdc, \ (fHT ? HALFTONE : \ ((bpp) == 1 ? BLACKONWHITE : COLORONCOLOR)))

Definition at line 15 of file wmicon.c.


Function Documentation

BOOL _DrawIconEx (  HDC  hdc,
int  x,
int  y,
PCURSOR  pcur,
int  cx,
int  cy,
UINT  istepIfAniCur,
HBRUSH  hbr,
UINT  diFlags
) 
 

Definition at line 93 of file wmicon.c.

References BltIcon(), BOOL, CURSORF_ACON, cy, FALSE, GetCHeight, GetCWidth, ghdcMem, NULL, and TRUE.

Referenced by DrawCaptionIcon(), NtUserDrawIconEx(), xxxPaintIconsInSwitchWindow(), and xxxRealDrawMenuItem().

00103 { 00104 BOOL fSuccess = FALSE; 00105 00106 /* 00107 * If this is an animated cursor, just grab the ith frame and use it 00108 * for drawing. 00109 */ 00110 if (pcur->CURSORF_flags & CURSORF_ACON) { 00111 00112 if ((int)istepIfAniCur >= ((PACON)pcur)->cicur) { 00113 RIPERR0(ERROR_INVALID_PARAMETER, RIP_WARNING, "DrawIconEx, icon step out of range."); 00114 goto Done; 00115 } 00116 00117 pcur = ((PACON)pcur)->aspcur[((PACON)pcur)->aicur[istepIfAniCur]]; 00118 } 00119 00120 /* 00121 * Setup defaults. 00122 */ 00123 cx = GetCWidth(cx, diFlags, pcur->cx); 00124 cy = GetCHeight(cy, diFlags, (pcur->cy / 2)); 00125 00126 if (hbr) { 00127 00128 HBITMAP hbmpT = NULL; 00129 HDC hdcT; 00130 HBITMAP hbmpOld; 00131 POLYPATBLT PolyData; 00132 00133 if (hdcT = GreCreateCompatibleDC(hdc)) { 00134 00135 if (hbmpT = GreCreateCompatibleBitmap(hdc, cx, cy)) { 00136 POINT pt; 00137 BOOL bRet; 00138 00139 hbmpOld = GreSelectBitmap(hdcT, hbmpT); 00140 00141 /* 00142 * Set new dc's brush origin in same relative 00143 * location as passed-in dc's. 00144 */ 00145 bRet = GreGetBrushOrg(hdc, &pt); 00146 /* 00147 * Bug 292396 - joejo 00148 * Stop overactive asserts by replacing with RIPMSG. 00149 */ 00150 if (bRet != TRUE) { 00151 RIPMSG0(RIP_WARNING, "DrawIconEx, GreGetBrushOrg failed."); 00152 } 00153 00154 bRet = GreSetBrushOrg(hdcT, pt.x, pt.y, NULL); 00155 if (bRet != TRUE) { 00156 RIPMSG0(RIP_WARNING, "DrawIconEx, GreSetBrushOrg failed."); 00157 } 00158 00159 PolyData.x = 0; 00160 PolyData.y = 0; 00161 PolyData.cx = cx; 00162 PolyData.cy = cy; 00163 PolyData.BrClr.hbr = hbr; 00164 00165 bRet = GrePolyPatBlt(hdcT, PATCOPY, &PolyData, 1, PPB_BRUSH); 00166 if (bRet != TRUE) { 00167 RIPMSG0(RIP_WARNING, "DrawIconEx, GrePolyPatBlt failed."); 00168 } 00169 00170 /* 00171 * Output the image to the temporary memoryDC. 00172 */ 00173 BltIcon(hdcT, 0, 0, cx, cy, ghdcMem, pcur, TRUE, SRCAND); 00174 BltIcon(hdcT, 0, 0, cx, cy, ghdcMem, pcur, FALSE, SRCINVERT); 00175 00176 /* 00177 * Blt the bitmap to the original DC. 00178 */ 00179 GreBitBlt(hdc, x, y, cx, cy, hdcT, 0, 0, SRCCOPY, (COLORREF)-1); 00180 00181 GreSelectBitmap(hdcT, hbmpOld); 00182 00183 bRet = GreDeleteObject(hbmpT); 00184 if (bRet != TRUE) { 00185 RIPMSG0(RIP_WARNING, "DrawIconEx, GreDeleteObject failed. Possible Leak"); 00186 } 00187 00188 fSuccess = TRUE; 00189 } 00190 00191 GreDeleteDC(hdcT); 00192 } 00193 00194 } else { 00195 00196 if (diFlags & DI_MASK) { 00197 00198 BltIcon(hdc, 00199 x, 00200 y, 00201 cx, 00202 cy, 00203 ghdcMem, 00204 pcur, 00205 TRUE, 00206 ((diFlags & DI_IMAGE) ? SRCAND : SRCCOPY)); 00207 } 00208 00209 if (diFlags & DI_IMAGE) { 00210 00211 BltIcon(hdc, 00212 x, 00213 y, 00214 cx, 00215 cy, 00216 ghdcMem, 00217 pcur, 00218 FALSE, 00219 ((diFlags & DI_MASK) ? SRCINVERT : SRCCOPY)); 00220 } 00221 00222 fSuccess = TRUE; 00223 } 00224 00225 Done: 00226 00227 return fSuccess; 00228 }

BOOL BltIcon (  HDC  hdc,
int  x,
int  y,
int  cx,
int  cy,
HDC  hdcSrc,
PCURSOR  pcur,
BOOL  fMask,
LONG  rop
) 
 

Definition at line 32 of file wmicon.c.

References BOOL, cy, FALSE, SetBestStretchMode, and TRUE.

Referenced by _DrawIconEx(), and BltMe4Times().

00042 { 00043 HBITMAP hbmpSave; 00044 HBITMAP hbmpUse; 00045 LONG rgbText; 00046 LONG rgbBk; 00047 int nMode; 00048 00049 /* 00050 * Setup the DC for drawing 00051 */ 00052 hbmpUse = (fMask || !pcur->hbmColor ? pcur->hbmMask : pcur->hbmColor); 00053 00054 rgbBk = GreSetBkColor(hdc, 0x00FFFFFFL); 00055 rgbText = GreSetTextColor(hdc, 0x00000000L); 00056 nMode = SetBestStretchMode(hdc, pcur->bpp, FALSE); 00057 00058 hbmpSave = GreSelectBitmap(hdcSrc, hbmpUse); 00059 00060 /* 00061 * Do the output to the surface. By passing in (-1) as the background 00062 * color, we are telling GDI to use the background-color already set 00063 * in the DC. 00064 */ 00065 GreStretchBlt(hdc, 00066 x, 00067 y, 00068 cx, 00069 cy, 00070 hdcSrc, 00071 0, 00072 (fMask || pcur->hbmColor ? 0 : pcur->cy / 2), 00073 pcur->cx, 00074 pcur->cy / 2, 00075 rop, 00076 (COLORREF)-1); 00077 00078 GreSetStretchBltMode(hdc, nMode); 00079 GreSetTextColor(hdc, rgbText); 00080 GreSetBkColor(hdc, rgbBk); 00081 00082 GreSelectBitmap(hdcSrc, hbmpSave); 00083 00084 return TRUE; 00085 }


Generated on Sat May 15 19:46:09 2004 for test by doxygen 1.3.7