#include <colcontx.h>
Inheritance diagram for ColourContextCMYK:
Public Member Functions | |
ColourContextCMYK (View *Scope) | |
Constructor for a "logical" CMYK Colour context. | |
ColourContextCMYK (View *Scope, StringBase *NewProfileName) | |
Constructor for a CMYK Colour context. | |
void | ConvertToCIET (ColourGeneric *Source, DColourCIET *Result) |
Converts the given colour from our CMYK colourspace to CIET colourspace. | |
void | ConvertFromCIET (DColourCIET *Source, ColourGeneric *Result) |
Converts the given colour to our CMYK colourspace from CIET colourspace Notes: -. | |
void | CreateExternalTransform () |
Create an external transform to be used during colour conversions from CMYK to the current RCS space. This function uses the Winoil CMS Manager to create the transform. Both forward and backward transforms use a physical printer profile description. | |
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 | ApplyInputFilter (ColourPlate *FilterDescription, ColourContext *DestContext, ColourGeneric *OutputColour, IndexedColour *SourceIxCol) |
All colour conversions call this function for the SOURCE context immediately before converting the colour. This gives the input colour context the chance to apply a filtering process to the colour. | |
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 BOOL | IsDifferent (ColourContext *Other) const |
Determine if two colour contexts are not exactly equivalent. | |
virtual void | GetWhite (ColourGeneric *Result) |
An easy way to get a colour definition in this colour model which is white (paper colour). | |
virtual BOOL | GetProfileTables (BYTE *Tables) |
Uses the CMSManager to extract the profile data from our current CMSTransform. | |
String_256 * | GetProfileName (void) |
Protected Member Functions | |
virtual UnitGroup ** | GetComponentUnitGroups () |
Provides an array of UnitGroups primarily for use by the base class (ColourContext) members Set/GetComponentUnitGroup(). | |
virtual void | ConvertColourBase (ColourContext *SourceContext, ColourGeneric *Source, ColourGeneric *Result, IndexedColour *SourceIxCol=NULL) |
SEE ColourContext::ConvertColourbase This method is identical to that function, except that it also passes the colour directly through (rather than converting to/from CIET) if the source and destination contexts are both CMYK (even if they are different contexts, CMYK colours are always passed through without colour correction). | |
Protected Attributes | |
String_256 | ProfileName |
Private Types | |
enum | { MAX_COMPONENTS = 4 } |
Static Private Attributes | |
static UnitGroup * | m_pUnitGroupArray [MAX_COMPONENTS] |
Friends | |
class | DocColour |
class | ColourContextList |
class | GRenderRegion |
class | OSRenderRegion |
Definition at line 1078 of file colcontx.h.
|
Definition at line 1126 of file colcontx.h. 01127 { 01128 MAX_COMPONENTS = 4 // Number of components in colour context 01129 };
|
|
Constructor for a "logical" CMYK Colour context.
Notes: Colour Contexts should not be created and used directly. See the notes in the SeeAlso's for instructions on proper care and use.
Definition at line 1973 of file colcontx.cpp. 01974 : ColourContext(Scope) 01975 { 01976 ColModel = COLOURMODEL_CMYK; 01977 CreateExternalTransform(); 01978 }
|
|
Constructor for a CMYK Colour context.
XaraCMS::GetPrinterProfile() can be used to find the default printer profile name.
Definition at line 2006 of file colcontx.cpp. 02007 : ColourContext(Scope) 02008 { 02009 ColModel = COLOURMODEL_CMYK; 02010 02011 if (NewProfileName == NULL) 02012 { 02013 ERROR3("Illegal NULL param"); 02014 ProfileName.Empty(); 02015 } 02016 else 02017 ProfileName = *NewProfileName; 02018 02019 CreateExternalTransform(); 02020 }
|
|
All colour conversions call this function for the SOURCE context immediately before converting the colour. This gives the input colour context the chance to apply a filtering process to the colour.
OutputColour - The colour to be filtered SourceIxCol - NULL, or the original IndexedColour which is being converted. This is used for handling spot colour separation correctly.
Reimplemented from ColourContext. Definition at line 2547 of file colcontx.cpp. 02549 { 02550 ERROR3IF(FilterDescription == NULL || DestContext == NULL || OutputColour == NULL, "Illegal NULL params"); 02551 02552 if (FilterDescription == NULL) 02553 return; 02554 02555 ColourCMYK *OutputCMYK = (ColourCMYK *)OutputColour; 02556 FIXED24 temp; 02557 02558 // Separate the colour as appropriate 02559 switch(FilterDescription->GetType()) 02560 { 02561 case COLOURPLATE_CYAN: 02562 { 02563 if (FilterDescription->IsNegative()) // Negate the plate if necessary 02564 OutputCMYK->Cyan = 1.0 - OutputCMYK->Cyan; 02565 02566 if (FilterDescription->IsMonochrome()) // Make the plate a greyscale if necessary 02567 { 02568 OutputCMYK->Key = OutputCMYK->Cyan; 02569 OutputCMYK->Cyan = OutputCMYK->Magenta = OutputCMYK->Yellow = 0.0; 02570 } 02571 else 02572 OutputCMYK->Key = OutputCMYK->Magenta = OutputCMYK->Yellow = 0.0; 02573 } 02574 break; 02575 02576 case COLOURPLATE_MAGENTA: 02577 { 02578 if (FilterDescription->IsNegative()) // Negate the plate if necessary 02579 OutputCMYK->Magenta = 1.0 - OutputCMYK->Magenta; 02580 02581 if (FilterDescription->IsMonochrome()) // Make the plate a greyscale if necessary 02582 { 02583 OutputCMYK->Key = OutputCMYK->Magenta; 02584 OutputCMYK->Cyan = OutputCMYK->Magenta = OutputCMYK->Yellow = 0.0; 02585 } 02586 else 02587 OutputCMYK->Key = OutputCMYK->Cyan = OutputCMYK->Yellow = 0.0; 02588 } 02589 break; 02590 02591 case COLOURPLATE_YELLOW: 02592 { 02593 if (FilterDescription->IsNegative()) // Negate the plate if necessary 02594 OutputCMYK->Yellow = 1.0 - OutputCMYK->Yellow; 02595 02596 if (FilterDescription->IsMonochrome()) // Make the plate a greyscale if necessary 02597 { 02598 OutputCMYK->Key = OutputCMYK->Yellow; 02599 OutputCMYK->Cyan = OutputCMYK->Magenta = OutputCMYK->Yellow = 0.0; 02600 } 02601 else 02602 OutputCMYK->Key = OutputCMYK->Magenta = OutputCMYK->Cyan = 0.0; 02603 } 02604 break; 02605 02606 case COLOURPLATE_KEY: 02607 { 02608 OutputCMYK->Cyan = OutputCMYK->Magenta = OutputCMYK->Yellow = 0.0; 02609 02610 // The FilterDescription->IsMonochrome() flag has no effect on this plate! 02611 02612 if (FilterDescription->IsNegative()) 02613 OutputCMYK->Key = 1.0 - OutputCMYK->Key; 02614 } 02615 break; 02616 02617 case COLOURPLATE_SPOT: 02618 // NOTE: 02619 // Real spot colours are generally sorted out by the higher level ConvertColour 02620 // calls. However, 2 cases may seep through to this level: 02621 // 1) Colours which are not indexed colours (which can't be spots, so are always 02622 // just converted to white) 02623 // 2) Spot colours which *do* appear on this plate must be made into monochrome 02624 // ink density values (which we put into the Key component). 02625 02626 // In all cases, we're going monochrome in the Key only, so clear C/M/Y now. 02627 OutputCMYK->Cyan = OutputCMYK->Magenta = OutputCMYK->Yellow = 0; 02628 if (SourceIxCol == NULL) 02629 { 02630 // It's not an IndexedColour, so can't appear on this plate - make it white 02631 OutputCMYK->Key = 0; 02632 } 02633 else 02634 { 02635 // We have a source IndexedColour, so we know it's been separated. 02636 // We just have to get a decent ink density value out of the IxCol 02637 if (SourceIxCol == FilterDescription->GetSpotColour()) 02638 { 02639 // The spot colour itself is always considered a 100% tint (100% ink) 02640 OutputCMYK->Key = 1.0; 02641 } 02642 else if (SourceIxCol->IsADescendantOf(FilterDescription->GetSpotColour())) 02643 { 02644 // It's not the spot colour, but it is a child - check that it's a tint 02645 ERROR3IF(SourceIxCol->GetType() != COLOURTYPE_TINT || 02646 SourceIxCol->TintIsShade(), 02647 "Spot colour children must all be tints!"); 02648 02649 // Tint gives the amount of ink, which we stick into the Key plate. 02650 // Note that we get the accumulated tint value rather than the simple 02651 // tint, which is the true output ink density. 02652 OutputCMYK->Key = SourceIxCol->GetAccumulatedTintValue(); 02653 } 02654 } 02655 02656 // If negative, then photographically invert the colour 02657 if (FilterDescription->IsNegative()) 02658 { 02659 OutputCMYK->Cyan = OutputCMYK->Magenta = OutputCMYK->Yellow = 1.0; 02660 OutputCMYK->Key = 1.0 - OutputCMYK->Key; 02661 } 02662 break; 02663 02664 // case COLOURPLATE_COMPOSITE: 02665 // -- We don't need to do anything here 02666 // break; 02667 02668 default: 02669 // If monochrome, convert the image to a greyscale 02670 if (FilterDescription->IsMonochrome()) 02671 { 02672 // It is extremely unlikely that anyone will ever need to do this. 02673 // (If you want a monochrome preview, you should really use a greyscale ColourContext) 02674 ERROR3("Unimplemented: Filtering of composite CMYK colour to monochrome!"); 02675 } 02676 02677 // If negative, then photographically invert the colour 02678 if (FilterDescription->IsNegative()) 02679 { 02680 OutputCMYK->Cyan = 1.0 - OutputCMYK->Cyan; 02681 OutputCMYK->Magenta = 1.0 - OutputCMYK->Magenta; 02682 OutputCMYK->Yellow = 1.0 - OutputCMYK->Yellow; 02683 OutputCMYK->Key = 1.0 - OutputCMYK->Key; 02684 } 02685 break; 02686 } 02687 }
|
|
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.
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.
Reimplemented from ColourContext. Definition at line 2726 of file colcontx.cpp. 02728 { 02729 ERROR3IF(FilterDescription == NULL || SourceContext == NULL || OutputColour == NULL, "Illegal NULL params"); 02730 02731 // No FilterDescription means no filtering; If the source colour was CMYK, we msutn't filter it 02732 // as the ApplyInputFilter will have dealt with it 02733 if (FilterDescription == NULL || SourceContext->GetColourModel() == COLOURMODEL_CMYK) 02734 return; 02735 02736 ColourCMYK *OutputCMYK = (ColourCMYK *)OutputColour; 02737 FIXED24 temp; 02738 02739 // Separate the colour as appropriate 02740 switch(FilterDescription->GetType()) 02741 { 02742 case COLOURPLATE_CYAN: 02743 { 02744 if (FilterDescription->IsNegative()) // Negate the plate if necessary 02745 OutputCMYK->Cyan = 1.0 - OutputCMYK->Cyan; 02746 02747 if (FilterDescription->IsMonochrome()) // Make the plate a greyscale if necessary 02748 { 02749 // Move the Cyan value into the Key component 02750 OutputCMYK->Key = OutputCMYK->Cyan; 02751 OutputCMYK->Cyan = OutputCMYK->Magenta = OutputCMYK->Yellow = 0.0; 02752 } 02753 else 02754 OutputCMYK->Key = OutputCMYK->Magenta = OutputCMYK->Yellow = 0.0; 02755 } 02756 break; 02757 02758 case COLOURPLATE_MAGENTA: 02759 { 02760 if (FilterDescription->IsNegative()) // Negate the plate if necessary 02761 OutputCMYK->Magenta = 1.0 - OutputCMYK->Magenta; 02762 02763 if (FilterDescription->IsMonochrome()) // Make the plate a greyscale if necessary 02764 { 02765 // Move the Cyan value into the Key component 02766 OutputCMYK->Key = OutputCMYK->Magenta; 02767 OutputCMYK->Cyan = OutputCMYK->Magenta = OutputCMYK->Yellow = 0.0; 02768 } 02769 else 02770 OutputCMYK->Key = OutputCMYK->Cyan = OutputCMYK->Yellow = 0.0; 02771 } 02772 break; 02773 02774 case COLOURPLATE_YELLOW: 02775 { 02776 if (FilterDescription->IsNegative()) // Negate the plate if necessary 02777 OutputCMYK->Yellow = 1.0 - OutputCMYK->Yellow; 02778 02779 if (FilterDescription->IsMonochrome()) // Make the plate a greyscale if necessary 02780 { 02781 // Move the Cyan value into the Key component 02782 OutputCMYK->Key = OutputCMYK->Yellow; 02783 OutputCMYK->Cyan = OutputCMYK->Magenta = OutputCMYK->Yellow = 0.0; 02784 } 02785 else 02786 OutputCMYK->Key = OutputCMYK->Cyan = OutputCMYK->Magenta = 0.0; 02787 } 02788 break; 02789 02790 case COLOURPLATE_KEY: 02791 { 02792 if (FilterDescription->IsNegative()) // Negate the plate if necessary 02793 OutputCMYK->Key = 1.0 - OutputCMYK->Key; 02794 02795 // The monochrome flag has no effect on a key plate! 02796 OutputCMYK->Cyan = OutputCMYK->Magenta = OutputCMYK->Yellow = 0.0; 02797 } 02798 break; 02799 02800 case COLOURPLATE_SPOT: 02801 // NOTE: 02802 // Spot colours are partially handled by the IndexedColour variants of 02803 // ConvertColour, so will never reach us here if they have been 02804 // eliminated from the plate. 02805 // However, if a spot colour gets this far, we need to generate an ink 02806 // density value for output, as well as applying the negate flag. 02807 // 02808 // Actually, I have decreed that all spot plates will always be monochrome, 02809 // because that makes coding DocColour::Mix much easier, and anyway it makes 02810 // a load more sense for the very good reason that if you don't believe me 02811 // I'll get my Dad to come around and beat up your dad. 02812 02813 if (SourceIxCol != NULL) // && FilterDescription->IsMonochrome()) 02814 { 02815 if (SourceIxCol == FilterDescription->GetSpotColour()) 02816 { 02817 // The spot colour itself is always considered a 100% tint (100% ink) 02818 OutputCMYK->Key = 1.0; 02819 OutputCMYK->Cyan = OutputCMYK->Magenta = OutputCMYK->Yellow = 0.0; 02820 } 02821 else if (SourceIxCol->IsADescendantOf(FilterDescription->GetSpotColour())) 02822 { 02823 // It's not the spot colour, but it is a child - check that it's a tint 02824 ERROR3IF(SourceIxCol->GetType() != COLOURTYPE_TINT || 02825 SourceIxCol->TintIsShade(), 02826 "Spot colour children must all be tints!"); 02827 02828 // Tint gives the amount of ink. Note that we get the accumlated 02829 // tint value (true ink density) rather than the simple tint. 02830 OutputCMYK->Key = SourceIxCol->GetAccumulatedTintValue(); 02831 OutputCMYK->Cyan = OutputCMYK->Magenta = OutputCMYK->Yellow = 0.0; 02832 } 02833 } 02834 02835 // If negative, then photographically invert the colour 02836 if (FilterDescription->IsNegative()) 02837 { 02838 OutputCMYK->Cyan = 1.0 - OutputCMYK->Cyan; 02839 OutputCMYK->Magenta = 1.0 - OutputCMYK->Magenta; 02840 OutputCMYK->Yellow = 1.0 - OutputCMYK->Yellow; 02841 OutputCMYK->Key = 1.0 - OutputCMYK->Key; 02842 } 02843 break; 02844 02845 case COLOURPLATE_COMPOSITE: 02846 #ifndef NO_XARACMS 02847 { 02848 /* 02849 // Go to and from (printer) cmyk just for a laugh 02850 // Find the CMS manager, and get it to do all the work 02851 XaraCMS* lpCMSMan = GetApplication()->GetCMSManager(); 02852 if (lpCMSMan != NULL) 02853 lpCMSMan->ConvertColourForPaperView(OutputRGB); 02854 */ 02855 ERROR3("Composite preview to a CMYK colour context is barmy!"); 02856 } 02857 #endif 02858 // ... drop through to the default case to apply monochrome/negate 02859 02860 default: 02861 // If monochrome, convert the image to a greyscale 02862 if (FilterDescription->IsMonochrome()) 02863 { 02864 // Will anyone ever need this? It seems unlikely - but we may well get Key coming 02865 // through here, which is entirely sensible, so we only error if there is colour info. 02866 ERROR3IF(OutputCMYK->Cyan != 0 || OutputCMYK->Magenta != 0 || OutputCMYK->Yellow != 0, 02867 "Monochrome output of colour CMYK to CMYK colour context is unimplemented"); 02868 } 02869 02870 // If negative, then photographically invert the colour 02871 if (FilterDescription->IsNegative()) 02872 { 02873 OutputCMYK->Cyan = 1.0 - OutputCMYK->Cyan; 02874 OutputCMYK->Magenta = 1.0 - OutputCMYK->Magenta; 02875 OutputCMYK->Yellow = 1.0 - OutputCMYK->Yellow; 02876 OutputCMYK->Key = 1.0 - OutputCMYK->Key; 02877 } 02878 break; 02879 } 02880 }
|
|
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 2499 of file colcontx.cpp. 02501 { 02502 ColourHSVT HSVDef; 02503 ColourContext *cc = ColourContext::GetGlobalDefault(COLOURMODEL_HSVT); 02504 ERROR3IF(cc == NULL, "No default HSV colour context?!"); 02505 02506 cc->ConvertColour(this, SourceAndResult, (ColourGeneric *) &HSVDef); 02507 cc->ApplyShade(XFraction, YFraction, (ColourGeneric *) &HSVDef); 02508 ConvertColour(cc, (ColourGeneric *) &HSVDef, SourceAndResult); 02509 }
|
|
Tints a colour (mixes it with white).
Implements ColourContext. Definition at line 2445 of file colcontx.cpp. 02446 { 02447 ColourCMYK *Result = (ColourCMYK *) SourceAndResult; 02448 02449 if (TintFraction <= FIXED24(0.0)) // 0% tint = White 02450 { 02451 Result->Cyan = Result->Magenta = Result->Yellow = Result->Key = 0; 02452 return; 02453 } 02454 02455 if (TintFraction >= FIXED24(1.0)) // The Result colour is identical to the source 02456 return; 02457 02458 // Otherwise, tint the colour... 02459 Result->Cyan = (Result->Cyan * TintFraction); 02460 Result->Magenta = (Result->Magenta * TintFraction); 02461 Result->Yellow = (Result->Yellow * TintFraction); 02462 Result->Key = (Result->Key * TintFraction); 02463 }
|
|
SEE ColourContext::ConvertColourbase This method is identical to that function, except that it also passes the colour directly through (rather than converting to/from CIET) if the source and destination contexts are both CMYK (even if they are different contexts, CMYK colours are always passed through without colour correction).
Result - A ColourGeneric structure to recieve the resulting converted colour, as defined in this ColourContextCMYK. SourceIxCol - NULL, or a pointer to the IndexedColour we are converting. This is used only for handling spot colour separations, to determine if the colour is a given spot colour or tint thereof.
Reimplemented from ColourContext. Definition at line 2967 of file colcontx.cpp. 02970 { 02971 // Copy the source colour into a temporary variable 02972 ColourGeneric FilteredSource; 02973 memcpy(&FilteredSource, Source, sizeof(ColourGeneric)); 02974 02975 // Call the SourceContext to allow it to pre-filter the colour. This is used to 02976 // provide colour separations and other doody features when converting CMYK colours 02977 // - when converting non-CMYK colours, this is usually done in the OutputFilter (below) 02978 if (ColPlate != NULL && !ColPlate->IsDisabled()) 02979 SourceContext->ApplyInputFilter(ColPlate, this, &FilteredSource, SourceIxCol); 02980 02981 // ----- 02982 // Call levels expected: 02983 // 1 inline ConvertColour checks if can satisfy from cache 02984 // 2 function ConvertColourInternal does any short cuts it can, such 02985 // as CMYK->CMYK passthrough 02986 // 3 Call ConvertColourBase, which 02987 // a) Checks if in same colour model, and implements passthrough, or 02988 // b) Converts colour properly via CIET space 02989 02990 if (SourceContext == this || SourceContext->GetColourModel() == COLOURMODEL_CMYK) 02991 { 02992 // The SourceContext and Destination context are identical, so we can 02993 // just copy the definition directly across. 02994 memcpy(Result, &FilteredSource, sizeof(ColourGeneric)); 02995 } 02996 else 02997 { 02998 DColourCIET IntermediateResult; 02999 03000 SourceContext->ConvertToCIET(&FilteredSource, &IntermediateResult); 03001 ConvertFromCIET(&IntermediateResult, Result); 03002 } 03003 03004 03005 // Call the DestinationContext (derived class of this) to apply any output filtering - 03006 // non-CMYK colour conversions will separate the colour (as appropriate) here 03007 if (ColPlate != NULL && !ColPlate->IsDisabled()) 03008 ApplyOutputFilter(ColPlate, SourceContext, Result, SourceIxCol); 03009 }
|
|
Converts the given colour to our CMYK colourspace from CIET colourspace Notes: -.
Implements ColourContext. Definition at line 2143 of file colcontx.cpp. 02144 { 02145 ENSURE(UsageCount > 0, "Colour context being used when not initialised!"); 02146 02147 ColourCMYK *cmyk = (ColourCMYK *) Result; 02148 02149 #ifndef NO_XARACMS 02150 // If we've got a CMS manager, use it, else use the version 1.1 bodge 02151 XaraCMS* lpCMSMan = GetApplication()->GetCMSManager(); 02152 02153 if (lpCMSMan != NULL) 02154 { 02155 // The new colour calibration method 02156 CMSColour icol, ocol; 02157 icol.c0 = Source->X; 02158 icol.c1 = Source->Y; 02159 icol.c2 = Source->Z; 02160 02161 // If we have no colour transform, or if we don't want the colour corrected/separated, 02162 // then we will just do a "logical" conversion. 02163 if (CMSTransform == NULL || (ColPlate != NULL && ColPlate->IsDisabled())) 02164 lpCMSMan->ConvCIEXYZtoCMYK(icol, ocol); 02165 else 02166 lpCMSMan->GTransform(CMSTransform, cmsReverse, icol, ocol); 02167 02168 cmyk->Cyan = FIXED24(ocol.c0); 02169 cmyk->Magenta= FIXED24(ocol.c1); 02170 cmyk->Yellow = FIXED24(ocol.c2); 02171 cmyk->Key = FIXED24(ocol.c3); 02172 02173 /* 02174 #ifdef _DEBUG 02175 { 02176 // Check that the colour will round-trip from CIE to CMYK and back to CIE correctly 02177 DColourCIET temp; 02178 ConvertToCIET(Result, &temp); 02179 INT32 t1 = (INT32)(Source->X*1000.0); 02180 INT32 t2 = (INT32)(Source->Y*1000.0); 02181 INT32 t3 = (INT32)(Source->Z*1000.0); 02182 INT32 t4 = (INT32)INT32(temp.X*1000.0); 02183 INT32 t5 = (INT32)INT32(temp.Y*1000.0); 02184 INT32 t6 = (INT32)INT32(temp.Z*1000.0); 02185 CMSColour orgb, orgb2; 02186 lpCMSMan->ConvCIEXYZtoRGB(icol, orgb); 02187 if (t1==t4 && t2==t5 && t3==t6) 02188 { 02189 TRACE( _T("CIE-CMYK-CIE roundtrip OK : RGB(%.3f,%.3f,%.3f) (%.3f,%.3f,%.3f,%.3f)\n"), orgb.c0, orgb.c1, orgb.c2, ocol.c0, ocol.c1, ocol.c2, ocol.c3); 02190 } 02191 else 02192 { 02193 TRACE( _T("CIE-CMYK-CIE roundtrip error: RGB(%.3f,%.3f,%.3f) (%.3f,%.3f,%.3f,%.3f)\n"), orgb.c0, orgb.c1, orgb.c2, ocol.c0, ocol.c1, ocol.c2, ocol.c3); 02194 TRACE( _T(" CIEIn[%d,%d,%d] CIEOut[%d,%d,%d]\n"), t1, t2, t3, t4, t5, t6); 02195 } 02196 02197 // ERROR3IF((INT32)(temp.X*1000.0)!=(INT32)(Source->X*1000.0) || 02198 // (INT32)(temp.Y*1000.0)!=(INT32)(Source->Y*1000.0) || 02199 // (INT32)(temp.Z*1000.0)!=(INT32)(Source->Z*1000.0), 02200 // "CMYK does not round-trip!"); 02201 } 02202 #endif 02203 */ 02204 02205 } 02206 else 02207 #endif 02208 { 02209 // The old rgb method 02210 ColourRGBT rgb; 02211 rgb.Red = FIXED24(Source->X); 02212 rgb.Green = FIXED24(Source->Y); 02213 rgb.Blue = FIXED24(Source->Z); 02214 02215 // If all components are 0 then we know it's BLACK. 02216 if (rgb.Red <= 0 && rgb.Green <= 0 && rgb.Blue <= 0) 02217 { 02218 cmyk->Cyan = cmyk->Magenta = cmyk->Yellow = 0; 02219 cmyk->Key = 1.0; 02220 } 02221 else 02222 { 02223 // Invert the Colour Vector 02224 cmyk->Cyan = 1.0 - rgb.Red; 02225 cmyk->Magenta = 1.0 - rgb.Green; 02226 cmyk->Yellow = 1.0 - rgb.Blue; 02227 02228 double smallest; 02229 02230 smallest = min(cmyk->Cyan.MakeDouble(), cmyk->Magenta.MakeDouble()); 02231 smallest = min(smallest, cmyk->Yellow.MakeDouble()); 02232 smallest = max(smallest-0.5, 0.0); 02233 02234 // Key starts being generated beyond threshold 02235 cmyk->Key = smallest; 02236 02237 // Subtract KEY component. 02238 cmyk->Cyan -= cmyk->Key; 02239 cmyk->Magenta -= cmyk->Key; 02240 cmyk->Yellow -= cmyk->Key; 02241 } 02242 } 02243 }
|
|
Converts the given colour from our CMYK colourspace to CIET colourspace.
Implements ColourContext. Definition at line 2080 of file colcontx.cpp. 02081 { 02082 ENSURE(UsageCount > 0, "Colour context being used when not initialised!"); 02083 02084 ColourCMYK *bob = (ColourCMYK *) Source; 02085 02086 #ifndef NO_XARACMS 02087 // If we've got a CMS manager, use it, else use the version 1.1 bodge 02088 XaraCMS* lpCMSMan = GetApplication()->GetCMSManager(); 02089 02090 if (lpCMSMan != NULL) 02091 { 02092 // The new colour calibration method 02093 CMSColour icol, ocol; 02094 icol.c0 = bob->Cyan.MakeDouble(); 02095 icol.c1 = bob->Magenta.MakeDouble(); 02096 icol.c2 = bob->Yellow.MakeDouble(); 02097 icol.c3 = bob->Key.MakeDouble(); 02098 02099 // If we have no colour transform, or if we don't want the colour corrected/separated, 02100 // then we will just do a "logical" conversion. 02101 if (CMSTransform == NULL || (ColPlate != NULL && ColPlate->IsDisabled())) 02102 lpCMSMan->ConvCMYKtoCIEXYZ(icol, ocol); 02103 else 02104 lpCMSMan->GTransform(CMSTransform, cmsForward, icol, ocol); 02105 02106 Result->X = ocol.c0; 02107 Result->Y = ocol.c1; 02108 Result->Z = ocol.c2; 02109 } 02110 else 02111 #endif 02112 { 02113 // The old rgb method 02114 Result->X = ( 1.0 - ( min( 1.0, ( bob->Cyan + bob->Key ).MakeDouble() ) ) ); // R 02115 Result->Y = ( 1.0 - ( min( 1.0, ( bob->Magenta + bob->Key ).MakeDouble() ) ) ); // G 02116 Result->Z = ( 1.0 - ( min( 1.0, ( bob->Yellow + bob->Key ).MakeDouble() ) ) ); // B 02117 } 02118 02119 Result->Transparent = 0.0; // CMYK values are not transparent 02120 }
|
|
Create an external transform to be used during colour conversions from CMYK to the current RCS space. This function uses the Winoil CMS Manager to create the transform. Both forward and backward transforms use a physical printer profile description.
Reimplemented from ColourContext. Definition at line 2039 of file colcontx.cpp. 02040 { 02041 #ifndef NO_XARACMS 02042 XaraCMS* lpCMSMan = GetApplication()->GetCMSManager(); 02043 02044 // If we have a CMS and we are not a logical context, set up a transform 02045 if (lpCMSMan != NULL && !ProfileName.IsEmpty()) 02046 { 02047 TCHAR* pProfile = (TCHAR*)ProfileName; 02048 02049 // set this as the active colour profile 02050 UINT32 err = lpCMSMan->SetProfile(ptPrinter, pProfile); 02051 02052 // if we haven't got an error, create that transform 02053 if (err==0) 02054 CMSTransform = lpCMSMan->CreateTransform(PRINT_RCS); 02055 } 02056 #endif 02057 }
|
|
Provides number of components in the colour context's colour model.
Implements ColourContext. Definition at line 2413 of file colcontx.cpp. 02414 { 02415 return MAX_COMPONENTS; 02416 }
|
|
Returns the name of one of this context's colour components.
Implements ColourContext. Definition at line 2338 of file colcontx.cpp. 02339 { 02340 UINT32 StringID = 0; 02341 BOOL Used = TRUE; 02342 02343 switch(ComponentID) 02344 { 02345 case 1: 02346 StringID = (LongName) ? _R(IDS_COLCOMPL_CYAN) : _R(IDS_COLCOMP_CYAN); 02347 break; 02348 02349 case 2: 02350 StringID = (LongName) ? _R(IDS_COLCOMPL_MAGENTA) : _R(IDS_COLCOMP_MAGENTA); 02351 break; 02352 02353 case 3: 02354 StringID = (LongName) ? _R(IDS_COLCOMPL_YELLOW) : _R(IDS_COLCOMP_YELLOW); 02355 break; 02356 02357 default: 02358 StringID = (LongName) ? _R(IDS_COLCOMPL_KEY) : _R(IDS_COLCOMP_KEY); 02359 break; 02360 } 02361 02362 if (Result != NULL && StringID != 0) 02363 *Result = String_32(StringID); 02364 02365 return(Used); 02366 }
|
|
Provides an array of UnitGroups primarily for use by the base class (ColourContext) members Set/GetComponentUnitGroup().
Implements ColourContext. Definition at line 2386 of file colcontx.cpp. 02387 { 02388 return m_pUnitGroupArray; 02389 }
|
|
Returns the name of this context's colour model Notes:.
Implements ColourContext. Definition at line 2299 of file colcontx.cpp. 02300 { 02301 ENSURE(Result != NULL, "ColourContext::GetModelName called with NULL result pointer!"); 02302 02303 *Result = String_32(_R(IDS_COLMODEL_CMYK)); 02304 }
|
|
Definition at line 1119 of file colcontx.h. 01119 { return(&ProfileName); };
|
|
Uses the CMSManager to extract the profile data from our current CMSTransform.
Reimplemented from ColourContext. Definition at line 2260 of file colcontx.cpp. 02261 { 02262 PORTNOTE("other","Removed HCMTRANSFORM usage") 02263 #ifndef EXCLUDE_FROM_XARALX 02264 if (CMSTransform==NULL) 02265 return FALSE; 02266 #endif 02267 02268 #ifdef NO_XARACMS 02269 return FALSE; 02270 #else 02271 XaraCMS* lpCMSMan = GetApplication()->GetCMSManager(); 02272 if (lpCMSMan==NULL) 02273 return FALSE; 02274 02275 return lpCMSMan->GetProfileTables(CMSTransform, Tables); 02276 #endif 02277 }
|
|
An easy way to get a colour definition in this colour model which is white (paper colour).
Implements ColourContext. Definition at line 2926 of file colcontx.cpp. 02927 { 02928 ColourCMYK *cmyk = (ColourCMYK *) Result; 02929 cmyk->Cyan = cmyk->Magenta = cmyk->Yellow = cmyk->Key = 0; 02930 }
|
|
Determine if two colour contexts are not exactly equivalent.
Reimplemented from ColourContext. Definition at line 2900 of file colcontx.cpp. 02901 { 02902 if (ColourContext::IsDifferent(Other)) // Different on generic ColourContext basis 02903 return(TRUE); 02904 02905 // These must both be CMYK contexts, so check if they are equivalent 02906 return(ProfileName.IsIdentical(((ColourContextCMYK *)Other)->ProfileName)); 02907 }
|
|
Reimplemented from ColourContext. Definition at line 1081 of file colcontx.h. |
|
Reimplemented from ColourContext. Definition at line 1080 of file colcontx.h. |
|
Reimplemented from ColourContext. Definition at line 1083 of file colcontx.h. |
|
Reimplemented from ColourContext. Definition at line 1084 of file colcontx.h. |
|
Initial value: { &(StandardUnit::PercentGroup), &(StandardUnit::PercentGroup), &(StandardUnit::PercentGroup), &(StandardUnit::PercentGroup) } Definition at line 1130 of file colcontx.h. |
|
Definition at line 1138 of file colcontx.h. |