GradTable32 Class Reference

A kernel representation of a 32 bpp graduation table. (This is a table of COLORREF RGB values for GDraw). More...

#include <gradtbl.h>

Inheritance diagram for GradTable32:

CCObject SimpleCCObject List of all members.

Public Member Functions

 GradTable32 ()
 Default constructor for a GradTable32.
 ~GradTable32 ()
 Destructor for a GradTable32.
void SetTableSize (BOOL LargeTable)
 To set the size of this Grad table.
BOOL BuildTable (DocColour &StartCol, DocColour &EndCol, View *ContextView, EFFECTTYPE Effect, DWORD TableSize=0x100)
 Builds a GradTable from StartCol to EndCol, filling in the entire table with appropriate GDraw dither patterns.
BOOL BuildTable (DocColour &StartCol, DocColour &EndCol, View *ContextView, EFFECTTYPE Effect, DWORD FirstEntry, DWORD LastEntry)
 Builds a GradTable from StartCol to EndCol, filling in a portion of the table with appropriate GDraw dither patterns.

Static Public Member Functions

static BOOL BuildGraduatedPalette (DocColour &StartCol, DocColour &EndCol, View *ContextView, EFFECTTYPE Effect, DWORD TableSize, COLORREF *pTable)
 Builds a Graduated Table, filling in the given table with COLORREF entries. The entries will be colour corrected and/or separated as appropriate to the context view.
static BOOL BuildGraduatedPalette (DocColour &StartCol, DocColour &EndCol, View *ContextView, EFFECTTYPE Effect, DWORD FirstEntry, DWORD LastEntry, COLORREF *pTable)
 Builds a Graduated Table from StartCol to EndCol, filling in the given table with COLORREF entries. The entries will be colour corrected and/or separated as appropriate to the context view.
static BOOL BuildGraduatedPalette (DocColour &StartCol, DocColour &EndCol, View *ContextView, EFFECTTYPE Effect, DWORD TableSize, RGBQUAD *pTable)
 Builds a Graduated Table, filling in the given table with RGBQUAD entries. The entries will be colour corrected and/or separated as appropriate to the context view.
static BOOL BuildGraduatedPalette (DocColour &StartCol, DocColour &EndCol, View *ContextView, EFFECTTYPE Effect, DWORD TableSize, RGBQUAD *pTable, CProfileBiasGain &BiasGain)
 Builds a Graduated Table, filling in the given table with RGBQUAD entries (taking into account the biasgain). The entries will be colour corrected and/or separated as appropriate to the context view.
static BOOL BuildGraduatedPalette (DocColour &StartCol, DocColour &EndCol, View *ContextView, EFFECTTYPE Effect, DWORD FirstEntry, DWORD LastEntry, RGBQUAD *pTable)
 Builds a Graduated Table from StartCol to EndCol, filling in the given table with RGBQUAD entries. The entries will be colour corrected and/or separated as appropriate to the context view.

Static Protected Member Functions

static BOOL BuildPaletteInternal (DocColour &StartCol, DocColour &EndCol, View *ContextView, EFFECTTYPE Effect, DWORD FirstEntry, DWORD LastEntry, void *pTable, BOOL IsColorRef, CProfileBiasGain &BiasGain)
 Builds a Graduated Table from StartCol to EndCol, filling in the given table with either COLORREF or RGBQUAD entries. The entries will be colour corrected and/or separated as appropriate to the context view.
static BOOL BuildPaletteInternalRGB (DocColour &StartCol, DocColour &EndCol, View *ContextView, DWORD FirstEntry, DWORD LastEntry, void *pTable, BOOL IsColorRef, CProfileBiasGain &BiasGain)
 Builds a Graduated (RGB Mix) Table from StartCol to EndCol, filling in the given table with either COLORREF or RGBQUAD entries.
static BOOL BuildPaletteInternalHSV (DocColour &StartCol, DocColour &EndCol, View *ContextView, EFFECTTYPE Effect, DWORD FirstEntry, DWORD LastEntry, void *pTable, BOOL IsColorRef, CProfileBiasGain &BiasGain)
 Builds a Graduated (HSV rainbow/alt-rainbow) Table from StartCol to EndCol, filling in the given table with either COLORREF or RGBQUAD entries.
static BOOL BuildPaletteInternalRGBComposite (DocColour &StartCol, DocColour &EndCol, View *ContextView, DWORD FirstEntry, DWORD LastEntry, void *pTable, BOOL IsColorRef)
 Builds a Graduated (RGB Mix) Table from StartCol to EndCol, filling in the given table with either COLORREF or RGBQUAD entries.

Detailed Description

A kernel representation of a 32 bpp graduation table. (This is a table of COLORREF RGB values for GDraw).

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/9/94
See also:
GradTable
Notes: There are now 3 base functions in GradTable and GradTable32 which build graduation tables. The tables are actually identical in meaning, but are encoded as: (a) Gavin 8bpp dither patterns, (b) RGBQUAD RGB structures, (c) COLORREF RGB values this is because the different places that use these tables demand the different formats, and converting all the code to use only one table format is non-trivial and/or inefficient.

Definition at line 286 of file gradtbl.h.


Constructor & Destructor Documentation

GradTable32::GradTable32  ) 
 

Default constructor for a GradTable32.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/9/94
Returns:
Errors: -

Definition at line 1597 of file gradtbl.cpp.

01598 {
01599 }

GradTable32::~GradTable32  ) 
 

Destructor for a GradTable32.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/10/96

Definition at line 1612 of file gradtbl.cpp.

01613 {
01614 }


Member Function Documentation

BOOL GradTable32::BuildGraduatedPalette DocColour StartCol,
DocColour EndCol,
View ContextView,
EFFECTTYPE  Effect,
DWORD  FirstEntry,
DWORD  LastEntry,
RGBQUAD pTable
[static]
 

Builds a Graduated Table from StartCol to EndCol, filling in the given table with RGBQUAD entries. The entries will be colour corrected and/or separated as appropriate to the context view.

Parameters:
StartCol,EndCol - Define the end colours of the graduation [INPUTS] ContextView - Points to the view in which the gradation is to be displayed. (This is necessary for correction and separation etc. If proper colour handling is not needed, then you may pass NULL, but generally, this parameter should be sensible)
Effect - EFFECT_FADE, EFFECT_HSV_SHORT, or EFFECT_HSV_LONG

FirstEntry - The index of the first entry (inclusive) to fill in (0 is the first) LastEntry - The index of the last entry (exclusive) to fill in (TableSize is the last) (i.e. to fill entire table use (0,TableSize) which will fill in entries 0..Tablesize-1)

