OffscreenAttrValue Class Reference

#include <offattr.h>

Inheritance diagram for OffscreenAttrValue:

GeometryLinkedAttrValue AttributeValue CCObject SimpleCCObject FeatherAttrValue List of all members.

Public Member Functions

 ~OffscreenAttrValue ()
virtual BOOL IsDifferent (AttributeValue *)
 Compare two AttributeValue objects. The base class version always returns TRUE - derived classes should override this function to provide functionality.
virtual void SimpleCopy (AttributeValue *pOther)
virtual void Restore (RenderRegion *, BOOL)
virtual void Render (RenderRegion *, BOOL Temp=FALSE)
virtual DocRect GetOffscreenBoundingRect ()
virtual void SetOffscreenBoundingRect (const DocRect drOffBB)
virtual BOOL DoesOffscreenBmpRequireTransp (GRenderRegion *pGRR=NULL)
 As an optimisation, you can make this call on an offscreen attribute, and only allocate + use a transparency-capable bitmap if it is necessary. eg, this results in about a 10% performance increase for feathering.
BOOL TestNodeForTransparency (Node *pNode=NULL)
 Test the given node to see whether it or any of its children requires transparency.
virtual void GetMinimumOffscreenBmpDimensions (UINT32 *RequiredWidth, UINT32 *RequiredHeight)
virtual BOOL DoesOffscreenBMPCaptureBackground ()
void SetAlwaysUseTransparency ()
void UnsetAlwaysUseTransparency ()
virtual void OffscreenRenderingCompleted (RenderRegion *pRender, LPBITMAPINFO lpBitmapInfo, LPBYTE lpBits, DocRect BitmapRect)=0

Protected Member Functions

 OffscreenAttrValue ()

Protected Attributes

DocRect m_OffBB
BOOL m_fForceTransparency

Detailed Description

Definition at line 156 of file offattr.h.


Constructor & Destructor Documentation

OffscreenAttrValue::OffscreenAttrValue  )  [protected]
 

Definition at line 201 of file offattr.cpp.

00202 {
00203     m_fForceTransparency = FALSE;
00204 #ifdef DEBUGOFFSCREENATTRS
00205     m_fHasBeenRendered = FALSE;
00206 #endif
00207 }

OffscreenAttrValue::~OffscreenAttrValue  ) 
 

Definition at line 217 of file offattr.cpp.

00218 {
00219 }


Member Function Documentation

virtual BOOL OffscreenAttrValue::DoesOffscreenBMPCaptureBackground  )  [inline, virtual]
 

Reimplemented in FeatherAttrValue.

Definition at line 190 of file offattr.h.

00190 {return FALSE;}

BOOL OffscreenAttrValue::DoesOffscreenBmpRequireTransp GRenderRegion pGRR = NULL  )  [virtual]
 

As an optimisation, you can make this call on an offscreen attribute, and only allocate + use a transparency-capable bitmap if it is necessary. eg, this results in about a 10% performance increase for feathering.

Author:
Ilan_Copelyn (Xara Group Ltd) <camelotdev@xara.com>, rewritten by Karim MacDonald
Date:
24/01/2000, rewritten 19/11/2000
Parameters:
pGRR ptr to the GRenderRegion into which we'll be rendered. [INPUTS]
Returns:
TRUE if we need a transparency-capable bitmap, FALSE otherwise.
Notes: pGRR is unused in this method, so may be NULL. However, at least one offscreen-attr - FeatherAttrValue - requires that this parameter be non-NULL.

See also: TestNodeForTransparency()

Reimplemented in FeatherAttrValue.

Definition at line 330 of file offattr.cpp.

00331 {
00332     // if we've been told to always use transparency, then always return TRUE here.
00333     if (m_fForceTransparency)
00334         return TRUE;
00335 
00336     // our normal behaviour - test our linked node to see whether it needs transparency.
00337     return TestNodeForTransparency(GetLinkedNode());
00338 }

virtual void OffscreenAttrValue::GetMinimumOffscreenBmpDimensions UINT32 RequiredWidth,
UINT32 RequiredHeight
[inline, virtual]
 

Reimplemented in FeatherAttrValue.

Definition at line 189 of file offattr.h.

00189 { *RequiredWidth=0;*RequiredHeight=0; }

DocRect OffscreenAttrValue::GetOffscreenBoundingRect  )  [virtual]
 

Definition at line 300 of file offattr.cpp.

00301 { 
00302     return m_OffBB;
00303 }

BOOL OffscreenAttrValue::IsDifferent AttributeValue  )  [virtual]
 

