TransparencyRamp Class Reference

This class holds a list of transparency records, each of which describe a specific entry in the transparency ramp. More...

#include <fillramp.h>

Inheritance diagram for TransparencyRamp:

FillRamp List CCObject SimpleCCObject List of all members.

Public Member Functions

virtual ~TransparencyRamp ()
 Deletes all members of the list. This is an internal private function which is used by other operations in this class.
TranspRampItemAddEntry (float pos, UINT32 transp)
 Add a new transparency ramp entry. Its selected state is FALSE.
TranspRampItemGetFirstTransp () const
TranspRampItemGetNextTransp (TranspRampItem *pItem) const
TransparencyRampoperator= (const TransparencyRamp &other)
 Assign this transparency ramp the same values as those refered to in other.
BOOL IsDifferentTo (TransparencyRamp *pRamp)
 Another matching function. See if this transparency ramp is different to that pointed to by pRamp See Also: TransparencyRamp::operator==.
UINT32GetFirstSelectedTransp ()
 Get a pointer to the first selected item's transparency field. NULL will be returned if there are no selected items.
INT32 operator== (const TransparencyRamp &other) const
 Try to match this ramp with another ramp. We simply check the numbers in the list, and if the same call the transparency ramp entry eqivalence operator against each list entry.
void DeleteAll ()
 Deletes all members of the list. This is an internal private function which is used by other operations in this class.
BOOL SetItemTransp (UINT32 index, UINT32 transp)
 Set the transparency of an existing ramp entry to a new value.
INT32 SetSelectedTransp (UINT32 transp)
 Sets all selected items in this ramp to the given transparency.

Detailed Description

This class holds a list of transparency records, each of which describe a specific entry in the transparency ramp.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/02/97

Definition at line 411 of file fillramp.h.


Constructor & Destructor Documentation

TransparencyRamp::~TransparencyRamp  )  [virtual]
 

Deletes all members of the list. This is an internal private function which is used by other operations in this class.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/2/97
Parameters:
- [INPUTS]

Definition at line 2090 of file fillramp.cpp.

02091 {
02092     DeleteAll();
02093 }


Member Function Documentation

TranspRampItem * TransparencyRamp::AddEntry float  pos,
UINT32  transp
 

Add a new transparency ramp entry. Its selected state is FALSE.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/2/97
Parameters:
pos = the position this doc colour occupies in the colour ramp 0..1 [INPUTS] transp = the transparency to add
- [OUTPUTS]
Returns:
TranspRampItem* , a pointer to the list entry created or NULL if out of memory

Definition at line 2130 of file fillramp.cpp.

02131 {
02132     ERROR2IF(((pos<0.0)||(pos>1.0)), FALSE, "position out of range!");
02133 
02134     // create ourselves a new colour ramp item
02135     TranspRampItem *pNewItem = new TranspRampItem(pos,transp);
02136 
02137     if (pNewItem)
02138         // insert it into the list
02139         InsertNewItem(pNewItem);
02140 
02141     // return the item pointer
02142     return pNewItem;
02143 }

void TransparencyRamp::DeleteAll  )  [virtual]
 

Deletes all members of the list. This is an internal private function which is used by other operations in this class.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/2/97
Parameters:
- [INPUTS]

Reimplemented from List.

Definition at line 2108 of file fillramp.cpp.

02109 {
02110     TranspRampItem* pItem;
02111     while ((pItem=((TranspRampItem*)RemoveTail()))!=NULL)
02112         delete pItem;
02113 }

UINT32 * TransparencyRamp::GetFirstSelectedTransp  ) 
 

Get a pointer to the first selected item's transparency field. NULL will be returned if there are no selected items.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/3/97
Parameters:
- [INPUTS]
Returns:
A pointer to the first selected transparency

Definition at line 2307 of file fillramp.cpp.

02308 {
02309     TranspRampItem *pItem = GetFirstTransp();
02310     while (pItem!=NULL)
02311     {
02312         if (pItem->IsSelected())
02313             return pItem->GetTranspAddr();
02314         pItem = GetNextTransp(pItem);
02315     }
02316     return NULL;
02317 }

TranspRampItem * TransparencyRamp::GetFirstTransp  )  const [inline]
 

Definition at line 435 of file fillramp.h.

00436 {
00437     return (TranspRampItem*)GetHead();
00438 }

