PrintingMaskedRenderRegion Class Reference

This is a simplified version of the MaskedRenderRegion. It does not have to cope with a mix of complex and simple shapes to be rendered, but knows that there will be a run of complex shapes and then all the rest will be simple. More...

#include <pmaskrgn.h>

Inheritance diagram for PrintingMaskedRenderRegion:

MaskedRenderRegion GRenderBitmap GRenderDIB GRenderRegion RenderRegion ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 PrintingMaskedRenderRegion (DocRect, Matrix, FIXED16, double, BOOL Printing)
 Constructs a PrintingMaskedRenderReigon 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.
 ~PrintingMaskedRenderRegion ()
 destructor - the base classes do all the work here
void SetMaskDrawingMode (BOOL OnOff)
 The render region can either be rendering simple nodes or complex nodes in runs (ie you get a block or complex one, then a block of simple ones). This function allows you to change the render regions idea of whether the nodes are complex or simple.
virtual void DrawPathToOutputDevice (Path *PathToRender, PathShape shapePath=PATHSHAPE_PATH)
 Renders a path black if we are in a complex run, or white if not.
virtual void DrawRect (DocRect *RectToRender)
 Renders a path black if we are in a complex run, or white if not.
virtual void DrawLine (const DocCoord &StartPoint, const DocCoord &EndPoint)
 Renders a path black if we are in a complex run, or white if not.
virtual void DrawPixel (const DocCoord &Point)
 Renders a path black if we are in a complex run, or white if not.
virtual void DrawBitmap (const DocCoord &Point, KernelBitmap *pBitmap)
 Renders a path black if we are in a complex run, or white if not.
virtual void DrawBitmap (const DocCoord &Point, UINT32 BitmapID, UINT32 ToolID=NULL)
 Renders a path black if we are in a complex run, or white if not.
virtual BOOL DrawTransformedBitmap (NodeBitmap *pNodeBitmap)
 Renders a path black if we are in a complex run, or white if not.
virtual BOOL RenderChar (WCHAR ch, Matrix *pMatrix)
 Renders a char into the mask sometimes - there are times when we do not want the char to render - eps when we are dealing with postscript, where what we render and what postscript renders may be different.
virtual WinRect CalculateWinRect (Matrix &RenderMatrix, const DocRect &docrect, const double dpi)
 To convert a rectangle in Doc coordinates to a rectangle in Win coordinates taking account of the destination dpi rather than assuming screen dpi. Virtual so that it can be overriden by different render regions if so required.
virtual GMATRIX MakeGavinMatrix (Matrix NewRenderMatrix, DocRect ClipRect, double dPixelsPerInch, BOOL bMasterCapture)
 Make a Gavin Matrix out of a Kernel Matrix.
virtual void SetOffscreen (OffscreenAttrValue *)
 Create a new bitmap into which, the subtree rooted at this attributes parent, will be rendered. Then call base version to push the current OffscreenAttr onto the context stack.
virtual void RestoreOffscreen (OffscreenAttrValue *)

Private Attributes

BOOL IsComplexRun

Detailed Description

This is a simplified version of the MaskedRenderRegion. It does not have to cope with a mix of complex and simple shapes to be rendered, but knows that there will be a run of complex shapes and then all the rest will be simple.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/7/95

Definition at line 118 of file pmaskrgn.h.


Constructor & Destructor Documentation

PrintingMaskedRenderRegion::PrintingMaskedRenderRegion DocRect  Rect,
Matrix  Mat,
FIXED16  Scale,
double  dpi,
BOOL  Printing
 

Constructs a PrintingMaskedRenderReigon 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.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/7/95
Parameters:
Rect - The Clip Rect of the region [INPUTS] Mat - the rendering matrix to use Scale - the View Scale dpi - the dpi to render to

Definition at line 135 of file pmaskrgn.cpp.