Compare two AttributeValue objects. The base class version always returns TRUE - derived classes should override this function to provide functionality.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/04/94
Parameters:
pAttr - the attribute to compare against this one. [INPUTS]
Returns:
TRUE if objects represent different attributes (e.g. one is red and the other is blue); FALSE otherwise (i.e. they represent the same attribute, e.g. both represent 0.25pt lines).
See also:
AttributeManager::ApplyBasedOnDefaults

Reimplemented from AttributeValue.

Definition at line 230 of file offattr.cpp.

00231 {
00232     return TRUE;
00233 }

virtual void OffscreenAttrValue::OffscreenRenderingCompleted RenderRegion pRender,
LPBITMAPINFO  lpBitmapInfo,
LPBYTE  lpBits,
DocRect  BitmapRect
[pure virtual]
 

Implemented in FeatherAttrValue.

void OffscreenAttrValue::Render RenderRegion ,
BOOL  Temp = FALSE
[virtual]
 

Implements AttributeValue.

Reimplemented in FeatherAttrValue.

Definition at line 246 of file offattr.cpp.

00247 {
00248     // Debug test for an offscreen attribute being Render()'ed multiple times without
00249     // OffscreenRenderingCompleted() being called. This is easily caused by:
00250     //  1.  rendering code which isn't bracketed by calls to SaveContext() / RestoreContext()
00251     //  2.  rendering an attribute map which includes an offscreen attr - you must be careful
00252     //      that you don't inadvertently render the attr twice.
00253     //
00254     // Reason:  offscreen attrs initialise and divert subsequent rendering into an offscreen
00255     //          bitmap, which is retrieved and processed when the attribute goes out of scope
00256     //          after a RestoreContext() call. Render the attr twice => you'll be creating
00257     //          and maybe rendering into an offscreen bitmap which is never used + may also
00258     //          cause a memory leak of that bitmap.
00259 #ifdef DEBUGOFFSCREENATTRS
00260     if (!IsDefaultFlagSet())
00261     {
00262         if (m_fHasBeenRendered)
00263         {
00264             char msg[120];
00265             sprintf(msg, "OffscreenAttrValue::Render; Attr at 0x%x rendered more than once! See code for details!", (DWORD)this);
00266             ERROR3(msg);
00267             return;
00268         }
00269         else
00270         {
00271             m_fHasBeenRendered = TRUE;
00272         }
00273     }
00274 #endif
00275 
00276     pRender->SetOffscreen(this);
00277 }

void OffscreenAttrValue::Restore RenderRegion ,
BOOL 
[virtual]
 

Implements AttributeValue.

Reimplemented in FeatherAttrValue.

Definition at line 288 of file offattr.cpp.

00289 {
00290     pRegion->RestoreOffscreen(this);
00291 }

void OffscreenAttrValue::SetAlwaysUseTransparency  )  [inline]
 

Definition at line 193 of file offattr.h.

virtual void OffscreenAttrValue::SetOffscreenBoundingRect const DocRect  drOffBB  )  [inline, virtual]
 

Definition at line 184 of file offattr.h.

00184 { m_OffBB = drOffBB; }

virtual void OffscreenAttrValue::SimpleCopy AttributeValue pOther  )  [inline, virtual]
 

Reimplemented from GeometryLinkedAttrValue.

Reimplemented in FeatherAttrValue.

Definition at line 171 of file offattr.h.

00172     {
00173         GeometryLinkedAttrValue::SimpleCopy(pOther);
00174         m_fForceTransparency = ((OffscreenAttrValue*)pOther)->m_fForceTransparency;
00175     }

BOOL OffscreenAttrValue::TestNodeForTransparency Node pNode = NULL  ) 
 

Test the given node to see whether it or any of its children requires transparency.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/08/2000
Parameters:
pNode the node to test for transparency. [INPUTS]
Returns:
TRUE if pNode requires transparency, or is NULL. See Also: NodeRenderable::IsSeeThrough()

Definition at line 355 of file offattr.cpp.

00356 {
00357     // return TRUE if the node is NULL, just in case transparency is later required.
00358     if (pNode == NULL || !pNode->IsNodeRenderableClass())
00359         return TRUE;
00360 
00361     // check the node to see whether it is see-through, remembering to test
00362     // its indirectly applied attributes.
00363     return ((NodeRenderable*)pNode)->IsSeeThrough(TRUE);
00364 }

void OffscreenAttrValue::UnsetAlwaysUseTransparency  )  [inline]
 

Definition at line 196 of file offattr.h.


Member Data Documentation

BOOL OffscreenAttrValue::m_fForceTransparency [protected]
 

Definition at line 224 of file offattr.h.

DocRect OffscreenAttrValue::m_OffBB [protected]
 

Definition at line 220 of file offattr.h.


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