CTransparencyReplacer Class Reference

Similar to CNamedColourReplacer, this class takes a transparency attribute, changes its values, and then changes them back. More...

#include <cnamecol.h>

Inheritance diagram for CTransparencyReplacer:

CCObject SimpleCCObject List of all members.

Public Member Functions

 CTransparencyReplacer ()
 default constructor
 ~CTransparencyReplacer ()
BOOL SetReplacementValue (INT32 Value)
 access
INT32 GetReplacementValue ()
 access
BOOL SetAdjustmentValue (double Value)
 access
double GetAdjustmentValue ()
 access
BOOL SetInvertedAdjuster (double Value)
 access to our inverted adjuster
double GetInvertedAdjuster ()
 access
void SetTransparencyAttr (TranspFillAttribute *pAttr)
 access
BOOL ReplaceTransparency ()
 Does the deed of replacing the transparency value in our attribute with the one we have been given.
BOOL RestoreTransparency ()
 Does the deed of replacing the transparency value in our attribute with the one we have been given.
BOOL IsInitialised ()
 as above

Protected Attributes

UINT32 m_OriginalTransp
INT32 m_ReplaceTransp
double m_TranspAdjust
double m_InvertAdjust
TranspFillAttributem_pTranspFill

Detailed Description

Similar to CNamedColourReplacer, this class takes a transparency attribute, changes its values, and then changes them back.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/6/2000

Definition at line 239 of file cnamecol.h.


Constructor & Destructor Documentation

CTransparencyReplacer::CTransparencyReplacer  ) 
 

default constructor

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/4/2000

Definition at line 791 of file cnamecol.cpp.

00792 {
00793     m_pTranspFill = NULL;
00794     m_OriginalTransp = 0;
00795     m_ReplaceTransp = -1;
00796     m_TranspAdjust  = 1.0;
00797     m_InvertAdjust = 1.0;
00798 }

CTransparencyReplacer::~CTransparencyReplacer  )  [inline]
 

Definition at line 245 of file cnamecol.h.

00245 {};


Member Function Documentation

double CTransparencyReplacer::GetAdjustmentValue  ) 
 

access

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/4/2000
Parameters:
[INPUTS] 
Returns:
our adjuster value

Definition at line 875 of file cnamecol.cpp.

00876 {
00877     return m_TranspAdjust;
00878 }

double CTransparencyReplacer::GetInvertedAdjuster  ) 
 

access

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/4/2000
Parameters:
[INPUTS] 
Returns:
our inverted adjuster value

Definition at line 915 of file cnamecol.cpp.

00916 {
00917     return m_InvertAdjust;
00918 }

INT32 CTransparencyReplacer::GetReplacementValue  ) 
 

access

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/4/2000
Parameters:
- [INPUTS]
Returns:
out replacement transparency value

Definition at line 835 of file cnamecol.cpp.

00836 {
00837     return m_ReplaceTransp;
00838 }

BOOL CTransparencyReplacer::IsInitialised  ) 
 

as above

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/4/2000
Parameters:
- [INPUTS]
Returns:
True if the replacer has been initialised and is ready to replace, false otherwise

Definition at line 1034 of file cnamecol.cpp.

01035 {
01036     return (m_pTranspFill != NULL && (m_ReplaceTransp >= 0 || m_TranspAdjust >= 0));
01037 }

BOOL CTransparencyReplacer::ReplaceTransparency  ) 
 

Does the deed of replacing the transparency value in our attribute with the one we have been given.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/4/2000
Parameters:
- [INPUTS]
Returns:
-

Definition at line 953 of file cnamecol.cpp.