Parameters:
pTable - On return, will be filled in with appropriate colours [OUTPUTS]
Returns:
FALSE if it fails

Errors: Out of memory

Definition at line 1950 of file gradtbl.cpp.

01954 {
01955     CProfileBiasGain DefaultBiasGain;           // we need a 'default' profile so we call
01956                                                 // standardise the following call ....
01957     return(BuildPaletteInternal(StartCol, EndCol, ContextView, Effect, FirstEntry, LastEntry,
01958                             (void *) pTable, FALSE, DefaultBiasGain));
01959 }

BOOL GradTable32::BuildGraduatedPalette DocColour StartCol,
DocColour EndCol,
View ContextView,
EFFECTTYPE  Effect,
DWORD  TableSize,
RGBQUAD pTable,
CProfileBiasGain BiasGain
[static]
 

Builds a Graduated Table, filling in the given table with RGBQUAD entries (taking into account the biasgain). The entries will be colour corrected and/or separated as appropriate to the context view.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/2/2000
Parameters:
StartCol,EndCol - Define the end colours of the graduation [INPUTS] ContextView - Points to the view in which the gradation is to be displayed. (This is necessary for correction and separation etc. If proper colour handling is not needed, then you may pass NULL, but generally, this parameter should be sensible)
Effect - EFFECT_FADE, EFFECT_HSV_SHORT, or EFFECT_HSV_LONG

TableSize - Number of entries in the table

BiasGain - The biasgain profile that is to alter the table

Parameters:
pTable - On return, will be filled in with appropriate colours [OUTPUTS]
Returns:
FALSE if it fails

Errors: -

Definition at line 1905 of file gradtbl.cpp.

01909 {
01910     return(BuildPaletteInternal(StartCol, EndCol, ContextView, Effect, 0, TableSize,
01911                             (void *) pTable, FALSE, BiasGain));
01912 }

BOOL GradTable32::BuildGraduatedPalette DocColour StartCol,
DocColour EndCol,
View ContextView,
EFFECTTYPE  Effect,
DWORD  TableSize,
RGBQUAD pTable
[static]
 

Builds a Graduated Table, filling in the given table with RGBQUAD entries. The entries will be colour corrected and/or separated as appropriate to the context view.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/5/96
Parameters:
StartCol,EndCol - Define the end colours of the graduation [INPUTS] ContextView - Points to the view in which the gradation is to be displayed. (This is necessary for correction and separation etc. If proper colour handling is not needed, then you may pass NULL, but generally, this parameter should be sensible)
Effect - EFFECT_FADE, EFFECT_HSV_SHORT, or EFFECT_HSV_LONG

TableSize - Number of entries in the table

Parameters:
pTable - On return, will be filled in with appropriate colours [OUTPUTS]
Returns:
FALSE if it fails

Errors: -

Definition at line 1859 of file gradtbl.cpp.

01862 {
01863     CProfileBiasGain DefaultBiasGain;           // we need a 'default' profile so we call
01864                                                 // standardise the following call ....
01865     return(BuildPaletteInternal(StartCol, EndCol, ContextView, Effect, 0, TableSize,
01866                             (void *) pTable, FALSE, DefaultBiasGain));
01867 }

BOOL GradTable32::BuildGraduatedPalette DocColour StartCol,
DocColour EndCol,
View ContextView,
EFFECTTYPE  Effect,
DWORD  FirstEntry,
DWORD  LastEntry,
COLORREF pTable
[static]
 

Builds a Graduated Table from StartCol to EndCol, filling in the given table with COLORREF entries. The entries will be colour corrected and/or separated as appropriate to the context view.

Parameters:
StartCol,EndCol - Define the end colours of the graduation [INPUTS] ContextView - Points to the view in which the gradation is to be displayed. (This is necessary for correction and separation etc. If proper colour handling is not needed, then you may pass NULL, but generally, this parameter should be sensible)
Effect - EFFECT_FADE, EFFECT_HSV_SHORT, or EFFECT_HSV_LONG

FirstEntry - The index of the first entry (inclusive) to fill in (0 is the first) LastEntry - The index of the last entry (exclusive) to fill in (TableSize is the last) (i.e. to fill entire table use (0,TableSize) which will fill in entries 0..Tablesize-1)

Parameters:
pTable - On return, will be filled in with appropriate colours [OUTPUTS]
Returns:
FALSE if it fails

Errors: Out of memory

Definition at line 1815 of file gradtbl.cpp.

01819 {
01820     CProfileBiasGain DefaultBiasGain;           // we need a 'default' profile so we call
01821                                                 // standardise the following call ....
01822     return(BuildPaletteInternal(StartCol, EndCol, ContextView, Effect, FirstEntry, LastEntry,
01823                             (void *) pTable, TRUE, DefaultBiasGain));
01824 }

BOOL GradTable32::BuildGraduatedPalette DocColour StartCol,
DocColour EndCol,
View ContextView,
EFFECTTYPE  Effect,
DWORD  TableSize,
COLORREF pTable
[static]
 

Builds a Graduated Table, filling in the given table with COLORREF entries. The entries will be colour corrected and/or separated as appropriate to the context view.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/5/96
Parameters:
StartCol,EndCol - Define the end colours of the graduation [INPUTS] ContextView - Points to the view in which the gradation is to be displayed. (This is necessary for correction and separation etc. If proper colour handling is not needed, then you may pass NULL, but generally, this parameter should be sensible)
Effect - EFFECT_FADE, EFFECT_HSV_SHORT, or EFFECT_HSV_LONG

TableSize - Number of entries in the table

Parameters:
pTable - On return, will be filled in with appropriate colours [OUTPUTS]
Returns:
FALSE if it fails

Errors: -

Definition at line 1769 of file gradtbl.cpp.

01772 {
01773     CProfileBiasGain DefaultBiasGain;           // we need a 'default' profile so we call
01774                                                 // standardise the following call ....
01775     return(BuildPaletteInternal(StartCol, EndCol, ContextView, Effect, 0, TableSize,
01776                             (void *) pTable, TRUE, DefaultBiasGain));
01777 }

BOOL GradTable32::BuildPaletteInternal DocColour StartCol,
DocColour EndCol,
View ContextView,
EFFECTTYPE  Effect,
DWORD  FirstEntry,
DWORD  LastEntry,
void *  pTable,
BOOL  IsColorRef,
CProfileBiasGain BiasGain
[static, protected]
 

Builds a Graduated Table from StartCol to EndCol, filling in the given table with either COLORREF or RGBQUAD entries. The entries will be colour corrected and/or separated as appropriate to the context view.