00135                                                                                                                          :
00136 MaskedRenderRegion(Rect, Mat, Scale, dpi)
00137 {
00138     // Default to a non complex run
00139     IsComplexRun = FALSE;
00140     RenderFlags.Printing = Printing;
00141 }

PrintingMaskedRenderRegion::~PrintingMaskedRenderRegion  ) 
 

destructor - the base classes do all the work here

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/7/95

Definition at line 154 of file pmaskrgn.cpp.

00155 {
00156 }


Member Function Documentation

WinRect PrintingMaskedRenderRegion::CalculateWinRect Matrix RenderMatrix,
const DocRect docrect,
const double  dpi
[virtual]
 

To convert a rectangle in Doc coordinates to a rectangle in Win coordinates taking account of the destination dpi rather than assuming screen dpi. Virtual so that it can be overriden by different render regions if so required.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/96
Parameters:
DocRect is a rectangle on document co-ords. [INPUTS] dpi is the resolution of the device we are rendering to
RenderMatrix is the rendering matrix, may have e anf f components changed by the call [OUTPUTS]
Returns:
Object containing the new rectangle coordinates.
See also:
OSRenderRegion::DocRectToWin;

Reimplemented from GRenderBitmap.

Definition at line 177 of file pmaskrgn.cpp.

00179 {
00180     // lets get the Rect into screen co-ords so we can use our big screen bitmap
00181     // Use a version of OSRenderRegion::DocRectToWin that uses the actual dpi we have stored
00182     // in PixelsPerInch
00183     // This goes back to the GRenderRegion form rather than the GRenderBitmap special form
00184 
00185     return OSRenderRegion::BitmapDocRectToWin( RenderMatrix, docrect, dpi );
00186 //  return OSRenderRegion::DocRectToWin( RenderMatrix, docrect, dpi );
00187 }

void PrintingMaskedRenderRegion::DrawBitmap const DocCoord Point,
UINT32  BitmapID,
UINT32  ToolID = NULL
[virtual]
 

Renders a path black if we are in a complex run, or white if not.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/7/95
Parameters:
Point - the point to draw the bitmap at [INPUTS] BitmapID - The ID of the bitmap to draw ToolID - the ID of the tool the resource is part of

Reimplemented from MaskedRenderRegion.

Definition at line 438 of file pmaskrgn.cpp.

00439 {
00440     // Save the context
00441     SaveContext();
00442 
00443     // Does this shape make use of complex things
00444     if (IsComplexRun)
00445         SetNextShapeColour(Black);
00446     else
00447         SetNextShapeColour(White);
00448 
00449     // Draw the Bitmap
00450     GRenderBitmap::DrawBitmap(Point, BitmapID, ToolID);
00451 
00452     // restore the context
00453     RestoreContext();
00454 }

void PrintingMaskedRenderRegion::DrawBitmap const DocCoord Point,
KernelBitmap pBitmap
[virtual]
 

Renders a path black if we are in a complex run, or white if not.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/7/95
Parameters:
Point - The point to draw the bitmap at [INPUTS] pBitmap - at the bitmap

Reimplemented from MaskedRenderRegion.

Definition at line 406 of file pmaskrgn.cpp.

00407 {
00408     // Save the context
00409     SaveContext();
00410 
00411     // Does this shape make use of complex things
00412     if (IsComplexRun)
00413         SetNextShapeColour(Black);
00414     else
00415         SetNextShapeColour(White);
00416 
00417     // Draw the bitmap
00418     GRenderBitmap::DrawBitmap(Point, pBitmap);
00419 
00420     // restore the context
00421     RestoreContext();
00422 }

void PrintingMaskedRenderRegion::DrawLine const DocCoord StartPoint,
const DocCoord EndPoint
[virtual]
 

Renders a path black if we are in a complex run, or white if not.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/7/95
Parameters:
StartPoint,EndPoint - the ends of the line [INPUTS]

