#include <fillramp.h>
Inheritance diagram for ColourRamp:
Public Member Functions | |
virtual | ~ColourRamp () |
This class holds a list of colour records, each of which describe a colour position in a colour ramp. The list contains the usual add/delete entry members and other suitable interfaces to allow colour ramps to be edited. The list is used inside GradFillAttribute to describe multicoloured fills. | |
ColRampItem * | AddEntry (float pos, DocColour *pCol) |
Add a new colour ramp entry. Its selected state is FALSE. | |
ColRampItem * | GetFirstCol () const |
ColRampItem * | GetLastCol () const |
ColRampItem * | GetNextCol (ColRampItem *pItem) const |
ColRampItem * | GetPrevCol (ColRampItem *pItem) const |
ColourRamp & | operator= (const ColourRamp &other) |
Assign this colour ramp the same values as those refered to in other. | |
DocColour * | GetFirstSelectedColour () |
Set all selected items in the colour ramp to the colour specified. | |
DocColour * | EnumerateColourFields (UINT32 index) |
Enumerates all colour fields in the colour ramp. This linear searching is not so quick. We might need to keep a static context pointer here. | |
BOOL | IsDifferentTo (ColourRamp *pRamp) |
Another matching function. See if this colour ramp is different to that pointed to by pRamp See Also: ColourRamp::operator==. | |
INT32 | operator== (const ColourRamp &other) const |
Dumps the data held in the fill ramp to the debug outputTry to match this colour ramp with another colour ramp. We simply check the numbers in the list, and if the same call the colour ramp entry eqivalence operator agains each list entry. | |
void | DeleteAll () |
Deletes all members of the colour ramp list. This is an internal private function which is used by other operations in this class. | |
BOOL | SetItemColour (UINT32 index, DocColour *pCol) |
Set the colour of an existing colour ramp entry to a new value. | |
INT32 | SetSelectedColours (DocColour *pCol) |
Set all selected items in the colour ramp to the colour specified. | |
BOOL | CopyComponentData (BaseDocument *SrcDoc, BaseDocument *NodesDoc) |
If the attribute contains any DocColours which are indexed then a copy of the indexed colour is made and added to the NodesDoc ColourListComponent. | |
BOOL | WriteColourDefinitions (BaseCamelotFilter *pFilter) |
Writes out colour definitions for this fill. | |
void | Dump () |
Definition at line 334 of file fillramp.h.
|
This class holds a list of colour records, each of which describe a colour position in a colour ramp. The list contains the usual add/delete entry members and other suitable interfaces to allow colour ramps to be edited. The list is used inside GradFillAttribute to describe multicoloured fills.
Definition at line 1698 of file fillramp.cpp. 01699 { 01700 DeleteAll(); 01701 }
|
|
Add a new colour ramp entry. Its selected state is FALSE.
Definition at line 1738 of file fillramp.cpp. 01739 { 01740 ERROR2IF(((pos<0.0)||(pos>1.0)), NULL, "position out of range!"); 01741 ERROR2IF(pCol==NULL, NULL, "no colour passed to ColourRamp::AddEntry()"); 01742 01743 // create ourselves a new colour ramp item 01744 ColRampItem *pNewItem = new ColRampItem(pos,pCol); 01745 if (pNewItem) 01746 // insert it in the list 01747 InsertNewItem(pNewItem); 01748 01749 // return the item pointer 01750 return pNewItem; 01751 }
|
|
If the attribute contains any DocColours which are indexed then a copy of the indexed colour is made and added to the NodesDoc ColourListComponent.
Definition at line 1967 of file fillramp.cpp. 01968 { 01969 // Get the colour list component 01970 ColourListComponent *pComponent = 01971 (ColourListComponent *) NodesDoc->GetDocComponent(CC_RUNTIME_CLASS(ColourListComponent)); 01972 01973 ENSURE (pComponent != NULL, "Could not find ColourListComponent"); 01974 01975 ColRampItem *pItem = GetFirstCol(); 01976 01977 // Copy across all DocColours 01978 01979 while (pItem!=NULL) 01980 { 01981 DocColour* pDocCol = pItem->GetColourAddr (); 01982 01983 if (pDocCol) if (pComponent->CopyColourAcross(pDocCol) == CCCOPY_FAILED) { return (FALSE); } 01984 01985 pItem = GetNextCol(pItem); 01986 } 01987 01988 return (TRUE); 01989 }
|
|
Deletes all members of the colour ramp list. This is an internal private function which is used by other operations in this class.
Reimplemented from List. Definition at line 1716 of file fillramp.cpp. 01717 { 01718 ColRampItem* pItem; 01719 while ((pItem=((ColRampItem*)RemoveTail()))!=NULL) 01720 delete pItem; 01721 }
|
|
Definition at line 366 of file fillramp.h.
|
|
Enumerates all colour fields in the colour ramp. This linear searching is not so quick. We might need to keep a static context pointer here.
Definition at line 2069 of file fillramp.cpp. 02070 { 02071 RampItem *pItem = GetIndexedItem(real_index); 02072 if (pItem) 02073 return ((ColRampItem*)pItem)->GetColourAddr(); 02074 return NULL; 02075 }
|
|
Definition at line 373 of file fillramp.h. 00374 { 00375 return (ColRampItem*)GetHead(); 00376 }
|
|
Set all selected items in the colour ramp to the colour specified.
Definition at line 2044 of file fillramp.cpp. 02045 { 02046 ColRampItem *pItem = GetFirstCol(); 02047 while (pItem!=NULL) 02048 { 02049 if (pItem->IsSelected()) 02050 return pItem->GetColourAddr(); 02051 pItem = GetNextCol(pItem); 02052 } 02053 return NULL; 02054 }
|
|
Definition at line 379 of file fillramp.h. 00380 { 00381 return (ColRampItem*)GetTail(); 00382 }
|
|
Definition at line 385 of file fillramp.h. 00386 { 00387 return (ColRampItem*)GetNext(pItem); 00388 }
|
|
Definition at line 391 of file fillramp.h. 00392 { 00393 return (ColRampItem*)GetPrev(pItem); 00394 }
|
|
Another matching function. See if this colour ramp is different to that pointed to by pRamp See Also: ColourRamp::operator==.
Definition at line 1840 of file fillramp.cpp. 01841 { 01842 ERROR3IF(this==NULL, "NULL 'this' object in ColourRamp::IsDifferentTo()"); 01843 if (pRamp==NULL) 01844 return TRUE; 01845 return (!((*this)==(*pRamp))); 01846 }
|
|
Assign this colour ramp the same values as those refered to in other.
Definition at line 1862 of file fillramp.cpp. 01863 { 01864 // the main problem we need to deal with here is 'what happens 01865 // when we fail to copy the entire list? Well, it makes no sense 01866 // to keep the old list as we've not then assigned anything 01867 // i.e. C=A=B not assigning A and C anything is a bit weird. 01868 // so we go ahead and toast whatever was in list A and copy B to 01869 // it (as much as we can at least). If afterwards A!=B then we 01870 // know we're out of memory 01871 01872 // toast all colours in our list 01873 DeleteAll(); 01874 BOOL ok = TRUE; 01875 01876 ColRampItem *pThisItem, *pOtherItem = other.GetFirstCol(); 01877 while (pOtherItem && ok) 01878 { 01879 pThisItem = new ColRampItem(*pOtherItem); 01880 ok = (pThisItem != NULL); 01881 if (ok) 01882 { 01883 // Add the new colour to our list 01884 AddTail(pThisItem); 01885 pOtherItem = other.GetNextCol(pOtherItem); 01886 } 01887 } 01888 01889 // run a debug check. 01890 ERROR3IF(!ok, "ColourRamp::operator= failed to copy the complete ColourRamp"); 01891 01892 return (*this); 01893 }
|
|
Dumps the data held in the fill ramp to the debug outputTry to match this colour ramp with another colour ramp. We simply check the numbers in the list, and if the same call the colour ramp entry eqivalence operator agains each list entry.
Definition at line 1805 of file fillramp.cpp. 01806 { 01807 if (GetCount() != other.GetCount()) 01808 return FALSE; 01809 01810 ColRampItem *pThisItem = GetFirstCol(); 01811 ColRampItem *pThatItem = other.GetFirstCol(); 01812 01813 BOOL ok=TRUE; 01814 while (pThisItem && ok) 01815 { 01816 ok = ((*pThisItem)==(*pThatItem)); 01817 pThisItem = GetNextCol(pThisItem); 01818 pThatItem = other.GetNextCol(pThatItem); 01819 } 01820 01821 return ok; 01822 }
|
|
Set the colour of an existing colour ramp entry to a new value.
Definition at line 1909 of file fillramp.cpp. 01910 { 01911 RampItem *pItem = GetValidIndexedItem(index); 01912 if (pItem!=NULL) 01913 ((ColRampItem*)pItem)->SetColour(pCol); 01914 return (pItem!=NULL); 01915 }
|
|
Set all selected items in the colour ramp to the colour specified.
Definition at line 1929 of file fillramp.cpp. 01930 { 01931 INT32 c=0; 01932 ColRampItem *pItem = GetFirstCol(); 01933 while (pItem!=NULL) 01934 { 01935 if (pItem->IsSelected()) 01936 { 01937 pItem->SetColour(pCol); 01938 c++; 01939 } 01940 pItem = GetNextCol(pItem); 01941 } 01942 return c; 01943 }
|
|
Writes out colour definitions for this fill. > virtual BOOL ColourRamp::WriteColourDefinitions (BaseCamelotFilter* pFilter)
Definition at line 2006 of file fillramp.cpp. 02007 { 02008 BOOL ok = TRUE; 02009 02010 ColRampItem *pItem = GetFirstCol(); 02011 02012 while (pItem!=NULL) 02013 { 02014 DocColour* pDocCol = pItem->GetColourAddr (); 02015 INT32 ColRef = pFilter->WriteRecord(pDocCol); 02016 02017 ok = (ColRef != 0); 02018 02019 if (ok) 02020 { 02021 pItem = GetNextCol(pItem); 02022 } 02023 else 02024 { 02025 pItem = NULL; 02026 } 02027 } 02028 02029 return (ok); 02030 }
|