CMXRenderRegion Class Reference

#include <cmxrendr.h>

Inheritance diagram for CMXRenderRegion:

VectorFileRenderRegion RenderRegion ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 CMXRenderRegion (DocRect ClipRect, Matrix ConvertMatrix, FIXED16 ViewScale)
 Constructor for an CMXOutputFilter object. The object should be initialised before use.
BOOL AttachDevice (View *ViewToAttach, CNativeDC *DCToAttach, Spread *SpreadToAttach, bool fOwned=false)
BOOL InitDevice ()
 Initialise the device specific mechanisms for this render region.
virtual void DrawPathToOutputDevice (Path *PathToRender, PathShape shapePath)
 Output all the commands required to render this path to the CMX file.
BOOL ExportPath (Path *PathToRender, BOOL DataOnly)
 Output all the commands required to render this path to the CMX file. If this is a compound path, the stroke/fill operators will always be output, regardless of the value of the DataOnly parameter.
BOOL ExportBevel (NodeBevel *pBevel)
 Contains the custom export code for the bevel node.
BOOL ExportBevelBegin (NodeBevelBegin *pBevel)
 Stub function to prevent NodeBevelBegin from rendering.
BOOL ExportShadow (OILBitmap *pBitmap, UINT32 Darkness, DocRect &Bounds)
 Contains the custom export code for the shadow node.
void GetRenderRegionCaps (RRCaps *pCaps)
 This function allows render regions to admit to what they can and can not render. This allows other areas of the program to come in and help render regions out in some situations, if they are unable to render everything. eg. an OSRenderRegion can not render transparancy.
virtual BOOL WantsGrids ()
 very little
void SetAreExportingContoneBitmap (BOOL flag)
BOOL GetAreExportingContoneBitmap (void)

Protected Member Functions

void OutputFontName ()
INT32 GetFontStyle ()
void ResetOutputAttributes ()

Protected Attributes

AttributeEntryLastOutputAttrs
CCLexFileExportFile
CMXExportDCcmxDC
RRCaps Caps
BOOL AreExportingContoneBitmap

Friends

class NodeBitmap

Detailed Description

Definition at line 113 of file cmxrendr.h.


Constructor & Destructor Documentation

CMXRenderRegion::CMXRenderRegion DocRect  ClipRect,
Matrix  ConvertMatrix,
FIXED16  ViewScale
 

Constructor for an CMXOutputFilter object. The object should be initialised before use.

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/06/96
See also:
CMXOutputFilter::Init

Definition at line 128 of file cmxrendr.cpp.

00128                                                                                           :
00129     VectorFileRenderRegion(ClipRect, ConvertMatrix, ViewScale)
00130 {
00131 }


Member Function Documentation

BOOL CMXRenderRegion::AttachDevice View ViewToAttach,
CNativeDC DCToAttach,
Spread SpreadToAttach,
bool  fOwned = false
[virtual]
 

Reimplemented from RenderRegion.

void CMXRenderRegion::DrawPathToOutputDevice Path DrawPath,
PathShape  shapePath
[virtual]
 

Output all the commands required to render this path to the CMX file.

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/06/96
Parameters:
DrawPath - the path to render. [INPUTS]
See also:
RenderRegion::DrawPath; CMXRenderRegion::GetValidPathAttributes CMXRenderRegion::ExportPath

Implements RenderRegion.

Definition at line 221 of file cmxrendr.cpp.

00222 {
00223     ExportPath(DrawPath, FALSE);
00224 }

BOOL CMXRenderRegion::ExportBevel NodeBevel pBevel  ) 
 

Contains the custom export code for the bevel node.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/2/00
Parameters:
pBevel - A pointer to a bevel node. [INPUTS]
Returns:
TRUE if the node was successfully exported, FALSE if it wasn't.

Definition at line 278 of file cmxrendr.cpp.

