GRenderRegion Class Reference

Encapsulates rendering using Gavins routines (ie. into a bitmap). This object is created when something needs rendering using Gavins routines eg. When anti-aliasing. See RenderRegion notes for more general details of this class. This is an abstract class - see GRenderDIB or GRenderDDB for implementations. More...

#include <grndrgn.h>

Inheritance diagram for GRenderRegion:

RenderRegion ListItem CCObject SimpleCCObject GRenderDIB GRenderWinG GRenderBitmap GRenderBrush GRenderClick GRenderPrint GRenderOptPalette MaskedRenderRegion GRenderClickColour PrintingMaskedRenderRegion GRenderClickColourNoPaper List of all members.

Public Member Functions

 GRenderRegion ()
 GRenderRegion (DocRect ClipRegion, Matrix ConvertMatrix, FIXED16 ViewScale, UINT32 Depth, double dpi)
 Constructor for a GRenderRegion. 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.
virtual ~GRenderRegion ()
 Default Destructor for GRenderRegion Class. Frees up memory.
virtual BOOL CopyRenderInfo (const RenderRegion &Other)
 Copies all the parameters from the render region 'Other' into this render region. This was written for the region merging code. When a new region is created, due to existing regions being split up, it should be based on the original region, with a different clipping rectangle.
virtual BOOL AttachDevice (View *, wxDC *, Spread *=NULL, bool fOwned=false)
virtual BOOL InitDevice ()
 Initialises the render region's connection to the device information passed in to RenderRegion::AttachDevice.
BOOL StartRender ()
 Initialises an GRenderRegion for rendering. Sets up a bitmap and gmatrix ready for gdraw rendering.
BOOL StopRender ()
 Stops the rendering of a GRenderRegion, saving it's current renderstate so that rendering can continue where it left off, later on. Copies the gdraw internal bitmap to its final resting place (e.g. the screen). Also tidies up windows' palette.
virtual void SetClean (BOOL bResetChangedBounds, BOOL FillWhite)
 Informs the GRenderRegion that it should consider it's bitmap image to be clean, i.e. it's an accurate representation of what is on screen already, so there is no need to blit it. This is used in conjunction with the PaperRenderRegion to avoid unnecessary blits.
virtual BOOL IsClean ()
void DrawPathToOutputDevice (Path *PathToDraw, PathShape shapePath=PATHSHAPE_PATH)
 Renders a path object using gavins routines.
void DrawRect (DocRect *RectToRender)
void DrawDragRect (DocRect *RectToRender)
void DrawLine (const DocCoord &StartPoint, const DocCoord &EndPoint)
void DrawBlob (DocCoord p, BlobType type)
void DrawPixel (const DocCoord &Point)
void DrawCross (const DocCoord &Point, const UINT32 Size)
void DrawBitmap (const DocCoord &Point, KernelBitmap *pBitmap)
void DrawBitmap (const DocCoord &Point, UINT32 BitmapID, UINT32 ToolID=NULL)
void DrawBitmap (const DocRect &rect, KernelBitmap *pBitmap)
void DrawBitmapBlob (const DocCoord &Point, KernelBitmap *BlobShape)
void DrawBitmapBlob (const DocCoord &Point, ResourceID resID)
void DrawFixedSystemText (StringBase *TheText, DocRect &BoundsRect, UINT32 uFormat=DEFAULT_TEXT_FORMATTING)
 To draw simple text, using the default host-operating-system font. The size and style of this font are decided by the host OS (or oil code) and cannot be set in any way. To determine how much space is needed to display a string with this method, see the SeeAlso.
void SetFixedSystemTextColours (DocColour *TextCol, DocColour *Background)
 To set the text and background colour(s) for any FixedSystem text rendered in this render region in the future (within the current rendering pass).
void GetFixedSystemTextSize (StringBase *TheText, DocRect *BoundsRect, double *atDpi=NULL)
 To determine how much room is needed to plot a bit of text with RenderRegion::DrawFixedSystemText.
void InitClipping ()
void InitAttributes ()
void SetLineAttributes ()
void SetFillAttributes ()
void SetOSDrawingMode ()
void SetQualityLevel ()
 Does nothing.
void Restore (RenderRegion *)
BOOL RenderGradFillPath (Path *, GradFillAttribute *)
 Fills a grad filled path (linear or radial).
BOOL RenderBitmapFill (Path *, BitmapFillAttribute *)
virtual void SetSolidColours (BOOL SetSolid)
GDrawContextGetDrawContext () const
virtual WinRect CalculateWinRect (Matrix &RenderMatrix, const DocRect &docrect, const double dpi)
 To create bitmap from wxBitmap structure. To free bitmap 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 WinRect CalculateWinRect (const DocRect &docrect)
