# Test TEXTAREA tag

<p class="top"><a href="index.htm">index</a></p> <p>Generated: On Fri Jan 4 20:14:55 2008, <br>From: c:\GTools\tools\testap3\testMagnify.cxx, dated Fri Jan 4 18:15:34 2008, with size 14579 bytes.</p> <pre class="cd"><span class="b">// testMagnify.cxx</span> <span class="b">//</span> <span class="b">// Some experiments 'magnifying' the bitmap under the cursor</span> <span class="b">// 2008/01/03 - geoff mclane - http://geoffair.net/ms/magnify.htm</span> <span class="b">// Open Source - praise me, if need be, but do not blame me!</span> <span class="b">//</span> <span class="c">#include</span> <span class="t">"testap3.h"</span> <span class="e">BOOL</span> bAddRedOutline = <span class="e">TRUE</span>; <span class="c">typedef</span> <span class="c">struct</span> tagMAGNIF { <span class="e">POINT</span> pt; <span class="b">// mouse POINT</span> <span class="e">HBITMAP</span> hbm; <span class="b">// saved BITMAP (handle) - for RESTORE</span> <span class="e">SIZE</span> szin, szout; <span class="b">// INNER and OUTER sizes</span> <span class="e">COLORREF</span> trans; <span class="b">// transparent color</span> <span class="e">HBITMAP</span> hBitmap2; <span class="b">// for REPAINT</span> }MAGNIF, * PMAGNIF; MAGNIF sMagnif = {0}; <span class="b">// some coding ideas from </span> <span class="b">// http://www.codeguru.com/cpp/g-m/bitmap/article.php/c1753__1</span> <span class="b">// but (a) this is in MS MFC code, and (b) could NOT get is working!</span> <span class="b">// later found something that worked -</span> <span class="b">// http://www.codeproject.com/KB/GDI/magnify.aspx</span> <span class="b">// You have to be a MEMBER of 'codeproject' (it is FREE) to download</span> <span class="b">// the source files. Again it is in MS MFC, so here I 'converted'</span> <span class="b">// that to standard C/C++.</span> <span class="b">// It uses one seemingly UNDOCUMENTED BitBlt() operation, 0x220326,</span> <span class="b">// but works like a charm ;=))</span> <span class="c">void</span> test_DrawTransparent(<span class="e">HDC</span> hdcDst, <span class="e">HBITMAP</span> hBmp, <span class="c">int</span> x, <span class="c">int</span> y, <span class="e">COLORREF</span> clrTransparency) { <span class="e">BITMAP</span> bm; <span class="b">//GetBitmap (&bm);</span> <span class="e">GetObject</span>( hBmp, <span class="c">sizeof</span>(<span class="e">BITMAP</span>), (<span class="e">LPSTR</span>)&bm ); <span class="b">//CPoint size (bm.bmWidth, bm.bmHeight);</span> <span class="b">//pDC->DPtoLP (&size);</span> <span class="b">//CPoint org (0, 0);</span> <span class="b">//pDC->DPtoLP (&org);</span> <span class="e">POINT</span> size; size.x = bm.<span class="e">bmWidth</span>; size.y = bm.<span class="e">bmHeight</span>; <span class="e">DPtoLP</span>( hdcDst, &size, 1 ); <span class="e">POINT</span> org; org.x = 0; org.y = 0; <span class="e">DPtoLP</span>( hdcDst, &org, 1 ); <span class="b">// Create a memory DC (dcImage) and select the bitmap into it.</span> <span class="b">//CDC dcImage;</span> <span class="b">//dcImage.CreateCompatibleDC (pDC);</span> <span class="e">HDC</span> dcImage = <span class="e">CreateCompatibleDC</span>(hdcDst); <span class="b">// CBitmap* pOldBitmapImage = dcImage.SelectObject (this);</span> <span class="e">HBITMAP</span> pOldBitmapImage = (<span class="e">HBITMAP</span>)<span class="e">SelectObject</span>(dcImage, hBmp); <span class="b">// dcImage.SetMapMode (pDC->GetMapMode ());</span> <span class="e">SetMapMode</span>( dcImage, <span class="e">GetMapMode</span>(hdcDst) ); <span class="b">// Create a second memory DC (dcAnd) and in it create an AND mask.</span> <span class="b">// CDC dcAnd;</span> <span class="b">// dcAnd.CreateCompatibleDC (pDC);</span> <span class="b">// dcAnd.SetMapMode (pDC->GetMapMode ());</span> <span class="e">HDC</span> dcAnd = <span class="e">CreateCompatibleDC</span> (hdcDst); <span class="e">SetMapMode</span> (dcAnd, <span class="e">GetMapMode</span> (hdcDst)); <span class="b">// CBitmap bitmapAnd;</span> <span class="b">// bitmapAnd.CreateBitmap (bm.bmWidth, bm.bmHeight, 1, 1, NULL);</span> <span class="b">// CBitmap* pOldBitmapAnd = dcAnd.SelectObject (&bitmapAnd);</span> <span class="e">HBITMAP</span> bitmapAnd = <span class="e">CreateBitmap</span> (bm.<span class="e">bmWidth</span>, bm.<span class="e">bmHeight</span>, 1, 1, <span class="e">NULL</span>); <span class="e">HBITMAP</span> pOldBitmapAnd = (<span class="e">HBITMAP</span>)<span class="e">SelectObject</span> (dcAnd, bitmapAnd); <span class="b">// dcImage.SetBkColor (clrTransparency);</span> <span class="b">// dcAnd.BitBlt (org.x, org.y, size.x, size.y, &dcImage, org.x, org.y,</span> <span class="b">// SRCCOPY);</span> <span class="e">SetBkColor</span>(dcImage, clrTransparency); <span class="e">BitBlt</span> (dcAnd, org.x, org.y, size.x, size.y, dcImage, org.x, org.y, <span class="e">SRCCOPY</span>); <span class="b">// Create a third memory DC (dcXor) and in it create an XOR mask.</span> <span class="b">// CDC dcXor;</span> <span class="b">// dcXor.CreateCompatibleDC (pDC);</span> <span class="b">// dcXor.SetMapMode (pDC->GetMapMode ());</span> <span class="e">HDC</span> dcXor = <span class="e">CreateCompatibleDC</span> (hdcDst); <span class="e">SetMapMode</span> ( dcXor, <span class="e">GetMapMode</span> (hdcDst) ); <span class="b">// CBitmap bitmapXor;</span> <span class="b">// bitmapXor.CreateCompatibleBitmap (&dcImage, bm.bmWidth, bm.bmHeight);</span> <span class="b">// CBitmap* pOldBitmapXor = dcXor.SelectObject (&bitmapXor);</span> <span class="e">HBITMAP</span> bitmapXor = <span class="e">CreateCompatibleBitmap</span> (dcImage, bm.<span class="e">bmWidth</span>, bm.<span class="e">bmHeight</span>); <span class="e">HBITMAP</span> pOldBitmapXor = (<span class="e">HBITMAP</span>)<span class="e">SelectObject</span> (dcXor, bitmapXor); <span class="b">//dcXor.BitBlt (org.x, org.y, size.x, size.y, &dcImage, org.x, org.y,</span> <span class="b">// SRCCOPY);</span> <span class="e">BitBlt</span> (dcXor, org.x, org.y, size.x, size.y, dcImage, org.x, org.y, <span class="e">SRCCOPY</span>); <span class="b">//dcXor.BitBlt (org.x, org.y, size.x, size.y, &dcAnd, org.x, org.y,</span> <span class="b">// 0x220326);</span> <span class="e">BitBlt</span> (dcXor, org.x, org.y, size.x, size.y, dcAnd, org.x, org.y, 0x220326); <span class="b">// Copy the pixels in the destination rectangle to a temporary</span> <span class="b">// memory DC (dcTemp).</span> <span class="b">// CDC dcTemp;</span> <span class="b">// dcTemp.CreateCompatibleDC (pDC);</span> <span class="b">// dcTemp.SetMapMode (pDC->GetMapMode ());</span> <span class="e">HDC</span> dcTemp = <span class="e">CreateCompatibleDC</span> (hdcDst); <span class="e">SetMapMode</span> ( dcTemp, <span class="e">GetMapMode</span> (hdcDst) ); <span class="b">// CBitmap bitmapTemp;</span> <span class="b">// bitmapTemp.CreateCompatibleBitmap (&dcImage, bm.bmWidth, bm.bmHeight);</span> <span class="b">// CBitmap* pOldBitmapTemp = dcTemp.SelectObject (&bitmapTemp);</span> <span class="e">HBITMAP</span> bitmapTemp = <span class="e">CreateCompatibleBitmap</span> (dcImage, bm.<span class="e">bmWidth</span>, bm.<span class="e">bmHeight</span>); <span class="e">HBITMAP</span> pOldBitmapTemp = (<span class="e">HBITMAP</span>)<span class="e">SelectObject</span> (dcTemp, bitmapTemp); <span class="b">// dcTemp.BitBlt (org.x, org.y, size.x, size.y, pDC, x, y, SRCCOPY);</span> <span class="e">BitBlt</span> (dcTemp, org.x, org.y, size.x, size.y, hdcDst, x, y, <span class="e">SRCCOPY</span>); <span class="b">// Generate the final image by applying the AND and XOR masks to</span> <span class="b">// the image in the temporary memory DC.</span> <span class="b">// dcTemp.BitBlt (org.x, org.y, size.x, size.y, &dcAnd, org.x, org.y,</span> <span class="b">// SRCAND);</span> <span class="b">// dcTemp.BitBlt (org.x, org.y, size.x, size.y, &dcXor, org.x, org.y,</span> <span class="b">// SRCINVERT);</span> <span class="e">BitBlt</span> ( dcTemp, org.x, org.y, size.x, size.y, dcAnd, org.x, org.y, <span class="e">SRCAND</span>); <span class="e">BitBlt</span> ( dcTemp, org.x, org.y, size.x, size.y, dcXor, org.x, org.y, <span class="e">SRCINVERT</span>); <span class="b">// Blit the resulting image to the screen.</span> <span class="b">// pDC->BitBlt (x, y, size.x, size.y, &dcTemp, org.x, org.y, SRCCOPY);</span> <span class="e">BitBlt</span> ( hdcDst, x, y, size.x, size.y, dcTemp, org.x, org.y, <span class="e">SRCCOPY</span>); <span class="b">//pDC->StretchBlt(x, y, cx, cy, &dcTemp, 0, 0, w, h, SRCCOPY);</span> <span class="b">// Restore the default bitmaps.</span> <span class="e">SelectObject</span> ( dcTemp, pOldBitmapTemp); <span class="e">SelectObject</span> ( dcXor, pOldBitmapXor); <span class="e">SelectObject</span> ( dcAnd, pOldBitmapAnd); <span class="e">SelectObject</span> ( dcImage, pOldBitmapImage); <span class="b">// delete objects</span> <span class="e">DeleteDC</span>(dcImage); <span class="e">DeleteDC</span>(dcAnd); <span class="e">DeleteObject</span>(bitmapAnd); <span class="e">DeleteDC</span>(dcXor); <span class="e">DeleteObject</span>(bitmapXor); <span class="e">DeleteDC</span>(dcTemp); <span class="e">DeleteObject</span>(bitmapTemp); } <span class="e">HBITMAP</span> test_MagnifyPoint( <span class="e">HWND</span> hWnd, PMAGNIF pm ) { TmStamp tm; <span class="e">HBITMAP</span> bitmap3 = <span class="e">NULL</span>; <span class="e">HRGN</span> rgn1, rgn2, rgn3; <span class="e">HDC</span> hdc = <span class="e">GetDC</span>(hWnd); <span class="e">HBITMAP</span> bitmap = <span class="e">NULL</span>; <span class="e">HBITMAP</span> bitmap2 = <span class="e">NULL</span>; <span class="e">HDC</span> hdcBmp = <span class="e">NULL</span>; <span class="e">HBITMAP</span> hold, hold2, hold3; <span class="e">HBRUSH</span> hbr = <span class="e">NULL</span>; <span class="e">HDC</span> hdcMem = <span class="e">NULL</span>; <span class="e">HDC</span> hdcKeep = <span class="e">NULL</span>; <span class="e">COLORREF</span> rgbTransparent = pm->trans; <span class="b">// gMagTC; // RGB(255, 0, 254);</span> <span class="b">//SIZE szIN, szOUT;</span> <span class="e">PSIZE</span> pszin = &pm->szin; <span class="e">PSIZE</span> pszout = &pm->szout; <span class="e">POINT</span> point = pm->pt; <span class="e">INT</span> xi2, yi2; <span class="e">INT</span> xo2, yo2; <span class="b">// INNER AND OUTER SIZES</span> <span class="b">//pszin->cx = gMagICX; // 40;</span> <span class="b">//pszin->cy = gMagICY; // 40;</span> <span class="b">//pszout->cx = gMagOCX; // 120</span> <span class="b">//pszout->cy = gMagOCY; // 120</span> <span class="b">// half INNER and OUTER sizes</span> xi2 = pszin->cx / 2; yi2 = pszin->cy / 2; xo2 = pszout->cx / 2; yo2 = pszout->cy / 2; <span class="b">// create regions</span> rgn1 = <span class="e">CreateEllipticRgn</span>(0,0,pszout->cx,pszout->cy); rgn2 = <span class="e">CreateRectRgn</span>(0,0,pszout->cx,pszout->cy); rgn3 = <span class="e">CreateRectRgn</span>(0,0,pszout->cx,pszout->cy); <span class="c">if</span>( !rgn1 || !rgn2 || !rgn3 ) <span class="c">goto</span> Cleanup; <span class="b">// ==============================================================</span> <span class="e">CombineRgn</span>(rgn3,rgn2,rgn1, <span class="e">RGN_DIFF</span>); <span class="b">// subtract center ellipse,</span> <span class="b">// from outer rectangle - gets a complex region</span> <span class="b">// Try outputRgn() for diagnostics only</span> <span class="b">// OutputRgn( hdc, rgn1 );</span> <span class="b">// OutputRgn( hdc, rgn3 ); // this PAINTS all the RECT to the HDC</span> <span class="b">// ==============================================================</span> <span class="c">if</span>( !hdc ) <span class="c">goto</span> Cleanup; hbr = <span class="e">CreateSolidBrush</span>( rgbTransparent ); hdcBmp = <span class="e">CreateCompatibleDC</span>(hdc); <span class="c">if</span>( !hdcBmp ) <span class="c">goto</span> Cleanup; hdcMem = <span class="e">CreateCompatibleDC</span>(hdc); <span class="c">if</span>( !hdcMem ) <span class="c">goto</span> Cleanup; hdcKeep = <span class="e">CreateCompatibleDC</span>(hdc); <span class="c">if</span>( !hdcKeep ) <span class="c">goto</span> Cleanup; bitmap = <span class="e">CreateCompatibleBitmap</span>( hdc, pszin->cx, pszin->cy ); <span class="c">if</span>( !bitmap ) <span class="c">goto</span> Cleanup; bitmap2 = <span class="e">CreateCompatibleBitmap</span>( hdc, pszout->cx, pszout->cy ); <span class="c">if</span>( !bitmap2 ) <span class="c">goto</span> Cleanup; bitmap3 = <span class="e">CreateCompatibleBitmap</span>( hdc, pszout->cx, pszout->cy ); <span class="c">if</span>( !bitmap3 ) <span class="c">goto</span> Cleanup; hold = (<span class="e">HBITMAP</span>)<span class="e">SelectObject</span>(hdcBmp,bitmap); hold2 = (<span class="e">HBITMAP</span>)<span class="e">SelectObject</span>(hdcMem,bitmap2); <span class="b">// get the OUTTER rectangle, for replacement</span> <span class="b">// =========================================</span> hold3 = (<span class="e">HBITMAP</span>)<span class="e">SelectObject</span>(hdcKeep,bitmap3); <span class="e">BitBlt</span>( hdcKeep, 0, 0, pszout->cx, pszout->cy, hdc, point.x - xo2, point.y - yo2, <span class="e">SRCCOPY</span> ); bitmap3 = (<span class="e">HBITMAP</span>)<span class="e">SelectObject</span>(hdcKeep,hold3); <span class="e">DeleteDC</span>(hdcKeep); <span class="b">// ==========================================</span> <span class="b">// get the INNER rectangle</span> <span class="e">BitBlt</span>( hdcBmp, 0, 0, pszin->cx, pszin->cx, hdc, point.x - xi2, point.y - yi2, <span class="e">SRCCOPY</span> ); <span class="b">// expand this inner rectangle to fill the outer rectangle</span> <span class="b">//StretchBlt(hdc, point.x, point.y, 120, 120, hdcBmp, 0, 0, 40, 40, SRCCOPY);</span> <span class="e">StretchBlt</span>(hdcMem, 0, 0, pszout->cx, pszout->cy, hdcBmp, 0, 0, pszin->cx, pszin->cy, <span class="e">SRCCOPY</span>); <span class="b">// fill the outside the circle with the transparent color</span> <span class="e">FillRgn</span>( hdcMem, rgn3, hbr ); <span class="b">// HAD VARIOUS TRIES AT COPYING THE EXPANDED RECTANGLE TO THE SCREEN,</span> <span class="b">// excluding the surrounding transparent region ... until SUCCESS</span> bitmap2 = (<span class="e">HBITMAP</span>)<span class="e">SelectObject</span>(hdcMem,hold2); test_DrawTransparent( hdc, bitmap2, point.x-xo2, point.y-yo2, rgbTransparent ); <span class="b">// MAYBE OUTLINE THE CIRCLE!</span> <span class="b">// dc.SelectObject(&CPen(PS_SOLID, 1, RGB(0, 0, 0)));</span> <span class="b">// dc.SelectObject(&CBrush(NULL, RGB(0, 0, 0)));</span> <span class="b">// dc.Ellipse(point.x-(60*1)-1, point.y-(60*1)-1, point.x+(60*1), point.y+(60*1));</span> <span class="c">if</span>( bAddRedOutline ) { <span class="e">RECT</span> rc; rc.left = point.x-xo2; rc.top = point.y-yo2; rc.right = rc.left + pszout->cx; rc.bottom = rc.top + pszout->cy; DrawColoredEllipse( hdc, &rc, <span class="e">RGB</span>(255,0,0) ); } <span class="e">SelectObject</span>(hdcBmp,hold); pm->hBitmap2 = bitmap2; bitmap2 = <span class="e">NULL</span>; Cleanup: <span class="c">if</span>(hdc) <span class="e">ReleaseDC</span>(hWnd, hdc); <span class="c">if</span>(bitmap) <span class="e">DeleteObject</span>(bitmap); <span class="c">if</span>(bitmap2) <span class="e">DeleteObject</span>(bitmap2); <span class="c">if</span>(hdcBmp) <span class="e">DeleteDC</span>(hdcBmp); <span class="c">if</span>(hdcMem) <span class="e">DeleteDC</span>(hdcMem); <span class="c">if</span>(hbr) <span class="e">DeleteObject</span>(hbr); <span class="c">if</span>(rgn1) <span class="e">DeleteObject</span>(rgn1); <span class="c">if</span>(rgn2) <span class="e">DeleteObject</span>(rgn2); <span class="c">if</span>(rgn3) <span class="e">DeleteObject</span>(rgn3); { <span class="c">long</span> elap = tm.elapsed(); sprtf( <span class="t">"test_MagnifyPoint: Elapsed = %ld usecs (%0.5f secs)\n"</span>, elap, tm.get_secs_d(elap) ); } <span class="c">return</span> bitmap3; } <span class="c">void</span> testReplaceMagnify( <span class="e">HWND</span> hWnd, PMAGNIF pm ) { <span class="e">HDC</span> hdcMem = <span class="e">NULL</span>; <span class="e">HBITMAP</span> hold; <span class="e">POINT</span> point = pm->pt; <span class="c">int</span> xo2 = pm->szout.cx / 2; <span class="c">int</span> yo2 = pm->szout.cy / 2; <span class="e">HDC</span> hdc = <span class="e">GetDC</span>(hWnd); <span class="c">if</span>(!hdc) <span class="b">// nothing to do!!!</span> <span class="c">goto</span> Cleanup; <span class="c">if</span>( !pm->hbm ) <span class="c">goto</span> Cleanup; <span class="b">// create compatible device context</span> hdcMem = <span class="e">CreateCompatibleDC</span>(hdc); <span class="c">if</span>(!hdcMem) <span class="c">goto</span> Cleanup; <span class="b">// select bitmap into context</span> hold = (<span class="e">HBITMAP</span>)<span class="e">SelectObject</span>(hdcMem, pm->hbm); <span class="b">// bli it to the destination</span> <span class="e">BitBlt</span>( hdc, point.x - xo2, point.y - yo2, pm->szout.cx, pm->szout.cy, hdcMem, 0, 0, <span class="e">SRCCOPY</span> ); <span class="b">// select out the bitmap</span> <span class="e">SelectObject</span>(hdcMem, hold); Cleanup: <span class="c">if</span>( hdc ) <span class="e">ReleaseDC</span>(hWnd,hdc); <span class="c">if</span>( hdcMem ) <span class="e">DeleteDC</span>(hdcMem); <span class="c">if</span>( pm->hbm ) <span class="e">DeleteObject</span>( pm->hbm ); pm->hbm = <span class="e">NULL</span>; } <span class="c">void</span> Setup_Magnify( <span class="c">void</span> ) { PMAGNIF pm = &sMagnif; <span class="b">// INNER AND OUTER SIZES</span> pm->szin.cx = gMagICX; <span class="b">// 40;</span> pm->szin.cy = gMagICY; <span class="b">// 40;</span> pm->szout.cx = gMagOCX; <span class="b">// 120</span> pm->szout.cy = gMagOCY; <span class="b">// 120</span> <span class="b">// and transparent color to use - can be any (I think)</span> pm->trans = gMagTC; } <span class="c">void</span> Toggle_Magnify( <span class="e">HWND</span> hWnd, <span class="e">POINT</span> pt ) { PMAGNIF pm = &sMagnif; <span class="c">if</span>( pm->hbm ) { testReplaceMagnify( hWnd, pm ); pm->hbm = <span class="e">NULL</span>; } <span class="c">else</span> { Setup_Magnify(); <span class="b">// do it around THIS POINT</span> pm->pt.x = pt.x; pm->pt.y = pt.y; pm->hbm = test_MagnifyPoint( hWnd, pm ); } } <span class="b">// void Previous_Magnify_Off( HWND hWnd )</span> <span class="c">void</span> Magnify2Off( <span class="e">HWND</span> hWnd ) { PMAGNIF pm = &sMagnif; <span class="c">if</span>( pm->hbm ) { testReplaceMagnify( hWnd, pm ); pm->hbm = <span class="e">NULL</span>; } <span class="c">if</span>( pm->hBitmap2 ) { <span class="e">DeleteObject</span>(pm->hBitmap2); pm->hBitmap2 = <span class="e">NULL</span>; } } <span class="c">void</span> Do_IDM_TEST_OK( <span class="e">HWND</span> hWnd ) { <span class="e">POINT</span> pt; pt.x = 217; pt.y = 218; Toggle_Magnify( hWnd, pt ); <span class="b">//Do_Bubble_Test( hWnd, pt );</span> } <span class="c">void</span> MouseMagnify( <span class="e">HWND</span> hWnd, <span class="e">LPARAM</span> lParam ) { MSG msg; <span class="e">RECT</span> rcClient; <span class="e">POINT</span> point; PMAGNIF pm = &sMagnif; <span class="c">if</span>( pm->hbm ) Magnify2Off( hWnd ); <span class="b">// replace any OLD</span> Setup_Magnify(); <span class="b">// set any NEW parameters</span> point.x = <span class="e">LOWORD</span> (lParam); point.y = <span class="e">HIWORD</span> (lParam); <span class="e">SetCapture</span>( hWnd ); <span class="e">GetWindowRect</span>( hWnd, &rcClient ); Toggle_Magnify( hWnd, point ); <span class="b">// paint FIRST</span> <span class="c">for</span>( ; ; ) { WaitMessage(); <span class="b">// suspended, until message available</span> <span class="b">// PeekMessage Return Values</span> <span class="b">// If a message is available, the return value is nonzero.</span> if( <span class="e">PeekMessage</span>( &msg, <span class="e">NULL</span>, <span class="e">WM_MOUSEFIRST</span>, <span class="e">WM_MOUSELAST</span>, <span class="e">PM_REMOVE</span> ) ) { <span class="c">if</span>( pm->hbm ) Magnify2Off( hWnd ); <span class="b">// remove OLD</span> point.x = <span class="e">LOWORD</span> (msg.lParam); point.y = <span class="e">HIWORD</span> (msg.lParam); pm->pt.x = point.x; pm->pt.y = point.y; pm->hbm = test_MagnifyPoint( hWnd, pm ); if( msg.message == <span class="e">WM_LBUTTONUP</span> ) { <span class="c">break</span>; <span class="b">// we have completed tracking</span> } } } <span class="e">ReleaseCapture</span>(); } <span class="e">BOOL</span> IsMagnifyOn( <span class="c">void</span> ) { PMAGNIF pm = &sMagnif; <span class="c">if</span>( pm->hbm && pm->hBitmap2 ) { <span class="c">return</span> <span class="e">TRUE</span>; } <span class="c">return</span> <span class="e">FALSE</span>; } <span class="c">void</span> RePaintMagnify( <span class="e">HDC</span> hdc ) { PMAGNIF pm = &sMagnif; <span class="c">if</span>( IsMagnifyOn() ) { <span class="e">HBITMAP</span> bitmap2 = pm->hBitmap2; <span class="e">COLORREF</span> rgbTransparent = pm->trans; <span class="e">PSIZE</span> pszin = &pm->szin; <span class="e">PSIZE</span> pszout = &pm->szout; <span class="e">POINT</span> point = pm->pt; <span class="e">INT</span> xo2 = pszout->cx / 2; <span class="e">INT</span> yo2 = pszout->cy / 2; test_DrawTransparent( hdc, bitmap2, point.x-xo2, point.y-yo2, rgbTransparent ); <span class="b">// MAYBE OUTLINE THE CIRCLE!</span> <span class="b">// dc.SelectObject(&CPen(PS_SOLID, 1, RGB(0, 0, 0)));</span> <span class="b">// dc.SelectObject(&CBrush(NULL, RGB(0, 0, 0)));</span> <span class="b">// dc.Ellipse(point.x-(60*1)-1, point.y-(60*1)-1, point.x+(60*1), point.y+(60*1));</span> <span class="c">if</span>( bAddRedOutline ) { <span class="e">RECT</span> rc; rc.left = point.x-xo2; rc.top = point.y-yo2; rc.right = rc.left + pszout->cx; rc.bottom = rc.top + pszout->cy; DrawColoredEllipse( hdc, &rc, <span class="e">RGB</span>(255,0,0) ); } } } <span class="b">// eof - testMagnify.cxx</span> </pre>