00279 {
00280     ColourFillAttribute     *pFill          = ( ColourFillAttribute * ) GetCurrentAttribute
00281                                               ( ATTR_FILLGEOMETRY );
00282     StrokeColourAttribute   *pLine          = ( StrokeColourAttribute * ) GetCurrentAttribute
00283                                               ( ATTR_STROKECOLOUR );
00284     OILBitmap               *pBMP           = NULL;
00285     DocColour               OldColour       ( pLine->Colour );
00286     BitmapFillAttribute     BevFill;
00287     BOOL                    Result          = FALSE;
00288     DocRect                 Bounds          = pBevel->GetBoundingRect ();
00289     RangeControl            ControlFlags    ( TRUE, TRUE );
00290     Range                   ToRender        ( pBevel, pBevel, ControlFlags );
00291     DocColour               Transparent     ( COLOUR_TRANS );
00292     KernelBitmap* pBevelBMP = NULL;
00293 
00294     NodeBevelController* pControl = (NodeBevelController*)pBevel->GetParentController();
00295 
00296     if(pControl)
00297         pBevelBMP = pBevel->CreateBitmapCopy(pControl->GetDPI());
00298     else
00299     {
00300         ERROR2(FALSE,"Failed to find a bevel controller node!");
00301     }
00302 
00303     ERROR2IF(!pBevelBMP,FALSE,"Failed to create a new Export BevelBitmap!");
00304 
00305     // Copy the information over.
00306     BevFill.SimpleCopy ( pBevel->GetBitmapFillAttribute () );
00307 
00308     // Set the line colour to be transparent.
00309     pLine->Colour = Transparent;
00310 
00311     // For some reason, the pBevFill attribute isn't correctly instansiated at this point.
00312     // Thus it's necessary to load up the points describing its position before export is
00313     // attempted. Note: In the Flash export filter, these points are pre-loaded, so there
00314     // must be some weird bug somewhere.
00315     BevFill.SetStartPoint   ( &Bounds.lo );
00316     BevFill.SetEndPoint     ( &DocCoord ( Bounds.hix, Bounds.loy ) );
00317     BevFill.SetEndPoint2    ( &DocCoord ( Bounds.lox, Bounds.hiy ) );
00318     
00319     // Attach the new bitmap to the bevel fill attribute.
00320     BevFill.AttachBitmap ( pBevelBMP );
00321 
00322     // Set up the bevel fill as a standard bitmap fill.
00323     SetFillGeometry ( &BevFill, FALSE );
00324 
00325     // Export the bevel.
00326     Result = ExportPath ( &( pBevel->InkPath ), FALSE );
00327 
00328     // Pop the attribute off the stack.
00329     RestoreFillGeometry ( pFill, FALSE );
00330 
00331     // Restore the line colour.
00332     pLine->Colour = OldColour;
00333 
00334     // Now delete the Copy Bitmap!
00335     delete pBevelBMP;
00336     pBevelBMP = NULL;
00337 
00338     return Result;
00339 }

BOOL CMXRenderRegion::ExportBevelBegin NodeBevelBegin pBevel  ) 
 

Stub function to prevent NodeBevelBegin from rendering.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/2/00 Input: pBevel - A pointer to a NodeBevelBegin object.
Returns:
TRUE if success.
See also:
-

Definition at line 354 of file cmxrendr.cpp.

00355 {
00356     return TRUE;
00357 }

BOOL CMXRenderRegion::ExportPath Path DrawPath,
BOOL  DataOnly
 

Output all the commands required to render this path to the CMX file. If this is a compound path, the stroke/fill operators will always be output, regardless of the value of the DataOnly parameter.

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/06/96
Parameters:
DrawPath - the path to render. [INPUTS] DataOnly - if TRUE, only output the line/curve/moveto data, and not the stroke or fill operators. if FALSE, just output path normally. NB. see Purpose
See also:
RenderRegion::DrawPath; CMXRenderRegion::GetValidPathAttributes

Definition at line 243 of file cmxrendr.cpp.

00244 {
00245     // Get the device context for our export file.
00246     KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
00247 
00248     DocCoord*   Coords      = DrawPath->GetCoordArray();
00249     PathVerb*   Verbs       = DrawPath->GetVerbArray();
00250     INT32           NumCoords   = DrawPath->GetNumCoords();
00251 
00252     // No need to export a zero length path.
00253     if ( NumCoords != 0 )
00254     {
00255         // There were some points on the path, so attempt to export it.
00256         return cmxDC->WritePath ( Coords, Verbs, NumCoords, DrawPath->IsFilled );
00257     }
00258 
00259     else
00260     {
00261         // Pretend that it worked to prevent any errors from being thrown.
00262         return TRUE;
00263     }
00264 }

BOOL CMXRenderRegion::ExportShadow OILBitmap pBitmap,
UINT32  Darkness,
DocRect Bounds
 

Contains the custom export code for the shadow node.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/2/00
Parameters:
pShadow - A pointer to a Shadow node. [INPUTS]
Returns:
TRUE if the node was successfully exported, FALSE if it wasn't.

Definition at line 373 of file cmxrendr.cpp.