TranspRampItem * TransparencyRamp::GetNextTransp TranspRampItem pItem  )  const [inline]
 

Definition at line 441 of file fillramp.h.

00442 {
00443     return (TranspRampItem*)GetNext(pItem);
00444 }

BOOL TransparencyRamp::IsDifferentTo TransparencyRamp pRamp  ) 
 

Another matching function. See if this transparency ramp is different to that pointed to by pRamp See Also: TransparencyRamp::operator==.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/2/97
Parameters:
pRamp = the ramp to check against [INPUTS]
- [OUTPUTS]
Returns:
TRUE if pRamp is different to this

Definition at line 2196 of file fillramp.cpp.

02197 {
02198     ERROR3IF(this==NULL, "NULL 'this' object in TransparencyRamp::IsDifferentTo()");
02199     if (pRamp==NULL)
02200         return TRUE;
02201     return (!((*this)==(*pRamp)));
02202 }

TransparencyRamp & TransparencyRamp::operator= const TransparencyRamp other  ) 
 

Assign this transparency ramp the same values as those refered to in other.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/2/97
Parameters:
other = a colour ramp reference [INPUTS]
- [OUTPUTS]
Returns:
A reference to this colour ramp

Definition at line 2218 of file fillramp.cpp.

02219 {
02220     // toast all entries in our list
02221     DeleteAll();
02222     BOOL ok = TRUE;
02223 
02224     TranspRampItem *pThisItem, *pOtherItem = other.GetFirstTransp();
02225     while (pOtherItem && ok)
02226     {
02227         pThisItem = new TranspRampItem(*pOtherItem);
02228         ok = (pThisItem != NULL);
02229         if (ok)
02230         {
02231             // Add the new colour to our list
02232             AddTail(pThisItem);
02233             pOtherItem = other.GetNextTransp(pOtherItem);
02234         }
02235     }
02236 
02237     // run a debug check.
02238     ERROR3IF(!ok, "TransparencyRamp::operator= failed to copy the complete TransparencyRamp");
02239 
02240     return (*this);
02241 }

INT32 TransparencyRamp::operator== const TransparencyRamp other  )  const
 

Try to match this ramp with another ramp. We simply check the numbers in the list, and if the same call the transparency ramp entry eqivalence operator against each list entry.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/2/97
Parameters:
other = a transparency ramp reference [INPUTS]
- [OUTPUTS]
Returns:
TRUE if other is equivalent to this

Definition at line 2162 of file fillramp.cpp.

02163 {
02164     if (GetCount() != other.GetCount())
02165         return FALSE;
02166 
02167     TranspRampItem *pThisItem = GetFirstTransp();
02168     TranspRampItem *pThatItem = other.GetFirstTransp();
02169 
02170     BOOL ok=TRUE;
02171     while (pThisItem && ok)
02172     {
02173         ok = ((*pThisItem)==(*pThatItem));
02174         pThisItem = GetNextTransp(pThisItem);
02175         pThatItem = other.GetNextTransp(pThatItem);
02176     }
02177 
02178     return TRUE;
02179 }

BOOL TransparencyRamp::SetItemTransp UINT32  index,
UINT32  t
 

Set the transparency of an existing ramp entry to a new value.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/3/97
Parameters:
index = the index of the ramp entry [INPUTS] t = the transparency to set
Returns:
TRUE if the transparency has been set

Definition at line 2286 of file fillramp.cpp.

02287 {
02288     RampItem *pItem = GetValidIndexedItem(index);
02289     if (pItem!=NULL)
02290         ((TranspRampItem*)pItem)->SetTransparency(t);
02291     return (pItem!=NULL);
02292 }

INT32 TransparencyRamp::SetSelectedTransp UINT32  transp  ) 
 

Sets all selected items in this ramp to the given transparency.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/3/97
Parameters:
transp = the level of transparency [INPUTS]
Returns:
the number of transparencies set

Definition at line 2257 of file fillramp.cpp.

02258 {
02259     INT32 c=0;
02260     TranspRampItem *pItem = GetFirstTransp();
02261     while (pItem!=NULL)
02262     {
02263         if (pItem->IsSelected())
02264         {
02265             pItem->SetTransparency(transp);
02266             c++;
02267         }
02268         pItem = GetNextTransp(pItem);
02269     }
02270     return c;
02271 }


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:02:18 2007 for Camelot by  doxygen 1.4.4