osrndrgn.cpp File Reference

(r1785/r1571)

#include "camtypes.h"
#include "osrndrgn.h"
#include <math.h>
#include "camelot.h"
#include "rendbits.h"
#include "grndrgn.h"
#include "devcolor.h"
#include "oilbitmap.h"
#include "camview.h"
#include "fuzzclip.h"
#include "nodeelip.h"
#include "noderect.h"
#include "princomp.h"
#include "printctl.h"
#include "psrndrgn.h"
#include "palman.h"
#include "maskedrr.h"
#include "textfuns.h"
#include "colcontx.h"
#include "nodebmp.h"
#include "fontman.h"
#include "gradtbl.h"
#include "unicdman.h"
#include "mrhbits.h"
#include "strkattr.h"
#include "cartprov.h"
#include "lineattr.h"

Go to the source code of this file.

Defines

#define new   CAM_DEBUG_NEW
#define MAX_POLYGONS   256
#define TEST_MANUAL_LINES   0
#define LONGEST_SEGMENT   8192

Enumerations

enum  GradFillMethodType { GF_USE_GDICLIPPING, GF_USE_GDIEOR, GF_USE_GAVINCLIPPING }

Functions

 DECLARE_SOURCE ("$Revision: 1571 $")
static INT32 GetDiagonal (const WinRect &Rectangle)
 Like PolyDraw but works on Chicago. Does not work on Win32s. Scope: Protected.
static INT32 ColDifference (DocColour &Start, DocColour &End, INT32 Depth, EFFECTTYPE EffectType)
 To determine the number of grad fill steps that will be necessary to render the given graduation to a reasonable quality.

Variables

static BOOL WantGDIPalette = TRUE
 Allows the user to determine whether a special palette is used when rendering with GDI. Ingored except on modes that support palettes (e.g. 256 colours). Defaults to 1.
static BOOL WantBetterLines
 Allows the user to determine whether we let GDI do lines (2) or we do them (1). When we do them we do end caps, mitres etc properly. 0 means let GDI32 do them, but we do them on GDI16. Defaults to 0.
static BOOL PrintRotatedTextAsPaths = FALSE
 Allows the user to force printing on non-Postscript printers to output all rotated characters as paths instead of using GDI text rendering. Note that "Rotated" means rotated on the physical paper. Defaults to FALSE (0).
BOOL BodgeRectangles = FALSE
 Set to 1 for video drivers that cannot plot rectangles with line borders correctly e.g. Avance 1.5F in 256 colours. Defaults to 0.
static INT32 GradFillQuality = 1
static DocCoord ConvPoints [8192]
static PathVerb ConvVerbs [8192]
const INT32 MAX_FILL_STEPS = 128
const BOOL USE_GDI_CLIPPING = FALSE


Define Documentation

#define LONGEST_SEGMENT   8192
 

Definition at line 2693 of file osrndrgn.cpp.

#define MAX_POLYGONS   256
 

Definition at line 2406 of file osrndrgn.cpp.

#define new   CAM_DEBUG_NEW
 

Definition at line 247 of file osrndrgn.cpp.

#define TEST_MANUAL_LINES   0
 

Definition at line 2687 of file osrndrgn.cpp.


Enumeration Type Documentation

enum GradFillMethodType
 

Enumerator:
GF_USE_GDICLIPPING 
GF_USE_GDIEOR 
GF_USE_GAVINCLIPPING 

Definition at line 4915 of file osrndrgn.cpp.


Function Documentation

static INT32 ColDifference DocColour Start,
DocColour End,
INT32  Depth,
EFFECTTYPE  EffectType
[static]
 

To determine the number of grad fill steps that will be necessary to render the given graduation to a reasonable quality.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>? Rik? Tim?
Date:
?
Parameters:
Start,End - The Start & end colours for the fill [INPUTS] EffectType - The fill type (EFFECT_RGB, EFFECT_HSV_SHORT, EFFECT_HSV_LONG)
Returns:
The number of gradient steps you should generate when rendering this fill
Scope: Private static (in osrndrgn.cpp)

Definition at line 4848 of file osrndrgn.cpp.

