#include <grndclik.h>
Inheritance diagram for GRenderClick:
Public Member Functions | |
GRenderClick (DocRect ClipRegion, Matrix ConvertMatrix, FIXED16 ViewScale, UINT32 Depth, double dpi) | |
Constructor. Most important job is to set the VeryMono flag. Do not call directly, use OSRenderBitmap::Create INT32 dpi changed to double dpi (12/12/95) to improve the range of values allowed at the < 1000dpi settings that we will be using. | |
~GRenderClick () | |
Destructor. Simple cleanup, which involves deleting the RenderDC. | |
virtual void | DebugMe (INT32 Stretch) |
Dupms the current bitmap onto the current view window, so we can see what is going on. Do not call directly, use OSRenderBitmap::DebugMe. | |
virtual BOOL | ImmediateRender () |
Used to Draw something immediately. | |
virtual BOOL | SetFirstBand () |
Sets up for banded rendering. This class does not do banded rendering as yet. This just sets things up to indicate that everything will be done in one band. | |
virtual BOOL | GetNextBand () |
Since this class does not do banded rendering, there are never any more bands. | |
Protected Member Functions | |
LPBITMAPINFO | GetLPBits (INT32 Width, INT32 Height, INT32 Depth, LPBYTE *) |
Allocates a bitmap from the CCMalloc heap. | |
void | FreeLPBits (LPBITMAPINFO, LPBYTE) |
Frees the memory allocated in GetLPBits. | |
virtual BitmapContents | GetContents (BOOL) |
To investigate whether anything has been rendered into a bitmap-based render region. Don't call directly, use OSRenderBitmap::GetContents. | |
BOOL | DisplayBits (LPBITMAPINFO lpDisplayBitmapInfo=NULL, LPBYTE lpDisplayBits=NULL) |
Supposed to dump bitmap on screen, but that makes no sense for this bitmap so it just does nothing and always returns TRUE. | |
virtual void | SetClean (BOOL bResetChangedBounds, BOOL FillWhite) |
Clears out the RR, both logically and (optionally) physically). | |
BOOL | AttachDevice (View *, wxDC *, Spread *SpreadToAttach=NULL, bool fOwned=false) |
Most work done in base class, except for the creation of a CCDC member. | |
BOOL | StartRender () |
Most work done in base class, except for the calculation of the address & mask of the centre pixel. | |
Protected Attributes | |
LPBYTE | pMiddle |
BYTE | MiddleMask |
BOOL | ClearOnStart |
Friends | |
class | OSRenderBitmap |
Definition at line 118 of file grndclik.h.
|
Constructor. Most important job is to set the VeryMono flag. Do not call directly, use OSRenderBitmap::Create INT32 dpi changed to double dpi (12/12/95) to improve the range of values allowed at the < 1000dpi settings that we will be using.
Definition at line 131 of file grndclik.cpp. 00132 : GRenderDIB(ClipRegion, ConvertMatrix, ViewScale, Depth, dpi) 00133 { 00134 pMiddle = NULL; // just in case used before set up 00135 RenderFlags.VeryMono = TRUE; // simple black&white rendering 00136 ClearOnStart = FALSE; 00137 }
|
|
Destructor. Simple cleanup, which involves deleting the RenderDC.
Definition at line 204 of file grndclik.cpp. 00205 { 00206 // Free up the bitmap here, as the call to FreeLPBits in the 00207 // GRenderDIB will not call the correct version (the virtual-ness will be 00208 // broken as it is called from a destructor 00209 if (pBitmapInfo!=NULL) 00210 { 00211 // FreeLPBits( lpBitmapInfo, lpBits ); 00212 FreeOffscreenState(); 00213 pBitmapInfo = NULL; 00214 pBits = NULL; 00215 } 00216 }
|
|
Most work done in base class, except for the creation of a CCDC member.
Reimplemented from GRenderRegion. Reimplemented in GRenderClickColour, and GRenderClickColourNoPaper. Definition at line 619 of file grndclik.cpp. 00620 { 00621 00622 // call base class first 00623 if (!GRenderDIB::AttachDevice(pView, DCToAttach, SpreadToAttach, fOwned)) 00624 return FALSE; 00625 00626 // now replace the usual RenderDC with our new one. This makes the type of the CCDC 00627 // correct, so Quality rendering works correctly, for example. 00628 /* 00629 TRY 00630 { 00631 // IMPORTANT: we 'borrow' the HDC from DCToAttach. We must take care when 00632 // deleting this not to delete the HDCs (see the constructor). 00633 RenderDC = new CCDC( DCToAttach, RENDERTYPE_MONOBITMAP ); 00634 } 00635 CATCH (CMemoryException, e) 00636 { 00637 // Ooer - not enough memory 00638 TRACEALL( _T("No memory for CCDC in GRenderClick::AttachDevice") ); 00639 return FALSE; 00640 } 00641 END_CATCH 00642 */ 00643 RenderDC = new wxBufferedDC() ; 00644 m_fOwned = true; 00645 00646 return TRUE; 00647 }
|
|
Dupms the current bitmap onto the current view window, so we can see what is going on. Do not call directly, use OSRenderBitmap::DebugMe.
Reimplemented in GRenderClickColour. Definition at line 525 of file grndclik.cpp. 00526 { 00527 #if defined(_DEBUG) && 0 // GAT 00528 DWORD *rgb = (DWORD*)lpBitmapInfo->bmiColors; 00529 00530 rgb[0] = RGB(0,0,0); 00531 rgb[1] = RGB(255,255,255); 00532 00533 const INT32 w = WRect.width; 00534 const INT32 h = WRect.height; 00535 00536 ::StretchDIBits( RenderDC->m_hDC, 0,0, w*Stretch, h*Stretch, 00537 0,0,w,h, 00538 lpBits, lpBitmapInfo, 00539 DIB_RGB_COLORS, 00540 SRCCOPY 00541 ); 00542 #endif 00543 }
|
|
Supposed to dump bitmap on screen, but that makes no sense for this bitmap so it just does nothing and always returns TRUE.
Reimplemented from GRenderDIB. Definition at line 599 of file grndclik.cpp. 00600 { 00601 return TRUE; 00602 }
|
|
Frees the memory allocated in GetLPBits.
Reimplemented from GRenderDIB. Definition at line 906 of file grndclik.cpp. 00907 { 00908 // Free up the memory. Not from Limited Heap 00909 FreeDIB(lpBMI, lpB, NULL, FALSE); 00910 }
|
|
To investigate whether anything has been rendered into a bitmap-based render region. Don't call directly, use OSRenderBitmap::GetContents.
Reimplemented in GRenderClickColour. Definition at line 335 of file grndclik.cpp. 00336 { 00337 RECT UsedRect; 00338 00339 if ( 00340 HaveRenderedSomething && 00341 (GetDrawContext()->GetChangedBBox( &UsedRect )) 00342 ) 00343 { 00344 if ( 00345 (UsedRect.right > UsedRect.left) || 00346 (UsedRect.top < UsedRect.bottom) 00347 ) 00348 { 00349 // something has been drawn - is it the middle? 00350 if ( (*pMiddle & MiddleMask) == 0) 00351 return BITMAPCONTENTS_CENTRE; 00352 00353 // if only interested in centre pixel then we're out of here 00354 if (JustMiddle) 00355 return BITMAPCONTENTS_NONE; 00356 00357 // not in the middle - if any byte is not 0xFF then something must have been 00358 // rendered 00359 LPDWORD Search = (LPDWORD)pBits; 00360 size_t Count = pBitmapInfo->bmiHeader.biSizeImage >> 2; 00361 while (Count--) 00362 { 00363 if (*Search != 0xFFFFFFFF) 00364 return BITMAPCONTENTS_ANY; 00365 Search++; 00366 } 00367 // else nothing rendered 00368 } 00369 } 00370 00371 return BITMAPCONTENTS_NONE; 00372 }
|
|
Allocates a bitmap from the CCMalloc heap.
Reimplemented from GRenderDIB. Definition at line 883 of file grndclik.cpp. 00884 { 00885 // Get a DIB out of the CCMalloc heap 00886 LPBITMAPINFO bmInfo = NULL; 00887 bmInfo = AllocDIB( Width, Height, Depth, lplpBits, NULL, FALSE); 00888 00889 // return it. 00890 return bmInfo; 00891 }
|
|
Since this class does not do banded rendering, there are never any more bands.
Reimplemented from GRenderDIB. Definition at line 862 of file grndclik.cpp. 00863 { 00864 // No banding 00865 return FALSE; 00866 }
|
|
Used to Draw something immediately.
Reimplemented from RenderRegion. Definition at line 272 of file grndclik.cpp. 00273 { 00274 RenderFlags.bImmediateRender = TRUE; 00275 if (!StartRender()) 00276 return FALSE; 00277 00278 // Set no funny attributes - let the hit test rendering do all that 00279 00280 return TRUE; 00281 }
|
|
Clears out the RR, both logically and (optionally) physically).
Reimplemented from GRenderRegion. Definition at line 296 of file grndclik.cpp. 00297 { 00298 // Do the normal cleaning process 00299 GRenderDIB::SetClean(bResetChangedBounds, FillWhite); 00300 00301 // and if asked, mark the rr as needing clearing 00302 ClearOnStart = FillWhite; 00303 00304 // Damn well clear it NOW! 00305 if (ClearOnStart) 00306 { 00307 // Set it to white 00308 if (pBits!=NULL) 00309 memset(pBits, 0xFF, pBitmapInfo->bmiHeader.biSizeImage); 00310 00311 // Dont do it next time please 00312 ClearOnStart = FALSE; 00313 } 00314 }
|
|
Sets up for banded rendering. This class does not do banded rendering as yet. This just sets things up to indicate that everything will be done in one band.
Reimplemented from GRenderDIB. Definition at line 840 of file grndclik.cpp. 00841 { 00842 // No Banding needed 00843 IsRegionBanded = FALSE; 00844 IsWaitingForRAM = FALSE; 00845 IsLastBand = TRUE; 00846 return TRUE; 00847 }
|
|
Most work done in base class, except for the calculation of the address & mask of the centre pixel.
Reimplemented from GRenderRegion. Reimplemented in GRenderClickColour. Definition at line 749 of file grndclik.cpp. 00750 { 00751 if (!GRenderDIB::StartRender()) 00752 return FALSE; 00753 00754 // work out the address & mask of the centre pixel 00755 const INT32 w = WRect.width; 00756 const INT32 h = WRect.height; 00757 00758 // address is pretty easy 00759 pMiddle = pBits + (h/2)*DIBUtil::ScanlineSize( w, 1 ); 00760 pMiddle += ((w/2)/8); 00761 00762 // bit within byte is also reasonably straight-forward (and should be independent of 00763 // byte-sex) 00764 MiddleMask = (BYTE) ( (INT32)0x80 >> ((w/2)&7) ); 00765 00766 // If we have been asked to clear out the contents of the bmp, then do it 00767 if (ClearOnStart) 00768 { 00769 // Set it to white 00770 if (pBits!=NULL) 00771 memset(pBits, 0xFF, pBitmapInfo->bmiHeader.biSizeImage); 00772 00773 // Dont do it next time please 00774 ClearOnStart = FALSE; 00775 } 00776 00777 return TRUE; 00778 }
|
|
Reimplemented in GRenderClickColour, and GRenderClickColourNoPaper. Definition at line 120 of file grndclik.h. |
|
Definition at line 151 of file grndclik.h. |
|
Definition at line 148 of file grndclik.h. |
|
Definition at line 147 of file grndclik.h. |