Parameters:
StartCol,EndCol - Define the end colours of the graduation [INPUTS] ContextView - Points to the view in which the gradation is to be displayed. (This is necessary for correction and separation etc. If proper colour handling is not needed, then you may pass NULL, but generally, this parameter should be sensible)
Effect - EFFECT_FADE, EFFECT_HSV_SHORT, or EFFECT_HSV_LONG

FirstEntry - The index of the first entry (inclusive) to fill in (0 is the first) LastEntry - The index of the last entry (exclusive) to fill in (TableSize is the last) (i.e. to fill entire table use (0,TableSize) which will fill in entries 0..Tablesize-1)

IsColorRef - TRUE if the pTable pointer is a (COLORREF *) FALSE if the pTable pointer is an (RGBQUAD *)

Parameters:
pTable - On return, will be filled in with appropriate colours, in the format [OUTPUTS] indicated by the IsColorRef flag.
Returns:
FALSE if it fails
This is an internal shared function used by all the other GradTable32 grad palette building methods

Notes: This routine supplies a simple, generic mixing loop. However, for normal (no colour plate) rendering, this function will call the other internal methods which are optimised for specific cases - this gives about a 3x performance enhancement for normal rendering.

Returns:
Errors: Out of memory

Definition at line 2010 of file gradtbl.cpp.

02015 {
02016     ERROR3IF(pTable == NULL, "Illegal NULL param");
02017 
02018     // The range should be withion the table size. We only ERROR3, though, because
02019     // the physical table is always large enough for the maximum number of entries.
02020     ERROR3IF(FirstEntry < 0 || FirstEntry > LastEntry,
02021                 "GradTable32::BuildPaletteInternal expects sensible First/Last Entry values");
02022 
02023     // Determine if either the start or end colour is a spot colour - if it is, we must
02024     // coerce the fill into a "mix" (rgb) rather than rainbow fill style
02025     if (Effect != EFFECT_RGB && (StartCol.GetSpotParent() != NULL || EndCol.GetSpotParent() != NULL))
02026         Effect = EFFECT_RGB;
02027 
02028 
02029     // --- Optimisation - are we trying to build a simple grad table under normal rendering
02030     // circumstances? If so, special case this to make it as fast as possible. This more than
02031     // doubles the speed of table generation.
02032     ColourContext *ccRGB = ColourManager::GetColourContext(COLOURMODEL_RGBT, ContextView);
02033     ERROR3IF(ccRGB == NULL, "GradTable32::BuildPaletteInternal - Can't find my colour context!");
02034 
02035     if (ccRGB->GetColourPlate() == NULL || ccRGB->GetColourPlate()->IsDisabled())
02036     {
02037         if (Effect == EFFECT_RGB)   // RGB mix?
02038         {
02039             return(BuildPaletteInternalRGB(StartCol, EndCol, ContextView,
02040                                         FirstEntry, LastEntry, pTable, IsColorRef, BiasGain));
02041         }
02042 
02043         // HSV (rainbow) mix
02044         return(BuildPaletteInternalHSV(StartCol, EndCol, ContextView, Effect,
02045                                     FirstEntry, LastEntry, pTable, IsColorRef, BiasGain));
02046     }
02047 
02048     if (Effect == EFFECT_RGB && ccRGB->GetColourPlate()->GetType() == COLOURPLATE_COMPOSITE &&
02049         (StartCol.GetColourModel() != COLOURMODEL_CMYK || EndCol.GetColourModel() != COLOURMODEL_CMYK))
02050     {
02051         return(BuildPaletteInternalRGBComposite(StartCol, EndCol, ContextView,
02052                                                 FirstEntry, LastEntry, pTable, IsColorRef));
02053     }
02054 
02055 
02056     // --- OK, we're trying to do something special. Drop back to the generic (slow) code
02057     RGBQUAD  *pRGBTable = (RGBQUAD *)  pTable;      // Cast the table pointer to the two
02058     COLORREF *pRefTable = (COLORREF *) pTable;      // possible types
02059 
02060     // Get colour contexts: we need 2 - first, an RGB context (got above) for the ContextView, which
02061     // will be used to get colour-corrected/separated/etc output colour in RGB; and second,
02062     // a generic RGB or HSV context to provide a "mixing colourspace" for the graduations.
02063     ColourContext *cc = NULL;
02064 
02065     if (Effect == EFFECT_RGB)
02066         cc = ColourManager::GetColourContext(COLOURMODEL_RGBT);     // RGB fade
02067     else
02068         cc = ColourManager::GetColourContext(COLOURMODEL_HSVT);     // HSV fade
02069 
02070     // If we can't find RGB/HSV contexts, something is seriously broken
02071     ERROR3IF(cc == NULL, "GradTable32::BuildPaletteInternal - Can't find my colour context!");
02072 
02073     // Fill in the Start and End colours of the table, if we've hit them
02074     PColourRGBT Result;
02075 
02076     // And build our graduated palette
02077     double MixFraction  = 0.0;
02078     double MixStep      = 1.0 / (double) (LastEntry - FirstEntry - 1);
02079 
02080     DocColour temp;
02081 
02082     for (DWORD col = FirstEntry; col < LastEntry; col++)
02083     {
02084         // Create a new colour which is an appropriate mixture of the start/end colours
02085         temp.Mix(&StartCol, &EndCol, MixFraction, cc, (Effect == EFFECT_HSV_LONG), ccRGB);
02086 
02087         // Convert back to the raw RGB and place it in the palette.
02088         // Note that this will colour correct and separate in an appropriate manner.
02089         // Note also that we're using a special ConvertColour call which returns 8-bit 
02090         // "packed" component values instead of FIXED24's.
02091         ccRGB->ConvertColour(&temp, (ColourPacked *) &Result);
02092 
02093         // And add to the table
02094         if (IsColorRef)
02095         {
02096             pRefTable[col] = RGB(Result.Red, Result.Green, Result.Blue);
02097         }
02098         else
02099         {
02100             pRGBTable[col].rgbRed       = Result.Red;
02101             pRGBTable[col].rgbGreen     = Result.Green;
02102             pRGBTable[col].rgbBlue      = Result.Blue;
02103             pRGBTable[col].rgbReserved  = 0;
02104         }
02105 
02106         // And step to the next mix fraction value
02107         MixFraction += MixStep;
02108     }
02109 
02110     return(TRUE);
02111 }

BOOL GradTable32::BuildPaletteInternalHSV DocColour StartCol,
DocColour EndCol,
View ContextView,
EFFECTTYPE  Effect,
DWORD  FirstEntry,
DWORD  LastEntry,
void *  pTable,
BOOL  IsColorRef,
CProfileBiasGain BiasGain
[static, protected]
 

