#include <grndrgn.h>
Inheritance diagram for GRenderRegion:
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) |
GDrawContext * | GetDrawContext () 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 RGBQUAD * | Get32BitRGBQuadData () |
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 Capture * | StartCapture (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 Capture * | GetTopCaptureBitmap (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 RenderRegion * | Create (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 GDrawContext * | SetTempDrawContext (GDrawContext *pContext) |
static GDrawContext * | GetStaticDrawContext () |
static GDrawContext * | GetStaticDrawContext (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 LOGPALETTE * | GetRecommendedPalette () |
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 REGION * | MakeClipRegionFromClipAttr (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 GDrawContext * | pRealGD = NULL |
static GDrawContext * | GD = NULL |
static GDrawContext * | ErrorDiffContext = 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 |
Definition at line 154 of file grndrgn.h.
|
|
|
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.
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 }
|
|
Default Destructor for GRenderRegion Class. Frees up memory.
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 }
|
|
Have a look at the current ClipRegionAttribute and make sure we set our clipping region accordingly. Details within the method.
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 }
|
|
Reimplemented from RenderRegion. Reimplemented in GRenderClick, GRenderClickColour, and GRenderClickColourNoPaper. |
|
|
|
Implements RenderRegion. |
|
|
|
Implements RenderRegion. |
|
|
|
Definition at line 1525 of file grndrgn.cpp. 01526 { 01527 return CalculateWinRect(RenderMatrix, docrect, PixelsPerInch ); 01528 }
|
|
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.
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 }
|
|
To inform the capture stack that things (transparency) have changed.
Reimplemented from RenderRegion. |
|
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.
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 }
|
|
|
|
Call once during termination to perform any necessary cleanup.
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 }
|
|
|
|
Implemented in GRenderBitmap, GRenderClick, GRenderDIB, GRenderPrint, and GRenderWinG. |
|
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!
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 // Create a Kernel bitmap from the bmp data. 01768 WinBitmap* wBitmap = new WinBitmap(pTempCapture->lpBitmapInfo, pTempCapture->lpBits); 01769 KernelBitmap* OffscreenBitmap = new KernelBitmap(wBitmap,TRUE); 01770 OffscreenBitmap->AttachDebugCopyToCurrentDocument("Render State Bitmap"); 01771 wBitmap->BMBytes = ((WinBitmap*)OILBitmap::Default)->BMBytes; 01772 delete OffscreenBitmap; 01773 } 01774 #endif 01775 01776 // Show the temp bitmap to the user 01777 DisplayBits(pTempCapture->lpBitmapInfo, pTempCapture->lpBits); 01778 01779 // Reset rendering back to normal 01780 SetRenderToCapture(GetTopCaptureBitmap()); 01781 01782 // Release the temp bitmap and delete the temp capture 01783 pTempCapture->FreeDIB(); 01784 delete pTempCapture; 01785 pTempCapture = NULL; 01786 } 01787 else 01788 { 01789 // Failed to craete temp bitmap 01790 // So just blit what we can... 01791 DisplayBits(); 01792 } 01793 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Implements RenderRegion. Reimplemented in MaskedRenderRegion, and PrintingMaskedRenderRegion. |
|
Implements RenderRegion. Reimplemented in MaskedRenderRegion, and PrintingMaskedRenderRegion. |
|
Implements RenderRegion. Reimplemented in MaskedRenderRegion. Definition at line 196 of file grndrgn.h.
|
|
Implements RenderRegion. Reimplemented in MaskedRenderRegion. Definition at line 195 of file grndrgn.h.
|
|
Implements RenderRegion. Reimplemented in MaskedRenderRegion. |
|
Implements RenderRegion. Reimplemented in MaskedRenderRegion. |
|
Implements RenderRegion. Reimplemented in MaskedRenderRegion. |
|
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.
Reimplemented from RenderRegion. |
|
Implements RenderRegion. Reimplemented in MaskedRenderRegion, and PrintingMaskedRenderRegion. |
|
Plots the bitmap using the mask supplied. The base class implementation here does nothing.
Reimplemented from RenderRegion. |
|
Renders a path object using gavins routines.
Implements RenderRegion. Reimplemented in MaskedRenderRegion, and PrintingMaskedRenderRegion. Definition at line 2051 of file grndrgn.cpp. 02052 { 02053 // If we are not drawing complex shapes and this shape is, then return 02054 // if ((!RenderComplexShapes) && (TestForComplexShape(&Caps))) 02055 // return; 02056 02057 // TRACEUSER( "Gerry", _T("GRenderRegion::DrawPathToOutputDevice\n")); 02058 02059 DWORD Style = 0; 02060 TranspGradTable TranspTable; 02061 02062 // Something to render later 02063 DocCoord* Coords; 02064 PathVerb* Verbs; 02065 UINT32 NumCoords; 02066 DocCoord* UnclippedCoords; 02067 PathVerb* UnclippedVerbs; 02068 UINT32 UnclippedNumCoords; 02069 02070 BOOL ShouldDeleteCoords = FALSE; 02071 02072 // Keep the unclipped path coords for arrow rendering 02073 UnclippedCoords = PathToDraw->GetCoordArray(); 02074 UnclippedVerbs = PathToDraw->GetVerbArray(); 02075 UnclippedNumCoords = PathToDraw->GetNumCoords(); 02076 02077 ClippedPathIsValid = TRUE; 02078 02079 // setup the fuzzy clipping rects. 02080 SetupFuzzyClipRects(); 02081 02082 // try and clip the path before rendering it, for bigger zoom values 02083 if (TryToFuzzyClip(PathToDraw, &Coords, &Verbs, &NumCoords)) 02084 { 02085 // This may have clipped out all the points (or left just a moveto), 02086 // and in this case, it may seem pointless to continue. 02087 // but we will carry on, so that ArrowHeads get a chance to render 02088 // using the unclipped path coords. 02089 // This shouldn't be a problem, so long as anything that uses the clipped 02090 // coords, checks to make sure there are enough (more than 1). 02091 02092 if (NumCoords < 2) 02093 { 02094 ClippedPathIsValid = FALSE; 02095 // OutputDebugString("Clipped path is too small\n"); 02096 } 02097 else 02098 { 02099 // char Str[256]; 02100 // _stprintf(Str, "Path clipped. Count=%d, Coords@%x, Verbs@%x\n",NumCoords,Coords,Verbs); 02101 // OutputDebugString(Str); 02102 /* 02103 for (INT32 i=0; i<(NumCoords-1); i++) 02104 { 02105 if (Verbs[i] == PT_BEZIERTO) 02106 { 02107 if (Coords[i] == Coords[i+3]) 02108 { 02109 ClippedPathIsValid = FALSE; 02110 // OutputDebugString("Clipped path zero length element, Ignoring it.\n"); 02111 NumCoords = 0; 02112 break; 02113 } 02114 02115 i += 2; 02116 } 02117 else 02118 { 02119 if (Coords[i] == Coords[i+1]) 02120 { 02121 ClippedPathIsValid = FALSE; 02122 // OutputDebugString("Clipped path zero length element, Ignoring it.\n"); 02123 NumCoords = 0; 02124 break; 02125 } 02126 } 02127 } 02128 */ 02129 } 02130 02131 // Yes, we clipped the paths alright 02132 ShouldDeleteCoords = TRUE; 02133 } 02134 else 02135 { 02136 // No Clipping here matey 02137 Coords = PathToDraw->GetCoordArray(); 02138 Verbs = PathToDraw->GetVerbArray(); 02139 NumCoords = PathToDraw->GetNumCoords(); 02140 } 02141 02142 enum Quality::Fill FillQuality = RRQuality.GetFillQuality(); 02143 02144 RememberMe("DrawPath"); 02145 HaveRenderedSomething = TRUE; 02146 02147 if ( PathToDraw->IsFilled ) 02148 { 02149 BOOL ExtendedFill = FALSE; 02150 FillGeometryAttribute *pFillProvider 02151 = (FillGeometryAttribute *) CurrentAttrs[ATTR_FILLGEOMETRY].pAttr; 02152 02153 if ( 02154 (pFillProvider->GetRuntimeClass() != CC_RUNTIME_CLASS(FlatFillAttribute)) && 02155 (FillQuality >= Quality::Graduated) 02156 ) 02157 ExtendedFill = TRUE; 02158 02159 if ( 02160 (pFillProvider->GetRuntimeClass() == CC_RUNTIME_CLASS(BitmapFillAttribute)) && 02161 (FillQuality >= Quality::Solid) 02162 ) 02163 ExtendedFill = TRUE; 02164 02165 if ( 02166 (pFillProvider->GetRuntimeClass() == CC_RUNTIME_CLASS(FractalFillAttribute)) && 02167 (FillQuality >= Quality::Solid) 02168 ) 02169 ExtendedFill = TRUE; 02170 02171 if (ExtendedFill) 02172 { 02173 // VeryMono forces non-extended fill 02174 if (RenderFlags.VeryMono) 02175 { 02176 // Up until now, we always rendered everything solid black when 02177 // in 'VeryMono' mode, but now we have 'masked' bitmaps, we 02178 // need to render them (will all non-masked pixels plotted black) 02179 if (pFillProvider->GetRuntimeClass() == CC_RUNTIME_CLASS(BitmapFillAttribute)) 02180 { 02181 // Check for a masked bitmap .... 02182 KernelBitmap* pBitmap = pFillProvider->GetBitmap(); 02183 INT32 Index = 0; 02184 02185 if (pBitmap && (pBitmap->GetTransparencyIndex(&Index) || pBitmap->GetBPP()>=32)) 02186 { 02187 // It's a masked bitmap, so we'll need to plot all 02188 // the non-masked pixels as black 02189 if (!pFillProvider->RenderFill(this, PathToDraw)) 02190 ExtendedFill = FALSE; // fail safe 02191 } 02192 else 02193 { 02194 ExtendedFill = FALSE; // Not a masked bitmap 02195 } 02196 } 02197 else 02198 { 02199 ExtendedFill = FALSE; // Not a bitmap at all 02200 } 02201 } 02202 else if (!pFillProvider->RenderFill(this, PathToDraw)) 02203 { 02204 ExtendedFill = FALSE; // fail safe 02205 } 02206 } 02207 02208 if ( (!ExtendedFill) && 02209 (FillQuality >= Quality::Solid) 02210 ) 02211 { 02212 DocColour FlatColour = RR_FILLCOLOUR(); 02213 02214 if (RenderFlags.VeryMono && 02215 pFillProvider->GetRuntimeClass() == CC_RUNTIME_CLASS(BitmapFillAttribute)) 02216 { 02217 // Bitmap fills will return 'No Colour' as their flat colour, 02218 // but for 'VeryMono' rendering they should be treated as black. 02219 FlatColour = COLOUR_BLACK; 02220 } 02221 02222 if (SetFillGCol(FlatColour)) 02223 { 02224 if (!RenderFlags.VeryMono && GetTransparencyFill(&TranspTable, &Style)) 02225 { 02226 DocColour Col = RR_FILLCOLOUR(); 02227 COLORREF rgb = ConvertColourToTransScreenWord(CurrentColContext, &Col); 02228 GetDrawContext()->SetTransparency(rgb, (TransparencyEnum)(Style>>8)); 02229 } 02230 02231 if (NumCoords > 1) 02232 { 02233 GetDrawContext()->FillPath( (POINT*)Coords, Verbs, NumCoords, 02234 (RR_WINDINGRULE()==EvenOddWinding) ? 0 : 1); 02235 } 02236 } 02237 } 02238 } 02239 02240 if ( PathToDraw->IsStroked ) 02241 { 02242 // Should we try and draw some ArrowHeads ? 02243 BOOL DrawArrows = (RRQuality.GetLineQuality() >= Quality::FullLine) && 02244 !(RR_STARTARROW().IsNullArrow() && RR_ENDARROW().IsNullArrow()) && 02245 ArrowRec::DoesPathNeedArrowHeads(UnclippedCoords, UnclippedVerbs, UnclippedNumCoords); 02246 02247 if ((FillQuality <= Quality::Bitmaps)) 02248 { 02249 // Just do everything in black outlines... 02250 DocColour colorBlk(COLOUR_BLACK); 02251 if ( SetGCol( colorBlk ) ) 02252 StrokePath( Coords, Verbs, NumCoords, 02253 UnclippedCoords, UnclippedVerbs, UnclippedNumCoords, DrawArrows ); 02254 } 02255 else if (RenderFlags.VeryMono) 02256 { 02257 // Just do everything in black outlines... 02258 DocColour colorBlk(COLOUR_BLACK); 02259 if ( !(RR_STROKECOLOUR().IsTransparent()) && SetGCol( colorBlk ) ) 02260 StrokePath( Coords, Verbs, NumCoords, 02261 UnclippedCoords, UnclippedVerbs, UnclippedNumCoords, DrawArrows ); 02262 } 02263 else if ( SetGCol( RR_STROKECOLOUR() ) ) 02264 { 02265 StrokePath( Coords, Verbs, NumCoords, 02266 UnclippedCoords, UnclippedVerbs, UnclippedNumCoords, DrawArrows ); 02267 } 02268 } 02269 02270 // We drew a clipped path, so get rid of the extra clipped coords 02271 if (ShouldDeleteCoords) 02272 { 02273 delete Coords; 02274 delete Verbs; 02275 } 02276 }
|
|
Implements RenderRegion. Reimplemented in MaskedRenderRegion, and PrintingMaskedRenderRegion. |
|
Implements RenderRegion. Reimplemented in MaskedRenderRegion, and PrintingMaskedRenderRegion. |
|
|
|
Implemented in GRenderBitmap, GRenderBrush, GRenderClick, GRenderDIB, GRenderPrint, and GRenderWinG. |
|
Definition at line 964 of file grndrgn.cpp. 00965 { 00966 // This function gets called when render regions deconstruct 00967 // It frees memory allocate to offscreen bitmaps as wella s the inital 00968 // bitmap. 00969 // NB this gets called before the attribute context stack is unwound (this happens 00970 // when ~RenderRegion calls CleanUpBeforeDestruct(RenderRegion *pRegion)) 00971 00972 // This function frees handles the freeing of all memory allocted to bitmaps. Includes:- 00973 // 1) offscreen bmp memory - alloc'd by the Offscreen rendering system, NOT from limited mem 00974 // 2) initial bmp memory - alloc'd by virtual GetLPBits() in a derived class specific fashion 00975 // - (ie either from limited mem manager or normal heap) 00976 // 00977 // It also restores the initial rendering states' wrect, cliprect, and gmatrix variables 00978 00979 Capture* pCapture = NULL; 00980 while (GetTopCapture()) 00981 { 00982 pCapture = GetTopCapture(); 00983 m_CaptureStack.Pop(); 00984 00985 // If we've reached the master capture 00986 // reset the rendering variables in case this RenderRegion survives for a while 00987 if (pCapture->IsMaster()) 00988 SetRenderToCapture(pCapture, FALSE, FALSE); 00989 else 00990 pCapture->FreeDIB(); 00991 00992 delete pCapture; 00993 } 00994 00995 #if USE_wxBITMAP 00996 FreeWxBitmap() ; 00997 #else 00998 if ( pBitmapInfo && pBits ) 00999 { 01000 FreeLPBits( pBitmapInfo, pBits ); 01001 pBitmapInfo = NULL; 01002 pBits = NULL; 01003 } 01004 #endif 01005 }
|
|
|
|
|
|
Definition at line 282 of file grndrgn.h.
|
|
|
|
|
|
Definition at line 501 of file grndrgn.h. 00502 { 00503 return LogPixelsX; 00504 };
|
|
Definition at line 267 of file grndrgn.h. 00267 { return WhichTransparency; }
|
|
Definition at line 224 of file grndrgn.h. 00225 { 00226 return GD; 00227 };
|
|
Definition at line 492 of file grndrgn.h. 00493 { 00494 return((LPLOGPALETTE)&ErrorDiffPalette); 00495 };
|
|
To determine how much room is needed to plot a bit of text with RenderRegion::DrawFixedSystemText.
Reimplemented from RenderRegion. |
|
Implemented in GRenderBitmap, GRenderClick, GRenderDIB, GRenderPrint, and GRenderWinG. |
|
|
|
|
|
Reimplemented from RenderRegion. Definition at line 304 of file grndrgn.h. 00304 {return PixelsPerInch;}
|
|
|
|
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.
Reimplemented from RenderRegion. |
|
|
|
Definition at line 283 of file grndrgn.h. 00283 { return pBitmapInfo ? pBitmapInfo->bmiHeader.biWidth * pBitmapInfo->bmiHeader.biHeight : 0; }
|
|
Definition at line 254 of file grndrgn.h. 00255 { 00256 #ifdef RALPH 00257 if (GDrawAsm::GetContextForCurrentThread() != NULL) 00258 return(GDrawAsm::GetContextForCurrentThread()); 00259 #endif 00260 00261 if ((DitherType == 0) || (DitherType == 3)) 00262 return(ErrorDiffContext); 00263 else 00264 return(GD); 00265 }
|
|
Definition at line 244 of file grndrgn.h. 00245 { 00246 #ifdef RALPH 00247 if (GDrawAsm::GetContextForCurrentThread() != NULL) 00248 return(GDrawAsm::GetContextForCurrentThread()); 00249 #endif 00250 00251 return GD; 00252 };
|
|
|
|
|
|
|
|
Determine possibility of using gdraw routines and determine various characterisitics of the screen.
Reimplemented in GRenderWinG. Definition at line 516 of file grndrgn.cpp. 00517 { 00518 BOOL GDrawImpossible = FALSE; 00519 00520 // Scary critical section stuff 00521 // CriticalSection::Init(); // Not required for CDraw 00522 00523 if (bFirstTime) 00524 { 00525 CanDoGDraw = FALSE; 00526 00527 if (Camelot.DeclareSection( _T("DebugFlags"), 20)) 00528 { 00529 Camelot.DeclarePref( NULL, _T("UseGdraw"), &WantDoGDraw, FALSE, TRUE ); 00530 Camelot.DeclarePref( NULL, _T("GDrawDepth"), &WantGDrawDepth, 0, 32 ); 00531 // Camelot.DeclarePref( NULL, "DontUsePalette", &WantNoPalette, FALSE, TRUE ); 00532 // Camelot.DeclarePref( NULL, "BlitMode", &WantBlitMode, 0, 4 ); 00533 // Camelot.DeclarePref( NULL, "HighColourDirect", &WantHighColourDirect, 0, 1 ); 00534 // Camelot.DeclarePref( NULL, "TryWinG", &WantWinG, FALSE, TRUE ); 00535 Camelot.DeclarePref( NULL, _T("WhichDither"), &WhichDither, 0, 20 ); 00536 // Camelot.DeclarePref( NULL, "LargeGradTables", &LargeGradTables, 0, 1 ); 00537 // TransparencyType removed by Gerry (23/8/96) cos its rampant 00538 // Camelot.DeclarePref( NULL, "TransparencyType", &WhichTransparency, 0, 10 ); 00539 // Camelot.DeclarePref( NULL, "ResizeRegions", &ResizeRegions, FALSE, TRUE ); 00540 } 00541 00542 if (Camelot.DeclareSection( _T("Screen"), 10)) 00543 { 00544 Camelot.DeclarePref( NULL, _T("ClickTranspLimit"), &ClickTranspLimit, 0, 255 ); 00545 // defaults to hardware value 00546 // RealFPU = IsMathCoprocInstalled(); 00547 // Camelot.DeclarePref( NULL, "RealFPU", &RealFPU, FALSE, TRUE ); 00548 Camelot.DeclarePref(NULL, _T("ViewDither"), &ViewDither, 0, 4); 00549 } 00550 00551 if (Camelot.DeclareSection(_T("Rendering"), 20)) 00552 { 00553 Camelot.DeclarePref( _T("Rendering"), _T("HighQualityAA"), &HighQualityAA, FALSE, TRUE ); 00554 Camelot.DeclarePref( _T("Rendering"), _T("BitmapConversion"), &BitmapConversion, 0, 3 ); 00555 } 00556 00557 if (pRealGD == NULL) 00558 pRealGD = new GDrawAsm(); // get permanent one 00559 00560 // fill in default translation tables 00561 for (INT32 i=0; i<256; i++) 00562 NoTransTable[i] = i; 00563 } 00564 00565 // Initialise the palette manager 00566 // PaletteManager::Init(); 00567 00568 // Initialise the DIBConvert classes (don't care if it fails) 00569 DIBConvert::Init(); 00570 00571 ::wxDisplaySize(&ScreenWidth,&ScreenHeight); 00572 ScreenDepth = ::wxDisplayDepth(); 00573 wxScreenDC dc; 00574 wxSize size = OSRenderRegion::GetFixedDCPPI(dc); 00575 PORTNOTE("other","Can't handle different DPIs, using X") 00576 LogPixelsX = size.x; 00577 LogPixelsY = size.y; //size.y; 00578 ERROR3IF(LogPixelsX != LogPixelsY, "Luke says non-square pixels are not supported"); 00579 00580 // CanSetPalette = FALSE; 00581 00582 // on startup lets make sure the GDraw version is OK. Must be done before any GDraw calls 00583 if (bFirstTime) 00584 { 00585 if (!pRealGD->Init()) // checks version etc 00586 { 00587 GDrawImpossible = TRUE; 00588 CanDoGDraw = FALSE; 00589 Error::SetError( _R(IDW_BADGDRAW), NULL, 0 ); 00590 InformWarning(); // tell the user his DLL is wrong 00591 Error::ClearError(); // else we won't start up 00592 } 00593 GD = pRealGD; 00594 } 00595 /* 00596 switch ( ScreenDepth ) 00597 { 00598 case 4 : ScreenHinting = CONVHINT_SCREEN4; break; 00599 case 8 : ScreenHinting = CONVHINT_SCREEN8; break; 00600 case 16 : ScreenHinting = CONVHINT_FINAL16; break; 00601 case 24 : ScreenHinting = CONVHINT_FINAL24; break; 00602 default : ScreenHinting = CONVHINT_NONE; 00603 } 00604 */ 00605 // we can set a palette if we are on a 256-colour screen and it says that we can 00606 PORTNOTE("other","GRenderRegion::Init - Removed palette code") 00607 #ifndef EXCLUDE_FROM_XARALX 00608 if ( 00609 ScreenDepth==8 && // 256 cols only 00610 !WantNoPalette // and user hasn't forbidden it 00611 ) 00612 { 00613 if (GetDeviceCaps( hdc, RASTERCAPS ) & RC_PALETTE ) 00614 CanSetPalette = TRUE; 00615 } 00616 #endif 00617 00618 ScreenHinting = CONVHINT_NONE; // safe default value 00619 if ( ScreenDepth<=8 ) 00620 ScreenHinting = DIBUtil::CalcConvertHint(ScreenDepth,NULL); 00621 else 00622 { 00623 // work out bitmap hinting by opening tiny window in top left of screen 00624 // It is TOPMOST so that, with luck, nothing will obscure it 00625 // wxWindow tempWindow(AfxGetApp().GetTopWindow(),-1,wxPoint(0,0),wxSize(0,0),wxNO_BORDER); 00626 // tempWindow.Show(); 00627 // tempWindow.Raise(); 00628 // wxClientDC tempDC(&tempWindow); 00629 // ScreenHinting = DIBUtil::CalcConvertHint(ScreenDepth,&tempDC); 00630 wxColour colour; 00631 dc.GetPixel(0,0,&colour); 00632 ScreenHinting = DIBUtil::CalcConvertHint(ScreenDepth,&dc); 00633 dc.SetPen(wxPen(colour)); 00634 dc.DrawPoint(0,0); 00635 } 00636 00637 if ( 00638 !GDrawImpossible && 00639 ( 00640 ScreenDepth==1 || 00641 ScreenDepth==4 || 00642 ScreenDepth==8 || // only certain depths allowed 00643 ScreenDepth==16 || 00644 ScreenDepth==24 || 00645 ScreenDepth==32 00646 ) 00647 ) 00648 { 00649 CanDoGDraw = TRUE; 00650 /* 00651 // DIB_PAL_INDICES is not available on Win32s or Chicago 00652 // or on 256 colour fixed palette devices 00653 if (IsWin32s()) 00654 CanDoPalIndices = FALSE; 00655 else 00656 CanDoPalIndices = TRUE; 00657 */ 00658 EnsurePalette(0); 00659 // set the stack limit to 100k. Assumes stacks go backwards 00660 GD->SetStackSize(100*1024); 00661 00662 if (ErrorDiffContext == NULL) 00663 { 00664 ErrorDiffContext = new GDrawAsm(); // get permanent one 00665 00666 if (ErrorDiffContext) 00667 ErrorDiffContext->Init(); 00668 } 00669 00670 /* UpdateErrorDiffPalette(); 00671 00672 if ( 00673 (ScreenDepth==8) && 00674 !CanSetPalette 00675 ) 00676 { 00677 // if we're a 256 colour fixed palette device then we make up a default RGB table 00678 // and use that 00679 Fixed256Palette = (LPRGBQUAD) CCMalloc( sizeof(RGBQUAD) * 256 ); 00680 00681 const LOGPALETTE* lpPal = GD->SelectPalette( 0 ); 00682 00683 if (Fixed256Palette && lpPal) 00684 { 00685 for (INT32 i=0; i<256; i++) 00686 { 00687 Fixed256Palette[i].rgbRed = lpPal->palPalEntry[i].peRed; 00688 Fixed256Palette[i].rgbGreen = lpPal->palPalEntry[i].peGreen; 00689 Fixed256Palette[i].rgbBlue = lpPal->palPalEntry[i].peBlue; 00690 Fixed256Palette[i].rgbReserved = 0; 00691 } 00692 } 00693 00694 // DIB_PAL_INDICES makes no sense on these devices 00695 CanDoPalIndices = FALSE; 00696 } 00697 */ 00698 } 00699 /* 00700 switch (WantBlitMode) 00701 { 00702 case 4: 00703 #if REAL_DDB 00704 // user wants badDDBs, only allow if possible 00705 if (GRenderDDB::CanDoBadDDBs()) 00706 { 00707 BlitMode = BLITMODE_BADDDB; 00708 break; 00709 } 00710 #endif 00711 // else fall through to default mode 00712 nobreak; 00713 case 0: 00714 // automatic setting using faster blits on non-NT platforms 00715 if (IsWin32NT()) 00716 BlitMode = BLITMODE_SETDIBS; 00717 else 00718 BlitMode = ( (ScreenDepth==4) || (ScreenDepth==8) ) ? BLITMODE_BITBLT : BLITMODE_STRETCH; 00719 break; 00720 case 1: 00721 BlitMode = BLITMODE_STRETCH; 00722 break; 00723 case 2: 00724 BlitMode = BLITMODE_SETDIBS; 00725 break; 00726 case 3: 00727 // use DDBs on 16- and 256-colour modes only 00728 BlitMode = ( (ScreenDepth==4) || (ScreenDepth==8) ) ? BLITMODE_BITBLT : BLITMODE_STRETCH; 00729 break; 00730 default: 00731 BlitMode = BLITMODE_STRETCH; // safest default value 00732 break; 00733 } 00734 */ 00735 // only NT can do BI_BITFIELD, Win32s and Chicago cannot. 00736 // Actually NT isn't guaranteed to support that any more 00737 //CanBiBitfield = IsWin32NT() ? TRUE : FALSE; 00738 00739 // only NT can do 16- and 32-bit DIBs, Win32s cannot. Chicago might? 00740 // CanDoDeepDIBs = IsWin32NT() ? TRUE : FALSE; 00741 // Changed by Will, on 14/7/95, as requested by Jason. 00742 // Apparently the PlotDeepDIB routine doesn't dither correctly. 00743 // CanDoDeepDIBs = FALSE; 00744 00745 // #if REAL_DDB && WIN16 00746 // GRenderDDB::CanDoBadDDBs(); 00747 // #endif 00748 00749 // init WinG if required. Saves memory if not wanted 00750 // if (WantWinG) 00751 // GRenderWinG::Init( bFirstTime ); 00752 00753 if (!Operation::RegisterOpDescriptor( 00754 0, 00755 _R(IDS_GDRAW), 00756 CC_RUNTIME_CLASS(OpGDraw), 00757 OPTOKEN_GDRAW, 00758 OpGDraw::GetState, 00759 0, // help ID 00760 _R(IDBBL_GDRAWOP), 00761 0 // bitmap ID 00762 )) 00763 return FALSE; 00764 00765 if (!GBrush::InitGBrush( bFirstTime )) 00766 return FALSE; 00767 00768 INT32 Flatness = INT32(MILLIPOINTS_PER_INCH/96 / 2); 00769 GD->SetFlatness( Flatness ); 00770 00771 return TRUE; 00772 }
|
|
Initialise the render region.
Reimplemented from RenderRegion. |
|
Implements RenderRegion. |
|
Definition at line 1066 of file grndrgn.cpp. 01067 { 01068 ENSURE(pBits,"Call to InitBmpBits with null bits pointer!"); 01069 if(!pBits) 01070 return; 01071 01072 LPBITMAPINFOHEADER bh = &pBitmapInfo->bmiHeader; 01073 BYTE* pSetBits = (BYTE*)pBits; 01074 01075 BOOL UseInternalFormat = FALSE; 01076 if(m_DoCompression) 01077 { 01078 bh->biCompression=0x80000001; // needs to be set correctly for GetDrawContext()->SetBitmap() 01079 UseInternalFormat = TRUE; 01080 } 01081 01082 // for offscreen rendering system which doesn't set m_DoCompression properly 01083 if(bh->biCompression==0x80000001) 01084 UseInternalFormat = TRUE; 01085 01086 // ensure all bitmap memory is initialised (ie don't use the 01087 // bogus info from the bmp header dimensions) 01088 // NB this assumes that the bmp buff lpBits was allocated using AllocDIB (usually via GetLPBits() fn) 01089 UINT32 BmpSize = GetDIBBitsSize( bh ); 01090 UINT32 Index = 0; 01091 01092 if(bh->biBitCount==32) 01093 { 01094 // 32bpp 01095 if(UseInternalFormat) 01096 { 01097 // TRACEUSER( "Gerry", _T("Initialising GRR to transparent black\n")); 01098 while(Index < BmpSize) 01099 { 01100 // initial values for using internal alpha channelled format 01101 // fully transparent black bacground 01102 01103 pSetBits[Index++] = 0x00; 01104 pSetBits[Index++] = 0x00; 01105 pSetBits[Index++] = 0x00; 01106 pSetBits[Index++] = 0xFF; 01107 } 01108 } 01109 else 01110 { 01111 // TRACEUSER( "Gerry", _T("Initialising GRR to opaque white\n")); 01112 while(Index < BmpSize) 01113 { 01114 // fully opaque white background 01115 pSetBits[Index++] = 0xFF; 01116 pSetBits[Index++] = 0xFF; 01117 pSetBits[Index++] = 0xFF; 01118 pSetBits[Index++] = 0x00; 01119 } 01120 } 01121 } 01122 else 01123 { 01124 #if FILL_BITMAP 01125 // this is taken from the previous bmp initialisation code (ie from old StartRender()) 01126 memset( pBits, FILL_BITMAP+1, BmpSize ); 01127 #else 01128 // this is what I would expect it to be (ie white background) 01129 memset( pBits, 0xFF, BmpSize ); 01130 #endif 01131 } 01132 }
|
|
Implements RenderRegion. |
|
Initialises the render region's connection to the device information passed in to RenderRegion::AttachDevice.
Reimplemented from RenderRegion. Reimplemented in GRenderPrint. |
|
|
|
Reimplemented from RenderRegion. Definition at line 181 of file grndrgn.h. 00181 {return !HaveRenderedSomething;}
|
|
|
|
Definition at line 412 of file grndrgn.h. 00412 { return m_bForceBitmapSmoothing; }
|
|
|
|
Reimplemented from RenderRegion. Definition at line 526 of file grndrgn.h. 00526 {return IsWrapped;}
|
|
|
|
Reimplemented in PrintingMaskedRenderRegion, and GRenderBitmap. |
|
|
|
Reimplemented from RenderRegion. Definition at line 558 of file grndrgn.h. 00558 {return (!m_CaptureStack.Empty() && GetTopCaptureBitmap() && GetTopCaptureBitmap()->IsMaster());}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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. / } /////////////////////////////////////////////////////////////////////////////////////////// Andy Hills, 23-10-00: Helper functions for RenderBitmapFill and SetBitmapTransparencyFill /*!
Currently, the text is drawn in a default manner (left justified and centered vertically; one line of text only (no word-wrap onto subsequent lines), etc) Do not use special characters such as tab/newline -their effect is undefined NOTE: this GRenderRegion version of the function plots with BkMode OPAQUE.
Note that these values are passed directly to the host OS at the point of calling, so you must call this method every time the colour is changed (i.e. don't rely on just changing the DocColours that you passed in originally, as they aren't remembered in any way). Note also that if you call DrawFixedSystemText without a prior call to this method, the colours used are undefined. The colour chosen may not exactly match the colour requested - under Windows, for example, the nearest solid (non-dithered) colour to that requested will be used. Thus, it is best to stick to 'simple' colour schemes. This method may or may not affect some other rendering processes (for example, under Windows, plotting of bitmaps may be affected by the settings used here...)
PLEASE Note that if you mix and match GetScaledPixelWidthDouble() with GetScaledPixelWidth(), you are HIGHLY likely to run into problems. Most of Camelot uses the original GetScaledPixelWidth(), so if you do decide to use this version, watch out for any interaction problems with the rest of the App! See also: GetScaledPixelWidth().
This function will also force a redraw of all windows if it detects that the palette has changed - this is because a palette change detected in the middle of a background redraw could leave the already-drawn areas invalid. Scope: Static public
Definition at line 3078 of file grndrgn.cpp. |
|
|
|
Fills a grad filled path (linear or radial).
Definition at line 2471 of file grndrgn.cpp. 02472 { 02473 DWORD Style = 0; 02474 TranspGradTable TranspTable; 02475 02476 BOOL SpecialFill = FALSE; 02477 02478 CCRuntimeClass *FillType = Fill->GetRuntimeClass(); 02479 02480 02481 if (FillType == CC_RUNTIME_CLASS(RadialFillAttribute)) 02482 Style = 1; 02483 else if (FillType == CC_RUNTIME_CLASS(LinearFillAttribute)) 02484 Style = 0; 02485 else if (FillType == CC_RUNTIME_CLASS(ConicalFillAttribute)) 02486 Style = 2; 02487 else if (FillType == CC_RUNTIME_CLASS(SquareFillAttribute)) 02488 Style = 3; 02489 else if (FillType == CC_RUNTIME_CLASS(ThreeColFillAttribute)) 02490 SpecialFill = TRUE; 02491 else if (FillType == CC_RUNTIME_CLASS(FourColFillAttribute)) 02492 SpecialFill = TRUE; 02493 else 02494 { 02495 ERROR3("Unknown fill type"); 02496 return FALSE; // unknown fill type 02497 } 02498 02499 if (uBitmapDepth == 32) 02500 { 02501 // InitTransparencyFill will setup the transparency fill if there is one 02502 if (!GetTransparencyFill(&TranspTable, &Style)) 02503 Style |= (WhichTransparency<<8); // Set the fill type of the transparency 02504 } 02505 02506 CProfileBiasGain DiagramMapper = Fill->GetProfile (); 02507 02508 // --- Convert ArtWorks style attribute into Gavin-style 02509 POINT A,B,C,D; 02510 02511 DocCoord* StartPoint = Fill->GetStartPoint(); 02512 DocCoord* EndPoint = Fill->GetEndPoint(); 02513 DocCoord* EndPoint2 = Fill->GetEndPoint2(); 02514 DocCoord* EndPoint3 = Fill->GetEndPoint3(); 02515 02516 A.x = (*StartPoint).x; A.y = (*StartPoint).y; 02517 B.x = (*EndPoint).x; B.y = (*EndPoint).y; 02518 02519 if (EndPoint2 != NULL) 02520 { 02521 C.x = (*EndPoint2).x; 02522 C.y = (*EndPoint2).y; 02523 } 02524 02525 if (FillType==CC_RUNTIME_CLASS(LinearFillAttribute)) 02526 { 02527 A.x = (*StartPoint).x; A.y = (*StartPoint).y; 02528 B.x = (*EndPoint2).x; B.y = (*EndPoint2).y; 02529 C.x = (*EndPoint).x; C.y = (*EndPoint).y; 02530 } 02531 else if (FillType==CC_RUNTIME_CLASS(ConicalFillAttribute)) 02532 { 02533 B.x = A.x - (B.x - A.x); 02534 B.y = A.y - (B.y - A.y); 02535 } 02536 02537 BOOL Perspective = FALSE; 02538 02539 // Is it a perspectivised fill ? 02540 if (Fill->IsPerspective()) 02541 { 02542 Perspective = TRUE; 02543 02544 POINT PGram[4]; 02545 02546 // Setup the Perspective control points 02547 if (FillType==CC_RUNTIME_CLASS(LinearFillAttribute)) 02548 { 02549 PGram[0].x = (*StartPoint).x; PGram[0].y = (*StartPoint).y; 02550 PGram[1].x = (*EndPoint2).x; PGram[1].y = (*EndPoint2).y; 02551 PGram[2].x = (*EndPoint3).x; PGram[2].y = (*EndPoint3).y; 02552 PGram[3].x = (*EndPoint).x; PGram[3].y = (*EndPoint).y; 02553 } 02554 else 02555 { 02556 PGram[0].x = A.x; PGram[0].y = A.y; 02557 PGram[1].x = B.x; PGram[1].y = B.y; 02558 PGram[2].x = (*EndPoint3).x; PGram[2].y = (*EndPoint3).y; 02559 PGram[3].x = (*EndPoint2).x; PGram[3].y = (*EndPoint2).y; 02560 } 02561 02562 // Are the control points sensible ? 02563 02564 // Gerry removed the pixel size test cos it makes small repeating fills go spappy 02565 02566 if (MouldPerspective::WillBeValid(PGram)) 02567 { 02568 // We're going to plot a perspective fill, 02569 // so copy the perspective control points 02570 A.x = PGram[0].x; A.y = PGram[0].y; 02571 B.x = PGram[1].x; B.y = PGram[1].y; 02572 C.x = PGram[2].x; C.y = PGram[2].y; 02573 D.x = PGram[3].x; D.y = PGram[3].y; 02574 } 02575 else 02576 { 02577 // The mould is bad... 02578 Perspective = FALSE; 02579 } 02580 } 02581 02582 // This needs to be allocated at the same level as the FillPath call below... 02583 GradTable Table(FALSE); 02584 02585 INT32 Tiling = ((FillMappingAttribute*)CurrentAttrs[ATTR_FILLMAPPING].pAttr)->Repeat; 02586 02587 if (SpecialFill) 02588 { 02589 // The fill is a fabby new one 02590 02591 if ((FillType != CC_RUNTIME_CLASS(ThreeColFillAttribute)) && 02592 (FillType != CC_RUNTIME_CLASS(FourColFillAttribute))) 02593 { 02594 ERROR3("Unknown new fill type"); 02595 return FALSE; // unknown fill type 02596 } 02597 02598 // Clear the bottom byte of the style cos it means something new 02599 Style = Style & 0xFFFFFF00; 02600 02601 // If the transparency type is one of the unimplemented ones then set to zero 02602 if ((Style & 0xFF00) < 0x400) 02603 Style = (Style & 0xFF0000); 02604 02605 // We wont do anything scary with the colours (separation/correction) 02606 // as this only renders to a GDraw bitmap 02607 02608 PColourRGBT Result; 02609 02610 CurrentColContext->ConvertColour(Fill->GetStartColour(), (ColourPacked *) &Result); 02611 COLORREF StartColour = RGB(Result.Red, Result.Green, Result.Blue); 02612 02613 CurrentColContext->ConvertColour(Fill->GetEndColour(), (ColourPacked *) &Result); 02614 COLORREF EndColour = RGB(Result.Red, Result.Green, Result.Blue); 02615 02616 CurrentColContext->ConvertColour(Fill->GetEndColour2(), (ColourPacked *) &Result); 02617 COLORREF EndColour2 = RGB(Result.Red, Result.Green, Result.Blue); 02618 02619 if (FillType == CC_RUNTIME_CLASS(FourColFillAttribute)) 02620 CurrentColContext->ConvertColour(Fill->GetEndColour3(), (ColourPacked *) &Result); 02621 COLORREF EndColour3 = RGB(Result.Red, Result.Green, Result.Blue); 02622 02623 /*CProfileBiasGain DefaultBiasGain; 02624 02625 if (!(DiagramMapper == DefaultBiasGain)) 02626 { 02627 Table.BuildTable(Fill->Colour, Fill->EndColour, GetRenderView(), GetFillEffect(), DiagramMapper, LargeGradTables); 02628 GetDrawContext()->SetGraduation( Style, Table.GetTable(), &A, &B, &C ); 02629 }*/ 02630 02631 if (FillType == CC_RUNTIME_CLASS(ThreeColFillAttribute)) 02632 { 02633 // Style & 0xFF = 0 (simple with better colours outside the mesh) 02634 // Style & 0xFF = 2 (tiled) 02635 02636 if (Tiling == 1) // If it is a simple fill 02637 Style |= 0; // set the style to 0 02638 else 02639 Style |= 2; // otherwise set it to 2 02640 02641 //CProfileBiasGain DefaultBiasGain; // default 02642 // DiagramMapper is the applied biasgain 02643 02644 //if (DiagramMapper == DefaultBiasGain) // if the applied biasgain is the default biasgain 02645 //{ 02646 if (Perspective) 02647 GetDrawContext()->Set3WayGraduation4(Style, StartColour, EndColour, EndColour2, 02648 &A, &B, &C, &D); 02649 else 02650 GetDrawContext()->Set3WayGraduation(Style, StartColour, EndColour, EndColour2, 02651 &A, &B, &C); 02652 //} 02653 //else 02654 //{ 02655 // Table.BuildTable(Fill->Colour, Fill->EndColour, GetRenderView(), GetFillEffect(), DiagramMapper, LargeGradTables); 02656 // GetDrawContext()->Set3WayGraduation(Style, StartColour, EndColour, EndColour2, 02657 // &A, &B, &C); 02658 //} 02659 } 02660 else 02661 { 02662 // Style & 0xFF = 1 (for better colours outside the mesh) 02663 // Style & 0xFF = 2 (tiled) 02664 02665 if (Tiling == 1) // If it is a simple fill 02666 Style |= 1; // set the style to 1 02667 else 02668 Style |= 2; // otherwise set it to 2 02669 02670 // The colours in the following lines are correct!!! 02671 if (Perspective) 02672 GetDrawContext()->Set4WayGraduation4(Style, StartColour, EndColour, EndColour3, EndColour2, 02673 &A, &B, &C, &D); 02674 else 02675 GetDrawContext()->Set4WayGraduation(Style, StartColour, EndColour, EndColour3, EndColour2, 02676 &A, &B, &C); 02677 } 02678 } 02679 else 02680 { 02681 // Mark Howitt, 6/10/97. Enable the repeating fill type operation if selected 02682 #ifdef NEW_FEATURES 02683 if(Tiling == 4) Style |= 0x80; // Check to see if repeating, if so set it 02684 #endif 02685 02686 // CGS .... 02687 // We now need to decide exactly who is going to build the table! 02688 // If the fill has the default biasgain, then we will continue to build 02689 // this in the standard fashion (i.e. let GDraw build it). 02690 // If however it does NOT, then we will build the table ourselves (with respect to 02691 // the applied biasgain) .... 02692 02693 CProfileBiasGain DefaultBiasGain; // default 02694 // DiagramMapper is the applied biasgain 02695 02696 if (DiagramMapper == DefaultBiasGain) // if the applied biasgain is the default biasgain 02697 { 02698 // get on and use standard rendering stuff .... 02699 02700 ColourRamp *pColourRamp = Fill->GetColourRamp(); 02701 if (pColourRamp) 02702 { 02703 if (Tiling != 4) 02704 { 02705 Table.BuildTable(Fill->Colour, Fill->EndColour, pColourRamp, GetRenderView(), GetFillEffect(), LargeGradTables); 02706 } 02707 else 02708 { 02709 Table.BuildHighQualityRepeatTable(Fill->Colour, Fill->EndColour, pColourRamp, GetRenderView(), GetFillEffect()); 02710 } 02711 } 02712 else 02713 { 02714 if (Tiling != 4) 02715 { 02716 Table.BuildTable(Fill->Colour, Fill->EndColour, GetRenderView(), GetFillEffect(), LargeGradTables); 02717 } 02718 else 02719 { 02720 Table.BuildHighQualityRepeatTable(Fill->Colour, Fill->EndColour, NULL, GetRenderView(), GetFillEffect()); 02721 } 02722 } 02723 02724 if (Perspective) 02725 GetDrawContext()->SetGraduation4( Style, Table.GetTable(), &A, &B, &C, &D ); 02726 else 02727 GetDrawContext()->SetGraduation( Style, Table.GetTable(), &A, &B, &C ); 02728 } 02729 else 02730 { 02731 // use our new rendering stuff that takes account of profiles .... 02732 02733 if (Tiling != 4) 02734 { 02735 Table.BuildTable(Fill->Colour, Fill->EndColour, GetRenderView(), GetFillEffect(), DiagramMapper, LargeGradTables); 02736 GetDrawContext()->SetGraduation( Style, Table.GetTable(), &A, &B, &C ); 02737 } 02738 else 02739 { 02740 Table.BuildHighQualityRepeatTable(Fill->Colour, Fill->EndColour, GetRenderView(), GetFillEffect(), DiagramMapper); 02741 GetDrawContext()->SetGraduation( Style, Table.GetTable(), &A, &B, &C ); 02742 } 02743 GetDrawContext()->SetGraduation( Style, Table.GetTable(), &A, &B, &C ); 02744 } 02745 } 02746 02747 // Now it is time to Draw the path, so we will Fuzzy Clip it just in case it is too big 02748 DocCoord* Coords; 02749 PathVerb* Verbs; 02750 UINT32 TotalCoords; 02751 BOOL ShouldDeleteCoords = FALSE; 02752 02753 // try and clip the path before rendering it, for bigger zoom values 02754 if (TryToFuzzyClip(PathToDraw, &Coords, &Verbs, &TotalCoords)) 02755 { 02756 // Yes, we clipped the paths alright 02757 ShouldDeleteCoords = TRUE; 02758 } 02759 else 02760 { 02761 // No Clipping here matey 02762 Coords = PathToDraw->GetCoordArray(); 02763 Verbs = PathToDraw->GetVerbArray(); 02764 TotalCoords = PathToDraw->GetNumCoords(); 02765 } 02766 02767 // Draw the actual path 02768 if (TotalCoords > 1) 02769 GetDrawContext()->FillPath( (POINT*)Coords, Verbs, TotalCoords, (RR_WINDINGRULE()==EvenOddWinding) ? 0 : 1 ); 02770 02771 // Clean up if we need to 02772 if (ShouldDeleteCoords) 02773 { 02774 delete Coords; 02775 delete Verbs; 02776 } 02777 02778 #if 0 02779 if (0) 02780 { 02781 // debug code - plot the points 02782 GetDrawContext()->SetColour( RGB(0,0,0) ); 02783 /*DocCoord*/ POINT Path[5]; 02784 BYTE Verbs[] = { PT_MOVETO, PT_LINETO, PT_MOVETO, PT_LINETO, PT_LINETO }; 02785 /*DocCoord*/POINT D; 02786 D.x = (A.x+B.x)/2; 02787 D.y = (A.y+B.y)/2; 02788 02789 Path[0] = A; 02790 Path[1] = B; 02791 Path[2] = A; 02792 Path[3] = C; 02793 Path[4] = D; 02794 GetDrawContext()->StrokePath( (LPPOINT)Path, Verbs, sizeof(Verbs), FALSE, 0, CAPS_ROUND, JOIN_ROUND, NULL ); 02795 } 02796 #endif 02797 return TRUE; 02798 }
|
|
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.
Reimplemented from RenderRegion. Definition at line 1049 of file grndrgn.cpp. 01050 { 01051 #ifdef _DEBUG 01052 // if(CurrentRenderState) 01053 // TRACEUSER( "Ilan", _T("RR (0x%x) being reset\n Context = %s (0x%x)\n Offscreen stack size = %d\n"), (DWORD)this, CurrentRenderState->Name(),(DWORD)CurrentRenderState, m_OffscreenStateStack.Size()); 01054 // TRACEUSER( "Ilan", _T("RR (0x%x) being reset\n Context = %s (0x%x)\n Offscreen stack size = %d\n"), (DWORD)this, CurrentRenderState->Name(),(DWORD)CurrentRenderState, m_CaptureStack.Size()); 01055 #endif 01056 01057 // base class version (called below) needs initial CurrentClipRect to be correct. 01058 // FreeOffscreenState restores RR state as well as freeing offscreen bitmap memory and stacked states 01059 FreeOffscreenState(); 01060 01061 RenderRegion::ResetRegion(NewClipRect); 01062 }
|
|
|
|
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.
Reimplemented from RenderRegion. Definition at line 2332 of file grndrgn.cpp. 02333 { 02334 // Karim 26/02/2001 02335 // Once a clip-region has been restored, we no longer need to cache its associated 02336 // clipping region, so we'll free it up here. 02337 // We only freeing up the old clip-region if the incoming attr is different 02338 // from the outgoing attr, and if we can successfully remove old clip-region 02339 // from our cache. 02340 02341 // REGION* pClipRegion = NULL; 02342 ClipRegionAttribute* pOutGoingClipAttr = RR_CLIPREGION(); 02343 ClipRegionAttribute* pInComingClipAttr = NULL; 02344 02345 // Actually restore the incoming over the outgoing attribute in our attr-context. 02346 RenderRegion::RestoreClipRegion(pClipAttr, Temp); 02347 02348 // Free up outgoing clip-region, now it's unneeded. 02349 pInComingClipAttr = RR_CLIPREGION(); 02350 if (pInComingClipAttr != pOutGoingClipAttr && 02351 pOutGoingClipAttr != NULL) 02352 { 02353 // if (m_ClipRegionMap.Lookup((void*)pOutGoingClipAttr, ((void*&)pClipRegion))) 02354 // { 02355 // if (m_ClipRegionMap.RemoveKey((void*)pOutGoingClipAttr)) 02356 // { 02357 // if (pClipRegion != NULL) 02358 // delete [] ((BYTE *)pClipRegion); 02359 // } 02360 // } 02361 // Normally GetTopCaptureBitmap must return a valid pointer 02362 // However RestoreClipRegion can be called when RenderRegions are being shut down 02363 Capture* pBitCapture = GetTopCaptureBitmap(); 02364 if (pBitCapture) 02365 pBitCapture->RemoveCachedClipRegion(pOutGoingClipAttr); 02366 } 02367 02368 // Finally, adopt the new clip-attr as our clipping region. 02369 ApplyCurrentClipRegion(); 02370 }
|
|
Reimplemented from RenderRegion. Reimplemented in MaskedRenderRegion, PrintingMaskedRenderRegion, and GRenderBrush. Definition at line 3033 of file grndrgn.cpp. 03034 { 03035 if (m_ForcePrintingCaps) 03036 return; 03037 03038 // call our base class, to update the offscreen attr stack. 03039 // this will also trigger a call to the current attr's OffscreenRenderingCompleted() method. 03040 RenderRegion::RestoreOffscreen(pAttr); 03041 }
|
|
|
|
|
|
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.
Reimplemented from RenderRegion. Reimplemented in GRenderClick. Definition at line 1812 of file grndrgn.cpp. 01813 { 01814 // Reset our rendering flag... 01815 HaveRenderedSomething = FALSE; 01816 if (bResetChangedBounds) 01817 GetDrawContext()->ClearChangedBBox(); 01818 }
|
|
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.
Reimplemented from RenderRegion. Definition at line 2302 of file grndrgn.cpp. 02303 { 02304 RenderRegion::SetClipRegion(pClipAttr, Temp); 02305 ApplyCurrentClipRegion(); 02306 }
|
|
|
|
Definition at line 507 of file grndrgn.h. 00508 { 00509 DitherStyle8Bit = DitherStyle; 00510 };
|
|
Definition at line 287 of file grndrgn.h. 00287 { m_bEnableConversion = bEnable; }
|
|
Definition at line 285 of file grndrgn.h. 00285 { m_DoCompression = bDoCompression; }
|
|
|
|
|
|
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).
If either of the colours is passed in as a NULL pointer, that colour will not be set, and will remain at the previous setting. Note that these values are passed directly to the host OS at the point of calling, so you must call this method every time the colour is changed (i.e. don't rely on just changing the DocColours that you passed in originally, as they aren't remembered in any way). Note also that if you call DrawFixedSystemText without a prior call to this method, the colours used are undefined.
Reimplemented from RenderRegion. |
|
Definition at line 411 of file grndrgn.h. 00411 { m_bForceBitmapSmoothing = ForceSmoothing; }
|
|
|
|
|
|
|
|
|
|
Definition at line 579 of file grndrgn.h. 00579 { IsWrapped = flag; }
|
|
|
|
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.
Reimplemented from RenderRegion. Reimplemented in MaskedRenderRegion, PrintingMaskedRenderRegion, and GRenderBrush. Definition at line 2835 of file grndrgn.cpp. 02836 { 02837 // Karim 23/07/2000 02838 // Mustn't have feathering overhead for hit-testing, so 02839 // don't bother doing anything if we're a hit-test RR. 02840 if (IsHitDetect()) 02841 return; 02842 02843 if (m_ForcePrintingCaps) 02844 return; 02845 02846 // Save pointer to OffscreenAttr, and move current OffscreenAttr to the attr context stack 02847 RenderRegion::SetOffscreen(pAttr); 02848 }
|
|
Implements RenderRegion. |
|
|
|
Does nothing.
Reimplemented from RenderRegion. |
|
Reimplemented from RenderRegion. |
|
|
|
Reimplemented from RenderRegion. |
|
Reimplemented from RenderRegion. |
|
Definition at line 229 of file grndrgn.h. 00230 { 00231 // Bad things will happen if we set this to NULL 00232 if (pContext == NULL) 00233 { 00234 TRACEUSER( "Gerry", _T("******** Trying to set a NULL GDrawContext\n") ); 00235 pContext = pRealGD; 00236 } 00237 00238 GDrawContext* pOldCon = GD; 00239 GD = pContext; 00240 // TRACEUSER( "Gerry", _T("GDraw context set to 0x%08x (prev = 0x%08x)\n"), GD, pOldCon); 00241 return(pOldCon); 00242 };
|
|
|
|
Definition at line 497 of file grndrgn.h. 00497 {ViewDither = dither;};
|
|
To start a bitmap capture of whatever is subsequently rendered.
Reimplemented from RenderRegion. |
|
Initialises an GRenderRegion for rendering. Sets up a bitmap and gmatrix ready for gdraw rendering.
Reimplemented from RenderRegion. Reimplemented in MaskedRenderRegion, GRenderBitmap, GRenderClick, GRenderClickColour, and GRenderPrint. Definition at line 1145 of file grndrgn.cpp. 01146 { 01147 // Ilan 01148 // The first time StartRender get's called it allocs memory for bitmaps 01149 // However, subsequent calls are made to StartRender during background redrawing, where 01150 // rendering pauses partway through to service other messages, and then resumes later 01151 // In order to pause, StopRender is called to store a pointer to the last node rendered 01152 // and, in the case where we are not busy rendering offscreen, blit the partly completed 01153 // bitmap to screen 01154 // "AllocatedNewBmp" allows us to distinguish between initial calls to StartRender (where 01155 // GetLPBits is called to alloc new bitmaps), and 'restart' calls which don't need to alloc 01156 // any new bmps. 01157 // In the former case the bitmap must be initialised 01158 // In the later case the bitmap must only be re-initialised if m_bDoCompression is set 01159 // as in this case inplace bmp conversion will have occured in the process of transfering 01160 // the bitmap to the screen (ie during the last StopRender() call) 01161 BOOL AllocatedNewBmp = FALSE; 01162 01163 RememberMe("StartRender"); 01164 01165 // Call base class first 01166 if (!RenderRegion::StartRender()) 01167 return FALSE; 01168 // RenderMatrix.Dump(); 01169 01170 // Check that Initialise hasn't been called already 01171 ENSURE(RenderFlags.Rendering == FALSE, "Initialise called whilst already rendering"); 01172 01173 // JCF: added this check for retail builds as otherwise this ENSURE goes off after a 01174 // Crash Me Render. 01175 if (RenderFlags.Rendering != false) return FALSE; 01176 01177 TRACEUSER("Gavin",_T("GRenderRegion::StartRender - RenderFlags.Rendering = TRUE;\n")); 01178 RenderFlags.Rendering = TRUE; 01179 01180 // lets get the Rect into screen co-ords so we can use our big screen bitmap 01181 // Use a version of OSRenderRegion::DocRectToWin that uses the actual dpi we have stored 01182 // in PixelsPerInch 01183 //RECT Rect = OSRenderRegion::DocRectToWin( RenderMatrix, CurrentClipRect, PixelsPerInch ); 01184 // Use a virtual function so that we can now override it in some special case. 01185 // At present, we use this to try and fix pixel problems on bitmap export (GRenderBitmap) 01186 // The e and f components of RenderMatrix may be changed by the call, but only in the bitmap export case 01187 // 01188 // NB PixelsPerInch always set to 96.0 so never accurate unless at 100% zoom?! 01189 wxRect Rect; 01190 if (GetMasterCapture()) 01191 Rect = CalculateWinRect(GetMasterCapture()->CaptureMatrix, GetMasterCapture()->CaptureRect, GetMasterCapture()->dPixelsPerInch); 01192 else 01193 Rect = CalculateWinRect(RenderMatrix, CurrentClipRect, PixelsPerInch); 01194 01195 if (LocalBitmap) 01196 { 01197 ScreenRect = wxRect(0,0,0,0); 01198 // if WRect has changed at all, we're in trouble 01199 const INT32 NewWidth = Rect.width; 01200 const INT32 OldWidth = WRect.width; 01201 const INT32 NewHeight = Rect.height; 01202 const INT32 OldHeight = WRect.height; 01203 01204 // Its changed size and/or position, so we'll try and re-size the bitmap 01205 // If this fails, then we'll just re-allocate 01206 // NB GetNextBand() always frees the bitmap memory structs and sets them to NULL 01207 // GRenderDIB::ResizeRegion sets up new bitmap, WRect and CurrentClipRect so doesn't need this 01208 // code 01209 // What would use this code?? 01210 // Code used by ExportRender(GRenderOptPalette* pPalRegion) when rendering in strips 01211 if ( pBits!=NULL && pBitmapInfo!=NULL && (NewWidth!=OldWidth || NewHeight!=OldHeight) ) 01212 { 01213 // Make sure we are not after an empty one 01214 if (NewWidth == 0 || NewHeight == 0) 01215 return FALSE; 01216 01217 // Sanity check 01218 ERROR3IF((NewWidth < 0 || NewHeight < 0),"GRenderRegion::StartRender got a bad rectangle (Width/Height < 0)\n"); 01219 01220 ResetRegion(RegionRect); 01221 if (!RenderRegion::StartRender()) 01222 return FALSE; 01223 01224 // Get a new bitmap to replace the last one 01225 #if USE_wxBITMAP 01226 pBitmapInfo = AllocWxBitmap(NewWidth,NewHeight,uBitmapDepth); 01227 #else 01228 pBitmapInfo = GetLPBits(NewWidth, NewHeight, uBitmapDepth, &pBits); 01229 #endif 01230 if (pBitmapInfo==NULL) 01231 { 01232 TRACE( _T("Growing GG failed\n")); 01233 return FALSE; 01234 } 01235 AllocatedNewBmp = TRUE; 01236 GetMasterCapture()->SetDIB(pBitmapInfo, pBits); 01237 } 01238 01239 // set new rectangle size 01240 WRect = Rect; 01241 } 01242 else 01243 { 01244 WRect = Rect; 01245 ScreenRect = WRect; 01246 if (RenderView != NULL) 01247 { 01248 CCamView *RenderWindow = RenderView->GetConnectionToOilView(); 01249 if ( RenderWindow!=NULL && RenderWindow->GetFrame()!=NULL ) 01250 { 01251 // RenderWindow->ClientToScreen( &ScreenRect ); 01252 wxPoint tl = ScreenRect.GetTopLeft(); 01253 wxPoint br = ScreenRect.GetBottomRight(); 01254 RenderWindow->GetFrame()->ClientToScreen(tl); 01255 RenderWindow->GetFrame()->ClientToScreen(br); 01256 ScreenRect = wxRect(tl,br); 01257 } 01258 } 01259 else 01260 ERROR2(FALSE, "No render view in GRenderRegion::StartRender()"); 01261 01262 } 01263 01264 // Create the default, master capture... 01265 Capture* pNewMasterCapture = NULL; 01266 01267 if (m_CaptureStack.Empty()) 01268 { 01269 ERROR2IF(pBitmapInfo!=NULL, FALSE, "How has this region got a bitmap when the capture stack is empty?"); 01270 01271 pNewMasterCapture = new Capture(this, CAPTUREINFO(ctNESTABLE, cfMASTER | cfPIXWIDTHSCALE), RenderMatrix, CurrentClipRect, PixelsPerInch, CurrentColContext); 01272 if (pNewMasterCapture==NULL) return FALSE; 01273 01274 m_CaptureStack.Push(pNewMasterCapture); 01275 } 01276 01277 #ifdef _DEBUG 01278 else 01279 { 01280 // Check capture stack sanity! 01281 Capture* pDebugCapture = GetTopCaptureBitmap(); 01282 if (pDebugCapture) 01283 { 01284 ERROR3IF(pDebugCapture->CaptureRect != CurrentClipRect, "Wha?"); 01285 // ERROR3IF(!(pDebugCapture->CaptureMatrix == RenderMatrix), "Wha?"); 01286 ERROR3IF(pDebugCapture->dPixelsPerInch != PixelsPerInch, "Wha?"); 01287 } 01288 } 01289 #endif 01290 01291 if (pBitmapInfo==NULL) 01292 { 01293 ERROR2IF(GetMasterCapture()->dPixelsPerInch!=GetPixelsPerInch(), FALSE, "Master capture has different dpi than master bitmap"); 01294 01295 // Get a bitmap 01296 #if USE_wxBITMAP 01297 pBitmapInfo = AllocWxBitmap(WRect.width, WRect.height, uBitmapDepth); 01298 #else 01299 pBitmapInfo = GetLPBits(WRect.width, WRect.height, uBitmapDepth, &pBits); 01300 #endif 01301 if (pBitmapInfo==NULL) 01302 { 01303 ERROR3("Allocating GRenderRegion bitmap failed\n"); 01304 return FALSE; 01305 } 01306 01307 AllocatedNewBmp = TRUE; 01308 GetMasterCapture()->SetDIB(pBitmapInfo, pBits); 01309 } 01310 #ifdef _DEBUG 01311 else 01312 { 01313 // Check capture stack sanity! 01314 ERROR3IF(GetTopCaptureBitmap()==NULL, "There must be at least ONE bitmap capture!"); 01315 } 01316 #endif 01317 01318 // Do the middle bit 01319 if (!StartRenderMiddle()) 01320 return FALSE; 01321 01322 // Determine the correct hinting value for the current output mode, and call gavin to 01323 // set up his offscreen bitmap. 01324 // DWORD GavinHint = DIBUtil::GetGavinBlitFormat(ScreenDepth, uBitmapDepth, ScreenHinting); 01325 01326 // If we have just created the master capture then we should initialise the bitmap 01327 if (AllocatedNewBmp || ForceInitBmpBits) 01328 { 01329 InitBmpBits(); 01330 } 01331 01332 // Make sure we don't Init again until something forces it 01333 ForceInitBmpBits = FALSE; 01334 01335 // Gerry has re-written this bit so it works properly 01336 // It no longer tries to select a palette when the RenderDC doesn't exist or 01337 // doesn't support a palette 01338 if (RenderDC != NULL) 01339 { 01340 /* GAT if (ScreenDepth == 8) 01341 { 01342 // use frame windows palette if desired 01343 if (PaletteManager::UsePalette()) 01344 hPalette = *(PaletteManager::GetPalette()); 01345 } 01346 */ 01347 if (hPalette != NULL) 01348 // hPrevPalette = PaletteManager::StartPaintPalette(RenderDC->m_hDC); 01349 hPrevPalette = PaletteManager::StartPaintPalette(RenderDC); 01350 01351 if (uBitmapDepth == 8) 01352 { 01353 // If we are not error diffusing then set the dither style 01354 if ((DitherStyle8Bit != 0) && (DitherStyle8Bit != 3)) 01355 GetDrawContext()->SetDitherStyle((DitherStyle) DitherStyle8Bit); // Stupid prototype 01356 } 01357 /* GAT if (ScreenDepth == 8) 01358 { 01359 // Whether we set a palette or not, we need this call on all 8-bit screens 01360 GRenderRegion::GColInit(RenderDC->m_hDC); 01361 } 01362 */ } 01363 01364 // Start rendering into the current Capture... 01365 // (And always apply the clip region...) 01366 // PROBLEM: Clipping information is lost when background rendering kicks in. 01367 // 01368 // SOLUTION: (Re)apply the current clipping region whenever the render region 01369 // starts up (again). vvvv 01370 SetRenderToCapture(GetTopCaptureBitmap(), TRUE); 01371 01372 ENSURE(pBitmapInfo && pBits, "No bitmap to render into"); 01373 01374 // RenderMatrix.Dump(); 01375 01376 return TRUE; 01377 }
|
|
A virtual fn in this class which can be overridden if more work on a GMatrix is required. Default version returns TRUE.
Reimplemented in GRenderWinG. Definition at line 1544 of file grndrgn.cpp. 01545 { 01546 return TRUE; 01547 }
|
|
A virtual fn in this class which can be overridden if more work on a lpBits is required. Default version returns TRUE.
Definition at line 1563 of file grndrgn.cpp. 01564 { 01565 return TRUE; 01566 }
|
|
|
|
To stop a bitmap capture.
Reimplemented from RenderRegion. |
|
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.
Implements RenderRegion. Reimplemented in GRenderPrint. Definition at line 1587 of file grndrgn.cpp. 01588 { 01589 RememberMe("StopRender"); 01590 01591 // Remember this now before it gets cleared by SetClean 01592 // or set by the debug code below 01593 BOOL bHaveRendered = HaveRenderedSomething; 01594 01595 #if 0 01596 if (HaveRenderedSomething) 01597 { 01598 TRACE( _T("GRR# DebugClipRect = (%d, %d) - (%d, %d)\n"), CurrentClipRect.lo.x, CurrentClipRect.lo.y, CurrentClipRect.hi.x, CurrentClipRect.hi.y); 01599 01600 DocRect TempRect(CurrentClipRect); 01601 TempRect.Inflate(-GetScaledPixelWidth()); 01602 TRACE( _T("GRR# Filling = (%d, %d) - (%d, %d)\n"), TempRect.lo.x, TempRect.lo.y, TempRect.hi.x, TempRect.hi.y); 01603 Path ClipPath; 01604 ClipPath.Initialise(); 01605 ClipPath.CreatePathFromDocRect(&TempRect); 01606 01607 SaveContext(); 01608 SetLineColour(COLOUR_TRANS); 01609 SetFillColour(COLOUR_BLUE); 01610 DrawPath(&ClipPath); 01611 RestoreContext(); 01612 } 01613 #endif 01614 #if 0 01615 { 01616 SaveContext(); 01617 01618 SetLineColour(COLOUR_TRANS); 01619 SetFillColour(COLOUR_BLUE); 01620 01621 DocRect SmallRect(750, 750, 1500, 1500); 01622 Path ThePath; 01623 ThePath.Initialise(); 01624 ThePath.CreatePathFromDocRect(&SmallRect); 01625 01626 DrawPath(&ThePath); 01627 ThePath.Translate(50, 1500); 01628 DrawPath(&ThePath); 01629 ThePath.Translate(50, 1500); 01630 DrawPath(&ThePath); 01631 ThePath.Translate(50, 1500); 01632 DrawPath(&ThePath); 01633 ThePath.Translate(50, 1500); 01634 DrawPath(&ThePath); 01635 ThePath.Translate(50, 1500); 01636 DrawPath(&ThePath); 01637 ThePath.Translate(50, 1500); 01638 DrawPath(&ThePath); 01639 ThePath.Translate(50, 1500); 01640 DrawPath(&ThePath); 01641 ThePath.Translate(50, 1500); 01642 DrawPath(&ThePath); 01643 ThePath.Translate(50, 1500); 01644 DrawPath(&ThePath); 01645 ThePath.Translate(50, 1500); 01646 DrawPath(&ThePath); 01647 ThePath.Translate(50, 1500); 01648 DrawPath(&ThePath); 01649 ThePath.Translate(50, 1500); 01650 DrawPath(&ThePath); 01651 ThePath.Translate(50, 1500); 01652 DrawPath(&ThePath); 01653 ThePath.Translate(50, 1500); 01654 DrawPath(&ThePath); 01655 ThePath.Translate(50, 1500); 01656 DrawPath(&ThePath); 01657 01658 RestoreContext(); 01659 } 01660 #endif 01661 // Check that Initialise was called 01662 // ENSURE(RenderFlags.Rendering, "DeInitialise called before Initialise"); 01663 TRACEUSER("Gavin",_T("GRenderRegion::StopRender - RenderFlags.Rendering = FALSE;\n")); 01664 RenderFlags.Rendering = FALSE; 01665 01666 // Don't Blit if we are partway through rendering offscreen. The offscreen bitmap must only 01667 // be blitted once it is completed. Offscreen system takes care of resetting the rect which 01668 // GDraw has rendered to (ie ChangedBBox) 01669 if (pBitmapInfo) 01670 { 01671 if (MasterCaptureIsCurrent() && !TopCaptureIsDirect()) 01672 { 01673 // if we rendered something then blit, else we don't. This is handy for not 01674 // double-blitting paper areas. Could take it even further to only blit those areas 01675 // of the bitmap which have been written to. 01676 01677 if (HaveRenderedSomething) 01678 { 01679 // Show the current rendering state on screen 01680 // No, just needs a simple blit to screen... 01681 // This is the commonest, fast case 01682 DisplayBits(); 01683 01684 // We have updated the screen, so now we're 'clean'. 01685 SetClean(TRUE, FALSE); 01686 } 01687 } 01688 else 01689 { 01690 // We were rendering into Capture bitmaps when this Stop request 01691 // occurred so, to show current progress, we must blit the contents 01692 // of the capture stack into a copy of the master bitmap and 01693 // put that on the screen... 01694 // 01695 // Note that we CANNOT alter the master bitmap itself because when 01696 // the captures terminate properly they will again be blitted into 01697 // the master bitmap and so the master bitmap must not contain any 01698 // earlier version of the captures otherwise transparency values 01699 // would be multiplied. 01700 // 01701 if (HaveRenderedSomething) 01702 { 01703 // Make a temporary bitmap from the current state of things and display that 01704 DisplayCurrentState(); 01705 01706 // We have updated the screen, so now we're 'clean'. 01707 SetClean(TRUE, FALSE); 01708 } 01709 } 01710 } 01711 else 01712 { 01713 if(!IsWrapped) 01714 TRACE( _T("GRenderRegion::StopRender called with no bitmap\n")); 01715 } 01716 01717 if (hPrevPalette) 01718 PaletteManager::StopPaintPalette(RenderDC, hPrevPalette); 01719 01720 // Clean out the Fuzzy Rectangles 01721 InnerRect.MakeEmpty(); 01722 OuterRect.MakeEmpty(); 01723 01724 // Karim 04/05/2000 01725 // free all of our cached clipping regions. 01726 FreeStoredClipRegions(); 01727 01728 // Reset dither style to ordered dither on 8bpp screens 01729 if (ScreenDepth == 8) 01730 GetDrawContext()->SetDitherStyle(DITHER_GREY_ORDERED); 01731 01732 return bHaveRendered; 01733 }
|
|
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.
Definition at line 1864 of file grndrgn.cpp. 01868 { 01869 CapStyles Caps; 01870 JoinStyles Join; 01871 01872 switch (RR_STARTCAP()) 01873 { 01874 case LineCapRound: 01875 Caps = CAPS_ROUND; 01876 break; 01877 case LineCapSquare: 01878 Caps = CAPS_SQUARE; 01879 break; 01880 case LineCapButt: 01881 Caps = CAPS_BUTT; 01882 break; 01883 default: 01884 ENSURE(FALSE, "Bad startcap"); 01885 Caps = CAPS_ROUND; 01886 break; 01887 } 01888 switch (RR_JOINTYPE()) 01889 { 01890 case BevelledJoin: 01891 Join = JOIN_BEVEL; 01892 break; 01893 case MitreJoin: 01894 Join = JOIN_MITER; 01895 break; 01896 case RoundJoin: 01897 Join = JOIN_ROUND; 01898 break; 01899 default: 01900 ENSURE(FALSE, "bad jointype"); 01901 Join = JOIN_ROUND; 01902 break; 01903 } 01904 01905 BOOL StrokeOK = TRUE; 01906 01907 // DMc updates so that arrow heads are drawn on the line not after it 01908 // 25/2/99 01909 // make a copy of the coord array 01910 DocCoord * pCopyCoords = NULL; 01911 if (UnclippedCount != 0) 01912 { 01913 pCopyCoords = (DocCoord *)(CCMalloc(sizeof(DocCoord) * UnclippedCount)); 01914 01915 for (UINT32 i = 0; i < UnclippedCount; i++) 01916 { 01917 pCopyCoords[i].x = UnclippedCoords[i].x; 01918 pCopyCoords[i].y = UnclippedCoords[i].y; 01919 } 01920 } 01921 01922 BOOL bRenderedArrows = FALSE; 01923 01924 // DMc update for arrow heads being drawn on the line not after it 01925 // 25/2/99 01926 // Pass the Unclipped coords to the arrow rendering routine. 01927 if (DrawArrows && pCopyCoords) 01928 { 01929 bRenderedArrows = DrawPathArrowHeads((DocCoord*)pCopyCoords, (PathVerb*)UnclippedVerbs, UnclippedCount); 01930 } 01931 01932 // We won't stroke anything, if the path has been 01933 // fuzzy clipped so much, that there are no points left 01934 if (Count > 1 && pCopyCoords) 01935 { 01936 MILLIPOINT Width = RR_LINEWIDTH(); 01937 01938 if (RenderFlags.HitDetect) 01939 { 01940 // rendering to off-screen bitmaps means minimum 3-pixel wide lines 01941 if (Width < (ScaledPixelWidth*1)) 01942 Width = ScaledPixelWidth*1; 01943 } 01944 else if (RRQuality.GetQuality() == Quality::QualityGuideLayer) 01945 { 01946 SetDashPattern(SD_DASH1); 01947 DocColour* pCol = AttrQuality::GetColour(); 01948 if (pCol != NULL) 01949 SetGCol(*pCol); 01950 else 01951 { 01952 DocColour colorRed(COLOUR_RED); 01953 SetGCol( colorRed ); 01954 } 01955 01956 Width = ScaledPixelWidth; 01957 DrawArrows = FALSE; 01958 } 01959 else if (RRQuality.GetLineQuality() < Quality::FullLine) 01960 { 01961 // do 0-width lines if line quality is low 01962 Width = 0; 01963 DrawArrows = FALSE; 01964 } 01965 else if (RRQuality.GetAntialiasQuality() < Quality::FullAntialias) 01966 { 01967 // if not anti-aliasing then check for lines thinner than one pixel as Gavin doesn't 01968 // render them very usefully 01969 if (Width < ScaledPixelWidth) 01970 Width = 0; 01971 } 01972 01973 DashType* pDashRec = NULL; 01974 DashType GavinDash; 01975 01976 if ( Width > 0 && 01977 (RRQuality.GetLineQuality() >= Quality::FullLine) && 01978 RR_DASHPATTERN().Elements > 0) 01979 { 01980 INT32 Length = RR_DASHPATTERN().Elements; 01981 01982 // Gavin Dashes are Max of 8 elements 01983 if (Length > 8) Length = 8; 01984 01985 01986 // If the flag is set, then we need to scale the dash elements 01987 // according to the linewidth 01988 BOOL DoScale = RR_DASHPATTERN().ScaleWithLineWidth; 01989 01990 FIXED16 Scale = DoScale ? (double(Width) / double(RR_DASHPATTERN().LineWidth)) : 1; 01991 01992 GavinDash.Length = Length; 01993 GavinDash.Offset = LongMulFixed16(RR_DASHPATTERN().DashStart, Scale); 01994 01995 for (INT32 el = 0; el < Length; el++) 01996 { 01997 // Copy each element into the Gavin Dash, scaling as we go 01998 GavinDash.Array[el] = LongMulFixed16(RR_DASHPATTERN().ElementData[el], Scale); 01999 } 02000 02001 pDashRec = &GavinDash; 02002 } 02003 02004 // DMc update 25/2/99 02005 // previously : 02006 // StrokeOK = GetDrawContext()->StrokePath( (POINT*)Coords, Verbs, Count, FALSE, 02007 // Width, Caps, Join, pDashRec ); 02008 02009 if (bRenderedArrows) 02010 { 02011 StrokeOK = GetDrawContext()->StrokePath( (POINT*)pCopyCoords, UnclippedVerbs, UnclippedCount, FALSE, 02012 Width, Caps, Join, pDashRec ); 02013 } 02014 else 02015 { 02016 StrokeOK = GetDrawContext()->StrokePath( (POINT*)Coords, Verbs, Count, FALSE, 02017 Width, Caps, Join, pDashRec ); 02018 } 02019 } 02020 02021 if (pCopyCoords) 02022 { 02023 CCFree(pCopyCoords); 02024 pCopyCoords = NULL; 02025 } 02026 02027 if (bRenderedArrows) 02028 return TRUE; 02029 02030 return StrokeOK; 02031 }
|
|
|
|
|
|
Definition at line 563 of file grndrgn.h. 00563 {return (GetTopCapture() && GetTopCapture()->IsDirect());}
|
|
Reimplemented from RenderRegion. |
|
|
|
|
|
|
|
|
|
|
|
|
|
Specifies which bitmap conversion algorithm is used by GDraw when rendering bitmaps in show printer colours mode. Preference: BitmapConversion Section: Rendering Range: 0 - no bitmap conversion (show printer colours will render wrong) 1 - fast conversion (visible banding in deep bitmaps and cached stuff) 2 - medium conversion (best setting for general use) 3 - slow conversion (not yet implemented, most accurate but slow) |
|
|
|
|
|
|
|
|
|
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. Preference: ClickTranspLimit Section: Screen Range: 0 to 255 |
|
|
|
|
|
|
|
|
|
Initial value: { 0x300, 256 } |
|
|
|
|
|
|
|
|
|
Determine whether to use GDraw's high quality anti-aliasing mode. Preference: HighQualityAA Section: Rendering Range: FALSE - normal Anti-aliasing TRUE - High quality Anti-aliasing |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|