ColourContextRGBT Class Reference

Object class representing colour contexts based upon the RGBT colour model (Red, Green, Blue, Transparent). More...

#include <colcontx.h>

Inheritance diagram for ColourContextRGBT:

ColourContext ListItem CCObject SimpleCCObject ColourContextWebRGBT List of all members.

Public Member Functions

 ColourContextRGBT (View *Scope, double GammaValue=1.0)
 Constructor for an RGBT Colour context.
void ConvertToCIET (ColourGeneric *Source, DColourCIET *Result)
 Converts the given colour from our RGBT colourspace to CIET colourspace This conversion will include Gamma correction etc as defined by this colour context. Notes: -.
void ConvertFromCIET (DColourCIET *Source, ColourGeneric *Result)
 Converts the given colour to our RGBT colourspace from CIET colourspace This conversion will include Gamma correction etc as defined by this colour context. Notes: -.
void CreateExternalTransform ()
 Create an external transform to be used during colour conversions from RGB to the current RCS space. This function uses the Winoil CMS Manager to create the transform. Both forward and backward transforms use logical RGB descriptions.
virtual void GetModelName (StringBase *Result)
 Returns the name of this context's colour model.
virtual BOOL GetComponentName (INT32 ComponentID, StringBase *Result, BOOL LongName=FALSE)
 Returns the name of one of this context's colour components.
virtual UINT32 GetComponentCount ()
 Provides number of components in the colour context's colour model.
virtual BOOL IsDifferent (ColourContext *Other) const
 Determine if two colour contexts are not exactly equivalent.
virtual void ApplyTint (ColourValue TintFraction, ColourGeneric *SourceAndResult)
 Tints a colour (mixes it with white).
virtual void ApplyShade (ColourValue XFraction, ColourValue YFraction, ColourGeneric *SourceAndResult)
 Shades a colour (tweaks the saturation and value in a relative way).
virtual void ApplyOutputFilter (ColourPlate *FilterDescription, ColourContext *SourceContext, ColourGeneric *OutputColour, IndexedColour *SourceIxCol)
 All colour conversions call this function immediately prior to returning the converted colour to the caller. This gives the output colour context the chance to apply an output filtering process to the output colour.
virtual void GetWhite (ColourGeneric *Result)
 An easy way to get a colour definition in this colour model which is white (paper colour).
double GetGamma (void) const
DWORD ConvertToScreenWord (DocColour *Source)
 Conversion of colours for screen output, NOT including a transparency value (i.e. in a Windows GDI compatible format) Scope: Pretty private. Should only need to be used by renderers.
DWORD ConvertToTransparentScreenWord (DocColour *Source)
 Conversion of colours for screen output, including a transparency value. (i.e in a Gavin compatible format, but NOT Windows GDI compatible) Scope: Pretty private. Should only need to be used by renderers.

Protected Member Functions

virtual UnitGroup ** GetComponentUnitGroups ()
 Provides an array of UnitGroups primarily for use by the base class (ColourContext) members Set/GetComponentUnitGroup().

Protected Attributes

double Gamma

Private Types

enum  { MAX_COMPONENTS = 3 }

Static Private Attributes

static UnitGroupm_pUnitGroupArray [MAX_COMPONENTS]

Friends

class DocColour
class ColourContextList
class Colour
class GRenderRegion
class OSRenderRegion

Detailed Description

Object class representing colour contexts based upon the RGBT colour model (Red, Green, Blue, Transparent).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/04/94
See also:
Colour; ColourModel; ColourContext; ColourContextRGBT::ColourContextRGBT Documentation: HowToUse.doc

Definition at line 899 of file colcontx.h.


Member Enumeration Documentation

anonymous enum [private]
 

Enumerator:
MAX_COMPONENTS 

Definition at line 948 of file colcontx.h.

00949     {
00950         MAX_COMPONENTS = 3                                  // Number of components in colour context
00951     };


Constructor & Destructor Documentation

ColourContextRGBT::ColourContextRGBT View Scope,
double  GammaValue = 1.0
 

Constructor for an RGBT Colour context.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/03/94
Parameters:
Scope - The view in which this context is to be used, or NULL [INPUTS] GammaValue - A gamma-correction gamma factor. You know... Gamma. Heck, if you don't know what a gamma value is, then don't pass anything in, because it has a good default value.
- [OUTPUTS]
Returns:
-
Notes: Colour Contexts should not be created and used directly. See the notes in the SeeAlso's for instructions on proper care and use.