00376 {
00377     // The bitmap export code for CMX in Camelot is a mess, due to it being done at the last
00378     // minute when the last version was shipped. Because of this, the ExportShadow function
00379     // repeats a few lines of code from NodeBitmap::ExportRender.
00380     CMXExportDC             *pDC            = static_cast<CMXExportDC *> ( RenderDC );
00381     ColourFillAttribute     *pFill          = ( ColourFillAttribute * ) GetCurrentAttribute
00382                                               ( ATTR_FILLGEOMETRY );
00383     StrokeColourAttribute   *pLine          = ( StrokeColourAttribute * ) GetCurrentAttribute
00384                                               ( ATTR_STROKECOLOUR );
00385     ADDR                    BitmapAddress   = pBitmap->GetBitmapBits ();
00386     DocColour               ShadowColour    = *( static_cast<FillGeometryAttribute*>
00387                                                 ( GetCurrentAttribute ( ATTR_FILLGEOMETRY ) )
00388                                                 ->GetStartColour () );
00389     DocColour               Background      ( COLOUR_WHITE );   // I don't do backgrounds yet.
00390     DocColour               BlendedShadow   = AlphaBlend ( ShadowColour, Background,
00391                                                            Darkness );
00392     DocCoord                Parallel [4];
00393     StrokeColourAttribute   StartColAttr    ( BlendedShadow );
00394     FlatFillAttribute       EndColAttr;
00395 
00396     // I need to set the line colour (temporarily) to be the start colour, and the fill
00397     // colour to be the end colour. This sets the attributes up for a contone bitmap
00398     // fill.
00399     EndColAttr.SetStartColour ( &Background );
00400 
00401     SetLineColour   ( &StartColAttr, FALSE );
00402     SetFillGeometry ( &EndColAttr, FALSE );
00403 
00404     // Get the rectangle describing the shadow's path.
00405     Parallel [0] = DocCoord ( Bounds.lox, Bounds.hiy );
00406     Parallel [1] = DocCoord ( Bounds.hix, Bounds.hiy );
00407     Parallel [2] = DocCoord ( Bounds.hix, Bounds.loy );
00408     Parallel [3] = DocCoord ( Bounds.lox, Bounds.loy );
00409 
00410     // Quickly knock up a kernel bitmap.
00411     KernelBitmap Bitmap ( pBitmap );
00412 
00413     // And export it.
00414     pDC->WriteBitmap ( &Bitmap, Parallel, CMXExportDC::CMXBITMAPCOLOURSOURCE_LINEANDFILL );
00415 
00416     // Restore the old settings.
00417     RestoreFillGeometry ( pFill, FALSE );
00418     RestoreLineColour   ( pLine, FALSE );
00419 
00420     // It all worked - so return TRUE.
00421     return TRUE;
00422 }

BOOL CMXRenderRegion::GetAreExportingContoneBitmap void   )  [inline]
 

Definition at line 143 of file cmxrendr.h.

00143 {return AreExportingContoneBitmap;};

INT32 CMXRenderRegion::GetFontStyle  )  [protected]
 

void CMXRenderRegion::GetRenderRegionCaps RRCaps pCaps  )  [virtual]
 

This function allows render regions to admit to what they can and can not render. This allows other areas of the program to come in and help render regions out in some situations, if they are unable to render everything. eg. an OSRenderRegion can not render transparancy.

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/06/96
Parameters:
pCaps - The details about what types of thing this render region can render [OUTPUTS]

Reimplemented from RenderRegion.

Definition at line 438 of file cmxrendr.cpp.

00439 {
00440     // This forces line attributes - dash patterns and arrow heads to be output
00441     // properly for CMX, rather than using Camelot 'shorthand' tokens.
00442     pCaps->CanDoNothing();
00443     pCaps->ArrowHeads = TRUE;
00444     pCaps->DashPatterns = TRUE;
00445 }

BOOL CMXRenderRegion::InitDevice  )  [virtual]
 

Initialise the device specific mechanisms for this render region.

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/06/96
Returns:
TRUE if the device context is initialised ok; FALSE if not.

Errors: Same as base class.

See also:
RenderRegion::InitDevice

Reimplemented from RenderRegion.

Definition at line 182 of file cmxrendr.cpp.

00183 {
00184     // Call base class
00185     if (!RenderRegion::InitDevice())
00186         return FALSE;
00187 
00188     // Set the render caps up
00189     GetRenderRegionCaps(&Caps);
00190 
00191     // Find out which document we're using
00192     ENSURE(RenderView->GetDoc() != NULL, "View's document is NULL!");
00193     Document *TheDocument = RenderView->GetDoc();
00194 
00195     KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
00196     cmxDC = (CMXExportDC *)RenderDC;
00197 
00198     // Set up render region
00199     InitClipping();
00200 
00201     // All ok
00202     return TRUE;
00203 }

void CMXRenderRegion::OutputFontName  )  [protected]
 

void CMXRenderRegion::ResetOutputAttributes  )  [protected]
 

void CMXRenderRegion::SetAreExportingContoneBitmap BOOL  flag  )  [inline]
 

Definition at line 142 of file cmxrendr.h.

00142 {AreExportingContoneBitmap = flag;};

BOOL CMXRenderRegion::WantsGrids  )  [virtual]
 

very little

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/06/96
Returns:
FALSE

Reimplemented from RenderRegion.

Definition at line 458 of file cmxrendr.cpp.

00459 {
00460     return FALSE;
00461 }


Friends And Related Function Documentation

friend class NodeBitmap [friend]
 

Definition at line 117 of file cmxrendr.h.


Member Data Documentation

BOOL CMXRenderRegion::AreExportingContoneBitmap [protected]
 

Definition at line 160 of file cmxrendr.h.

RRCaps CMXRenderRegion::Caps [protected]
 

Definition at line 158 of file cmxrendr.h.

CMXExportDC* CMXRenderRegion::cmxDC [protected]
 

Definition at line 155 of file cmxrendr.h.

CCLexFile* CMXRenderRegion::ExportFile [protected]
 

Definition at line 154 of file cmxrendr.h.

AttributeEntry* CMXRenderRegion::LastOutputAttrs [protected]
 

Reimplemented from VectorFileRenderRegion.

Definition at line 152 of file cmxrendr.h.


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