GRenderRegionWrapper Class Reference

#include <offscrn.h>

Inheritance diagram for GRenderRegionWrapper:

CCObject SimpleCCObject GDrawBorrower QuickRenderer ConcurrentRenderer List of all members.

Public Member Functions

 GRenderRegionWrapper ()
 ~GRenderRegionWrapper ()
virtual BOOL Initialise (GRenderRegion *pActiveRR, double ResFactor, DocRect AreaOfDocumentToRender, UINT32 bpp, BOOL NeedsTransp)=0
virtual BOOL RestorePreviousRendererState ()=0
virtual GRenderRegionGetRenderRegion ()=0
void GetBitmapPointers (LPBITMAPINFO *bi, LPBYTE *by)
void SetBitmapPointers (LPBITMAPINFO bi, LPBYTE by)
KernelBitmapGetKernelBitmap ()

Static Public Member Functions

static GRenderRegionWrapperGetAppropriateRenderWrapper (GRenderRegion *pActiveRR, double ResFactor, DocRect AreaOfDocumentToRender, UINT32 bpp, BOOL NeedsTransp)
static ConcurrentRendererGetConcurrentRenderer (GRenderRegion *pSourceRR, double ResFactor, DocRect AreaOfDocumentToRender, UINT32 bpp, BOOL NeedsTransp)
 Create and use a concurrent renderer. This flavour of render wrapper derives from QuickRenderer, and creates a fresh GRenderRegion, whose rendering matrix is based on the source RR.
static void NewWrappedRRCreated (GRenderRegion *pGrr)
static void GetBitmapPointers (GRenderRegion *pGrr, LPBITMAPINFO *bi, LPBYTE *by)

Detailed Description

Definition at line 141 of file offscrn.h.


Constructor & Destructor Documentation

GRenderRegionWrapper::GRenderRegionWrapper  )  [inline]
 

Definition at line 147 of file offscrn.h.

00147 {}

GRenderRegionWrapper::~GRenderRegionWrapper  )  [inline]
 

Definition at line 148 of file offscrn.h.

00148 {}


Member Function Documentation

GRenderRegionWrapper * GRenderRegionWrapper::GetAppropriateRenderWrapper GRenderRegion pActiveRR,
double  ResFactor,
DocRect  AreaOfDocumentToRender,
UINT32  bpp,
BOOL  NeedsTransp
[static]
 

Definition at line 141 of file offscrn.cpp.

00147 {
00148     if(NeedsTransp)
00149     {
00150         ENSURE(bpp==32,"Can only handle transp when rendering to 32bpp bmp");
00151         if(bpp!=32)
00152             return NULL;
00153     }
00154 
00155     GRenderRegionWrapper* pNewWrap = NULL;
00156 
00157     if(pActiveRR == NULL)
00158     {
00159         pNewWrap = (GRenderRegionWrapper*) new QuickRenderer();
00160     }
00161     else
00162     {
00163         if(ResFactor!=1.0 || bpp!=32)
00164         {
00165             pNewWrap = (GRenderRegionWrapper*) new ConcurrentRenderer();
00166         }
00167         else
00168         {
00169             // can only use offscreen rendering system in 32bpp mode and
00170             // using same resolution as screen (ie same kernel matrix)
00171             pNewWrap = (GRenderRegionWrapper*) new GDrawBorrower();
00172         }
00173     }
00174 
00175     if(!pNewWrap->Initialise(pActiveRR, ResFactor, AreaOfDocumentToRender, bpp, NeedsTransp))
00176     {
00177         // failed to init. free mem.
00178         delete pNewWrap;
00179         return NULL;
00180     }
00181 
00182     // initialised and ready to render
00183     return pNewWrap;
00184 }

void GRenderRegionWrapper::GetBitmapPointers GRenderRegion pGrr,
LPBITMAPINFO bi,
LPBYTE by
[static]
 

Definition at line 286 of file offscrn.cpp.

00287 {
00288     *bi = pGrr->pBitmapInfo;
00289     *by = pGrr->pBits;
00290 }

void GRenderRegionWrapper::GetBitmapPointers LPBITMAPINFO bi,
LPBYTE by
 

Definition at line 271 of file offscrn.cpp.

00272 {
00273     GRenderRegion *pGrr = GetRenderRegion();
00274     *bi = pGrr->pBitmapInfo;
00275     *by = pGrr->pBits;
00276 }