void SetDeepDIB (BOOL Value)
const RGBQUADGet32BitRGBQuadData ()
UINT32 GetSizeOfRGBQuadData ()
void SetDoCompression (BOOL bDoCompression)
void SetDoBitmapConversion (BOOL bEnable)
DocRect GetChangedRect ()
void SetBitmapPointers (LPBITMAPINFO bi, LPBYTE by)
BOOL GetBitmapPointers (LPBITMAPINFO *ppInfo, LPBYTE *ppBits, BOOL bCorrectTransparency=TRUE)
double GetScaledPixelWidthDouble ()
void SetSimulatePrinting (UINT32 PrintType)
virtual void GetRenderRegionCaps (RRCaps *pCaps)
 This function allows a render region to declare what it can render and what it can not render. This base class version of the function says that it can render none of the options. If your render region can do some of these things then you should overide this function and set the appropriate flags.
virtual SlowJobResult DrawMaskedBitmap (const DocRect &Rect, KernelBitmap *pBitmap, MaskedRenderRegion *pMask, ProgressDisplay *Progress)
 Plots the bitmap using the mask supplied. The base class implementation here does nothing.
void SetForceBitmapSmoothing (BOOL ForceSmoothing)
BOOL IsForcingBitmapSmoothing ()
void SetDitherStyle8Bit (INT32 DitherStyle)
virtual void ResetRegion (DocRect &NewClipRect)
 Resets the render region (after it has been merged), so that it no longer thinks it is banded etc. It also takes the Regions rectangle from the Current Clipping rectangle, so set this correctly before calling this function.