Builds a Graduated (HSV rainbow/alt-rainbow) Table from StartCol to EndCol, filling in the given table with either COLORREF or RGBQUAD entries.

Parameters:
StartCol,EndCol - Define the end colours of the graduation [INPUTS] ContextView - Points to the view in which the gradation is to be displayed. (This is necessary for correction and separation etc. If proper colour handling is not needed, then you may pass NULL, but generally, this parameter should be sensible)
Effect - EFFECT_HSV_SHORT or EFFECT_HSV_LONG

FirstEntry - The index of the first entry (inclusive) to fill in (0 is the first) LastEntry - The index of the last entry (exclusive) to fill in (TableSize is the last) (i.e. to fill entire table use (0,TableSize) which will fill in entries 0..Tablesize-1)

IsColorRef - TRUE if the pTable pointer is a (COLORREF *) FALSE if the pTable pointer is an (RGBQUAD *)

BiasGain - The profile that controls how the table is built

Parameters:
pTable - On return, will be filled in with appropriate colours, in the format [OUTPUTS] indicated by the IsColorRef flag.
Returns:
FALSE if it fails
NOTE that the generated entries will NOT be colour corrected or separated in any way. You should not use this code when generating colour plates.

Definition at line 2306 of file gradtbl.cpp.

02310 {
02311     ERROR3IF(ContextView == NULL || pTable == NULL, "Illegal NULL params");
02312     ERROR3IF(Effect != EFFECT_HSV_SHORT && Effect != EFFECT_HSV_LONG, "Unsupported HSV effect");
02313 
02314     ColourContext *ccHSV = ColourManager::GetColourContext(COLOURMODEL_HSVT, ContextView);
02315     ERROR3IF(ccHSV == NULL, "No colour context");
02316 
02317     PColourHSVT StartDef;
02318     PColourHSVT EndDef;
02319 
02320     if (StartCol.IsTransparent())
02321     {
02322         StartDef.Hue = 0;       // If transparent, use white
02323         StartDef.Value = 255;
02324         StartDef.Saturation = 0;
02325     }
02326     else
02327         ccHSV->ConvertColour(&StartCol, (ColourPacked *) &StartDef);
02328 
02329     if (EndCol.IsTransparent())
02330     {
02331         EndDef.Hue = 0;         // If transparent, use white
02332         EndDef.Value = 255;
02333         EndDef.Saturation = 0;
02334     }
02335     else
02336         ccHSV->ConvertColour(&EndCol, (ColourPacked *) &EndDef);
02337 
02338     // When doing alt-rainbow, if one end colour has no specific hue (saturation near 0)
02339     // then use the other colour's hue (if any)
02340     //
02341     // TODO: WRONG!!! This should always be doing these two tests, not just when
02342     // the Effect equals EFFECT_HSV_LONG. Note also that the INT32 HSV colour
02343     // generation is incorrect, although I'm not too sure why. (Gavin).
02344     //
02345     if (Effect == EFFECT_HSV_LONG)
02346     {
02347         if (StartDef.Saturation < 2 && EndDef.Saturation >= 2)
02348             StartDef.Hue = EndDef.Hue;
02349         else if (StartDef.Saturation >= 2 && EndDef.Saturation < 2)
02350             EndDef.Hue = StartDef.Hue;
02351     }
02352 
02353     // Now work out which way we have to do the mix (rainbow or alt-rainbow)
02354     BOOL BlendNormally = TRUE;
02355 
02356     // Calc. the "simple" (non-wrapping) distance between the hues
02357     double StartHue = StartDef.Hue / 360.0;
02358     double EndHue   = EndDef.Hue / 360.0;
02359 
02360     const double SimpleDist = fabs(StartHue - EndHue);
02361 
02362     // Determine whether we do a simple blend, or we have to "wrap"
02363     if (SimpleDist <= 0.5)
02364         BlendNormally = (Effect != EFFECT_HSV_LONG);
02365     else
02366         BlendNormally = (Effect == EFFECT_HSV_LONG);
02367 
02368     // If we have to go the long way, then move the smaller of the two hue
02369     // values up by 360 degrees (1.0) - after blending we'll 'mod' the result
02370     // back down into gamut.
02371     if (!BlendNormally)
02372     {
02373         if (StartHue > EndHue)
02374             EndHue += 1.0;
02375         else
02376             StartHue += 1.0;
02377     }
02378 
02379     // Precalculate mixing fraction and step to minimise mul/div in the inner loop
02380     // We use an 8.24 bit fixed point notation (homebrew FIXED24s)
02381     double MixStep = 1.0 / (double)(LastEntry - FirstEntry);
02382     double MixFraction = 0.0;
02383 
02384     if (IsColorRef)
02385     {
02386         COLORREF *pRefTable = (COLORREF *) pTable;
02387 
02388         double H, S, V;
02389         for (DWORD col = FirstEntry; col < LastEntry; col++)
02390         {
02391             const double InvFraction = 1.0 - MixFraction;
02392 
02393             // Calculate intermediate RGB values into 8bpp values
02394             H =  (StartHue            * InvFraction) + (EndHue            * MixFraction);           // 0.0 - 1.0
02395             if (H > 1.0)
02396                 H -= 1.0;       // If necessary, "mod" the value back down into the 0..1 range
02397 
02398             S = ((StartDef.Saturation * InvFraction) + (EndDef.Saturation * MixFraction)) / 255.0;  // 0.0 - 1.0
02399             V =  (StartDef.Value      * InvFraction) + (EndDef.Value      * MixFraction);           // 0.0 - 255.0
02400 
02401             // Convert the HSV value to an RGB table entry
02402             if (S == 0)
02403             {
02404                 BYTE Val = (BYTE) V;
02405                 pRefTable[col] = RGB(Val, Val, Val);
02406             }
02407             else
02408             {
02409                 H *= 6.0;
02410                 const INT32 I = (INT32) floor(H);
02411                 const double F = H - I;
02412                 const double P = V * (1.0 - S);
02413                 const double Q = V * (1.0 - (S * F));
02414                 const double T = V * (1.0 - (S * (1.0 - F)));
02415 
02416                 switch (I)
02417                 {
02418                     case 1:  pRefTable[col] = RGB(BYTE(Q), BYTE(V), BYTE(P)); break;
02419                     case 2:  pRefTable[col] = RGB(BYTE(P), BYTE(V), BYTE(T)); break;
02420                     case 3:  pRefTable[col] = RGB(BYTE(P), BYTE(Q), BYTE(V)); break;
02421                     case 4:  pRefTable[col] = RGB(BYTE(T), BYTE(P), BYTE(V)); break;
02422                     case 5:  pRefTable[col] = RGB(BYTE(V), BYTE(P), BYTE(Q)); break;
02423                     default: pRefTable[col] = RGB(BYTE(V), BYTE(T), BYTE(P)); break;
02424                 }
02425             }
02426 
02427             MixFraction += MixStep;
02428         }
02429     }
02430     else
02431     {
02432         CProfileBiasGain DefaultBiasGain;           // default
02433         if (BiasGain == DefaultBiasGain)
02434         {
02435             RGBQUAD  *pRGBTable = (RGBQUAD *)  pTable;
02436 
02437             double H, S, V;
02438             for (DWORD col = FirstEntry; col < LastEntry; col++)
02439             {
02440                 const double InvFraction = 1.0 - MixFraction;
02441 
02442                 // Calculate intermediate RGB values into 8bpp values
02443                 H =  (StartHue            * InvFraction) + (EndHue            * MixFraction);           // 0.0 - 1.0
02444                 if (H > 1.0)
02445                     H -= 1.0;       // If necessary, "mod" the value back down into the 0..1 range
02446 
02447                 S = ((StartDef.Saturation * InvFraction) + (EndDef.Saturation * MixFraction)) / 255.0;  // 0.0 - 1.0
02448                 V =  (StartDef.Value      * InvFraction) + (EndDef.Value      * MixFraction);           // 0.0 - 255.0
02449 
02450                 // Convert the HSV value to an RGB table entry
02451                 if (S == 0)
02452                 {
02453                     pRGBTable[col].rgbRed = pRGBTable[col].rgbGreen = pRGBTable[col].rgbBlue = (BYTE) V;
02454                 }
02455                 else
02456                 {
02457                     H *= 6.0;
02458                     const INT32 I = (INT32) floor(H);
02459                     const double F = H - I;
02460                     const double P = V * (1.0 - S);
02461                     const double Q = V * (1.0 - (S * F));
02462                     const double T = V * (1.0 - (S * (1.0 - F)));
02463 
02464 // Define a wee macro to make this all a lot more readable
02465 #if 0
02466 #define SETRGBENTRY(P1,P2,P3) pRGBTable[col].rgbRed = (BYTE)P3; pRGBTable[col].rgbGreen = (BYTE)P2; pRGBTable[col].rgbBlue = (BYTE)P1;
02467 #else
02468 #define SETRGBENTRY(P1,P2,P3) pRGBTable[col].rgbRed = (BYTE)P1; pRGBTable[col].rgbGreen = (BYTE)P2; pRGBTable[col].rgbBlue = (BYTE)P3;
02469 #endif
02470                     switch (I)
02471                     {
02472                         case 1:  SETRGBENTRY(Q, V, P); break;
02473                         case 2:  SETRGBENTRY(P, V, T); break;
02474                         case 3:  SETRGBENTRY(P, Q, V); break;
02475                         case 4:  SETRGBENTRY(T, P, V); break;
02476                         case 5:  SETRGBENTRY(V, P, Q); break;
02477                         default: SETRGBENTRY(V, T, P); break;
02478                     }
02479 #undef SETRGBENTRY
02480                 }
02481 
02482                 pRGBTable[col].rgbReserved = 0;
02483 
02484                 MixFraction += MixStep;
02485             }
02486         }
02487         else
02488         {
02489             BiasGain.SetIntervals (AFp (0), AFp (LastEntry));
02490 
02491             RGBQUAD  *pRGBTable = (RGBQUAD *)  pTable;
02492 
02493             double MixFraction;
02494             double InvFraction;
02495             double RLastEntry = 1.0/LastEntry;
02496 
02497             double H, S, V;
02498 
02499             for (DWORD col = FirstEntry; col < LastEntry; col++)
02500             {
02501                 //const double InvFraction = 1.0 - MixFraction;
02502 
02503                 MixFraction = (INT32) BiasGain.MapInterval( AFp( col ) );
02504                 MixFraction *= RLastEntry;
02505                 InvFraction = 1 - MixFraction;
02506 
02507                 // Calculate intermediate RGB values into 8bpp values
02508                 H =  (StartHue            * InvFraction) + (EndHue            * MixFraction);           // 0.0 - 1.0
02509                 if (H > 1.0)
02510                     H -= 1.0;       // If necessary, "mod" the value back down into the 0..1 range
02511 
02512                 S = ((StartDef.Saturation * InvFraction) + (EndDef.Saturation * MixFraction)) / 255.0;  // 0.0 - 1.0
02513                 V =  (StartDef.Value      * InvFraction) + (EndDef.Value      * MixFraction);           // 0.0 - 255.0
02514 
02515                 // Convert the HSV value to an RGB table entry
02516                 if (S == 0)
02517                 {
02518                     pRGBTable[col].rgbRed = pRGBTable[col].rgbGreen = pRGBTable[col].rgbBlue = (BYTE) V;
02519                 }
02520                 else
02521                 {
02522                     H *= 6.0;
02523                     const INT32 I = (INT32) floor(H);
02524                     const double F = H - I;
02525                     const double P = V * (1.0 - S);
02526                     const double Q = V * (1.0 - (S * F));
02527                     const double T = V * (1.0 - (S * (1.0 - F)));
02528 
02529 // Define a wee macro to make this all a lot more readable
02530 #define SETRGBENTRY(P1,P2,P3) pRGBTable[col].rgbRed = (BYTE)P1; pRGBTable[col].rgbGreen = (BYTE)P2; pRGBTable[col].rgbBlue = (BYTE)P3;
02531                     switch (I)
02532                     {
02533                         case 1:  SETRGBENTRY(Q, V, P); break;
02534                         case 2:  SETRGBENTRY(P, V, T); break;
02535                         case 3:  SETRGBENTRY(P, Q, V); break;
02536                         case 4:  SETRGBENTRY(T, P, V); break;
02537                         case 5:  SETRGBENTRY(V, P, Q); break;
02538                         default: SETRGBENTRY(V, T, P); break;
02539                     }
02540 #undef SETRGBENTRY
02541                 }
02542 
02543                 pRGBTable[col].rgbReserved = 0;
02544 
02545                 MixFraction += MixStep;
02546             }
02547         }
02548     }
02549 
02550     return(TRUE);
02551 }