Returns:
Errors: -
See also:
ColourContext::ColourContext; ColourContextList::AddContext

Definition at line 1160 of file colcontx.cpp.

01161                   : ColourContext(Scope)
01162 {
01163     ColModel = COLOURMODEL_RGBT;
01164     Gamma = GammaValue;
01165 
01166     CreateExternalTransform();
01167 }


Member Function Documentation

void ColourContextRGBT::ApplyOutputFilter ColourPlate FilterDescription,
ColourContext SourceContext,
ColourGeneric OutputColour,
IndexedColour SourceIxCol
[virtual]
 

All colour conversions call this function immediately prior to returning the converted colour to the caller. This gives the output colour context the chance to apply an output filtering process to the output colour.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/1/96
Parameters:
FilterDescription - A ColourPlate describing how the colour is to be filtered [INPUTS]
SourceContext - Points to the context from which the OutputColour has just been converted.

OutputColour - The colour to be filtered

SourceIxCol - NULL, or the IndexedColour which was the source of the colour being converted. This is only used for information when preparing spot colour separations.

Parameters:
OutputColour - Will be modified as appropriate to the current colour [OUTPUTS] filtering options (see Purpose)
This is usually used to provide colour separations, and may also be used to apply some colour corrections. Often, this function will do nothing to the output colour.

See also:
ColourContext::ConvertColourBase

Reimplemented from ColourContext.

Definition at line 1688 of file colcontx.cpp.