void FreeOffscreenState ()
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 *)
BOOL RenderBitmapWithTransparency (Path *, BitmapFillAttribute *, BitmapTranspFillAttribute *)
 Helper function for RenderBitmapFill and SetBitmapTransparencyFill. Used to work out whether or not to smooth bitmap fills/transparencies. Helper function for RenderBitmapFill and SetBitmapTransparencyFill. Used to work out whether or not to smooth bitmap fills/transparencies. Helper function for RenderBitmapFill and SetBitmapTransparencyFill. Used to work out whether or not to smooth bitmap fills/transparencies. Helper function for RenderBitmapFill and SetBitmapTransparencyFill. Used to work out whether or not to smooth bitmap fills/transparencies. Helper function for RenderBitmapFill and SetBitmapTransparencyFill. Sets the smoothing flags using SetBitmapSmoothingFlag and SetTileFilteringFlag. These flags determine the quality of subsequent SetBitmapFill / SetTransparentBitmapFill operations. Fills a shape with a bitmap Initialises a Transparency fill. Scope: ProtectedSets up a fractal fill. Scope: ProtectedSets up a fractal transparency fill. Scope: ProtectedRenders a rectangle using gavins routines. Rectangles are not anti-aliased. Does NOTHING AT ALL as gdraw cannot do xor plotting Does NOTHING AT ALL as gdraw cannot do xor plotting Renders a line using gdraw. Draws an un-scaled Bitmap. Use this for drawing Icons for dialogue boxes etc. The Bitmap can be any size, but will be plotted unscaled. Note that 'Point' specifies where the bottom left of the bitmap will be.Draws an un-scaled Bitmap. Use this for drawing Icons for dialogue boxes etc. The Bitmap can be any size, but will be plotted unscaled. Note that 'Point' specifies where the bottom left of the bitmap will be.Draws an un-scaled Bitmap. Use this for drawing Icons for dialogue boxes etc. The Bitmap can be any size, but will be plotted unscaled. Note that 'Point' specifies where the bottom left of the bitmap will be.To draw simple text, using the default host-operating-system font. The size and style of this font are decided by the host OS (or oil code) and cannot be set in any way. To determine how much space is needed to display a string with this method, see the SeeAlso.To set the text and background colour(s) for any FixedSystem text rendered in this render region in the future (within the current rendering pass).To determine how much room is needed to plot a bit of text with GRenderRegion::DrawFixedSystemTextDraw an Arrow head on the start or end of a line. Updates the GMATRIX used for rendering. Make a Gavin Matrix out of a Kernel Matrix Sets Gavins drawing colour. He does not distinguish between line & fill colours - the caller has to do that. Sets Gavins drawing colour. He does not distinguish between line & fill colours - the caller has to do that. Allows the dithering of colours to be turned off so they look the same using GDraw as they do with the GDI.Calculates the size of a Pixel in MILLIPOINTS, based on the output DPI but IGNORES the scale factor. Calculates the size of a Pixel in MILLIPOINTS, based on the output DPI but IGNORES the scale factor. Calculates the size of a Pixel in MILLIPOINTS, based on the output DPI and current scale factor. Calculates the size of a Pixel in MILLIPOINTS, based on the output DPI and current scale factor. Returns the true scaled pixel width of this GRenderRegion, to the accuracy of a double. GetScaledPixelWidth() returns a whole number, which is highly inaccurate at high zooms - eg SPW at 6031% is usually 750 / 60.31 = 12.44ish but GetScaledPixelWidth() returns 12. This method is useful if your code needs precise conversion between millipoints and pixels.Called after the Quality setting has been changed on the region. We have to recalculate the antialiasing & flatness settings. Also used by StartRender.Gets ready to do actual rendering. In this case it does nothing. bitmap. Initialise the device specific mechanisms for this render region. IN this case the bitmap is allocated, so can fail. Determines whether a GRenderRegion can be created for rendering. A NULL return should NOT be tested with ENSURE, it is a perfectly valid return result. Slightly misleading name for historic reasons. Actually plots any depth bitmap on any device, without any special handling. Use as a fallback when the more specialist versions are not suitable.Plot high colour bitmap (16 or 32-bits) to a 256 colour device. If we let GDI do this it would take a very long time, so we convert to an intermediate bitmap first. NEW - also plots to a 16-colour device. Will ENSURE if not 16- or 256-colours.If can do PAL_INDICES, just does that, else fills in the RGB quads in the DIB and returns DIB_RGB_COLOR. Only really make sense to call on 16 or 256 colour bitmaps. Plot the DIB as fast as possible to the display surface. IMPORTANT: Only works on SCREEN devices. Plot the DIB as fast as possible to the display surface. Member function version. There is also a more general static version (which this uses). This member fn one uses the ChangedBBox for optimal blitting. Plot a bitmap to a device of the same colour depth.For the main window to get a Gavin-approved logical palette. Scope: StaticDraws a cross in the render region. The cross consists of a vertical line 'Size' millipoints high, and a horizontal line 'Size' millipoints wide.Used to know whether StrokePathToPath will fail. If we don't have GDraw, we cannot do this, if we do, we can. Scope: StaticUsed for rendering complex strokes when the native system cannot do it (e.g. GDI16). Scope: StaticInitialises GDraw for rendering into 8bpp bitmapsCalls SelectPalette for the static GDraw context and sets the palette Scope: Static publicSets up a sensible palette for error diffusion It sets 3 of the entries to black to avoid them being used Scope: Static protectedGiven a ptr to a ClipRegionAttribute, generate an appropriate GDraw clipping region and return it. Sets the flag which indicates that we are rendering to a 32bit bitmapDelete and free memory used by all clip regions which this render region has stored.Intended solely for use by the feathering and shadowing systems, both of which make use of a bitmap blurring algorithm which can sometimes return a blurred bitmap up and right by half a pixel.This function allows a GRenderRegion to declare what it can render and what it can not render. This allows us to pretend to be a simple render region when doing onscreen print previews.This function tells a GRenderRegion to simulate printing This allows us to pretend to be a simple render region when doing onscreen print previews.Plots the bitmap using the mask supplied.Plots the bitmap using the mask supplied.To get the changed rectangle so far To start a bitmap capture of whatever is subsequently rendered To stop a bitmap capture To inform the capture stack that things (transparency) have changedTo setup a direct capture if that is possible Render the current state of the capture stack into the specified bitmap (For use when rendering is interrupted) (For use when capture must be collapsed from 32BPP to 24BPP without affecting the master bitmap)Search down the Capture stack from the top or from the capture specified until we find one that owns a bitmap. The master capture at the bottom of the stack should ALWAYS own a bitmap!Render the current state of the capture stack into the specified bitmap (For use when rendering is interrupted)To connect this renderregion to a bitmap along with clipping and view transformation information (a "capture") Discover whether this transparency type can be rendered into RGBT bitmap by GDraw. (Things like stain and bleach cannot be accurately captured in the T channel of the RGBT bitmap.) Map Camelot's internal transp type to GDraw's transp type Notes: This function only understands FLAT and GRAD - it will never map a Camelot transparency type to one of GDraw's "Colour and transp" valuesTo set the bitmap pointers for the master capture only, updating both the working members and the versions stored in the master capture. To get the bitmap pointers for the master capture only. Toggles state of gdraw flag then forces a redraw. Constructor for OpGDraw operation. It is not undoable. This item is always available when GDraw is available.
virtual BOOL IsWrappedRender () const
virtual BOOL TranspTypeIsRGBTCompatible (UINT32 ttype) const
TransparencyEnum MapTranspTypeToGDraw (UINT32 ttype, BOOL bGraduated) const
virtual CaptureStartCapture (CCObject *pOwner, DocRect CaptureRect, CAPTUREINFO cinfo, BOOL bTransparent=TRUE, BOOL bCaptureBackground=FALSE, double mpPixelWidth=0, NodeRenderableInk *pDirectSupplier=NULL)
 To start a bitmap capture of whatever is subsequently rendered.
virtual BOOL StopCapture (CCObject *pOwner, BOOL bRender=TRUE, BOOL bReleaseBitmap=FALSE, LPBITMAPINFO *plpBitmapInfo=NULL, LPBYTE *plpBits=NULL, DocRect *pCaptureRect=NULL, Matrix *pmatTransform=NULL, double *pdResolution=NULL)
 To stop a bitmap capture.