Reimplemented from MaskedRenderRegion.

Definition at line 344 of file pmaskrgn.cpp.

00345 {
00346     // Save the context
00347     SaveContext();
00348 
00349     // Does this shape make use of complex things
00350     if (IsComplexRun)
00351         SetNextShapeColour(Black);
00352     else
00353         SetNextShapeColour(White);
00354 
00355     // Draw the Line
00356     GRenderBitmap::DrawLine(StartPoint, EndPoint);
00357 
00358     // restore the context
00359     RestoreContext();
00360 }

void PrintingMaskedRenderRegion::DrawPathToOutputDevice Path PathToRender,
PathShape  shapePath = PATHSHAPE_PATH
[virtual]
 

Renders a path black if we are in a complex run, or white if not.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/7/95
Parameters:
PathToRender - the path to render [INPUTS]

Reimplemented from MaskedRenderRegion.

Definition at line 245 of file pmaskrgn.cpp.

00246 {
00247     // Save the context
00248     SaveContext();
00249 
00250     // Does this shape make use of complex things
00251     if (IsComplexRun)
00252         SetNextShapeColour(Black);
00253     else
00254         SetNextShapeColour(White);
00255 
00256     // Draw the path
00257     GRenderBitmap::DrawPathToOutputDevice(PathToRender);
00258 
00259 /*  BOOL RenderFill = FALSE;
00260 
00261     // Get the current fill attr
00262     FillGeometryAttribute* pFillAttr = (FillGeometryAttribute*) CurrentAttrs[ATTR_FILLGEOMETRY].pAttr;
00263 
00264     if (pFillAttr->GetBitmap() != NULL && pFillAttr->GetBitmap()->GetBPP() <= 8)
00265     {
00266         INT32 TranspIndex;
00267 
00268         // If it's a masked bitmap fill, then we'll need to actually render it
00269         // (but we'll force all the non-masked pixels to be rendered black)
00270         if (pFillAttr->GetBitmap()->GetTransparencyIndex(&TranspIndex))
00271             RenderFill = TRUE;
00272     }
00273 
00274     if (RenderFill)
00275     {
00276         BOOL OldVMState = RenderFlags.VeryMono;
00277         RenderFlags.VeryMono = TRUE;    // Forces non-masked pixels to be plotted black
00278 
00279         // Draw the path, with the bitmap fill
00280         GRenderBitmap::DrawPathToOutputDevice(PathToRender);
00281 
00282         RenderFlags.VeryMono = OldVMState;
00283     }
00284     else
00285     {
00286         // Does this shape make use of complex things
00287         if (IsComplexRun)
00288             SetNextShapeColour(Black);
00289         else
00290             SetNextShapeColour(White);
00291 
00292         // Draw the path
00293         GRenderBitmap::DrawPathToOutputDevice(PathToRender);
00294     }
00295 */  
00296     
00297     // restore the context
00298     RestoreContext();
00299 }

void PrintingMaskedRenderRegion::DrawPixel const DocCoord Point  )  [virtual]
 

Renders a path black if we are in a complex run, or white if not.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/7/95
Parameters:
Point - the point to draw the pixel at [INPUTS]

Reimplemented from MaskedRenderRegion.

Definition at line 374 of file pmaskrgn.cpp.

00375 {
00376     // Save the context
00377     SaveContext();
00378 
00379     // Does this shape make use of complex things
00380     if (IsComplexRun)
00381         SetNextShapeColour(Black);
00382     else
00383         SetNextShapeColour(White);
00384 
00385     // Draw the Pixel
00386     GRenderBitmap::DrawPixel(Point);
00387 
00388     // restore the context
00389     RestoreContext();
00390 }

void PrintingMaskedRenderRegion::DrawRect DocRect RectToRender  )  [virtual]
 

Renders a path black if we are in a complex run, or white if not.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/7/95
Parameters:
The rect to render [INPUTS]

