#include <colcontx.h>
Inheritance diagram for ColourContextGreyT:
Public Member Functions | |
ColourContextGreyT (View *Scope) | |
Constructor for an GreyT Colour context. | |
void | ConvertToCIET (ColourGeneric *Source, DColourCIET *Result) |
Converts the given colour from our GreyT colourspace to CIET colourspace Notes: -. | |
void | ConvertFromCIET (DColourCIET *Source, ColourGeneric *Result) |
Converts the given colour to our GreyT colourspace from CIET colourspace Notes: -. | |
void | CreateExternalTransform () |
Create an external transform to be used during colour conversions from Grey 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 Notes:. | |
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 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 | GetWhite (ColourGeneric *Result) |
An easy way to get a colour definition in this colour model which is white (paper colour). | |
Protected Member Functions | |
virtual UnitGroup ** | GetComponentUnitGroups () |
Provides an array of UnitGroups primarily for use by the base class (ColourContext) members Set/GetComponentUnitGroup(). | |
Private Types | |
enum | { MAX_COMPONENTS = 3 } |
Static Private Attributes | |
static UnitGroup * | m_pUnitGroupArray [MAX_COMPONENTS] |
Friends | |
class | DocColour |
class | ColourContextList |
class | GRenderRegion |
class | OSRenderRegion |
Definition at line 1217 of file colcontx.h.
|
Definition at line 1248 of file colcontx.h. 01249 { 01250 MAX_COMPONENTS = 3 // Number of components in colour context 01251 };
|
|
Constructor for an GreyT Colour context.
Definition at line 3670 of file colcontx.cpp. 03671 : ColourContext(Scope) 03672 { 03673 ColModel = COLOURMODEL_GREYT; 03674 03675 CreateExternalTransform(); 03676 }
|
|
Shades a colour (tweaks the saturation and value in a relative way).
SourceAndResult - The source colour to be tinted, as defined in this colour model
Implements ColourContext. Definition at line 4062 of file colcontx.cpp. 04064 { 04065 ColourHSVT HSVDef; 04066 ColourContext *cc = ColourContext::GetGlobalDefault(COLOURMODEL_HSVT); 04067 ERROR3IF(cc == NULL, "No default HSV colour context?!"); 04068 04069 cc->ConvertColour(this, SourceAndResult, (ColourGeneric *) &HSVDef); 04070 cc->ApplyShade(XFraction, YFraction, (ColourGeneric *) &HSVDef); 04071 ConvertColour(cc, (ColourGeneric *) &HSVDef, SourceAndResult); 04072 }
|
|
Tints a colour (mixes it with white).
Implements ColourContext. Definition at line 4011 of file colcontx.cpp. 04012 { 04013 ColourGreyT *Result = (ColourGreyT *) SourceAndResult; 04014 04015 if (TintFraction <= FIXED24(0.0)) // 0% tint = White 04016 { 04017 Result->Intensity = FIXED24(1.0); 04018 return; 04019 } 04020 04021 if (TintFraction >= FIXED24(1.0)) // The Result colour is identical to the source 04022 return; 04023 04024 // Otherwise, tint the colour... 04025 Result->Intensity = FIXED24(1.0) - (TintFraction - (Result->Intensity * TintFraction)); 04026 }
|
|
Converts the given colour to our GreyT colourspace from CIET colourspace Notes: -.
Implements ColourContext. Definition at line 3793 of file colcontx.cpp. 03794 { 03795 ENSURE(UsageCount > 0, "Colour context being used when not initialised!"); 03796 03797 #ifndef NO_XARACMS 03798 // If we've got a CMS manager, use it, else use the version 1.1 bodge 03799 XaraCMS* lpCMSMan = GetApplication()->GetCMSManager(); 03800 03801 if (lpCMSMan != NULL) 03802 { 03803 CMSColour icol, ocol; 03804 03805 icol.c0 = Source->X; 03806 icol.c1 = Source->Y; 03807 icol.c2 = Source->Z; 03808 03809 // If we have no colour transform, or if we don't want the colour corrected/separated, 03810 // then we will just do a "logical" conversion. 03811 if (CMSTransform == NULL || (ColPlate != NULL && ColPlate->IsDisabled())) 03812 lpCMSMan->ConvCIEXYZtoRGB(icol, ocol); 03813 else 03814 lpCMSMan->GTransform(CMSTransform, cmsReverse, icol, ocol); 03815 03816 // The loadings below are taken from Gerry, the expert on colour loadings 03817 // in this particular office. No expense was spared to research these 03818 // values properly... ;-) 03819 double inten; 03820 inten = (ocol.c0 * 0.305) + (ocol.c1 * 0.586) + (ocol.c2 * 0.109); 03821 ((ColourGreyT *)Result)->Intensity = inten; 03822 } 03823 else 03824 #endif 03825 { 03826 double R, G, B; 03827 R = Source->X; 03828 G = Source->Y; 03829 B = Source->Z; 03830 03831 // The loadings below are taken from Gerry, the expert on colour loadings 03832 // in this particular office. No expense was spared to research these 03833 // values properly... ;-) 03834 ((ColourGreyT *)Result)->Intensity = (R * 0.305) + (G * 0.586) + (B * 0.109); 03835 } 03836 03837 // Set the transparency field 03838 ((ColourGreyT *)Result)->Transparent = 0;//Source->Transparent; 03839 03840 // And ensure that the reserved fields are cleared 03841 ((ColourGreyT *)Result)->Reserved1 = ((ColourGreyT *)Result)->Reserved2 = 0; 03842 }
|
|
Converts the given colour from our GreyT colourspace to CIET colourspace Notes: -.
Implements ColourContext. Definition at line 3735 of file colcontx.cpp. 03736 { 03737 ENSURE(UsageCount > 0, "Colour context being used when not initialised!"); 03738 03739 #ifndef NO_XARACMS 03740 // If we've got a CMS manager, use it, else use the version 1.1 bodge 03741 XaraCMS* lpCMSMan = GetApplication()->GetCMSManager(); 03742 03743 if (lpCMSMan != NULL) 03744 { 03745 // The new colour calibration method 03746 CMSColour icol, ocol; 03747 03748 icol.c2 = ((ColourGreyT *)Source)->Intensity.MakeDouble(); 03749 icol.c0 = icol.c1 = icol.c2; 03750 03751 // If we have no colour transform, or if we don't want the colour corrected/separated, 03752 // then we will just do a "logical" conversion. 03753 if (CMSTransform == NULL || (ColPlate != NULL && ColPlate->IsDisabled())) 03754 lpCMSMan->ConvRGBtoCIEXYZ(icol, ocol); 03755 else 03756 lpCMSMan->GTransform(CMSTransform, cmsForward, icol, ocol); 03757 03758 Result->X = ocol.c0; 03759 Result->Y = ocol.c1; 03760 Result->Z = ocol.c2; 03761 } 03762 else 03763 #endif 03764 { 03765 // The old rgb system 03766 Result->X = Result->Y = Result->Z = ((ColourGreyT *)Source)->Intensity.MakeDouble(); 03767 } 03768 03769 Result->Transparent = 0.0;//((ColourGreyT *)Source)->Transparent; 03770 }
|
|
Create an external transform to be used during colour conversions from Grey 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.
Reimplemented from ColourContext. Definition at line 3695 of file colcontx.cpp. 03696 { 03697 #ifndef NO_XARACMS 03698 CMSColourSpace cmsSpace; 03699 XaraCMS* lpCMSMan = GetApplication()->GetCMSManager(); 03700 03701 if (lpCMSMan != NULL) 03702 { 03703 // first read our internal colour calibration space 03704 lpCMSMan->GetLogicalProfile(&cmsSpace); 03705 03706 // set this as the active colour profile 03707 UINT32 err = lpCMSMan->SetProfile(cmsSpace); 03708 03709 // if we haven't got an error, create that transform 03710 if (err==0) 03711 CMSTransform = lpCMSMan->CreateTransform(DISPLAY_RCS); 03712 } 03713 #endif 03714 }
|
|
Provides number of components in the colour context's colour model.
Implements ColourContext. Definition at line 3979 of file colcontx.cpp. 03980 { 03981 return MAX_COMPONENTS; 03982 }
|
|
Returns the name of one of this context's colour components.
Implements ColourContext. Definition at line 3903 of file colcontx.cpp. 03904 { 03905 UINT32 StringID = 0; 03906 BOOL Used = TRUE; 03907 03908 switch(ComponentID) 03909 { 03910 case 1: 03911 StringID = (LongName) ? _R(IDS_COLCOMPL_INTENSITY) : _R(IDS_COLCOMP_INTENSITY); 03912 break; 03913 03914 #ifdef TRANSPARENTCOLOUR 03915 case 2: 03916 case 3: 03917 Used = FALSE; // These components are not used 03918 break; 03919 03920 default: 03921 StringID = _R(IDS_COLCOMP_TRANS); 03922 break; 03923 #else 03924 default: 03925 Used = FALSE; 03926 break; 03927 #endif 03928 } 03929 03930 if (Result != NULL && StringID != 0) 03931 *Result = String_32(StringID); 03932 03933 return(Used); 03934 }
|
|
Provides an array of UnitGroups primarily for use by the base class (ColourContext) members Set/GetComponentUnitGroup().
Implements ColourContext. Definition at line 3955 of file colcontx.cpp. 03956 { 03957 return m_pUnitGroupArray; 03958 }
|
|
Returns the name of this context's colour model Notes:.
Implements ColourContext. Definition at line 3864 of file colcontx.cpp. 03865 { 03866 ENSURE(Result != NULL, "ColourContext::GetModelName called with NULL result pointer!"); 03867 03868 *Result = String_32(_R(IDS_COLMODEL_GREY)); 03869 }
|
|
An easy way to get a colour definition in this colour model which is white (paper colour).
Implements ColourContext. Definition at line 4091 of file colcontx.cpp. 04092 { 04093 ColourGreyT *grey = (ColourGreyT *) Result; 04094 grey->Intensity = 1.0; 04095 04096 grey->Reserved1 = grey->Reserved2 = grey->Transparent = 0; 04097 }
|
|
Reimplemented from ColourContext. Definition at line 1220 of file colcontx.h. |
|
Reimplemented from ColourContext. Definition at line 1219 of file colcontx.h. |
|
Reimplemented from ColourContext. Definition at line 1222 of file colcontx.h. |
|
Reimplemented from ColourContext. Definition at line 1223 of file colcontx.h. |
|
Initial value: { &(StandardUnit::PercentGroup) } Definition at line 1252 of file colcontx.h. |