virtual BOOL ChangeCapture (CAPTUREINFO cinfo, BOOL bTransparent=TRUE, BOOL bCaptureBackground=FALSE)
 To inform the capture stack that things (transparency) have changed.
virtual BOOL MasterCaptureIsCurrent () const
virtual BOOL RenderCurrentCaptureState (BOOL bStartFromMaster=FALSE)
virtual CaptureGetTopCaptureBitmap (Capture *pFromCapture=NULL) const
virtual BOOL TopCaptureIsDirect ()
virtual void SetClipRegion (ClipRegionAttribute *pClipAttr, BOOL Temp)
 Set the current ClipRegion for this RenderRegion. pClipAttr contains a path, and all future rendering will occur *through* that clipping path, after it is clipped to any pre-existing clipping region.
virtual void RestoreClipRegion (ClipRegionAttribute *pClipAttr, BOOL Temp)
 Set the current ClipRegion for this RenderRegion. pClipAttr contains a path, and all future rendering will occur *through* that clipping path, after it is clipped to any pre-existing clipping region.
void OffsetByHalfPixel ()
virtual BOOL GrabBitmap (DocRect *rectGrab, LPBITMAPINFO *plpBitmapInfo, LPBYTE *plpBits)

Static Public Member Functions

static BOOL Init ()
 Initialise the render region.
static RenderRegionCreate (DocRect ClipRegion, Matrix ConvertMatrix, FIXED16 ViewScale, RenderType, View *pView=NULL, BOOL bForce32BPP=FALSE)
static BOOL Init (BOOL)
 Determine possibility of using gdraw routines and determine various characterisitics of the screen.
static void DeInit ()
 Call once during termination to perform any necessary cleanup.
static BOOL CalcBlitMode (INT32 Wanted)
static GDrawContextSetTempDrawContext (GDrawContext *pContext)
static GDrawContextGetStaticDrawContext ()
static GDrawContextGetStaticDrawContext (INT32 DitherType)
static INT32 GetDefaultTransparency ()
static UINT32 SetPaletteEntries (LPBITMAPINFO lpBmi, wxDC *pOutputDC=NULL)
static LPBYTE StaticPlotBitmap (wxDC *pDC, UINT32 ColourFlag, LPBITMAPINFO lpBitmapInfo, LPBYTE lpBits, INT32 Left, INT32 Top, UINT32 Width, UINT32 Height, wxPalette *hPal, INT32, INT32)
static const LOGPALETTEGetRecommendedPalette ()
static BOOL StrokePathAvailable ()
static INT32 StrokePathToPath (CONST DocCoord *IPoints, CONST BYTE FAR *ITypes, size_t ILength, DocCoord *OPoints, BYTE *OTypes, DWORD OLength, BOOL Close, DWORD LineWidth, DWORD Flattening, LineCapType LineCaps, JointType LineJoin, CONST DashType *Dash)
static void GColInit (wxDC *, BOOL=FALSE)
static void PaletteHasChanged ()
static void EnsurePalette (INT32 PaletteFlag)
static LPLOGPALETTE GetErrorDiffPalette (void)
static void SetViewDither (INT32 dither)
static DWORD GetMaxBitmapWidth (void)
static DWORD GetMaxBitmapDepth (void)
static INT32 GetDefaultDPI ()

Protected Member Functions

GMATRIX SetGavinMatrix (GMATRIX *GMatrix)
virtual GMATRIX MakeGavinMatrix (Matrix NewRenderMatrix, DocRect ClipRect, double PixelsPerInch, BOOL bMasterCapture)
virtual double GetPixelsPerInch ()
MILLIPOINT CalcPixelWidth ()
double CalcPixelWidthDouble ()
MILLIPOINT CalcScaledPixelWidth ()
double CalcScaledPixelWidthDouble ()
BOOL GetTransparencyFill (TranspGradTable *, DWORD *)
virtual BOOL DrawArrowHead (ArrowRec &ArrowToDraw, DocCoord &Centre, DocCoord &Direction)
BOOL SetBitmapTransparencyFill (TranspFillAttribute *, DWORD *, TranspGradTable *)
BOOL SetFractalFill (ColourFillAttribute *, DWORD *)
BOOL SetFractalTransparencyFill (TranspFillAttribute *, DWORD *)
virtual LPBITMAPINFO GetLPBits (INT32 Width, INT32 Height, INT32 Depth, LPBYTE *)=0
virtual void FreeLPBits (LPBITMAPINFO, LPBYTE)=0
virtual BOOL DisplayBits (LPBITMAPINFO lpDisplayBitmapInfo=NULL, LPBYTE lpDisplayBits=NULL)=0
virtual void InitBmpBits ()
virtual BOOL StartRenderAfter (GMATRIX *)
 A virtual fn in this class which can be overridden if more work on a GMatrix is required. Default version returns TRUE.
virtual BOOL StartRenderMiddle ()
 A virtual fn in this class which can be overridden if more work on a lpBits is required. Default version returns TRUE.