ConcurrentRenderer * GRenderRegionWrapper::GetConcurrentRenderer GRenderRegion pSourceRR,
double  ResFactor,
DocRect  AreaOfDocumentToRender,
UINT32  bpp,
BOOL  NeedsTransp
[static]
 

Create and use a concurrent renderer. This flavour of render wrapper derives from QuickRenderer, and creates a fresh GRenderRegion, whose rendering matrix is based on the source RR.

Parameters:
pSourceRR The render-region to base ourself upon. [INPUTS] If NULL, then we will use the current view settings. ResFactor Scale at which to render things, RELATIVE to the source RR's scale factor, as we're assuming you'll want to be at the same scale for most uses. AreaOfDocumentToRender The area to render, in millipoints. bpp bits per pixel. must be 32 if you want transparency. NeedsTransp Whether you want transparency on or not.
Returns:
The RenderWrapper created, or NULL if unsuccessful.
Here's an example without any error-checking:

ConcurrentRenderer* pRendWrap = GRenderRegionWrapper::GetConcurrentRenderer(...) GRenderRegion* pOffscreenRR = pRendWrap->GetRenderRegion(); pOffscreenRR->SetFillColour(COLOUR_BLACK); pOffscreenRR->SetLineColour(COLOUR_TRANS); pOffscreenRR->DrawPath(pPathToDraw); pRendWrap->GetBitmapPointers(&pBmpInfo, &pBmpBits); pRendWrap->RestorePreviousRendererState();

Returns:
Errors: ERROR2 if pSourceRR is NULL or you ask for a transparent, non-32bpp RR.
See also: BitmapShadower::RenderShadowedNodeOffscreen() for a real-use example.

Definition at line 231 of file offscrn.cpp.

00237 {
00238     ERROR2IF(NeedsTransp && (bpp != 32), NULL, "Can only do transp with 32 bpp bitmaps");
00239 
00240     ConcurrentRenderer* pNewWrap = new ConcurrentRenderer;
00241     if (!pNewWrap->Initialise(pSourceRR, ResFactor, AreaOfDocumentToRender, bpp, NeedsTransp))
00242     {
00243         delete pNewWrap;
00244         pNewWrap = NULL;
00245     }
00246 
00247     return pNewWrap;
00248 }

KernelBitmap * GRenderRegionWrapper::GetKernelBitmap  ) 
 

Definition at line 315 of file offscrn.cpp.

00316 {
00317     LPBITMAPINFO bi;
00318     LPBYTE by;
00319     GetBitmapPointers(&bi,&by);
00320 
00321     LPBITMAPINFOHEADER  bh = &bi->bmiHeader;
00322     if(bh->biCompression==0x80000001)
00323     {
00324         GetRenderRegion()->GetDrawContext()->ConvertBitmap(
00325                                     bh, by,
00326                                     bh, by,
00327                                     0
00328                                 );
00329     }
00330 
00331     CWxBitmap* pTempBmp= new CWxBitmap(bi, by);
00332     KernelBitmap* kBmp = new KernelBitmap(pTempBmp,TRUE);
00333     return kBmp;
00334 }

virtual GRenderRegion* GRenderRegionWrapper::GetRenderRegion  )  [pure virtual]
 

Implemented in GDrawBorrower, and QuickRenderer.

virtual BOOL GRenderRegionWrapper::Initialise GRenderRegion pActiveRR,
double  ResFactor,
DocRect  AreaOfDocumentToRender,
UINT32  bpp,
BOOL  NeedsTransp
[pure virtual]
 

Implemented in GDrawBorrower, QuickRenderer, and ConcurrentRenderer.

void GRenderRegionWrapper::NewWrappedRRCreated GRenderRegion pGrr  )  [static]
 

Definition at line 259 of file offscrn.cpp.

00260 {
00261     pGrr->SetIsWrapped(TRUE);
00262 }

virtual BOOL GRenderRegionWrapper::RestorePreviousRendererState  )  [pure virtual]
 

Implemented in GDrawBorrower, QuickRenderer, and ConcurrentRenderer.

void GRenderRegionWrapper::SetBitmapPointers LPBITMAPINFO  bi,
LPBYTE  by
 

Definition at line 302 of file offscrn.cpp.

00303 {
00304     GRenderRegion *pGrr = GetRenderRegion();
00305     pGrr->SetBitmapPointers(bi, by);
00306 }


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:55:01 2007 for Camelot by  doxygen 1.4.4