BOOL GradTable32::BuildPaletteInternalRGB DocColour StartCol,
DocColour EndCol,
View ContextView,
DWORD  FirstEntry,
DWORD  LastEntry,
void *  pTable,
BOOL  IsColorRef,
CProfileBiasGain BiasGain
[static, protected]
 

Builds a Graduated (RGB Mix) Table from StartCol to EndCol, filling in the given table with either COLORREF or RGBQUAD entries.

Parameters:
StartCol,EndCol - Define the end colours of the graduation [INPUTS] ContextView - Points to the view in which the gradation is to be displayed. (This is necessary for correction and separation etc. If proper colour handling is not needed, then you may pass NULL, but generally, this parameter should be sensible)
FirstEntry - The index of the first entry (inclusive) to fill in (0 is the first) LastEntry - The index of the last entry (exclusive) to fill in (TableSize is the last) (i.e. to fill entire table use (0,TableSize) which will fill in entries 0..Tablesize-1)

IsColorRef - TRUE if the pTable pointer is a (COLORREF *) FALSE if the pTable pointer is an (RGBQUAD *)

BiasGain - The profile that controls how the table is built

Parameters:
pTable - On return, will be filled in with appropriate colours, in the format [OUTPUTS] indicated by the IsColorRef flag.
Returns:
FALSE if it fails
NOTE that the generated entries will NOT be colour corrected or separated in any way. You should not use this code when generating colour plates.