virtual void DisplayCurrentState ()
 Make a temporary bitmap, copy current GRenderRegion bitmap into it then render other offscreen state into it before blitting it to screen Notes: This routine does a lot of bitmap copying and blitting so it is much slower than just blitting the current bitmap to screen!
void Display1to1Bitmap ()
void DisplayLtoHBitmap ()
void DisplayHto8Bitmap ()
void PlotBitmap (UINT32 ColourFlag)
void PlotBitmap (wxDC *pDC, UINT32 ColourFlag, INT32 Left, INT32 Top, UINT32 Width, UINT32 Height, wxPalette *hPal, INT32, INT32)
virtual BOOL SetRenderToCapture (Capture *pCapture, BOOL bApplyClipRegion=FALSE, BOOL bSetBitmap=TRUE)
virtual BOOL SetupDirectCapture (Capture *pNewCapture, NodeRenderableInk *pSupplier)
void SetIsWrapped (BOOL flag)
const REGIONMakeClipRegionFromClipAttr (ClipRegionAttribute *pClipAttr)
BOOL ApplyCurrentClipRegion ()
 Have a look at the current ClipRegionAttribute and make sure we set our clipping region accordingly. Details within the method.
void FreeStoredClipRegions ()
BOOL IsScaledUp (FillGeometryAttribute *Fill)
BOOL IsAt100Percent (FillGeometryAttribute *Fill)
BOOL IsDistorted (FillGeometryAttribute *Fill)
BOOL NeedToSmooth (FillGeometryAttribute *Fill, BOOL bAlreadyScaled)
virtual BOOL SetSmoothingFlags (FillGeometryAttribute *Fill)

Static Protected Member Functions

static void UpdateErrorDiffPalette (void)

Protected Attributes

GMATRIX CurrentGMatrix
RRCaps Caps
LPBITMAPINFO pBitmapInfo
LPBYTE pBits
UINT32 uBitmapDepth
UINT32 uLineSize
wxRect WRect
wxRect ScreenRect
double PixelsPerInch
double dScaledPixelWidth
wxPalette * hPalette
wxPalette * hPrevPalette
BOOL LocalBitmap
BOOL UseSolidColours
BOOL m_bForceBitmapSmoothing
BOOL m_bEnableConversion
BOOL ForceInitBmpBits
INT32 DitherStyle8Bit
BOOL HaveRenderedSomething
UINT32 m_ForcePrintingCaps
BOOL IsWrapped

Static Protected Attributes

static GDrawContextpRealGD = NULL
static GDrawContextGD = NULL
static GDrawContextErrorDiffContext = NULL
static UINT32 ClickTranspLimit = 255
 Determine how transparent rendered pixels may be before click detection will ignore them. E.g. 230 means pixels must be 90% transparent before they will be ignored.
static BOOL HighQualityAA = FALSE
 Determine whether to use GDraw's high quality anti-aliasing mode.
static INT32 BitmapConversion = 2
 Specifies which bitmap conversion algorithm is used by GDraw when rendering bitmaps in show printer colours mode.
static BOOL WantDoGDraw = TRUE
static UINT32 WantGDrawDepth
static BOOL WantHighColourDirect
static BOOL WantDeepGDraw
static INT32 WhichPalette
static INT32 WhichDither = 2
static INT32 WhichTransparency = 0
static INT32 ViewDither = 2
static BOOL CanDoGDraw
static BOOL CanDoPalIndices
static BOOL CanSetPalette
static INT32 ScreenDepth
static INT32 ScreenWidth
static INT32 ScreenHeight
static INT32 LogPixelsX
static INT32 LogPixelsY
static LPRGBQUAD Fixed256Palette
static BitmapConvertHint ScreenHinting
static INT32 LastPaletteFlag
static RealLogPalette ErrorDiffPalette

Private Member Functions

BOOL SetGCol (DocColour &) const
BOOL SetFillGCol (DocColour &) const
DocCoord DocCoordToG (const DocCoord &DocPoint)
void DocCoordToG (DocCoord *DocPoint)
BOOL StrokePath (const DocCoord *, const PathVerb *, UINT32, const DocCoord *, const PathVerb *, UINT32, BOOL DrawArrows=FALSE)
 sets the immediate render flag to the value specified Sits on top of GDraw_StrokePath that calculates Joins, Caps & Width then renders via GDraw. Does dashed lines too now. Also renders ArrowHeads in needed.

Friends

class GBrush
class OpGDraw
class GRenderRegionWrapper
class ConcurrentRenderer
class GDrawBorrower

Detailed Description

Encapsulates rendering using Gavins routines (ie. into a bitmap). This object is created when something needs rendering using Gavins routines eg. When anti-aliasing. See RenderRegion notes for more general details of this class. This is an abstract class - see GRenderDIB or GRenderDDB for implementations.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/5/93

Definition at line 154 of file grndrgn.h.