00954 {
00955     if (m_pTranspFill == NULL)
00956         return FALSE;
00957 
00958     // first cache the original value
00959     m_OriginalTransp = *m_pTranspFill->GetStartTransp();
00960     
00961     // recall that a negative replacement value means don't replace
00962     if (m_ReplaceTransp >= 0)
00963         m_pTranspFill->Transp = (UINT32)m_ReplaceTransp;
00964 
00965     if (m_TranspAdjust >= 0)
00966     {
00967         /* Ok, so what is going on here?  Basically this:
00968         - We have two adjusters, they both generate a value which is a proportion of the maximum transparency
00969         - One of the adjusters is inverted (i.e. as its value increases, its output value decreases 
00970         - Both adjusters make sure they are within legal limits 
00971         - The adjuster value is added to the original value
00972         - We take a straight mean of the two adjusted values and set it back to the attribute
00973         */
00974 
00975         double TranspAdj = m_TranspAdjust * MAX_TRANSPARENCY;
00976         double TranspAdj1 = m_InvertAdjust * MAX_TRANSPARENCY;
00977 
00978         INT32 Adjust = INT32(TranspAdj); 
00979         Adjust -= MAX_TRANSPARENCY;
00980 
00981         INT32 InvertAdjust = INT32(MAX_TRANSPARENCY- TranspAdj1);
00982         
00983         INT32 FirstTransp = m_pTranspFill->Transp + Adjust;
00984         
00985         INT32 FinalTransp = FirstTransp + InvertAdjust;
00986 
00987         if (FinalTransp > MAX_TRANSPARENCY)
00988             FinalTransp = MAX_TRANSPARENCY;
00989         if (FinalTransp < 0)
00990             FinalTransp = 0;
00991     //  TRACEUSER( "Diccon", _T("New Transp = %d\n"), FinalTransp);
00992         m_pTranspFill->Transp = UINT32(FinalTransp); 
00993     }
00994 
00995     return TRUE;
00996 }

BOOL CTransparencyReplacer::RestoreTransparency  ) 
 

Does the deed of replacing the transparency value in our attribute with the one we have been given.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/4/2000
Parameters:
- [INPUTS]
Returns:
-

Definition at line 1012 of file cnamecol.cpp.

01013 {
01014     if (m_pTranspFill == NULL)
01015         return FALSE;
01016 
01017     m_pTranspFill->Transp = m_OriginalTransp;
01018 
01019     return TRUE;
01020 }

BOOL CTransparencyReplacer::SetAdjustmentValue double  Value  ) 
 

access

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/4/2000
Parameters:
our adjuster value [INPUTS]
Returns:
TRUE unless Value is outside the legal range

Definition at line 853 of file cnamecol.cpp.

00854 {
00855     if (Value > 3.0 || Value < 0)
00856         return FALSE;
00857     m_TranspAdjust = Value;
00858     
00859     return TRUE;
00860 }

BOOL CTransparencyReplacer::SetInvertedAdjuster double  Value  ) 
 

access to our inverted adjuster

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/4/2000
Parameters:
our adjuster value [INPUTS]
Returns:
TRUE unless Value is outside the legal range

Definition at line 893 of file cnamecol.cpp.

00894 {
00895     if (Value > 3.0 || Value < 0)
00896         return FALSE;
00897     m_InvertAdjust = Value;
00898     
00899     return TRUE;
00900 }

BOOL CTransparencyReplacer::SetReplacementValue INT32  Value  ) 
 

access

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/4/2000
Parameters:
the value to use as our replacement [INPUTS]
Returns:
TRUE unless Value is outside the legal range

Definition at line 813 of file cnamecol.cpp.

00814 {
00815     if (Value > MAX_TRANSP_VALUE)
00816         return FALSE;
00817 
00818     m_ReplaceTransp = Value;
00819     return TRUE;
00820 }

void CTransparencyReplacer::SetTransparencyAttr TranspFillAttribute pAttrVal  ) 
 

access

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/4/2000
Parameters:
pAttrVal - the transparency attribute value that we are working on [INPUTS]
Returns:
-

Definition at line 934 of file cnamecol.cpp.

00935 {
00936     m_pTranspFill = pAttrVal;
00937 }


Member Data Documentation

double CTransparencyReplacer::m_InvertAdjust [protected]
 

Definition at line 266 of file cnamecol.h.

UINT32 CTransparencyReplacer::m_OriginalTransp [protected]
 

Definition at line 262 of file cnamecol.h.

TranspFillAttribute* CTransparencyReplacer::m_pTranspFill [protected]
 

Definition at line 268 of file cnamecol.h.

INT32 CTransparencyReplacer::m_ReplaceTransp [protected]
 

Definition at line 263 of file cnamecol.h.

double CTransparencyReplacer::m_TranspAdjust [protected]
 

Definition at line 265 of file cnamecol.h.


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