#include <colourix.h>
Inheritance diagram for IndexedColour:
Public Member Functions | |
IndexedColour () | |
Constructor for an IndexedColour object Initialises the colour to the RGBT value for Opaque Black. | |
~IndexedColour () | |
Destructor for an IndexedColour object. | |
IndexedColour (const IndexedColour &Col) | |
Copy constructor for an IndexedColour object. | |
IndexedColour (const DocColour &Col) | |
Copy constructor for an IndexedColour object. | |
IndexedColour (ColourModel ColModel, ColourGeneric *Col) | |
Constructor for an IndexedColour object Initialises the colour to the given value in the given colour model NOTE that if you have a ColourABCD structure, you can pass this in as a single parameter, and inline functions will convert the call into a call to this function on your behalf. i.e. you can use IndexedColour((ColourRGBT *)Bob); -- See colour.h. | |
IndexedColour (ColourValue Red, ColourValue Green, ColourValue Blue, ColourValue Transparent=0, UINT32 TransType=TRANSTYPE_DEFAULT) | |
Constructor for an IndexedColour object Initialises the colour to the given Extended RGBT value. | |
IndexedColour & | operator= (const IndexedColour &) |
IndexedColour assignment operator Copies the definition of one IndexedColour into another Notes: The name field is copied verbatim - if you want it to say 'Copy of ...' then you'll have to prepend this text yourself. | |
void | SetName (const StringBase &Name, BOOL ForceNamed=TRUE) |
To set the name of an IndexedColour. The name will be truncated to a maximum length of 63 characters. | |
void | SetUnnamed (void) |
To UNset the name of an IndexedColour, forcing it back to being Unnamed. | |
String_64 * | GetName (BOOL ReturnTrueID=FALSE) |
To find the name of an IndexedColour (or the ID of an unnamed indexed colour). | |
BOOL | IsNamed (void) |
Determines if this colour has been given a name. This cannot be determined using the GetName function, which returns a default name if the colour is unnamed. | |
void | GetSourceColour (ColourGeneric *Result) |
Gets the definition of the IndexedColour. | |
BOOL | IsDifferent (const IndexedColour &Other) |
To determine if two indexed colours share a common definition. | |
BOOL | IsDifferent (const IndexedColour &Other, FIXED24 ErrorLimit) |
ColourModel | GetColourModel (void) const |
To determine the colour model in which an IndexedColour is defined. | |
void | IncrementUsage (void) |
Informs the IndexedColour that yet another thing is referencing it. An IndexedColour should not be deleted if its usage count != 0 A non-zero usage count on exit will generate ENSUREs which usually signal memory leaks or people forgetting to link/delink themselves properly. | |
BOOL | DecrementUsage (void) |
Informs the IndexedColour that a client is no longer referencing it. An IndexedColour should not be deleted if its usage count != 0. | |
BOOL | IsInUse (BOOL IgnoreColourGallery=FALSE) |
To determine if anything references this IndexedColour (An IndexedColour must not be deleted if it is in use). | |
BOOL | IsDeleted (void) |
To determine if this colour has been marked 'deleted'. This is used for undo, to hide colours which have been 'deleted'. | |
void | SetDeleted (BOOL DeletedFlag) |
This marks/unmarks a colour as 'deleted'. This flag is used for undo, to hide colours which have been 'deleted'. Remember that this constitutes a change to the colour, so you should call ColourManager::ColourListHasChanged, to ensure that the Colour dialogues update all displayed lists to show/not-show this colour. Scope: Only intended for internal ColourManager use Notes: Used by the undoable ColourManager OpColourChange. You should use colour manager calls to delete colours rather than touching them directly. Note that you can 'delete'/'undelete' colours even when they are deemed 'In Use'. | |
void | InvalidateCache (void) |
Invalidates the IndexedColours output colour cache. This ensures that the colour is re-converted and cached the next time it is used. Scope: Generally private; All public access functions invalidate the cache automatically if it is necessary (if the colour changes). | |
IndexedColourType | GetType (void) const |
Determines the type of this colour. | |
BOOL | IsSpotOrTintOfSpot (void) const |
Determines if this colour is either a spot colour or a true tint of a spot colour. (Tints can unfortunately be made from non-spot colour parents, so you need to call this function to determine if a tint really is cleanly derived from a spot colour, or if it must be treated as a simple process colour). | |
IndexedColour * | FindLinkedParent (void) |
Finds the colour upon which a tint/based-on colour is based, if any. Can also be used to determine if a colour is a tint/basedon colour. | |
IndexedColour * | FindOldestAncestor (void) |
Finds the colour upon which a tint/based-on colour is based, if any. Can also be used to determine if a colour is a tint/basedon colour. | |
BOOL | HasLinkedChildren (void) |
To determine if any other IndexedColour references this IndexedColour (An IndexedColour must not be deleted if it is in use). | |
BOOL | IsADescendantOf (IndexedColour *Parent) |
Recursively backtracks through the chain of LinkedParent links to determine if this colour is in any way (directly or indirectly) linked to the given Parent colour, and might therefore be affected by any change to said colour. | |
void | LinkedAncestorHasChanged (void) |
Informs an IndexedColour that an ancestor in the linking chain has changed, and that therefore, it may also have changed. | |
void | SetLinkedParent (IndexedColour *Parent, IndexedColourType NewType=COLOURTYPE_LINKED) |
To make a colour linked to or a tint of another colour. This links the colour to the parent. | |
IndexedColour * | FindLastLinkedParent (void) |
Finds the last parent colour of this colour. Note that after changing a linked/tint colour back into a normal/spot colour, the parent is remembered. This call thus returns the parent even when the colour is no longer a linked/tint colour. Intended only for use by the colour editor to allow temporary type chnages to not lose the parent link info. The colour editor probably clears the parent colour on exit. | |
BOOL | SetInheritsComponent (UINT32 ComponentID, BOOL Inherits) |
To set if a given component of a colour is inherited from its linked parent colour. | |
BOOL | InheritsComponent (UINT32 ComponentID) |
To determine if a given component of a colour is inherited from its linked parent colour. Always returns FALSE if a colour is not linked. | |
void | SetTintValue (FIXED24 NewTintValue) |
Sets a new tint value for a Tint colour. Will generate ENSURE failures in the debug build if the colour is not a tint. | |
FIXED24 | GetTintValue (void) const |
Gets the current Tint value for the colour. | |
FIXED24 | GetAccumulatedTintValue (void) |
To determine the accumulated tint value of any colour. | |
void | SetShadeValues (FIXED24 NewShadeValueX, FIXED24 NewShadeValueY) |
Sets new shade values for a Shade colour. Will generate ENSURE failures in the debug build if the colour is not a Tint/Shade. | |
FIXED24 | GetShadeValueX (void) const |
Gets the current Shade Saturation value for the colour. | |
FIXED24 | GetShadeValueY (void) const |
Gets the current Shade Brightness value for the colour. | |
void | SetTintOrShade (BOOL IsATint) |
Sets a COLOURTYPE_TINT colour to be either a Tint (fade-to-white) or a shade (fade-to-black) colour. The tint/shade fraction is unchnaged (the colour will just toggle between being darker and lighter!). | |
BOOL | TintIsShade (void) const |
Determines if a COLOURTYPE_TINT colour is really a tint or a shade. | |
void | SwapWith (IndexedColour *Other) |
void | GetDebugDetails (StringBase *Str) |
To get information on this colour for display in the Debug Tree. | |
Static Public Member Functions | |
static BOOL | AreSpotsForcedToProcess (void) |
static void | ForceSpotsToBeProcess (BOOL ForceOn) |
To set the global colour flag. When the flag is TRUE, all spot colours in the entire program are forced to act as "normal" colours; when set FALSE, all spot colours behave normally. | |
Protected Member Functions | |
void | InitialiseInfoFields (ColourModel ColModel) |
Private shared code for construction of IndexedColour objects Initialises the 'Info' structure to default values Scope: private. | |
void | IncrementChildUsage (void) |
Informs the IndexedColour that yet another thing is referencing it. An IndexedColour must not be deleted if its usage count != 0 Scope: private. | |
BOOL | DecrementChildUsage (void) |
Informs the IndexedColour that a client is no longer referencing it. An IndexedColour should not be deleted if its usage count != 0 Scope: private. | |
BOOL | SetType (IndexedColourType NewType) |
Sets the type of this colour: MonoOn COLOURTYPE_NORMAL, COLOURTYPE_SPOT, COLOURTYPE_TINT, COLOURTYPE_LINKED MonoOff. | |
void | SetSourceColourModel (ColourModel NewModel) |
Sets our colour model number, and invalidates the colour cache Scope: Private, for use by friend classes only. | |
ColourGeneric * | SourceColourPtr (void) |
Returns a pointer to our source colour. Used to encapsulate our data for external friend users, rather than them poking directly at our data structures. Inlined, so just as efficient anyway. Scope: Private, for use by friend class ColourContext. | |
Protected Attributes | |
IndexedColourInfo | Info |
ColourGeneric | SourceColour |
ColourGeneric | CachedColour |
IndexedColour * | ParentColour |
DWORD | ChildUsage |
DWORD | UsageCount |
String_64 * | Name |
Static Private Attributes | |
static BOOL | SpotsAreProcess = FALSE |
Friends | |
class | ColourContext |
class | DocColour |
class | ColourPicker |
NOTE That if an UNNAMED IndexedColour's usage count is decremented to zero, it will automatically delete itself. Named colours must be explicitly deleted.
Definition at line 207 of file colourix.h.
|
Constructor for an IndexedColour object Initialises the colour to the RGBT value for Opaque Black.
Definition at line 185 of file colourix.cpp. 00186 { 00187 InitialiseInfoFields(COLOURMODEL_RGBT); 00188 00189 SourceColour.Component1 = 0; // Black & No-colour (in RGBT) 00190 SourceColour.Component2 = 0; 00191 SourceColour.Component3 = 0; 00192 SourceColour.Component4 = 1.0; // 100% transparent 00193 }
|
|
Destructor for an IndexedColour object.
Definition at line 212 of file colourix.cpp. 00213 { 00214 ERROR3IF(UsageCount < 0, "IndexedColour UsageCount is negative"); 00215 00216 #ifdef _DEBUG 00217 if (UsageCount != 0) 00218 { 00219 if (IsNamed()) 00220 TRACE( _T("\n>> Named IndexedColour %p ('%s') is still referenced %ld times\n"), 00221 this, (TCHAR *)(*Name), (INT32)UsageCount); 00222 else 00223 TRACE( _T("\n>> Unnamed IndexedColour %p is still referenced %ld times\n"), 00224 this, (INT32)UsageCount); 00225 00226 // Now, ask SimpleCCObject to wugg through all current objects to see if we can find something 00227 // that could be the pointer back at us! 00228 extern void CheckForUsedPointer(void *ThePointer); 00229 00230 TRACE( _T(" References to this object were found in:\n")); 00231 CheckForUsedPointer(this); 00232 TRACE( _T("\n")); 00233 } 00234 00235 ERROR3IF(UsageCount > 0, "IndexedColour deleted while still in use"); 00236 00237 if (ChildUsage != 0) 00238 { 00239 if (IsNamed()) 00240 { 00241 TRACEUSER( "Jason", _T("Jason: Named IndexedColour %p ('%s') is still LINKED %ld times\n"), 00242 this, (TCHAR *)(*Name), (INT32)ChildUsage); 00243 } 00244 else 00245 { 00246 TRACEUSER( "Jason", _T("Jason: Unnamed IndexedColour %p is still LINKED %ld times\n"), 00247 this, (INT32)ChildUsage); 00248 } 00249 } 00250 #endif 00251 00252 // If we are linked to another colour, we need to de-reference it 00253 if (ParentColour != NULL) 00254 ParentColour->DecrementChildUsage(); 00255 00256 if (Name != NULL) 00257 delete Name; 00258 }
|
|
Copy constructor for an IndexedColour object.
Definition at line 277 of file colourix.cpp. 00278 { 00279 Info = Col.Info; 00280 memcpy(&SourceColour, &Col.SourceColour, sizeof(ColourGeneric)); 00281 memcpy(&CachedColour, &Col.CachedColour, sizeof(ColourGeneric)); 00282 00283 // If we are copying a linked/tint colour, we make ourselves linked to their parent 00284 ParentColour = Col.ParentColour; 00285 if (ParentColour != NULL) 00286 ParentColour->IncrementChildUsage(); 00287 00288 UsageCount = 0; 00289 ChildUsage = 0; 00290 00291 Info.IsNamed = FALSE; 00292 Name = NULL; 00293 00294 // Nasty casting to get around this messy const problem. 00295 if (((IndexedColour *)&Col)->IsNamed()) 00296 SetName(*(Col.Name)); // Copy the string, not the string-pointer 00297 }
|
|
Copy constructor for an IndexedColour object.
If the DocColour references an IndexedColour, the referenced colour is copied Tints and Linked colours are copied and remain tints/linked (Gosh!) Named/Unnamed colours will be copied as Named/Unnamed colours (Gosh!) The name is copied verbatim (i.e it is not changed to 'Copy of X')
Definition at line 329 of file colourix.cpp. 00330 { 00331 // Find the parent IndexedColour, if any. Nasty cast to remove compiler warning 00332 IndexedColour *Def = ((DocColour *) &Col)->FindParentIndexedColour(); 00333 00334 if (Def != NULL) 00335 { 00336 // The DocColour references an IndexedColour, so copy the parent IndexedColour 00337 Info = Def->Info; 00338 memcpy(&SourceColour, &Def->SourceColour, sizeof(ColourGeneric)); 00339 memcpy(&CachedColour, &Def->CachedColour, sizeof(ColourGeneric)); 00340 00341 // If we are copying a linked/tint colour, we need to link ourselves to its parent 00342 ParentColour = Def->ParentColour; 00343 if (ParentColour != NULL) 00344 ParentColour->IncrementChildUsage(); 00345 00346 UsageCount = 0; 00347 ChildUsage = 0; 00348 00349 Info.IsNamed = FALSE; 00350 Name = NULL; 00351 if (Def->IsNamed()) 00352 SetName(*(Def->Name)); // Copy the string, not the string-pointer 00353 } 00354 else 00355 { 00356 // This is an immediate DocColour, so copy its definition into our SourceColour 00357 InitialiseInfoFields(Col.GetColourModel()); 00358 ((DocColour *) &Col)->GetSourceColour(&SourceColour); 00359 } 00360 }
|
|
Constructor for an IndexedColour object Initialises the colour to the given value in the given colour model NOTE that if you have a ColourABCD structure, you can pass this in as a single parameter, and inline functions will convert the call into a call to this function on your behalf. i.e. you can use IndexedColour((ColourRGBT *)Bob); -- See colour.h.
Definition at line 423 of file colourix.cpp. 00424 { 00425 InitialiseInfoFields(ColModel); 00426 memcpy(&SourceColour, Col, sizeof(ColourGeneric)); 00427 }
|
|
Constructor for an IndexedColour object Initialises the colour to the given Extended RGBT value.
Definition at line 390 of file colourix.cpp. 00392 { 00393 InitialiseInfoFields(COLOURMODEL_RGBT); 00394 SourceColour.Component1 = Red; 00395 SourceColour.Component2 = Green; 00396 SourceColour.Component3 = Blue; 00397 SourceColour.Component4 = Transparent; 00398 }
|
|
Definition at line 290 of file colourix.h. 00290 { return(SpotsAreProcess); };
|
|
Informs the IndexedColour that a client is no longer referencing it. An IndexedColour should not be deleted if its usage count != 0 Scope: private.
Definition at line 504 of file colourix.h. 00505 { 00506 ENSURE(IsNamed(), "Attempt to decrement child usage of an UNNAMED colour!"); 00507 00508 ENSURE(ChildUsage > 0, "IndexedColour::DecrementChildUsage - UsageCount has gone NEGATIVE!"); 00509 00510 return((--ChildUsage) != 0); 00511 }
|
|
Informs the IndexedColour that a client is no longer referencing it. An IndexedColour should not be deleted if its usage count != 0.
Definition at line 413 of file colourix.h. 00414 { 00415 ENSURE(UsageCount > 0, "IndexedColour::DecrementUsage - UsageCount has gone NEGATIVE!"); 00416 00417 return((--UsageCount) != 0); 00418 }
|
|
Finds the last parent colour of this colour. Note that after changing a linked/tint colour back into a normal/spot colour, the parent is remembered. This call thus returns the parent even when the colour is no longer a linked/tint colour. Intended only for use by the colour editor to allow temporary type chnages to not lose the parent link info. The colour editor probably clears the parent colour on exit.
Definition at line 760 of file colourix.h. 00761 { 00762 return(ParentColour); 00763 }
|
|
Finds the colour upon which a tint/based-on colour is based, if any. Can also be used to determine if a colour is a tint/basedon colour.
Definition at line 1080 of file colourix.cpp. 01081 { 01082 if (IsDeleted()) 01083 return(NULL); 01084 01085 if (GetType() != COLOURTYPE_TINT && GetType() != COLOURTYPE_LINKED) 01086 return(NULL); 01087 01088 return(FindLastLinkedParent()); 01089 }
|
|
Finds the colour upon which a tint/based-on colour is based, if any. Can also be used to determine if a colour is a tint/basedon colour.
Definition at line 1113 of file colourix.cpp. 01114 { 01115 IndexedColour *Ptr = FindLinkedParent(); 01116 IndexedColour *Last = this; 01117 01118 while (Ptr != NULL) 01119 { 01120 Last = Ptr; 01121 Ptr = Ptr->FindLinkedParent(); 01122 } 01123 01124 return(Last); 01125 }
|
|
To set the global colour flag. When the flag is TRUE, all spot colours in the entire program are forced to act as "normal" colours; when set FALSE, all spot colours behave normally.
This calls ColourManager::SelViewContextHasChanged() to make all the appropriate colour interfaces update themselves correctly. (Yeah, it's not quite the right name for what the message does, but this is just as fundamental a change as context changing) Definition at line 1934 of file colourix.cpp. 01935 { 01936 SpotsAreProcess = ForceOn; 01937 ColourManager::SelViewContextHasChanged(); 01938 }
|
|
To determine the accumulated tint value of any colour.
If this is a spot colour, returns 1.0 (i.e. 100% ink) If this is a true tint of a spot ink, it returns the overall ink density that should be used. With a simple tint-of-spot tint, this is the normal tint value, but if there are a chain of tints, the tint values are cumulative, i.e. a 50% tint of a 50% tint of Red gives a _25_ ink density. Thus, if you apply the GetAccumulatedTintVlaue() to the GetOldestAncestor() colour, you will arrive at the right output colour. (This isn't actually how screen values for tints are produced, but the cumulative tint is used when mixing tints in blends, and most importantly when outputting separated Spot ink plates! Notes: The cumulative value is simply the tint values of each colour in turn in the parent-colour chain multiplied together (where process colours are treated as a tint value of 0.0 and the ultimate spot colour is 1.0) Definition at line 1566 of file colourix.cpp. 01567 { 01568 double Tint = 1.0; 01569 IndexedColour *Ptr = this; 01570 01571 while (Ptr != NULL && Tint > 0.0) 01572 { 01573 Tint *= Ptr->GetTintValue().MakeDouble(); 01574 01575 Ptr = Ptr->FindLinkedParent(); 01576 } 01577 01578 return(FIXED24(Tint)); 01579 }
|
|
To determine the colour model in which an IndexedColour is defined.
Definition at line 582 of file colourix.cpp. 00583 { 00584 // If we're a tint, return our parent's colour. NOTE that we do not call GetType() 00585 // as we want to ask our parent even if it is 'deleted' for UNDO reasons. 00586 if (Info.ColourType == COLOURTYPE_TINT && ParentColour != NULL) 00587 return(ParentColour->GetColourModel()); 00588 00589 return((ColourModel) Info.SourceColourModel); 00590 }
|
|
To get information on this colour for display in the Debug Tree.
Definition at line 1854 of file colourix.cpp. 01855 { 01856 String_256 TempStr; 01857 ColourContext *cc = ColourContext::GetGlobalDefault(GetColourModel()); 01858 ColourGeneric col; 01859 01860 String_8 UnnamedString(TEXT("N")); 01861 if (!IsNamed()) 01862 UnnamedString = TEXT("U"); 01863 01864 GetSourceColour(&col); 01865 01866 String_32 ModelName; 01867 cc->GetModelName(&ModelName); 01868 01869 String_32 Type(TEXT("")); 01870 switch(GetType()) 01871 { 01872 case COLOURTYPE_SPOT: 01873 Type._MakeMsg(TEXT(" Spot")); 01874 break; 01875 01876 case COLOURTYPE_TINT: 01877 if (TintIsShade()) 01878 TempStr._MakeMsg( TEXT(" Shade, resulting in")); 01879 else 01880 TempStr._MakeMsg( TEXT(" #1%ld% Tint, resulting in"), 01881 (INT32) (GetTintValue().MakeDouble()*100)); 01882 break; 01883 01884 case COLOURTYPE_LINKED: 01885 Type._MakeMsg(TEXT(" Linked, resulting in")); 01886 break; 01887 01888 default: 01889 break; 01890 } 01891 01892 01893 TempStr._MakeMsg( TEXT(" #1%sIxCol (#2%s) =#3%s #4%s(#5%ld, #6%ld, #7%ld, #8%ld)\r\n"), 01894 (TCHAR *) UnnamedString, 01895 (TCHAR *) *(GetName(TRUE)), 01896 (TCHAR *) Type, 01897 (TCHAR *) ModelName, 01898 (INT32) (col.Component1.MakeDouble()*100), 01899 (INT32) (col.Component2.MakeDouble()*100), 01900 (INT32) (col.Component3.MakeDouble()*100), 01901 (INT32) (col.Component4.MakeDouble()*100)); 01902 01903 (*Str) += TempStr; 01904 }
|
|
To find the name of an IndexedColour (or the ID of an unnamed indexed colour).
Definition at line 893 of file colourix.cpp. 00894 { 00895 static String_64 Default(_R(IDS_LOCALCOLOUR)); 00896 00897 if (IsNamed()) 00898 { 00899 if (Name != NULL) 00900 return(Name); 00901 } 00902 else 00903 { 00904 if (ReturnTrueID) 00905 { 00906 // If we're an unnamed colour, then we generate an "ID" (not a name, honest, guv!) 00907 // which is unique. This is used for export/import to recognise unnamed colours 00908 00909 if (Name == NULL) 00910 { 00911 Name = new String_64; 00912 if (Name != NULL) 00913 Name->_MakeMsg( TEXT("_#1%ld"), (UINT32)(UINT_PTR)(this) ); 00914 } 00915 00916 if (Name != NULL) 00917 return(Name); 00918 } 00919 } 00920 00921 return(&Default); 00922 }
|
|
Gets the current Shade Saturation value for the colour.
Definition at line 1661 of file colourix.cpp. 01662 { 01663 if (GetType() != COLOURTYPE_TINT || !Info.InheritComponent1) 01664 { 01665 ERROR3("Attempt to read tint value for a non-shade colour"); 01666 return(FIXED24(1.0)); 01667 } 01668 01669 return(SourceColour.Component1); 01670 }
|
|
Gets the current Shade Brightness value for the colour.
Definition at line 1695 of file colourix.cpp. 01696 { 01697 if (GetType() != COLOURTYPE_TINT || !Info.InheritComponent1) 01698 { 01699 ERROR3("Attempt to read tint value for a non-shade colour"); 01700 return(FIXED24(1.0)); 01701 } 01702 01703 return(SourceColour.Component2); 01704 }
|
|
Gets the definition of the IndexedColour.
Definition at line 615 of file colourix.cpp. 00616 { 00617 ERROR3IF(Result == &SourceColour, 00618 "Illegal attempt to GetSourceColour into a colour's own SourceColour field!"); 00619 00620 if (ParentColour == NULL || ParentColour == this || 00621 (Info.ColourType != COLOURTYPE_LINKED && Info.ColourType != COLOURTYPE_TINT)) 00622 { 00623 // We are not linked to a parent colour (or the link is scarily illegal to ourself!) 00624 // (ParentColour == NULL OR we are not tint/linked) 00625 // - simply copy our own colour definition, checking that this is not an internal 00626 // call to get a source colour definition into our own source colour! 00627 if (&SourceColour != Result) 00628 memcpy(Result, &SourceColour, sizeof(ColourGeneric)); 00629 } 00630 else 00631 { 00632 ERROR3IF(ParentColour == NULL || ParentColour == this || 00633 ParentColour->IsADescendantOf(this), 00634 "Consistency failure in IndexedColour parent linkage"); 00635 00636 // Ask our parent for its colour definition - recurse! 00637 ParentColour->GetSourceColour(Result); 00638 00639 // Get our 'parent' colour context 00640 ColourContext *cc = ColourContext::GetGlobalDefault(GetColourModel()); 00641 ERROR3IF(cc == NULL, "IndexedColour::GetSourceColour - illegal colour context in use?!"); 00642 00643 // Now, override the colour as necessary 00644 // NOTE that we do NOT call GetType(), as this might return COLOURTYPE_NORMAL for tints/linked 00645 // colours which have 'deleted' parents. This is due to nasty UNDO considerations - we retain 00646 // our linked parent internally when it is 'deleted'. 00647 if (Info.ColourType == COLOURTYPE_LINKED) 00648 { 00649 // If necessary, convert the Result colour into our own colour model 00650 if (ParentColour->GetColourModel() != GetColourModel()) 00651 { 00652 ColourContext *ccSource = ColourContext::GetGlobalDefault(ParentColour->GetColourModel()); 00653 00654 if (ccSource != NULL) // Shouldn't happen, but let's be safe 00655 { 00656 ColourGeneric Source; 00657 memcpy(&Source, Result, sizeof(ColourGeneric)); 00658 00659 cc->ConvertColour(ccSource, &Source, Result); 00660 } 00661 } 00662 00663 // **** ToDo !!!! Override by copying OR Inherit by scaling !!!! 00664 00665 // This is a linked colour. Override the given components with our own values 00666 if (!Info.InheritComponent1) 00667 Result->Component1 = SourceColour.Component1; 00668 if (!Info.InheritComponent2) 00669 Result->Component2 = SourceColour.Component2; 00670 if (!Info.InheritComponent3) 00671 Result->Component3 = SourceColour.Component3; 00672 if (!Info.InheritComponent4) 00673 Result->Component4 = SourceColour.Component4; 00674 } 00675 else if (Info.ColourType == COLOURTYPE_TINT) 00676 { 00677 // This is a tint. Component 1 of our 'SourceColour' is the tinting value 00678 // We get our 'parent' colour context to work out how to apply the tint/shade 00679 if (TintIsShade()) 00680 cc->ApplyShade(SourceColour.Component1, SourceColour.Component2, Result); // Shade it 00681 else 00682 cc->ApplyTint(SourceColour.Component1, Result); // Tint it 00683 } 00684 else 00685 { 00686 ERROR3("Unknown/Illegal colour type in IndexedColour::GetSourceColour"); 00687 } 00688 } 00689 }
|
|
Gets the current Tint value for the colour.
NOTE that the returned tint value simply indicates how much this colour tints its parent colour (if at all). If you want to know how much ink will actually be produced for this colour, then you want to use GetAccumulatedTintValue() instead. Notes: Internally, tint is currently stored in the SourceColour.Component1 field This should not be relied upon externally.
Definition at line 1520 of file colourix.cpp. 01521 { 01522 if (GetType() == COLOURTYPE_SPOT) 01523 return(FIXED24(1.0)); // Spot colour is a 100% tint 01524 01525 if (GetType() != COLOURTYPE_TINT || TintIsShade()) 01526 return(FIXED24(0.0)); // Any process colour is a 0% tint 01527 01528 return(SourceColour.Component1); // Any tint is a (Tint)% tint 01529 }
|
|
Determines the type of this colour.
Definition at line 497 of file colourix.cpp. 00498 { 00499 if ((Info.ColourType == (UINT32) COLOURTYPE_LINKED || 00500 Info.ColourType == (UINT32) COLOURTYPE_TINT) && 00501 ParentColour != NULL && ParentColour->IsDeleted()) 00502 { 00503 return(COLOURTYPE_NORMAL); 00504 } 00505 00506 // If the global "SpotsareProcess" flag is set, then spots pretend to be normal 00507 // Unnamed/Local colours also cannot be spots, so in case we accidentally get into the 00508 // wrong state, we make sure never to return a silly result. 00509 if (Info.ColourType == COLOURTYPE_SPOT && (SpotsAreProcess || !Info.IsNamed)) 00510 return(COLOURTYPE_NORMAL); 00511 00512 return((IndexedColourType) Info.ColourType); 00513 }
|
|
To determine if any other IndexedColour references this IndexedColour (An IndexedColour must not be deleted if it is in use).
Definition at line 535 of file colourix.h. 00536 { 00537 return(ChildUsage != 0); 00538 }
|
|
Informs the IndexedColour that yet another thing is referencing it. An IndexedColour must not be deleted if its usage count != 0 Scope: private.
Definition at line 476 of file colourix.h. 00477 { 00478 ENSURE(IsNamed(), "Attempt to increment child usage of an UNNAMED colour!"); 00479 ChildUsage++; 00480 }
|
|
Informs the IndexedColour that yet another thing is referencing it. An IndexedColour should not be deleted if its usage count != 0 A non-zero usage count on exit will generate ENSUREs which usually signal memory leaks or people forgetting to link/delink themselves properly.
Definition at line 387 of file colourix.h. 00388 { 00389 UsageCount++; 00390 }
|
|
To determine if a given component of a colour is inherited from its linked parent colour. Always returns FALSE if a colour is not linked.
Definition at line 1345 of file colourix.cpp. 01346 { 01347 ERROR3IF(ComponentID < 1 || ComponentID > 4, 01348 "Bad colour component index passed to IndexedColour::InheritsComponent"); 01349 01350 if (GetType() == COLOURTYPE_LINKED) 01351 { 01352 switch(ComponentID) 01353 { 01354 case 1: 01355 return(Info.InheritComponent1); 01356 01357 case 2: 01358 return(Info.InheritComponent2); 01359 01360 case 3: 01361 return(Info.InheritComponent3); 01362 01363 case 4: 01364 return(Info.InheritComponent4); 01365 } 01366 } 01367 01368 return(FALSE); 01369 }
|
|
Private shared code for construction of IndexedColour objects Initialises the 'Info' structure to default values Scope: private.
Definition at line 142 of file colourix.cpp. 00143 { 00144 UsageCount = 0; // We are not in-use yet 00145 ChildUsage = 0; 00146 00147 Name = NULL; // This colour has no name 00148 00149 ParentColour = NULL; // We are not linked to another colour by default 00150 00151 Info.OCContextHandle = 0; // Set colour model, and remember we're not cached 00152 Info.SourceColourModel = ColModel; 00153 Info.CacheColourModel = COLOURMODEL_NOTCACHED; 00154 00155 Info.InheritComponent1 = // By default, override all components in linked colour 00156 Info.InheritComponent2 = 00157 Info.InheritComponent3 = 00158 Info.InheritComponent4 = FALSE; 00159 00160 Info.ColourType = COLOURTYPE_NORMAL; // Is normal (not spot/tint/linked) colour 00161 00162 Info.Deleted = FALSE; // Not a deleted (hidden) colour 00163 00164 Info.IsNamed = FALSE; 00165 }
|
|
Invalidates the IndexedColours output colour cache. This ensures that the colour is re-converted and cached the next time it is used. Scope: Generally private; All public access functions invalidate the cache automatically if it is necessary (if the colour changes).
Definition at line 616 of file colourix.h. 00617 { 00618 Info.CacheColourModel = COLOURMODEL_NOTCACHED; 00619 Info.OCContextHandle = 0; 00620 }
|
|
Recursively backtracks through the chain of LinkedParent links to determine if this colour is in any way (directly or indirectly) linked to the given Parent colour, and might therefore be affected by any change to said colour.
If the TestParent is THIS colour, the return value is TRUE (i.e Yes, a change to the 'Parent' colour will affect 'this' colour!). {This is also an end-of- recursion clause} This method only calculates descendant information for LINKED/TINT colours. Non-linked/tint colours will always spell the end of the search. Is quite happy if TestParent is NULL - will always return FALSE in this case Definition at line 1040 of file colourix.cpp. 01041 { 01042 if (TestParent == NULL) // Silly test! Of course it's not! 01043 return(FALSE); 01044 01045 if (this == TestParent) // We are the colour being tested - we are related 01046 return(TRUE); 01047 // We cannot be descended, as we're a normal colour 01048 if (GetType() == COLOURTYPE_NORMAL || GetType() == COLOURTYPE_SPOT) 01049 return(FALSE); 01050 01051 if (ParentColour == NULL) // We have no parent, so cannot be descended from anything 01052 return(FALSE); 01053 // Ask our parent to check back in the family tree 01054 return(ParentColour->IsADescendantOf(TestParent)); 01055 }
|
|
To determine if this colour has been marked 'deleted'. This is used for undo, to hide colours which have been 'deleted'.
Definition at line 559 of file colourix.h.
|
|
Definition at line 804 of file colourix.cpp. 00805 { 00806 if (GetType() != Other.GetType()) 00807 return(TRUE); 00808 00809 if (GetColourModel() != Other.GetColourModel()) 00810 return(TRUE); 00811 00812 // If this is a linked colour, check if their inheritance flags match 00813 if (GetType() == COLOURTYPE_LINKED) 00814 { 00815 if (ParentColour != Other.ParentColour) 00816 return(TRUE); 00817 00818 if (Info.InheritComponent1 != Other.Info.InheritComponent1 || 00819 Info.InheritComponent2 != Other.Info.InheritComponent2 || 00820 Info.InheritComponent3 != Other.Info.InheritComponent3 || 00821 Info.InheritComponent4 != Other.Info.InheritComponent4) 00822 return(TRUE); 00823 } 00824 00825 // If this is a tint, it has no components in the regular sense. 00826 // Return immediately with the result of comparing the tint values 00827 if (GetType() == COLOURTYPE_TINT) 00828 { 00829 if (ParentColour != Other.ParentColour) 00830 return(TRUE); 00831 00832 if (TintIsShade() != Other.TintIsShade()) 00833 return(TRUE); 00834 00835 if (TintIsShade()) 00836 { 00837 return( OUTSIDE_LIMIT(GetShadeValueX(), Other.GetShadeValueX()) || 00838 OUTSIDE_LIMIT(GetShadeValueY(), Other.GetShadeValueY()) ); 00839 } 00840 00841 return( OUTSIDE_LIMIT(GetTintValue(), Other.GetTintValue()) ); 00842 } 00843 00844 // Special case for greyscales... 00845 if (GetColourModel() == COLOURMODEL_GREYT) 00846 { 00847 // We ignore the 2nd and 3rd components as they are not used. 00848 if (OUTSIDE_LIMIT(SourceColour.Component1, Other.SourceColour.Component1) || 00849 OUTSIDE_LIMIT(SourceColour.Component4, Other.SourceColour.Component4)) 00850 return(TRUE); 00851 } 00852 else 00853 { 00854 if (OUTSIDE_LIMIT(SourceColour.Component1, Other.SourceColour.Component1) || 00855 OUTSIDE_LIMIT(SourceColour.Component2, Other.SourceColour.Component2) || 00856 OUTSIDE_LIMIT(SourceColour.Component3, Other.SourceColour.Component3) || 00857 OUTSIDE_LIMIT(SourceColour.Component4, Other.SourceColour.Component4)) 00858 return(TRUE); 00859 } 00860 00861 return(FALSE); 00862 }
|
|
To determine if two indexed colours share a common definition.
NOTE especially that this does NOT compare the names of the colours Definition at line 714 of file colourix.cpp. 00715 { 00716 if (GetType() != Other.GetType()) 00717 return(TRUE); 00718 00719 if (GetColourModel() != Other.GetColourModel()) 00720 return(TRUE); 00721 00722 // If this is a linked colour, check if their inheritance flags match 00723 if (GetType() == COLOURTYPE_LINKED) 00724 { 00725 if (ParentColour != Other.ParentColour) 00726 return(TRUE); 00727 00728 if (Info.InheritComponent1 != Other.Info.InheritComponent1 || 00729 Info.InheritComponent2 != Other.Info.InheritComponent2 || 00730 Info.InheritComponent3 != Other.Info.InheritComponent3 || 00731 Info.InheritComponent4 != Other.Info.InheritComponent4) 00732 return(TRUE); 00733 } 00734 00735 // If this is a tint, it has no components in the regular sense. 00736 // Return immediately with the result of comparing the tint values 00737 if (GetType() == COLOURTYPE_TINT) 00738 { 00739 if (ParentColour != Other.ParentColour) 00740 return(TRUE); 00741 00742 if (TintIsShade() != Other.TintIsShade()) 00743 return(TRUE); 00744 00745 if (TintIsShade()) 00746 { 00747 return(GetShadeValueX() != Other.GetShadeValueX() || 00748 GetShadeValueY() != Other.GetShadeValueY()); 00749 } 00750 00751 return(GetTintValue() != Other.GetTintValue()); 00752 } 00753 00754 if (GetColourModel() == COLOURMODEL_GREYT) 00755 { 00756 // We ignore the 2nd and 3rd components as they are not used. 00757 // (Should not be necessary, as these components should be zeroed anyway) 00758 if (SourceColour.Component1 != Other.SourceColour.Component1 || 00759 SourceColour.Component4 != Other.SourceColour.Component4) 00760 return(TRUE); 00761 } 00762 else 00763 { 00764 if (SourceColour.Component1 != Other.SourceColour.Component1 || 00765 SourceColour.Component2 != Other.SourceColour.Component2 || 00766 SourceColour.Component3 != Other.SourceColour.Component3 || 00767 SourceColour.Component4 != Other.SourceColour.Component4) 00768 return(TRUE); 00769 } 00770 00771 return(FALSE); 00772 }
|
|
To determine if anything references this IndexedColour (An IndexedColour must not be deleted if it is in use).
Definition at line 446 of file colourix.h. 00447 { 00448 // If this item is referenced in the colour gallery, the gallery needs to know if 00449 // nobody *else* is using the colour (i.e. if it has more than 1 user) 00450 if (IgnoreColourGallery) 00451 return(UsageCount > 1); 00452 00453 // Under normal circumstances, the colour is in use if anybody is using it 00454 return(UsageCount != 0); 00455 }
|
|
Determines if this colour has been given a name. This cannot be determined using the GetName function, which returns a default name if the colour is unnamed.
Definition at line 729 of file colourix.h. 00730 { 00731 return((Info.IsNamed) ? TRUE : FALSE); // **** !!!! TEMPORARY BODGE! 00732 //return(Name != NULL); 00733 }
|
|
Determines if this colour is either a spot colour or a true tint of a spot colour. (Tints can unfortunately be made from non-spot colour parents, so you need to call this function to determine if a tint really is cleanly derived from a spot colour, or if it must be treated as a simple process colour).
Notes: If a colour in the tint chain is deleted, then all children must become process (non true-tint) colours, so this will return FALSE Definition at line 540 of file colourix.cpp. 00541 { 00542 if (Info.Deleted) 00543 return(FALSE); 00544 00545 IndexedColourType Type = GetType(); 00546 if (Type == COLOURTYPE_SPOT) 00547 return(TRUE); // Is it a true spot colour? 00548 00549 if (Type != COLOURTYPE_TINT || TintIsShade()) 00550 return(FALSE); // It's not even a tint 00551 00552 if (ParentColour == NULL) 00553 return(FALSE); // We have no parent colour 00554 00555 // OK, we're a tint of something. Recurse to find out if that something 00556 // is a true tint or a spot colour. 00557 return(ParentColour->IsSpotOrTintOfSpot()); 00558 }
|
|
Informs an IndexedColour that an ancestor in the linking chain has changed, and that therefore, it may also have changed.
Notes: Currently this simply invalidates the cache to make the next access update the colour from its Parent(s). A separate function has been used just in case we change our minds about how this should be done in the future.
Definition at line 648 of file colourix.h. 00649 { 00650 InvalidateCache(); 00651 }
|
|
IndexedColour assignment operator Copies the definition of one IndexedColour into another Notes: The name field is copied verbatim - if you want it to say 'Copy of ...' then you'll have to prepend this text yourself.
Definition at line 448 of file colourix.cpp. 00449 { 00450 ERROR2IF(&Other == this, *this, "Attempt to copy an IndexedColour over itself!"); 00451 00452 Info = Other.Info; 00453 memcpy(&SourceColour, &Other.SourceColour, sizeof(ColourGeneric)); 00454 memcpy(&CachedColour, &Other.CachedColour, sizeof(ColourGeneric)); 00455 00456 if (ParentColour != NULL) // Delink from old parent (if any) 00457 ParentColour->DecrementChildUsage(); 00458 00459 ParentColour = Other.ParentColour; 00460 if (ParentColour != NULL) // Link to new parent (if any) 00461 ParentColour->IncrementChildUsage(); 00462 00463 // UsageCount = 0; // These DO NOT CHANGE! We still have people referencing us 00464 // ChildUsage = 0; // and we must not forget about them! 00465 00466 Info.IsNamed = FALSE; 00467 if (((IndexedColour *)&Other)->IsNamed()) 00468 SetName(*(Other.Name)); // Copy the string, not the string-pointer 00469 00470 return(*this); 00471 }
|
|
This marks/unmarks a colour as 'deleted'. This flag is used for undo, to hide colours which have been 'deleted'. Remember that this constitutes a change to the colour, so you should call ColourManager::ColourListHasChanged, to ensure that the Colour dialogues update all displayed lists to show/not-show this colour. Scope: Only intended for internal ColourManager use Notes: Used by the undoable ColourManager OpColourChange. You should use colour manager calls to delete colours rather than touching them directly. Note that you can 'delete'/'undelete' colours even when they are deemed 'In Use'.
Definition at line 591 of file colourix.h.
|
|
To set if a given component of a colour is inherited from its linked parent colour.
Definition at line 1402 of file colourix.cpp. 01403 { 01404 BOOL Result = FALSE; 01405 01406 ERROR3IF(ComponentID < 1 || ComponentID > 4, 01407 "Bad colour component index passed to IndexedColour::InheritsComponent"); 01408 01409 ERROR3IF(GetType() != COLOURTYPE_LINKED, 01410 "Attempt to set Component Inheritance for non-Linked colour"); 01411 01412 UINT32 ItInherits = (Inherits) ? 1 : 0; 01413 01414 if (GetType() == COLOURTYPE_LINKED) 01415 { 01416 switch(ComponentID) 01417 { 01418 case 1: 01419 Result = (Info.InheritComponent1 != ItInherits); 01420 Info.InheritComponent1 = ItInherits; 01421 break; 01422 01423 case 2: 01424 Result = (Info.InheritComponent2 != ItInherits); 01425 Info.InheritComponent2 = ItInherits; 01426 break; 01427 01428 case 3: 01429 Result = (Info.InheritComponent3 != ItInherits); 01430 Info.InheritComponent3 = ItInherits; 01431 break; 01432 01433 case 4: 01434 Result = (Info.InheritComponent4 != ItInherits); 01435 Info.InheritComponent4 = ItInherits; 01436 break; 01437 } 01438 } 01439 01440 if (Result) // If the colour has changed, invalidate the output cache 01441 InvalidateCache(); 01442 01443 return(Result); 01444 }
|
|
To make a colour linked to or a tint of another colour. This links the colour to the parent.
Notes: Generally, the colour's colour model and definition will be unaffected. However, if the colour was previously linked/tint, and it is being made into a standalone colour, the existing linked colour definition will be read, and then placed into SourceColour as a standalone version of the previous linked definition. (i.e. the colour's appearance will not change but the link will be broken) If the colour was not already a COLOURTYPE_LINKED when it is being made LINKED, all components will be set to override the parent. If the colour was not already a COLOURTYPE_TINT when it is being made a TINT, it will be set to be a 100% tint (no tinting at all) When making a COLOURTYPE_TINT colour, it will be a TINT, not a SHADE. To make a shade, make it COLOURTYPE_TINT then call SetTintOrShade(TRUE); If it was already a COLOURTYPE_TINT, the tint/shade state is unaffected. The colour's output cache is flushed by this call It is your responsibility to confirm overwriting the colour. It is also your responsibility to inform the system that this colour has changed, by calling ColourManager::ColourHasChanged IMPORTANT NOTE: This method allows you to do things like making a colour 'normal' (supposedly not linked), but still set a parent colour. This is a potentially dangerous practice so be very careful. (It is allowed so that the colour editor can cunningly remember what a colour was last linked to, in order to be far more helpful to the user). Scope: private? Generally speaking, you should not be calling this method, unless you are the colour editor, or a load/import filter.
Definition at line 1188 of file colourix.cpp. 01189 { 01190 if (this == Parent) 01191 { 01192 ERROR3("Illegal attempt to make an IndexedColour Linked to itself"); 01193 return; 01194 } 01195 01196 if (Parent != NULL && Parent->IsADescendantOf(this)) 01197 { 01198 // Our new parent-to-be is already a linked child of us! 01199 ERROR3("Illegal attempt to generate circular reference in Colour linking"); 01200 return; 01201 } 01202 01203 if (Parent != NULL && !Parent->IsNamed()) 01204 { 01205 ERROR3("Illegal attempt to use UNNAMED IndexedColour as a linked parent"); 01206 return; 01207 } 01208 01209 if (Parent!= NULL && Parent->IsDeleted()) 01210 { 01211 ERROR3("Illegal attempt to use 'DELETED' IndexedColour as a linked parent"); 01212 return; 01213 } 01214 01215 01216 switch(NewType) 01217 { 01218 case COLOURTYPE_LINKED: 01219 if (GetType() != COLOURTYPE_LINKED) 01220 { 01221 Info.InheritComponent1 = // Override all components for now 01222 Info.InheritComponent2 = 01223 Info.InheritComponent3 = 01224 Info.InheritComponent4 = FALSE; 01225 } 01226 break; 01227 01228 01229 case COLOURTYPE_TINT: 01230 if (GetType() != COLOURTYPE_TINT) 01231 { 01232 SetType(NewType); // Set type now to stop the next call ENSURE'ing 01233 SetTintOrShade(FALSE); // Make it a real tint (not a shade "tint") 01234 SetTintValue(FIXED24(1.0)); // 100% tint (the colour) for now 01235 } 01236 01237 // Swapping from Tint to Shade (which are both COLOURTYPE_TINT will need to do this, 01238 // so we do it even if it is supposely chnaging to the same "type" 01239 if (Parent != NULL) 01240 Info.SourceColourModel = (UINT32) Parent->GetColourModel(); 01241 break; 01242 01243 01244 default: // COLOURTYPE_NORMAL, COLOURTYPE_SPOT 01245 if (FindLastLinkedParent() != NULL) 01246 { 01247 // If this was previously a tint/linked colour, then copy the resulting 01248 // colour definition into this colour to make it standalone again. 01249 01250 ColourGeneric NewSourceColour; 01251 GetSourceColour(&NewSourceColour); 01252 memcpy(&SourceColour, &NewSourceColour, sizeof(ColourGeneric)); 01253 } 01254 break; 01255 } 01256 01257 if (ParentColour != NULL) 01258 ParentColour->DecrementChildUsage(); 01259 01260 ParentColour = Parent; // Set the new linked/tint parent colour 01261 01262 if (ParentColour != NULL) 01263 ParentColour->IncrementChildUsage(); 01264 01265 InvalidateCache(); // Invalidate the output colour cache 01266 SetType(NewType); // And set the new type of the colour 01267 }
|
|
To set the name of an IndexedColour. The name will be truncated to a maximum length of 63 characters.
Notes: Any underscore characters in the name will be converted to spaces, on the grounds that the export system uses underscores as a special name identifier to recognise unnamed colours. Suffice to say we just don't allow underscores If NewName is NULL, or if we fail to allocate space for the name to be stored, the colour will revert to having no name. Setting the name of an IndexedColour makes it a Named IndexedColour (Trust me, that is less silly than it sounds! ;-)
Definition at line 960 of file colourix.cpp. 00961 { 00962 if (ForceNamed) 00963 Info.IsNamed = TRUE; 00964 00965 if (Name == NULL) 00966 Name = new String_64; // If this fails, Name will just be NULL, which is safe 00967 00968 if (Name != NULL) 00969 { 00970 if (ForceNamed) 00971 { 00972 const TCHAR *Src = (const TCHAR *)NewName; 00973 TCHAR *Dest = (TCHAR *)(*Name); 00974 00975 // Copy up to 63 chars across 00976 camStrncpy(Dest, Src, 63); 00977 00978 // convert underscores into spaces 00979 Name->SwapChar(TCHAR('_'), TCHAR(' ')); 00980 } 00981 else 00982 { 00983 NewName.Left(Name, 63); // Truncate to 63 chars max, and copy 00984 } 00985 } 00986 }
|
|
Sets new shade values for a Shade colour. Will generate ENSURE failures in the debug build if the colour is not a Tint/Shade.
Notes: Internally, tint/shade is currently stored in the SourceColour.Component1 field. And now the Component2 field as well. Bodgy city dude. This should not be relied upon externally.
Definition at line 1606 of file colourix.cpp. 01607 { 01608 if (GetType() != COLOURTYPE_TINT) 01609 { 01610 ERROR3("Your puny attempt to set the shade values for a non-shade colour has been ignored"); 01611 return; 01612 } 01613 01614 Info.InheritComponent1 = TRUE; // Force it to be a shade 01615 01616 01617 if (NewShadeValueX <= FIXED24(-1.0)) 01618 NewShadeValueX = FIXED24(-1.0); 01619 01620 if (NewShadeValueX >= FIXED24(1.0)) 01621 NewShadeValueX = FIXED24(1.0); 01622 01623 SourceColour.Component1 = NewShadeValueX; 01624 01625 01626 if (NewShadeValueY <= FIXED24(-1.0)) 01627 NewShadeValueY = FIXED24(-1.0); 01628 01629 if (NewShadeValueY >= FIXED24(1.0)) 01630 NewShadeValueY = FIXED24(1.0); 01631 01632 SourceColour.Component2 = NewShadeValueY; 01633 01634 01635 InvalidateCache(); // The colour has changed, so invalidate the output cache 01636 }
|
|
Sets our colour model number, and invalidates the colour cache Scope: Private, for use by friend classes only.
Definition at line 671 of file colourix.h. 00672 { 00673 // Set the new colour model 00674 Info.SourceColourModel = NewModel; 00675 00676 // And invalidate the cache... 00677 Info.CacheColourModel = COLOURMODEL_NOTCACHED; 00678 Info.OCContextHandle = 0; 00679 }
|
|
Sets a COLOURTYPE_TINT colour to be either a Tint (fade-to-white) or a shade (fade-to-black) colour. The tint/shade fraction is unchnaged (the colour will just toggle between being darker and lighter!).
Definition at line 1726 of file colourix.cpp. 01727 { 01728 if (GetType() != COLOURTYPE_TINT) 01729 { 01730 ERROR3("Attempt to set tint/shade value for a non-tint colour"); 01731 return; 01732 } 01733 01734 Info.InheritComponent1 = IsATint ? 1 : 0; 01735 }
|
|
Sets a new tint value for a Tint colour. Will generate ENSURE failures in the debug build if the colour is not a tint.
Notes: Internally, tint is currently stored in the SourceColour.Component1 field. This should not be relied upon externally.
Definition at line 1470 of file colourix.cpp. 01471 { 01472 if (GetType() != COLOURTYPE_TINT) 01473 { 01474 ERROR3("Your puny attempt to set the tint value for a non-tint colour has been ignored"); 01475 return; 01476 } 01477 01478 Info.InheritComponent1 = FALSE; // Force it to be a tint (not a shade) 01479 01480 if (NewTintValue <= FIXED24(0.0)) 01481 NewTintValue = 0; 01482 01483 if (NewTintValue >= FIXED24(1.0)) 01484 NewTintValue = FIXED24(1.0); 01485 01486 SourceColour.Component1 = NewTintValue; 01487 01488 InvalidateCache(); // The colour has changed, so invalidate the output cache 01489 }
|
|
Sets the type of this colour: MonoOn COLOURTYPE_NORMAL, COLOURTYPE_SPOT, COLOURTYPE_TINT, COLOURTYPE_LINKED MonoOff.
On second thoughts, you shouldn't be calling this method! Scope: private
Definition at line 1299 of file colourix.cpp. 01300 { 01301 BOOL Result = (NewType != (IndexedColourType) Info.ColourType); 01302 01303 if ((INT32)NewType < 0 || (INT32)NewType > 3) 01304 { 01305 ERROR3("Attempt to set invalid colour type"); 01306 return(FALSE); 01307 } 01308 01309 Info.ColourType = (UINT32) NewType; 01310 01311 if (Result) // If the colour has changed, invalidate the output cache 01312 InvalidateCache(); 01313 01314 return(Result); 01315 }
|
|
To UNset the name of an IndexedColour, forcing it back to being Unnamed.
Definition at line 1001 of file colourix.cpp. 01002 { 01003 Info.IsNamed = FALSE; 01004 01005 if (Name != NULL) 01006 delete Name; 01007 01008 Name = NULL; 01009 }
|
|
Returns a pointer to our source colour. Used to encapsulate our data for external friend users, rather than them poking directly at our data structures. Inlined, so just as efficient anyway. Scope: Private, for use by friend class ColourContext.
Definition at line 704 of file colourix.h. 00705 { 00706 return(&SourceColour); 00707 }
|
|
Definition at line 1806 of file colourix.cpp. 01807 { 01808 // Components to copy are: 01809 // Info 01810 // SourceColour 01811 // ParentColour pointer 01812 // Name POINTER 01813 // CachedColour -- We are discarding the cache anyway so ignore 01814 // UsageCount -- We wish to keep the usage counts intact, as it is 01815 // ChildUsage the number of refs to THIS object. 01816 // Thus, only the first 4 in this list are copied. 01817 01818 JASONSWAP(Info, Other->Info, IndexedColourInfo); 01819 JASONSWAP(SourceColour, Other->SourceColour, ColourGeneric); 01820 01821 // Swap the Name POINTER 01822 String_64 *NameTemp = Name; 01823 Name = Other->Name; 01824 Other->Name = NameTemp; 01825 01826 // Swap the linked/tint Parent Colour pointer 01827 IndexedColour *ParentTemp = ParentColour; 01828 ParentColour = Other->ParentColour; 01829 Other->ParentColour = ParentTemp; 01830 01831 // And invalidate the caches just to be on the safe side 01832 Info.CacheColourModel = Other->Info.CacheColourModel = COLOURMODEL_NOTCACHED; 01833 Info.OCContextHandle = Other->Info.OCContextHandle = 0; 01834 }
|
|
Determines if a COLOURTYPE_TINT colour is really a tint or a shade.
Internally, tint/shade is currently stored in the SourceColour.Component1 field This should not be relied upon externally. Definition at line 1762 of file colourix.cpp. 01763 { 01764 if (Info.ColourType != COLOURTYPE_TINT) 01765 { 01766 ERROR3("TintIsShade() called for non-tint/shade colour"); 01767 return(FALSE); 01768 } 01769 01770 return(Info.InheritComponent1); 01771 }
|
|
Definition at line 209 of file colourix.h. |
|
Definition at line 211 of file colourix.h. |
|
Definition at line 210 of file colourix.h. |
|
Definition at line 297 of file colourix.h. |
|
Definition at line 300 of file colourix.h. |
|
Definition at line 295 of file colourix.h. |
|
Definition at line 304 of file colourix.h. |
|
Definition at line 299 of file colourix.h. |
|
Definition at line 296 of file colourix.h. |
|
Definition at line 325 of file colourix.h. |
|
Definition at line 302 of file colourix.h. |