Constructor & Destructor Documentation

GRenderRegion::GRenderRegion  ) 
 

GRenderRegion::GRenderRegion DocRect  ClipRegion,
Matrix  ConvertMatrix,
FIXED16  ViewScale,
UINT32  Depth,
double  dpi
 

Constructor for a GRenderRegion. 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:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/5/93
Parameters:
ClipRect is a DocRect defining the invalid rectangle to be rendered. [INPUTS] ConvertMatrix is a Matrix for converting Doc coords to OS coords. ViewScale is the scale factor of the view, used to calculate how much to flatten paths. Depth is bitmap depth required. dpi is the pixels-per-inch which can be zero for screen resolution.
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 850 of file grndrgn.cpp.

00852     : RenderRegion(ClipRegion, ConvertMatrix, ViewScale)
00853 {
00854     pBitmapInfo = NULL;
00855     pBits       = NULL;
00856 #if USE_wxBITMAP
00857     pBitmap     = NULL;
00858     pBitmapData = NULL;
00859 #endif
00860 
00861 //  BitmapSize = 0;
00862     
00863     // If specified dpi is zero then use the calculated screen dpi otherwise use the specified value
00864     if (dpi == 0.0)
00865         PixelsPerInch = (double)LogPixelsX;
00866     else
00867         PixelsPerInch = dpi;
00868     ERROR3IF(PixelsPerInch < 4.0,"GRenderRegion PixelsPerInch < 4 dpi, is this good?");
00869 
00870     hPalette = NULL;
00871     hPrevPalette = NULL;
00872     uBitmapDepth = Depth;
00873 //GAT   FractalBitmap = NULL;
00874     UseSolidColours = FALSE;
00875     LocalBitmap = TRUE;                             // always local bitmap currently
00876     m_bEnableConversion = TRUE;
00877     dScaledPixelWidth = 0.0;
00878 
00879     if (LocalBitmap)
00880     {
00881         WRect = wxRect(0,0,0,0);
00882 
00883         // this ensure triggers up on bitmap export, so it is removed
00884         //ENSURE( (WRect.left>=0) && (WRect.top>=0), "neg wrect");
00885 
00886         #if DEBUG_BORDER
00887         // kludge the rectangle slightly
00888         WRect.left += 2; WRect.width -= 4;
00889         WRect.top += 2; WRect.height -= 4;
00890         #endif
00891     }
00892     else
00893         ENSURE(FALSE, "Non local bitmap error");
00894 
00895     // BG time slice should be 0.5 of a second due to blit overhead
00896     Timeslice = 500;
00897 
00898     // Set default dither type
00899     DitherStyle8Bit = WhichDither;
00900 
00901     m_DoCompression = FALSE;
00902 
00903     m_bForceBitmapSmoothing = FALSE;
00904     m_ForcePrintingCaps = FALSE;
00905 
00906     // Set the render caps up
00907     GetRenderRegionCaps(&Caps);
00908 
00909     // Ilan
00910     IsWrapped = FALSE;
00911 
00912     // Default to not forcing Init (allocation will force it anyway)
00913     ForceInitBmpBits = FALSE;
00914 
00915     RememberMe("Constructor");
00916 }

GRenderRegion::~GRenderRegion  )  [virtual]
 

Default Destructor for GRenderRegion Class. Frees up memory.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/5/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
- GRenderRegion::FreeOffscreenState()

Definition at line 934 of file grndrgn.cpp.

00935 {
00936 #ifdef RALPH
00937 #ifdef _DEBUG
00938     if(GetCurrentThreadId() == RalphDocument::GetImportingThreadID())
00939     {
00940         TRACE( _T("Whoop Whoop... GRenderRegion::~GRenderRegion called from load thread\n"));
00941         AfxDebugBreak();
00942     }
00943 #endif
00944 #endif
00945 
00946     if (RenderFlags.Rendering)
00947     {
00948         TRACE( _T("StopRender() was not called before destructor\n") );
00949         StopRender();
00950     }
00951 
00952 //GAT   if (FractalBitmap)
00953 //      delete FractalBitmap;
00954     
00955     // manual removal of the contents of our clip-maps.
00956     FreeStoredClipRegions();
00957 
00958     RememberMe("Destructor");
00959 }


Member Function Documentation

BOOL GRenderRegion::ApplyCurrentClipRegion  )  [protected]
 

Have a look at the current ClipRegionAttribute and make sure we set our clipping region accordingly. Details within the method.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
14 April 2000
Parameters:
[INPUTS] 
GDraw should have its clipping region and rectangle set so that rendering [OUTPUTS] only occurs within a region specified by the clipping path which the current ClipRegionAttribute is carrying.
Returns:
TRUE if successful, FALSE otherwise.

Errors: ERROR3 in DEBUG if we have no valid ptr to a ClipRegionAttribute. See also:

Definition at line 2392 of file grndrgn.cpp.