01690 {
01691     ERROR3IF(FilterDescription == NULL || SourceContext == NULL || OutputColour == NULL, "Illegal NULL params");
01692 
01693     // No FilterDescription means no filtering, so we return immeidately
01694     // If the source colour was CMYK, we mustn't filter it, except when doing a composite preview, as
01695     // the filtering (separation) of CMYK all happens in ApplyInputFilter
01696     if (FilterDescription == NULL ||
01697         (SourceContext->GetColourModel() == COLOURMODEL_CMYK &&
01698          FilterDescription->GetType() != COLOURPLATE_COMPOSITE))
01699     {
01700         return;
01701     }
01702 
01703     ColourRGBT *OutputRGB = (ColourRGBT *)OutputColour;
01704     FIXED24 temp;
01705 
01706 
01707 /*-----------------------------------------------------------------------------------------------
01708     Local Macro GETCOLOURINCMYK(ColourCMYK RESULT)
01709 
01710     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01711     Date:       3/7/96
01712     Inputs:     RESULT - will be filled in with a CMYK definition for OutputRGB
01713     Purpose:    Converts our OutputRGB variable into a CMYK form.
01714 
01715     Notes:      This only works in the scope in which it is used below. It is merely to save
01716                 writing the code out longhand, and to make the repeated section of the code below
01717                 more readable.
01718 
01719                 Special care is taken with the conversion - We try to find a CMYK context from
01720                 our ScopeView, so that we use the correct colour-separation profile for the current
01721                 output device. We also do the conversion manually (to & from CIE space) rather
01722                 than just calling ConvertColour because (a) it's more efficient, and (b) we don't
01723                 want the CMYK context to do anything like colour separation on the colour!
01724 
01725                 This macro ius undefined at the end of the switch statement which uses it
01726 
01727   -----------------------------------------------------------------------------------------------
01728 */
01729 #define GETCOLOURINCMYK(RESULT)                                                                 \
01730     {                                                                                           \
01731         ColourContextCMYK *ccCMYK;                                                              \
01732         if (ScopeView != NULL)                                                                  \
01733             ccCMYK = (ColourContextCMYK *) ScopeView->GetColourContext(COLOURMODEL_CMYK);       \
01734         else                                                                                    \
01735             ccCMYK = (ColourContextCMYK *) ColourManager::GetColourContext(COLOURMODEL_CMYK);   \
01736                                                                                                 \
01737         DColourCIET IntermediateResult;                                                         \
01738         ConvertToCIET(OutputColour, &IntermediateResult);                                       \
01739         ccCMYK->ConvertFromCIET(&IntermediateResult, (ColourGeneric *)&(RESULT));               \
01740     }
01741 //-----------------------------------------------------------------------------------------------
01742 
01743 
01744     // Separate the colour as appropriate
01745     switch(FilterDescription->GetType())
01746     {
01747         case COLOURPLATE_CYAN:
01748             {
01749                 ColourCMYK cmyk;                                // Get OutputRGB as defined in cmyk
01750                 GETCOLOURINCMYK(cmyk);
01751 
01752                 if (FilterDescription->IsNegative())            // Negate the plate if necessary
01753                     OutputRGB->Red = cmyk.Cyan;
01754                 else
01755                     OutputRGB->Red = 1.0 - cmyk.Cyan;
01756 
01757                 if (FilterDescription->IsMonochrome())          // Make the plate a greyscale if necessary
01758                     OutputRGB->Green = OutputRGB->Blue = OutputRGB->Red;
01759                 else
01760                     OutputRGB->Green = OutputRGB->Blue = 1.0;
01761             }
01762             break;
01763 
01764         case COLOURPLATE_MAGENTA:
01765             {
01766                 ColourCMYK cmyk;                                // Get OutputRGB as defined in cmyk
01767                 GETCOLOURINCMYK(cmyk);
01768 
01769                 if (FilterDescription->IsNegative())            // Negate the plate if necessary
01770                     OutputRGB->Green = cmyk.Magenta;
01771                 else
01772                     OutputRGB->Green = 1.0 - cmyk.Magenta;
01773 
01774                 if (FilterDescription->IsMonochrome())          // Make the plate a greyscale if necessary
01775                     OutputRGB->Red = OutputRGB->Blue = OutputRGB->Green;
01776                 else
01777                     OutputRGB->Red = OutputRGB->Blue = 1.0;
01778             }
01779             break;
01780 
01781         case COLOURPLATE_YELLOW:
01782             {
01783                 ColourCMYK cmyk;                                // Get OutputRGB as defined in cmyk
01784                 GETCOLOURINCMYK(cmyk);
01785 
01786                 if (FilterDescription->IsNegative())            // Negate the plate if necessary
01787                     OutputRGB->Blue = cmyk.Yellow;
01788                 else
01789                     OutputRGB->Blue = 1.0 - cmyk.Yellow;
01790 
01791                 if (FilterDescription->IsMonochrome())          // Make the plate a greyscale if necessary
01792                     OutputRGB->Green = OutputRGB->Red = OutputRGB->Blue;
01793                 else
01794                     OutputRGB->Green = OutputRGB->Red = 1.0;
01795             }
01796             break;
01797 
01798         case COLOURPLATE_KEY:
01799             {
01800                 ColourCMYK cmyk;                                // Get OutputRGB as defined in cmyk
01801                 GETCOLOURINCMYK(cmyk);
01802 
01803                 // The FilterDescription->IsMonochrome() flag has no effect on this plate!
01804 
01805                 if (FilterDescription->IsNegative())
01806                     OutputRGB->Red = OutputRGB->Green = OutputRGB->Blue = cmyk.Key;
01807                 else
01808                     OutputRGB->Red = OutputRGB->Green = OutputRGB->Blue = 1.0 - cmyk.Key;
01809             }
01810             break;
01811 
01812         case COLOURPLATE_SPOT:
01813             // NOTE:
01814             // Spot colours are partially handled by the IndexedColour variants of
01815             // ConvertColour, so will be separated appropriately by the time they
01816             // reach us here. However, non-IndexedColours will not be, so we must
01817             // sit on them to make them white, so that DocColour and GenericColour
01818             // conversions are eliminated properly from spot plates.
01819             // However, if a spot colour gets this far, we need to generate an ink
01820             // density value for output, as well as applying the negate flag.
01821             //
01822             // Actually, I have decreed that all spot plates will always be monochrome,
01823             // because that makes coding DocColour::Mix much easier, and anyway it makes
01824             // a load more sense for the very good reason that if you don't believe me
01825             // I'll get my Dad to come around and beat up your dad.
01826 
01827             if (SourceIxCol == NULL)
01828             {
01829                 // It's not an IndexedColour, so can't appear on this plate - make it white
01830                 OutputRGB->Red = OutputRGB->Green = OutputRGB->Blue = 1.0;
01831             }
01832             else
01833             {
01834                 // We have a source IndexedColour, so we know it's been separated.
01835                 // We just have to get a decent ink density value out of the IxCol
01836                 if (SourceIxCol == FilterDescription->GetSpotColour())
01837                 {
01838                     // The spot colour itself is always considered a 100% tint (100% ink)
01839                     OutputRGB->Red = OutputRGB->Green = OutputRGB->Blue = 0.0;
01840                 }
01841                 else if (SourceIxCol->IsADescendantOf(FilterDescription->GetSpotColour()))
01842                 {
01843                     // It's not the spot colour, but it is a child - check that it's a tint
01844                     ERROR3IF(SourceIxCol->GetType() != COLOURTYPE_TINT ||
01845                              SourceIxCol->TintIsShade(),
01846                              "Spot colour children must all be tints!");
01847 
01848                     // Tint gives the amount of ink - we have to inverse this in RGB
01849                     // to get the appropriate grey level. Note that we get the accumulated
01850                     // tint value rather than the simple tint, which is the true output ink
01851                     // density.
01852                     OutputRGB->Red = OutputRGB->Green = OutputRGB->Blue =
01853                                             1.0 - SourceIxCol->GetAccumulatedTintValue();
01854                 }
01855             }
01856 
01857             // If negative, then photographically invert the colour
01858             if (FilterDescription->IsNegative())
01859             {
01860                 OutputRGB->Red   = 1.0 - OutputRGB->Red;
01861                 OutputRGB->Green = 1.0 - OutputRGB->Green;
01862                 OutputRGB->Blue  = 1.0 - OutputRGB->Blue;
01863             }
01864             break;
01865 
01866         case COLOURPLATE_COMPOSITE:
01867 #ifndef NO_XARACMS
01868             // Go to and from (printer) cmyk just for a laugh.
01869             // (NOTE that ConvertColourBase won't actually call us in this case any more)
01870             if (SourceIxCol != NULL && SourceIxCol->GetColourModel() == COLOURMODEL_CMYK)
01871             {
01872                 // If it's a CMYK colour, then it's already in printer gamut, so we only apply
01873                 // the backward colour correction factor to it.
01874                 // Note that this means we chuck away the entire colour conversion result!
01875                 XaraCMS* lpCMSMan = GetApplication()->GetCMSManager();
01876                 if (lpCMSMan != NULL)
01877                 {
01878                     ColourCMYK Def;
01879                     SourceIxCol->GetSourceColour((ColourGeneric *) &Def);
01880 
01881                     lpCMSMan->ConvertColourForPaperView(&Def, OutputRGB);
01882                 }
01883             }
01884             else
01885             {
01886                 // If it's a non-CMYK colour, then we go to and from printer gamut just for a laugh
01887                 // Find the CMS manager, and get it to do all the work
01888                 XaraCMS* lpCMSMan = GetApplication()->GetCMSManager();
01889                 if (lpCMSMan != NULL)
01890                     lpCMSMan->ConvertColourForPaperView(OutputRGB);
01891             }
01892 #endif
01893             // ... drop through to the default case to apply monochrome/negate
01894 
01895         default:
01896             // If monochrome, convert the image to a greyscale
01897             if (FilterDescription->IsMonochrome())
01898             {
01899                 FIXED24 temp = (OutputRGB->Red * 0.305) + (OutputRGB->Green * 0.586) + (OutputRGB->Blue * 0.109);
01900                 OutputRGB->Red = OutputRGB->Green = OutputRGB->Blue = temp;
01901             }
01902 
01903             // If negative, then photographically invert the colour
01904             if (FilterDescription->IsNegative())
01905             {
01906                 OutputRGB->Red   = 1.0 - OutputRGB->Red;
01907                 OutputRGB->Green = 1.0 - OutputRGB->Green;
01908                 OutputRGB->Blue  = 1.0 - OutputRGB->Blue;
01909             }
01910             break;
01911     }
01912 
01913 // And un-define our macro again to make sure it's not used out of its scope
01914 #undef GETCOLOURINCMYK
01915 }