Definition at line 2154 of file gradtbl.cpp.

02158 {
02159     ERROR3IF(ContextView == NULL || pTable == NULL, "Illegal NULL params");
02160 
02161     ColourContext *ccRGB = ColourManager::GetColourContext(COLOURMODEL_RGBT, ContextView);
02162     ERROR3IF(ccRGB == NULL, "No colour context");
02163 
02164     PColourRGBT StartDef;
02165     PColourRGBT EndDef;
02166 
02167     if (StartCol.IsTransparent())
02168         StartDef.Red = StartDef.Green = StartDef.Blue = 255L;   // If transparent, use white
02169     else
02170         ccRGB->ConvertColour(&StartCol, (ColourPacked *) &StartDef);
02171 
02172     if (EndCol.IsTransparent())
02173         EndDef.Red = EndDef.Green = EndDef.Blue = 255L;         // If transparent, use white
02174     else
02175         ccRGB->ConvertColour(&EndCol, (ColourPacked *) &EndDef);
02176 
02177     // Precalculate mixing fraction and step to minimise mul/div in the inner loop
02178     // We use an 8.24 bit fixed point notation (homebrew FIXED24s)
02179     DWORD MixStep = (1 << 24) / (LastEntry - FirstEntry);
02180     DWORD MixFraction = 0;
02181 
02182     if (IsColorRef)
02183     {
02184         COLORREF *pRefTable = (COLORREF *) pTable;
02185 
02186         DWORD R,G,B;
02187         for (DWORD col = FirstEntry; col < LastEntry; col++)
02188         {
02189             const DWORD InvFraction = 0x01000000 - MixFraction;
02190 
02191             // Calculate intermediate RGB values into 8bpp values
02192             R = ((StartDef.Red   * InvFraction) + (EndDef.Red   * MixFraction)) >> 24;
02193             G = ((StartDef.Green * InvFraction) + (EndDef.Green * MixFraction)) >> 24;
02194             B = ((StartDef.Blue  * InvFraction) + (EndDef.Blue  * MixFraction)) >> 24;
02195 
02196             // Fill in this table entry
02197             pRefTable[col] = RGB(R, G, B);
02198 
02199             MixFraction += MixStep;
02200         }
02201     }
02202     else
02203     {
02204         CProfileBiasGain DefaultBiasGain;           // default
02205         if (BiasGain == DefaultBiasGain)
02206         {
02207             RGBQUAD  *pRGBTable = (RGBQUAD *)  pTable;
02208 
02209             DWORD InvFraction;
02210 
02211             for (DWORD col = FirstEntry; col < LastEntry; col++)
02212             {
02213                 InvFraction = 0x01000000 - MixFraction;
02214 
02215                 // Calculate intermediate RGB values into the 8bpp table values
02216 #if defined(__WXMSW__)
02217                 pRGBTable[col].rgbRed   = static_cast<BYTE> (((StartDef.Red     * InvFraction) + (EndDef.Red    * MixFraction)) >> 24);
02218                 pRGBTable[col].rgbGreen = static_cast<BYTE> (((StartDef.Green   * InvFraction) + (EndDef.Green  * MixFraction)) >> 24);
02219                 pRGBTable[col].rgbBlue  = static_cast<BYTE> (((StartDef.Blue    * InvFraction) + (EndDef.Blue   * MixFraction)) >> 24);
02220 #else
02221                 pRGBTable[col].rgbBlue  = static_cast<BYTE> (((StartDef.Red     * InvFraction) + (EndDef.Red    * MixFraction)) >> 24);
02222                 pRGBTable[col].rgbGreen = static_cast<BYTE> (((StartDef.Green   * InvFraction) + (EndDef.Green  * MixFraction)) >> 24);
02223                 pRGBTable[col].rgbRed   = static_cast<BYTE> (((StartDef.Blue    * InvFraction) + (EndDef.Blue   * MixFraction)) >> 24);
02224 #endif
02225                 pRGBTable[col].rgbReserved  = 0;
02226 
02227                 MixFraction += MixStep;
02228             }
02229         }
02230         else
02231         {
02232             BiasGain.SetIntervals (AFp (0), AFp (LastEntry));
02233 
02234             RGBQUAD  *pRGBTable = (RGBQUAD *)  pTable;
02235 
02236             double MixFraction;
02237             double InvFraction;
02238             double RLastEntry = 1.0/LastEntry;
02239 
02240             for (DWORD col = FirstEntry; col < LastEntry; col++)
02241             {
02242                 MixFraction = (INT32) BiasGain.MapInterval( AFp( col ) );
02243                 MixFraction *= RLastEntry;
02244                 InvFraction = 1 - MixFraction;
02245 
02246                 // Calculate intermediate RGB values into the 8bpp table values
02247 #if defined(__WXMSW__)
02248                 pRGBTable[col].rgbRed   = static_cast<BYTE> (((StartDef.Red     * InvFraction) + (EndDef.Red    * MixFraction)));
02249                 pRGBTable[col].rgbGreen = static_cast<BYTE> (((StartDef.Green   * InvFraction) + (EndDef.Green  * MixFraction)));
02250                 pRGBTable[col].rgbBlue  = static_cast<BYTE> (((StartDef.Blue    * InvFraction) + (EndDef.Blue   * MixFraction)));
02251 #else
02252                 pRGBTable[col].rgbBlue  = static_cast<BYTE> (((StartDef.Red     * InvFraction) + (EndDef.Red    * MixFraction)));
02253                 pRGBTable[col].rgbGreen = static_cast<BYTE> (((StartDef.Green   * InvFraction) + (EndDef.Green  * MixFraction)));
02254                 pRGBTable[col].rgbRed   = static_cast<BYTE> (((StartDef.Blue    * InvFraction) + (EndDef.Blue   * MixFraction)));
02255 #endif
02256                 pRGBTable[col].rgbReserved  = 0;
02257             }
02258         }
02259     }
02260 
02261     return(TRUE);
02262 }