02393 {
02394 //  return TRUE;
02395 
02396     // note that we don't bother with any clipping unless we're actually doing something
02397     // useful, eg rendering.
02398     if (!RenderFlags.Rendering)
02399         return FALSE;
02400 
02401     // This is what we do...
02402     //
02403     //  1.  We keep a hash table containing clip regions, with an entry for each unique
02404     //      ClipRegionAttribute, so that we do the time-consuming (I assume!) make-region
02405     //      work as little as possible.
02406     //  2.  If we haven't seen a ClipRegionAttribute before, then we make a region from/for
02407     //      it and stick the association in the table for future look-up
02408     //  3.  We apply the clip region appropriate to the current attribute.
02409     //  4.  We do all the above for device clip rectangles too, which need to be re-applied
02410     //      whenever a new clip region is applied.
02411 
02412     // remember the current clip region, or make a new one for the current clipattr.
02413     BOOL            fSuccess    = FALSE;
02414     const REGION*   pClipRegion = NULL;
02415     ClipRegionAttribute* pClipAttr = RR_CLIPREGION();
02416 
02417     ERROR3IF(pClipAttr == NULL, "Doh! NULL ClipRegionAttribute in render region!");
02418 
02419     // if we don't have a clip-region, do a DeviceClipRectangle() with an 'infinite' rect.
02420     // this will reset GDraw's clip-rectangle to the size of its bitmap, and also
02421     // reset its clip-region to empty.
02422     if (pClipAttr->GetClipPath() == NULL)
02423     {
02424         RECT BigRect;
02425         BigRect.bottom  = BigRect.left  = INT32_MIN;
02426         BigRect.top     = BigRect.right = INT32_MAX;
02427         fSuccess = GetDrawContext()->DeviceClipRectangle(&BigRect);
02428     }
02429 
02430     // try to look up a clip-region for this clip-attr; failing that, create a new one
02431     // and store it.
02432     else
02433     {
02434 //      if (!m_ClipRegionMap.Lookup((void*)pClipAttr, ((void*&)pClipRegion)))
02435 //      {
02436 //          pClipRegion = MakeClipRegionFromClipAttr(pClipAttr);
02437 //          m_ClipRegionMap.SetAt((void*)pClipAttr, ((void*&)pClipRegion));
02438 //      }
02439         pClipRegion = GetTopCaptureBitmap()->GetCachedClipRegion(pClipAttr);
02440         if (pClipRegion==NULL)
02441         {
02442             pClipRegion = MakeClipRegionFromClipAttr(pClipAttr);
02443             GetTopCaptureBitmap()->SetCachedClipRegion(pClipAttr, pClipRegion);
02444         }
02445 
02446         fSuccess = GetDrawContext()->ClipRegion(pClipRegion);
02447     }
02448 
02449     return fSuccess;
02450 }

virtual BOOL GRenderRegion::AttachDevice View ,
wxDC *  ,
Spread = NULL,
bool  fOwned = false
[virtual]
 

Reimplemented from RenderRegion.

Reimplemented in GRenderClick, GRenderClickColour, and GRenderClickColourNoPaper.

static BOOL GRenderRegion::CalcBlitMode INT32  Wanted  )  [static]
 

MILLIPOINT GRenderRegion::CalcPixelWidth  )  [protected, virtual]
 

Implements RenderRegion.

double GRenderRegion::CalcPixelWidthDouble  )  [protected]
 

MILLIPOINT GRenderRegion::CalcScaledPixelWidth  )  [protected, virtual]
 

Implements RenderRegion.

double GRenderRegion::CalcScaledPixelWidthDouble  )  [protected]
 

WinRect GRenderRegion::CalculateWinRect const DocRect docrect  )  [virtual]
 

Definition at line 1525 of file grndrgn.cpp.

01526 {
01527     return CalculateWinRect(RenderMatrix, docrect, PixelsPerInch );
01528 }

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

To create bitmap from wxBitmap structure. To free bitmap 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 in PrintingMaskedRenderRegion, and GRenderBitmap.

Definition at line 1508 of file grndrgn.cpp.

01510 {
01511     // lets get the Rect into screen co-ords so we can use our big screen bitmap
01512     // Use a version of OSRenderRegion::DocRectToWin that uses the actual dpi we have stored
01513     // in PixelsPerInch
01514     // Ilan
01515     // I need this to use the supplied rectangle - docrect.
01516     // Looks like previous version was a typo so I am changing it here.
01517     // Karim 07/07/2000
01518     // I'm now changing this to actually _use_ the dpi param in its calculations.
01519     // I've checked, and I'm 99.99% certain this doesn't screw up any existing code.
01520     return OSRenderRegion::DocRectToWin( RenderMatrix, docrect, dpi );
01521 //  return OSRenderRegion::DocRectToWin( RenderMatrix, docrect, PixelsPerInch );
01522 //  return OSRenderRegion::DocRectToWin( RenderMatrix, CurrentClipRect, PixelsPerInch );
01523 }