void ColourContextRGBT::ApplyShade ColourValue  XFraction,
ColourValue  YFraction,
ColourGeneric SourceAndResult
[virtual]
 

Shades a colour (tweaks the saturation and value in a relative way).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/8/95
Parameters:
XFraction - The fraction (as a FIXED24 ColourValue) by which the colour [INPUTS] should be saturated. This value is expected to lie between -1.0 and 1.0 inclusive Values below 0.0 mean tint towards 0, while values above mean tint towards 1. 0.0 means no tinting
YFraction - The fraction (as a FIXED24 ColourValue) by which the colour should be shaded. This value is expected to lie between -1.0 and 1.0 inclusive Values below 0.0 mean shade towards 0, while values above mean shade towards 1. 0.0 means no shading

SourceAndResult - The source colour to be tinted, as defined in this colour model

Parameters:
SourceAndResult is shaded by the given Fractions [OUTPUTS] Any invalid value is clipped to 0.0
Returns:
-
Notes: Contexts other than HSV currently convert the colour to and from HSV form in order to apply the shade. This is a tad inefficient, but a quick'n'easy bodge that will get it going nice and quickly.

Implements ColourContext.

Definition at line 1639 of file colcontx.cpp.

01641 {
01642     ColourHSVT HSVDef;
01643     ColourContext *cc = ColourContext::GetGlobalDefault(COLOURMODEL_HSVT);
01644     ERROR3IF(cc == NULL, "No default HSV colour context?!");
01645 
01646     cc->ConvertColour(this, SourceAndResult, (ColourGeneric *) &HSVDef);
01647     cc->ApplyShade(XFraction, YFraction,  (ColourGeneric *) &HSVDef);
01648     ConvertColour(cc, (ColourGeneric *) &HSVDef, SourceAndResult);
01649 }