04849 {
04850     // Get RGB values of start and end colours...
04851     INT32 StartRed, StartGreen, StartBlue;
04852     Start.GetRGBValue(&StartRed, &StartGreen, &StartBlue);
04853 
04854     INT32 EndRed, EndGreen, EndBlue;
04855     End.GetRGBValue(&EndRed, &EndGreen, &EndBlue);
04856 
04857     // Find maximum difference between colours
04858     INT32 Diff = Abs(StartRed-EndRed);
04859     INT32 Tmp = StartGreen - EndGreen;
04860     Diff = max(Abs(Tmp), Diff);
04861     Tmp = StartBlue - EndBlue;
04862     Diff = max(Abs(Tmp), Diff);
04863 
04864     // Spot colours in a fill coerce the fill to a simple RGB mix
04865     if (Start.GetSpotParent() != NULL || End.GetSpotParent() != NULL)
04866         EffectType = EFFECT_RGB;
04867 
04868     // See if HSV route requires larger number of steps...
04869     if (EffectType == EFFECT_HSV_SHORT || EffectType == EFFECT_HSV_LONG)
04870     {
04871         // Get an HSV context (quite fast - simple array lookup)
04872         ColourContext *pContext = ColourContext::GetGlobalDefault(COLOURMODEL_HSVT);
04873         ERROR3IF(pContext == NULL, "No HSV context?!");
04874 
04875         ColourHSVT StartDef;
04876         pContext->ConvertColour(&Start, (ColourGeneric *) &StartDef);
04877 
04878         ColourHSVT EndDef;
04879         pContext->ConvertColour(&End, (ColourGeneric *) &EndDef);
04880 
04881         // HSV blend! We can go 2 ways, as HSV can 'wrap' from 1.0 back to 0.0
04882         BOOL BlendNormally = TRUE;
04883 
04884         // Calc. the "simple" (non-wrapping) distance between the hues
04885         const double StartHue   = StartDef.Hue.MakeDouble();
04886         const double EndHue     = EndDef.Hue.MakeDouble();
04887 
04888         double SimpleDist = StartHue - EndHue;
04889         if (SimpleDist < 0.0)
04890             SimpleDist = -SimpleDist;
04891 
04892         // Determine whether we do a simple blend, or we have to "wrap"
04893         if (SimpleDist <= 0.5)
04894             BlendNormally = !(EffectType == EFFECT_HSV_LONG);
04895         else
04896             BlendNormally = (EffectType == EFFECT_HSV_LONG);
04897 
04898         // Convert to 9 bit value
04899         INT32 HSVDiff = (INT32) (360.0 * SimpleDist);
04900         if (!BlendNormally)         // Go the long way around
04901             HSVDiff = 360 - HSVDiff;
04902 
04903         if (HSVDiff > Diff)         // Use this if it's larger.
04904             Diff = HSVDiff;
04905     }
04906 
04907     return((Depth >= 24) ? Diff : Diff / 3);    // Decide how many steps to do based on colour depth.
04908 }

DECLARE_SOURCE "$Revision: 1571 $"   ) 
 

static INT32 GetDiagonal const WinRect Rectangle  )  [inline, static]
 

Like PolyDraw but works on Chicago. Does not work on Win32s. Scope: Protected.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/4/94
Parameters:
A list of points (in GDI coords), a list of PT_ verbs and a count. [INPUTS]
- [OUTPUTS]
Returns:
Errors: -

TRUE if worked, FALSE if failed

Definition at line 4299 of file osrndrgn.cpp.

04300 {
04301     const double W = Rectangle.width;
04302     const double H = Rectangle.height;
04303     return (INT32) sqrt(W*W+H*H);
04304 }


Variable Documentation

BOOL BodgeRectangles = FALSE
 

Set to 1 for video drivers that cannot plot rectangles with line borders correctly e.g. Avance 1.5F in 256 colours. Defaults to 0.

Preference: SlowRectangles Section: DisplayKludges Range: 0 or 1

Definition at line 230 of file osrndrgn.cpp.

DocCoord ConvPoints[8192] [static]
 

Definition at line 2695 of file osrndrgn.cpp.

PathVerb ConvVerbs[8192] [static]
 

Definition at line 2696 of file osrndrgn.cpp.

INT32 GradFillQuality = 1 [static]
 

Definition at line 242 of file osrndrgn.cpp.

const INT32 MAX_FILL_STEPS = 128
 

Definition at line 4912 of file osrndrgn.cpp.

BOOL PrintRotatedTextAsPaths = FALSE [static]
 

Allows the user to force printing on non-Postscript printers to output all rotated characters as paths instead of using GDI text rendering. Note that "Rotated" means rotated on the physical paper. Defaults to FALSE (0).

Preference: PrintRotatedTextAsPaths Section: Printing Range: 1 or 0

Definition at line 199 of file osrndrgn.cpp.

const BOOL USE_GDI_CLIPPING = FALSE
 

Definition at line 4913 of file osrndrgn.cpp.

BOOL WantBetterLines [static]
 

Allows the user to determine whether we let GDI do lines (2) or we do them (1). When we do them we do end caps, mitres etc properly. 0 means let GDI32 do them, but we do them on GDI16. Defaults to 0.

Preference: BetterLines Section: Screen Range: 0 (auto), 1 (yes), 2 (no)

Definition at line 182 of file osrndrgn.cpp.

BOOL WantGDIPalette = TRUE [static]
 

Allows the user to determine whether a special palette is used when rendering with GDI. Ingored except on modes that support palettes (e.g. 256 colours). Defaults to 1.

Preference: GDIPalette Section: Screen Range: 1 or 0

Definition at line 165 of file osrndrgn.cpp.


Generated on Sat Nov 10 03:49:35 2007 for Camelot by  doxygen 1.4.4