BOOL GradTable32::BuildPaletteInternalRGBComposite DocColour StartCol,
DocColour EndCol,
View ContextView,
DWORD  FirstEntry,
DWORD  LastEntry,
void *  pTable,
BOOL  IsColorRef
[static, protected]
 

Builds a Graduated (RGB Mix) Table from StartCol to EndCol, filling in the given table with either COLORREF or RGBQUAD entries.

Parameters:
StartCol,EndCol - Define the end colours of the graduation [INPUTS] ContextView - Points to the view in which the gradation is to be displayed. (This is necessary for correction and separation etc. If proper colour handling is not needed, then you may pass NULL, but generally, this parameter should be sensible)
FirstEntry - The index of the first entry (inclusive) to fill in (0 is the first) LastEntry - The index of the last entry (exclusive) to fill in (TableSize is the last) (i.e. to fill entire table use (0,TableSize) which will fill in entries 0..Tablesize-1)

IsColorRef - TRUE if the pTable pointer is a (COLORREF *) FALSE if the pTable pointer is an (RGBQUAD *)

Parameters:
pTable - On return, will be filled in with appropriate colours, in the format [OUTPUTS] indicated by the IsColorRef flag.
Returns:
FALSE if it fails
The table is constructed taking into account "Composite Print Preview" colour correction. You must only call this when generating a COLOURPLATE_COPMPOSITE colour plate, when doing RGB mixes of non-CMYK colours!

Notes: (Analogue of GradTable code in BuildTable() and Filltable()) For composite preview, I've only bothered to optimise the RGB mix case, as this is by far and away the most common one.

See also:
GradTable32::BuildPaletteInternal

Definition at line 2598 of file gradtbl.cpp.

02602 {
02603     ERROR3IF(ContextView == NULL || pTable == NULL, "Illegal NULL params");
02604 
02605     ColourContext *ccRGB = ColourManager::GetColourContext(COLOURMODEL_RGBT, ContextView);
02606     ColourContext *cc = ColourManager::GetColourContext(COLOURMODEL_RGBT);      // RGB fade
02607     ERROR3IF(cc == NULL || ccRGB == NULL, "No colour context");
02608 
02609     ERROR3IF(ccRGB->GetColourPlate() == NULL || ccRGB->GetColourPlate()->IsDisabled() ||
02610                 ccRGB->GetColourPlate()->GetType() != COLOURPLATE_COMPOSITE,
02611                     "BuildPaletteInternalRGBComposite called under incorrect conditions");
02612 
02613     ERROR3IF(StartCol.GetColourModel() == COLOURMODEL_CMYK && EndCol.GetColourModel() == COLOURMODEL_CMYK,
02614                 "BuildPaletteInternalRGBComposite called for CMYK -> CMYK fill!");
02615 
02616     COLORREF *pRefTable = (COLORREF *) pTable;
02617     RGBQUAD  *pRGBTable = (RGBQUAD *)  pTable;
02618 
02619     PColourRGBT StartDef;
02620     PColourRGBT EndDef;
02621     ccRGB->ConvertColour(&StartCol, (ColourPacked *) &EndDef);
02622 
02623     DWORD StartIndex = FirstEntry;
02624     DWORD EndIndex;
02625 
02626     DocColour TempCol;
02627 
02628     while (StartIndex < LastEntry)
02629     {
02630         // Move the last run's end colour into Start
02631         memcpy(&StartDef, &EndDef, sizeof(PColourRGBT));
02632 
02633         // Calculate the end of this run
02634         EndIndex = StartIndex + FillStep;
02635         if (EndIndex > LastEntry)
02636             EndIndex = LastEntry;
02637 
02638         // Calculate the colour at the end of this run, and convert into EndDef
02639         TempCol.Mix(&StartCol, &EndCol,
02640                     ((double)(EndIndex - FirstEntry)) / ((double)(LastEntry - FirstEntry)),
02641                     cc, FALSE, ccRGB);
02642 
02643         ccRGB->ConvertColour(&TempCol, (ColourPacked *) &EndDef);
02644 
02645         // Linearly interpolate all colours in the run (cf GradTable::FillTable code)
02646         // BLOCK
02647         {
02648             #define MFX 24
02649 
02650             // optimised code by Mike
02651 
02652             INT32 MixFracR = ((INT32)StartDef.Red)  <<MFX;
02653             INT32 MixFracG = ((INT32)StartDef.Green)<<MFX;
02654             INT32 MixFracB = ((INT32)StartDef.Blue) <<MFX;
02655             
02656             INT32 MixStepR = ((INT32)(EndDef.Red   - StartDef.Red  ))<<MFX;
02657             INT32 MixStepG = ((INT32)(EndDef.Green - StartDef.Green))<<MFX;
02658             INT32 MixStepB = ((INT32)(EndDef.Blue  - StartDef.Blue ))<<MFX;
02659             
02660             MixStepR = MixStepR / ((INT32)(EndIndex-StartIndex));
02661             MixStepG = MixStepG / ((INT32)(EndIndex-StartIndex));
02662             MixStepB = MixStepB / ((INT32)(EndIndex-StartIndex));
02663 
02664             if (IsColorRef)
02665             {
02666                 for (DWORD Index=StartIndex; Index<EndIndex; Index++)
02667                 {
02668                     // Calculate intermediate RGB values into 8bpp values
02669                     pRefTable[Index] = RGB(MixFracR>>MFX, MixFracG>>MFX, MixFracB>>MFX);
02670                     MixFracR += MixStepR;
02671                     MixFracG += MixStepG;
02672                     MixFracB += MixStepB;
02673                 }
02674             }
02675             else
02676             {
02677                 for (DWORD Index=StartIndex; Index<EndIndex; Index++)
02678                 {
02679                     // Calculate intermediate RGB values into 8bpp values
02680                     pRGBTable[Index].rgbRed     = (BYTE)(MixFracR>>MFX);
02681                     pRGBTable[Index].rgbGreen   = (BYTE)(MixFracG>>MFX);
02682                     pRGBTable[Index].rgbBlue    = (BYTE)(MixFracB>>MFX);
02683                     pRGBTable[Index].rgbReserved = 0;
02684                     MixFracR += MixStepR;
02685                     MixFracG += MixStepG;
02686                     MixFracB += MixStepB;
02687                 }
02688             }
02689 
02690             #undef MFX
02691 /*
02692             // Place the StartDef in as the first entry
02693 
02694             if (IsColorRef)
02695                 pRefTable[StartIndex] = RGB(StartDef.Red, StartDef.Green, StartDef.Blue);
02696             else
02697             {
02698                 pRGBTable[StartIndex].rgbRed    = StartDef.Red;
02699                 pRGBTable[StartIndex].rgbGreen  = StartDef.Green;
02700                 pRGBTable[StartIndex].rgbBlue   = StartDef.Blue;
02701                 pRGBTable[StartIndex].rgbReserved = 0;
02702             }
02703 
02704             // ...and start interpolating from the second entry
02705             DWORD MixStep = (1 << 24) / (EndIndex - StartIndex);
02706             DWORD MixFraction = MixStep;
02707 
02708             DWORD R,G,B;
02709 
02710             if (IsColorRef)
02711             {
02712                 for (DWORD Index = StartIndex + 1; Index < EndIndex; Index++)
02713                 {
02714                     // Calculate intermediate RGB values into 8bpp values
02715                     const DWORD InvFraction = (0x01000000 - MixFraction);
02716                     R = ((StartDef.Red   * InvFraction) + (EndDef.Red   * MixFraction)) >> 24;
02717                     G = ((StartDef.Green * InvFraction) + (EndDef.Green * MixFraction)) >> 24;
02718                     B = ((StartDef.Blue  * InvFraction) + (EndDef.Blue  * MixFraction)) >> 24;
02719 
02720                     pRefTable[Index] = RGB(R, G, B);
02721                     MixFraction += MixStep;
02722                 }
02723             }
02724             else
02725             {
02726                 for (DWORD Index = StartIndex + 1; Index < EndIndex; Index++)
02727                 {
02728                     // Calculate intermediate RGB values into 8bpp values
02729                     const DWORD InvFraction = (0x01000000 - MixFraction);
02730                     R = ((StartDef.Red   * InvFraction) + (EndDef.Red   * MixFraction)) >> 24;
02731                     G = ((StartDef.Green * InvFraction) + (EndDef.Green * MixFraction)) >> 24;
02732                     B = ((StartDef.Blue  * InvFraction) + (EndDef.Blue  * MixFraction)) >> 24;
02733 
02734                     // Fill in this table entry
02735                     pRGBTable[Index].rgbRed     = (BYTE)R;
02736                     pRGBTable[Index].rgbGreen   = (BYTE)G;
02737                     pRGBTable[Index].rgbBlue    = (BYTE)B;
02738                     pRGBTable[Index].rgbReserved = 0;
02739 
02740                     MixFraction += MixStep;
02741                 }
02742             }
02743 */
02744         }
02745 
02746         // And step on to the next run
02747         StartIndex = EndIndex;
02748     }
02749 
02750     return(TRUE);
02751 }