void ColourContextRGBT::ApplyTint ColourValue  TintFraction,
ColourGeneric SourceAndResult
[virtual]
 

Tints a colour (mixes it with white).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/11/94
Parameters:
TintFraction - The fraction (as a FIXED24 ColourValue) by which the colour [INPUTS] should be tinted. This value is expected to lie between 0.0 and 1.0 inclusive
SourceAndResult - The source colour to be tinted, as defined in this colour model

Parameters:
SourceAndResult is tinted by the given TintFraction [OUTPUTS] If TintFraction <= 0.0, White is output If TintFraction >= 1.0, The source colour is output
Returns:
-
Notes: If the tinting value is out of range, either source-colour ow white (as appropriate) will be output.

Implements ColourContext.

Definition at line 1587 of file colcontx.cpp.

01588 {
01589     ColourRGBT *Result = (ColourRGBT *) SourceAndResult;
01590     
01591     if (TintFraction <= FIXED24(0.0))       // 0% tint = White
01592     {
01593         Result->Red = Result->Green = Result->Blue = FIXED24(1.0);
01594         return;
01595     }
01596 
01597     if (TintFraction >= FIXED24(1.0))       // The Result colour is identical to the source
01598         return;
01599 
01600     // Otherwise, tint the colour...
01601     Result->Red   = FIXED24(1.0) - (TintFraction - (Result->Red   * TintFraction));
01602     Result->Green = FIXED24(1.0) - (TintFraction - (Result->Green * TintFraction));
01603     Result->Blue  = FIXED24(1.0) - (TintFraction - (Result->Blue  * TintFraction));
01604 }

void ColourContextRGBT::ConvertFromCIET DColourCIET Source,
ColourGeneric Result
[virtual]
 

Converts the given colour to our RGBT colourspace from CIET colourspace This conversion will include Gamma correction etc as defined by this colour context. Notes: -.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/03/94
Parameters:
Source - A Colour defined in the CIET colourspace [INPUTS] Result - pointer to a structure to recieve the resulting colour as defined in the RGBT space described by this colour context.
- [OUTPUTS]
Returns:
-

Errors: -

See also:
ColourContextRGBT::ConvertToCIET

Implements ColourContext.

Definition at line 1323 of file colcontx.cpp.