Reimplemented from MaskedRenderRegion.

Definition at line 313 of file pmaskrgn.cpp.

00314 {
00315     // Save the context
00316     SaveContext();
00317 
00318     // Does this shape make use of complex things
00319     if (IsComplexRun)
00320         SetNextShapeColour(Black);
00321     else
00322         SetNextShapeColour(White);
00323 
00324     // Draw the Rect
00325     GRenderBitmap::DrawRect(RectToRender);
00326 
00327     // restore the context
00328     RestoreContext();
00329 }

BOOL PrintingMaskedRenderRegion::DrawTransformedBitmap NodeBitmap pNodeBitmap  )  [virtual]
 

Renders a path black if we are in a complex run, or white if not.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/7/95
Parameters:
pNodeBitmap - the Node bitmap to render [INPUTS]

Reimplemented from MaskedRenderRegion.

Definition at line 468 of file pmaskrgn.cpp.

00469 {
00470     // Save the context
00471     SaveContext();
00472 
00473     // Does this shape make use of complex things
00474     if (IsComplexRun)
00475         SetNextShapeColour(Black);
00476     else
00477         SetNextShapeColour(White);
00478 
00479     // Draw the Bitmap
00480     BOOL Result = GRenderBitmap::DrawTransformedBitmap(pNodeBitmap);
00481 
00482 /*  BOOL Result = TRUE;
00483     
00484     // Work out if we can do this bitmap directly
00485     BOOL CanDoBitmap = FALSE;
00486 
00487     // Does this shape make use of complex things
00488     if (!(IsComplexRun || pNodeBitmap->NeedsTransparency()))
00489     {
00490         // See what kind of bitmaps this render region can do
00491         if (HostCaps.ArbitraryBitmaps)
00492         {
00493             // We can do anything...
00494             CanDoBitmap = TRUE;
00495         }
00496         else
00497         {
00498             if (HostCaps.SimpleBitmaps)
00499             {
00500                 // Check that the bitmap area is rectangular, and is perpendicular to
00501                 // the x and y axes.
00502                 if (pNodeBitmap->HasSimpleOrientation(this))
00503                 {
00504                     // Yes - simple scaling - the render region can do this.
00505                     CanDoBitmap = TRUE;
00506                 }
00507             }
00508         }
00509     }
00510 
00511     // Here we set up reasonable attributes - we want to fill the bitmap
00512     // path but not stroke it.  NB. This is very important - do not remove
00513     // otherwise the mask will be wrong!
00514     SetFillColour(DocColour(COLOUR_BLACK));
00515     SetLineColour(DocColour(COLOUR_NONE));
00516 
00517     if (CanDoBitmap)
00518     {
00519         SetNextShapeColour(White);
00520 
00521         // Draw the path (that represents the bitmap object)
00522         GRenderBitmap::DrawPathToOutputDevice(&pNodeBitmap->InkPath);
00523     }
00524     else
00525     {
00526         if (pNodeBitmap->NeedsTransparency())
00527         {
00528             // It's a masked bitmap, so we'll need to actually render the non-masked
00529             // pixels as black 
00530             BOOL OldVMState = RenderFlags.VeryMono;
00531             RenderFlags.VeryMono = TRUE;    // Forces non-masked pixels to be plotted black
00532 
00533             // Call base class to plot the bitmap
00534             RenderRegion::DrawTransformedBitmap(pNodeBitmap);
00535 
00536             RenderFlags.VeryMono = OldVMState;
00537         }
00538         else
00539         {
00540             SetNextShapeColour(Black);
00541 
00542             // Draw the path (that represents the bitmap object)
00543             GRenderBitmap::DrawPathToOutputDevice(&pNodeBitmap->InkPath);
00544         }
00545     }
00546 */
00547 
00548     // restore the context
00549     RestoreContext();
00550 
00551     // return if it worked or not
00552     return Result;
00553 }