virtual BOOL GRenderRegion::ChangeCapture CAPTUREINFO  cinfo,
BOOL  bTransparent = TRUE,
BOOL  bCaptureBackground = FALSE
[virtual]
 

To inform the capture stack that things (transparency) have changed.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/07/2004
Parameters:
- [INPUTS]
- [OUTPUTS]

Reimplemented from RenderRegion.

BOOL GRenderRegion::CopyRenderInfo const RenderRegion Other  )  [virtual]
 

Copies all the parameters from the render region 'Other' into this render region. This was written for the region merging code. When a new region is created, due to existing regions being split up, it should be based on the original region, with a different clipping rectangle.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/94
Parameters:
Other - The render region to get the info out of [INPUTS]
Returns:
FALSE if failed, TRUE if worked.

Reimplemented from RenderRegion.

Definition at line 1007 of file grndrgn.cpp.

01008 {
01009     RememberMe("CopyRenderInfo");
01010 
01011     if (!RenderRegion::CopyRenderInfo( Other ))
01012         return FALSE;
01013 
01014     ENSURE( Other.IsKindOf( CC_RUNTIME_CLASS(GRenderRegion) ) , "CopyRenderOther wrong class" );
01015 
01016     // safe to cast now
01017     const GRenderRegion *GOther = (GRenderRegion*)&Other;
01018 
01019     // copy most of the member variables
01020     LocalBitmap = GOther->LocalBitmap;
01021     if (LocalBitmap)
01022     {
01023         // leave WRect alone
01024         ScreenRect = wxRect(0,0,0,0);
01025     }
01026     else
01027     {
01028         // (hmm, untested dubious code)
01029         WRect = GOther->WRect;
01030         ScreenRect = GOther->ScreenRect;
01031     }
01032 
01033     PixelsPerInch = GOther->PixelsPerInch;
01034     dScaledPixelWidth = GOther->dScaledPixelWidth;
01035     hPalette = GOther->hPalette;
01036     hPrevPalette = NULL;
01037 
01038     return TRUE;
01039 }

static RenderRegion* GRenderRegion::Create DocRect  ClipRegion,
Matrix  ConvertMatrix,
FIXED16  ViewScale,
RenderType  ,
View pView = NULL,
BOOL  bForce32BPP = FALSE
[static]
 

void GRenderRegion::DeInit void   )  [static]
 

Call once during termination to perform any necessary cleanup.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/4/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Static

Definition at line 789 of file grndrgn.cpp.

00790 {
00791 /*  if (Fixed256Palette != NULL)
00792     {
00793         CCFree(Fixed256Palette);
00794         Fixed256Palette = NULL;
00795     }
00796 */
00797     ERROR3IF(GD != pRealGD, "GDraw context not restored in GRenderRegion::DeInit");
00798     
00799     GD = NULL;
00800 
00801     if (pRealGD)
00802     {
00803         delete pRealGD;
00804         pRealGD = NULL;
00805     }
00806 
00807     // Clean up the DIBConvert classes
00808     DIBConvert::DeInit();
00809 
00810     if (ErrorDiffContext != NULL)
00811     {
00812         delete ErrorDiffContext;
00813         ErrorDiffContext = NULL;
00814     }
00815 
00816 //  GRenderWinG::Deinit();
00817 
00818     // Scary critical section stuff
00819 //  CriticalSection::DeInit();  // Not required for CDraw
00820     
00821     // Make sure GBrush doesn't leave any memory leaks lying around
00822     GBrush::DeinitGBrush();
00823 }

void GRenderRegion::Display1to1Bitmap  )  [protected]
 

virtual BOOL GRenderRegion::DisplayBits LPBITMAPINFO  lpDisplayBitmapInfo = NULL,
LPBYTE  lpDisplayBits = NULL
[protected, pure virtual]
 

Implemented in GRenderBitmap, GRenderClick, GRenderDIB, GRenderPrint, and GRenderWinG.

void GRenderRegion::DisplayCurrentState  )  [protected, virtual]
 

Make a temporary bitmap, copy current GRenderRegion bitmap into it then render other offscreen state into it before blitting it to screen Notes: This routine does a lot of bitmap copying and blitting so it is much slower than just blitting the current bitmap to screen!

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/07/2005

Definition at line 1751 of file grndrgn.cpp.

01752 {
01753     // Create a temporary capture that is a copy of the master capture
01754     // (and get a copy of the bitmap)
01755     Capture* pTempCapture = new Capture(GetMasterCapture(), TRUE);
01756 
01757     if (pTempCapture)
01758     {
01759         // Point rendering at the temp capture bitmap
01760         SetRenderToCapture(pTempCapture);
01761 
01762         // Render the current capture state into the temp bitmap
01763         RenderCurrentCaptureState();
01764 
01765 #ifdef DEBUG_ATTACH_RENDERSTATE_BMP
01766 {
01767 //