01324 {
01325     ENSURE(UsageCount > 0, "Colour context being used when not initialised!");
01326 
01327     ColourRGBT *bob = (ColourRGBT *) Result;
01328 
01329 #ifndef NO_XARACMS
01330     // If we've got a CMS manager, use it, else use the version 1.1 bodge
01331     XaraCMS* lpCMSMan = GetApplication()->GetCMSManager();
01332 
01333     if (lpCMSMan != NULL)
01334     {
01335         // The new colour calibration method
01336         CMSColour icol, ocol;
01337         icol.c0 = Source->X;
01338         icol.c1 = Source->Y;
01339         icol.c2 = Source->Z;
01340 
01341         // If we have no colour transform, or if we don't want the colour corrected/separated,
01342         // then we will just do a "logical" conversion.
01343         if (CMSTransform == NULL || (ColPlate != NULL && ColPlate->IsDisabled()))
01344             lpCMSMan->ConvCIEXYZtoRGB(icol, ocol);
01345         else
01346             lpCMSMan->GTransform(CMSTransform, cmsReverse, icol, ocol);
01347 
01348         bob->Red    = ocol.c0;
01349         bob->Green  = ocol.c1;
01350         bob->Blue   = ocol.c2;
01351     }
01352     else
01353 #endif
01354     {
01355         // The old rgb method
01356         bob->Red    = Source->X;
01357         bob->Green  = Source->Y; 
01358         bob->Blue   = Source->Z;
01359     }
01360 
01361     bob->Transparent = 0;//Source->Transparent;
01362 }

void ColourContextRGBT::ConvertToCIET ColourGeneric Source,
DColourCIET Result
[virtual]
 

Converts the given colour from our RGBT colourspace to CIET colourspace This conversion will include Gamma correction etc as defined by this colour context. Notes: -.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/03/94
Parameters:
Source - A Colour defined in this RGBT context [INPUTS] Result - pointer to a structure to recieve the resulting colour as defined in CIE space
- [OUTPUTS]
Returns:
-

Errors: -

See also:
ColourContextRGBT::ConvertFromCIET

Implements ColourContext.

Definition at line 1259 of file colcontx.cpp.

01260 {
01261     ENSURE(UsageCount > 0, "Colour context being used when not initialised!");
01262 
01263     ColourRGBT *bob = (ColourRGBT *) Source;
01264 
01265 #ifndef NO_XARACMS
01266     // If we've got a CMS manager, use it, else use the version 1.1 bodge
01267     XaraCMS* lpCMSMan = GetApplication()->GetCMSManager();
01268 
01269     if (lpCMSMan != NULL)
01270     {
01271         // The new colour calibration method
01272         CMSColour icol, ocol;
01273         icol.c0 = bob->Red.MakeDouble();
01274         icol.c1 = bob->Green.MakeDouble();
01275         icol.c2 = bob->Blue.MakeDouble();
01276 
01277         // If we have no colour transform, or if we don't want the colour corrected/separated,
01278         // then we will just do a "logical" conversion.
01279         if (CMSTransform == NULL || (ColPlate != NULL && ColPlate->IsDisabled()))
01280             lpCMSMan->ConvRGBtoCIEXYZ(icol, ocol);
01281         else
01282             lpCMSMan->GTransform(CMSTransform, cmsForward, icol, ocol);
01283 
01284         Result->X = ocol.c0;
01285         Result->Y = ocol.c1;
01286         Result->Z = ocol.c2;
01287     }
01288     else
01289 #endif
01290     {
01291         // The old rgb method
01292         Result->X = bob->Red.MakeDouble();
01293         Result->Y = bob->Green.MakeDouble();
01294         Result->Z = bob->Blue.MakeDouble();
01295     }
01296 
01297     Result->Transparent = 0.0;//bob->Transparent;
01298 }

DWORD ColourContextRGBT::ConvertToScreenWord DocColour Source  )  [inline]
 

Conversion of colours for screen output, NOT including a transparency value (i.e. in a Windows GDI compatible format) Scope: Pretty private. Should only need to be used by renderers.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/04/94
Parameters:
Source - the DocColour to convert [INPUTS]
- [OUTPUTS]
Returns:
The colour, converted into the current screen RGBT context, in the form of an RGB WORD (in the same format as a Microsoft/Gavin RGB word) i.e. 0x00BBGGRR

Errors: -

See also:
-

Definition at line 1008 of file colcontx.h.

01009 {
01010     ColourPacked Result;
01011 
01012     ConvertColour(Source, &Result);
01013 
01014     DWORD tmp = (DWORD) Result.RGBT.Red;        // (Compiler bug?) forced me
01015     tmp |= ((DWORD)Result.RGBT.Green) << 8;     // to do this as 3 stmts instead
01016     tmp |= ((DWORD)Result.RGBT.Blue) << 16;     // of only one.
01017 
01018     return(tmp);
01019 }