GMATRIX PrintingMaskedRenderRegion::MakeGavinMatrix Matrix  NewRenderMatrix,
DocRect  ClipRect,
double  dPixelsPerInch,
BOOL  bMasterCapture
[virtual]
 

Make a Gavin Matrix out of a Kernel Matrix.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> (from Will (from Phil code))
Date:
??/??/2004
Parameters:
The Kernel Matrix and cliprect to use to create the Gavin Matrix. [INPUTS]
Returns:
TRUE if the GMatrix was created ok.
See also:
GRenderRegion::SetGavinMatrix Notes: Doesn't rely on current state of CurrentClipRect like the above version

Reimplemented from GRenderBitmap.

Definition at line 204 of file pmaskrgn.cpp.

00205 {
00206     // Bypass the behaviour inherited from GRenderBitmap because we don't want it
00207     return GRenderRegion::MakeGavinMatrix(NewRenderMatrix, ClipRect, dPixelsPerInch, bMasterCapture);
00208 }

BOOL PrintingMaskedRenderRegion::RenderChar WCHAR  ch,
Matrix pMatrix
[virtual]
 

Renders a char into the mask sometimes - there are times when we do not want the char to render - eps when we are dealing with postscript, where what we render and what postscript renders may be different.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/8/95
Parameters:
ch - the char to render [INPUTS]
pMatrix - the matrix to use to render with [OUTPUTS]
Returns:
TRUE if it worked, FALSE if not.

Reimplemented from RenderRegion.

Definition at line 573 of file pmaskrgn.cpp.

00574 {
00575     // Save the context
00576     SaveContext();
00577 
00578     // Get ready to return
00579     BOOL Result = TRUE;
00580     
00581     // Does this shape make use of complex things
00582     // if it is not complex them do not try and punch it out of the mask, as this
00583     // causes problems on postscript devices.
00584     if (IsComplexRun)
00585     {
00586         SetNextShapeColour(Black);
00587         Result = GRenderBitmap::RenderChar(ch, pMatrix);
00588     }
00589 
00590     // restore the context
00591     RestoreContext();
00592 
00593     // return
00594     return Result;
00595 }

virtual void PrintingMaskedRenderRegion::RestoreOffscreen OffscreenAttrValue  )  [inline, virtual]
 

Reimplemented from MaskedRenderRegion.

Definition at line 158 of file pmaskrgn.h.

00159     {
00160     }

void PrintingMaskedRenderRegion::SetMaskDrawingMode BOOL  OnOff  ) 
 

The render region can either be rendering simple nodes or complex nodes in runs (ie you get a block or complex one, then a block of simple ones). This function allows you to change the render regions idea of whether the nodes are complex or simple.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/7/95
Parameters:
OnOff - TRUE means the nodes we are about render will all be treated as [INPUTS] complex nodes. FALSE means that all the nodes we are about to render are treated as simple nodes.

Definition at line 227 of file pmaskrgn.cpp.

00228 {
00229     // Set our bool, making sure that it is always either TRUE or FALSE
00230     IsComplexRun = (OnOff) ? TRUE : FALSE;
00231 }

virtual void PrintingMaskedRenderRegion::SetOffscreen OffscreenAttrValue  )  [inline, virtual]
 

Create a new bitmap into which, the subtree rooted at this attributes parent, will be rendered. Then call base version to push the current OffscreenAttr onto the context stack.

Following only used by GRenderRegion version ** info pointer to bmp info struct which we will setup. bits pointer to bitmap bits which we'll setup.

See also:
GRenderRegion::RestoreOffscreen; GRenderRegion::

Reimplemented from MaskedRenderRegion.

Definition at line 155 of file pmaskrgn.h.

00156     {
00157     }


Member Data Documentation

BOOL PrintingMaskedRenderRegion::IsComplexRun [private]
 

Definition at line 164 of file pmaskrgn.h.


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