BOOL GradTable32::BuildTable DocColour StartCol,
DocColour EndCol,
View ContextView,
EFFECTTYPE  Effect,
DWORD  FirstEntry,
DWORD  LastEntry
 

Builds a GradTable from StartCol to EndCol, filling in a portion of the table with appropriate GDraw dither patterns.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com> (Will)
Date:
14/5/96 (14/9/94)
Parameters:
StartCol,EndCol - Define the end colours of the graduation [INPUTS] ContextView - Points to the view in which the gradation is to be displayed. (This is necessary for correction and separation etc. If proper colour handling is not needed, then you may pass NULL, but generally, this parameter should be sensible)
Effect - EFFECT_FADE, EFFECT_HSV_SHORT, or EFFECT_HSV_LONG

FirstEntry - The index of the first entry (inclusive) to fill in (0 is the first) LastEntry - The index of the last entry (exclusive) to fill in (TableSize is the last) (i.e. to fill entire table use (0,TableSize) which will fill in entries 0..Tablesize-1)

Returns:
FALSE if it fails
Notes: GDraw requires the Start and End colours for the entire table to be set separately in the table structure. These will be set if FirstEntry==0 and/or if LastEntry==TableSize, respectively.

See also:
GradTable::SetTableSize

Definition at line 1722 of file gradtbl.cpp.

01725 {
01726     ERROR3("GradTable32::BuildTable() is rampant so don't use it\n");
01727 
01728     return(FALSE);  
01729 /*  
01730     return(BuildPaletteInternal(StartCol, EndCol, ContextView, Effect,
01731                                 FirstEntry, LastEntry,
01732                                 (void *)Table.Table, TRUE));
01733 */
01734 }

BOOL GradTable32::BuildTable DocColour StartCol,
DocColour EndCol,
View ContextView,
EFFECTTYPE  Effect,
DWORD  TableSize = 0x100
 

Builds a GradTable from StartCol to EndCol, filling in the entire table with appropriate GDraw dither patterns.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com> (Will)
Date:
14/5/96 (14/9/94)
Parameters:
StartCol,EndCol - Define the end colours of the graduation [INPUTS] ContextView - Points to the view in which the gradation is to be displayed. (This is necessary for correction and separation etc. If proper colour handling is not needed, then you may pass NULL, but generally, this parameter should be sensible)
Effect - EFFECT_FADE, EFFECT_HSV_SHORT, or EFFECT_HSV_LONG

TableSize - The number of entries you wish to make the table (0x100 or 0x800)

Returns:
FALSE if it fails
== NOTE that this version of the call also implicitly sets the table size! ==

See also:
GradTable::SetTableSize

Definition at line 1669 of file gradtbl.cpp.

01672 {
01673     ERROR3("GradTable32::BuildTable() is rampant so don't use it\n");
01674 
01675     return(FALSE);  
01676 /*
01677     SetTableSize(TableSize);
01678 
01679     return(BuildPaletteInternal(StartCol, EndCol, ContextView, Effect,
01680                                 0, Table.Length,
01681                                 (void *)Table.Table, TRUE));
01682 */
01683 }

void GradTable32::SetTableSize BOOL  LargeTable  ) 
 

To set the size of this Grad table.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/5/96
Parameters:
NewSize - The new size (number of entries) in this table. [INPUTS] May only be 0x100 or 0x800
Notes: The default table size is 0x100 entries

Definition at line 1632 of file gradtbl.cpp.

01633 {
01634 }


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