DWORD ColourContextRGBT::ConvertToTransparentScreenWord DocColour Source  )  [inline]
 

Conversion of colours for screen output, including a transparency value. (i.e in a Gavin compatible format, but NOT Windows GDI compatible) Scope: Pretty private. Should only need to be used by renderers.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/04/94
Parameters:
Source - the DocColour to convert [INPUTS]
- [OUTPUTS]
Returns:
The colour, converted into the current screen RGBT context, in the form of an RGB WORD (in the same format as a Gavin RGBT word) i.e. 0xTTBBGGRR

Errors: -

See also:
-

Definition at line 1042 of file colcontx.h.

01043 {
01044     ColourPacked Result;
01045 
01046     ConvertColour(Source, &Result);
01047 
01048     DWORD tmp = (DWORD) Result.RGBT.Red;
01049     tmp |= ((DWORD)Result.RGBT.Green) << 8;
01050     tmp |= ((DWORD)Result.RGBT.Blue) << 16;
01051     tmp |= ((DWORD)Result.RGBT.Transparent) << 24;
01052 
01053     return(tmp);
01054 }

void ColourContextRGBT::CreateExternalTransform  )  [virtual]
 

Create an external transform to be used during colour conversions from RGB to the current RCS space. This function uses the Winoil CMS Manager to create the transform. Both forward and backward transforms use logical RGB descriptions.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/05/96
Parameters:
- [INPUTS]
Returns:
-

Reimplemented from ColourContext.

Definition at line 1217 of file colcontx.cpp.

01218 {
01219 #ifndef NO_XARACMS
01220     CMSColourSpace cmsSpace;
01221     XaraCMS* lpCMSMan = GetApplication()->GetCMSManager();
01222 
01223     if (lpCMSMan != NULL)
01224     {
01225         // first read our internal colour calibration space
01226         lpCMSMan->GetLogicalProfile(&cmsSpace);
01227 
01228         // set this as the active colour profile
01229         UINT32 err = lpCMSMan->SetProfile(cmsSpace);
01230 
01231         // if we haven't got an error, create that transform
01232         if (err==0)
01233             CMSTransform = lpCMSMan->CreateTransform(DISPLAY_RCS);
01234     }
01235 #endif
01236 }

UINT32 ColourContextRGBT::GetComponentCount  )  [virtual]
 

Provides number of components in the colour context's colour model.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/05/96
Returns:
The number of components

Implements ColourContext.

Definition at line 1556 of file colcontx.cpp.

01557 {
01558     return MAX_COMPONENTS;
01559 }

BOOL ColourContextRGBT::GetComponentName INT32  ComponentID,
StringBase Result,
BOOL  LongName = FALSE
[virtual]
 

Returns the name of one of this context's colour components.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/7/94
Parameters:
ComponentID - Index [1..4] of the component you want the name of [INPUTS] (Result is an output) LongName - TRUE to get the long name, FALSE to get the short name (e.g. "Magenta" vs "M", "Saturation" vs "Sat")
Result returns containing a String of the name of the given component [OUTPUTS] of colours defined in this context. This string is guaranteed to fit within a String_32 - this is the minimum size you should allocate. (Most names, in English at least, are shorter than this (10 chars max, e.g. 'Red' 'Hue' 'Saturation') so allow at least 10 chars of space in your displays as well)
Note that Result can be passed in NULL in order to only determine if the context supports a given component.

Returns:
FALSE if this component is not used by this model.
Notes: The components are given in the same order as they appear in the high-precision ColourXYZ structures defined in colmodel.h

Implements ColourContext.

Definition at line 1476 of file colcontx.cpp.

01477 {
01478     UINT32 StringID = 0;
01479     BOOL Used = TRUE;
01480 
01481     switch(ComponentID)
01482     {
01483         case 1:
01484             StringID = (LongName) ? _R(IDS_COLCOMPL_RED) : _R(IDS_COLCOMP_RED);
01485             break;
01486             
01487         case 2:
01488             StringID = (LongName) ? _R(IDS_COLCOMPL_GREEN) : _R(IDS_COLCOMP_GREEN);
01489             break;
01490 
01491         case 3:
01492             StringID = (LongName) ? _R(IDS_COLCOMPL_BLUE) : _R(IDS_COLCOMP_BLUE);
01493             break;
01494 #ifdef TRANSPARENTCOLOUR
01495         default:
01496             StringID = _R(IDS_COLCOMP_TRANS);
01497             break;
01498 #else
01499         default:
01500             Used = FALSE;
01501             break;
01502 #endif
01503     }
01504 
01505     if (Result != NULL && StringID != 0)
01506         *Result = String_32(StringID);
01507 
01508     return(Used);
01509 }

UnitGroup ** ColourContextRGBT::GetComponentUnitGroups  )  [protected, virtual]
 

Provides an array of UnitGroups primarily for use by the base class (ColourContext) members Set/GetComponentUnitGroup().

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/05/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
A pointer to the UnitGroup array

Errors: - See Also: ColourContext::GetComponentUnitGroup() ColourContext::SetComponentUnitGroup()

Implements ColourContext.

Definition at line 1530 of file colcontx.cpp.

01531 {
01532     return m_pUnitGroupArray;
01533 }

double ColourContextRGBT::GetGamma void   )  const
 

void ColourContextRGBT::GetModelName StringBase Result  )  [virtual]
 

Returns the name of this context's colour model.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/6/94
Parameters:
- [INPUTS]
Result returns continaing a String of the name of the context. [OUTPUTS] This string is guaranteed to fit within a String_32 - this is the minimum size you should allocate. (Most names, in English at least, are shorter than this (10 chars max, e.g. 'RGB' 'HSV' 'Greyscale') so allow at least 10 chars of space in your displays as well)
Returns:
-

Implements ColourContext.

Reimplemented in ColourContextWebRGBT.

Definition at line 1411 of file colcontx.cpp.

01412 {
01413     ENSURE(Result != NULL, "ColourContext::GetModelName called with NULL result pointer!");
01414 
01415     *Result = String_32(_R(IDS_COLMODEL_RGBT));
01416 }

void ColourContextRGBT::GetWhite ColourGeneric Result  )  [virtual]
 

An easy way to get a colour definition in this colour model which is white (paper colour).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/6/96
Parameters:
Result - Will be filled in with White, however that is defined in [OUTPUTS] this context's colour model. (i.e. RGB(1,1,1) or CMYK(0,0,0,0), etc)

Implements ColourContext.

Definition at line 1934 of file colcontx.cpp.

01935 {
01936     ColourRGBT *rgb = (ColourRGBT *) Result;
01937     rgb->Red = rgb->Green = rgb->Blue = 1.0;
01938     rgb->Transparent = 0;
01939 }

BOOL ColourContextRGBT::IsDifferent ColourContext Other  )  const [virtual]
 

Determine if two colour contexts are not exactly equivalent.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/04/94
Parameters:
Other - a colour context to comapre ourselves to [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the other colour context object is different from ourself, or TRUE if it is an exactly equivalent context.

Errors: -

See also:
ColourContext::IsDifferent

Reimplemented from ColourContext.

Definition at line 1383 of file colcontx.cpp.

01384 {
01385     if(ColourContext::IsDifferent(Other))   // Different on generic ColourContext basis
01386         return(TRUE);
01387 
01388     // These must both be RGBT contexts, so check if they are equivalent
01389     return(Gamma != ((ColourContextRGBT *)Other)->Gamma);
01390 }


Friends And Related Function Documentation

friend class Colour [friend]
 

Definition at line 904 of file colcontx.h.

friend class ColourContextList [friend]
 

Reimplemented from ColourContext.

Definition at line 902 of file colcontx.h.

friend class DocColour [friend]
 

Reimplemented from ColourContext.

Definition at line 901 of file colcontx.h.

friend class GRenderRegion [friend]
 

Reimplemented from ColourContext.

Definition at line 907 of file colcontx.h.

friend class OSRenderRegion [friend]
 

Reimplemented from ColourContext.

Definition at line 908 of file colcontx.h.


Member Data Documentation

double ColourContextRGBT::Gamma [protected]
 

Definition at line 943 of file colcontx.h.

UnitGroup * ColourContextRGBT::m_pUnitGroupArray [static, private]
 

Initial value:

Definition at line 952 of file colcontx.h.


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