#include <cnamecol.h>
Inheritance diagram for CHSVChanger:
Public Member Functions | |
CHSVChanger () | |
default constructor | |
CHSVChanger (ColourFillAttribute *, DocColour *) | |
default constructor | |
~CHSVChanger () | |
destructor | |
virtual BOOL | ReplaceColours () |
This function asks the colour fill for its colours one by one, checks to see if they are named, or if they were created by a named colour. If so it copies them and stores them. It then replaces them with our replacement colour. | |
virtual BOOL | RestoreColours () |
Restores the colours that were changed. | |
BOOL | ChangeHSVValues () |
The raison d'etre of this object. Changes the HSV values of the member fill. | |
BOOL | ShouldChangeHSV () |
does a few checks to see if it is worth changing hsv values, currently we only use the multipliers so it just checks to see if they are default or not | |
virtual BOOL | IsInitialised () |
void | ChangeColour (DocColour *pCol) |
Simply changes the values in this one colour alone, in case you're fed up of worrying about attributes and the like. | |
double | GetHueMultiplier () |
Access. | |
BOOL | SetHueMultiplier (double Value) |
Sets the Hue multiplier, also calculates the value that will be added/subtracted from the colour. | |
double | GetSaturationMultiplier () |
Access. | |
BOOL | SetSaturationMultiplier (double Value) |
Sets the saturation multiplier, also calculates the addition/subtraction value. | |
Protected Member Functions | |
void | ApplyIncrements (DocColour *pCol) |
Takes a colour, extracts its HSV values, adds (or subtracts) the increment value. | |
Protected Attributes | |
double | m_HueMultiplier |
double | m_SaturationMultiplier |
double | m_ValueMultiplier |
INT32 | m_HueIncrement |
INT32 | m_SatIncrement |
DocColour | m_OrigStartCol |
DocColour | m_OrigEndCol1 |
DocColour | m_OrigEndCol2 |
DocColour | m_OrigEndCol3 |
Definition at line 177 of file cnamecol.h.
|
default constructor
Definition at line 385 of file cnamecol.cpp. 00385 : CNamedColourReplacer() 00386 { 00387 m_HueMultiplier = 1.0; 00388 m_SaturationMultiplier = 1.0; 00389 m_ValueMultiplier = 1.0; 00390 m_HueIncrement = 0; 00391 m_SatIncrement = 0; 00392 }
|
|
default constructor
Definition at line 406 of file cnamecol.cpp. 00406 : CNamedColourReplacer(pFill, pCol) 00407 { 00408 m_HueMultiplier = 1.0; 00409 m_SaturationMultiplier = 1.0; 00410 m_ValueMultiplier = 1.0; 00411 m_HueIncrement = 0; 00412 m_SatIncrement = 0; 00413 00414 }
|
|
destructor
Definition at line 427 of file cnamecol.cpp. 00428 { 00429 // PORTNOTETRACE("other","CHSVChanger::~CHSVChanger - do nothing"); 00430 //#ifndef EXCLUDE_FROM_XARALX 00431 // have to do a hack here to ensure that we don't decrement the usage count on 00432 // indexed colours which we never incremented in the first place 00433 m_OrigStartCol.HackColReplacerPreDestruct(); 00434 m_OrigEndCol1.HackColReplacerPreDestruct(); 00435 m_OrigEndCol2.HackColReplacerPreDestruct(); 00436 m_OrigEndCol3.HackColReplacerPreDestruct(); 00437 //#endif 00438 }
|
|
Takes a colour, extracts its HSV values, adds (or subtracts) the increment value.
Definition at line 633 of file cnamecol.cpp. 00634 { 00635 // PORTNOTETRACE("other","CHSVChanger::ApplyIncrements - do nothing"); 00636 //#ifndef EXCLUDE_FROM_XARALX 00637 if (pCol == NULL) 00638 { 00639 ERROR3("Colour pointer is NULL in CHSVChanger::ApplyIncrements"); 00640 return; 00641 } 00642 00643 INT32 Hue; 00644 INT32 Sat; 00645 INT32 Dummy; 00646 00647 pCol->GetHSVValue(&Hue, &Sat, &Dummy); 00648 //TRACEUSER( "Diccon", _T("Original Sat = %d, "), Sat); 00649 //TRACEUSER( "Diccon", _T("Original Hue = %d, "), Hue); 00650 Hue += m_HueIncrement; 00651 if (Hue < 0) 00652 Hue += MAX_HUE_VALUE; 00653 else if (Hue > MAX_HUE_VALUE) 00654 Hue -= MAX_HUE_VALUE; 00655 00656 Sat -= abs(m_SatIncrement); 00657 if (Sat < 0) 00658 Sat = 1; 00659 else if (Sat > MAX_SAT_VALUE) 00660 Sat = MAX_SAT_VALUE; 00661 00662 // TRACEUSER( "Diccon", _T("SatIncr = %d, New Sat = %d\n"), m_SatIncrement, Sat); 00663 // TRACEUSER( "Diccon", _T("Hue Incr = %d, New Hue = %d\n"), m_HueIncrement, Hue); 00664 pCol->SetHSVValue(Hue, Sat, Dummy); 00665 //#endif 00666 }
|
|
Simply changes the values in this one colour alone, in case you're fed up of worrying about attributes and the like.
Definition at line 766 of file cnamecol.cpp. 00767 { 00768 if (pCol == NULL) 00769 return; 00770 ApplyIncrements(pCol); 00771 }
|
|
The raison d'etre of this object. Changes the HSV values of the member fill.
Definition at line 476 of file cnamecol.cpp. 00477 { 00478 if (m_pColourFill == NULL) 00479 { 00480 ERROR3("Colour fill is NULL in CHSVChanger::ChangeHSVValues"); 00481 return FALSE; 00482 } 00483 00484 // we need to ask for the colours one by one 00485 DocColour* pStartCol = NULL; 00486 if (m_pReplaceColour != NULL) 00487 pStartCol = m_pReplaceColour; 00488 else 00489 pStartCol = m_pColourFill->GetStartColour(); 00490 00491 if (pStartCol != NULL) 00492 { 00493 m_OrigStartCol = *pStartCol; 00494 ApplyIncrements(pStartCol); 00495 m_pColourFill->SetStartColour(pStartCol); 00496 } 00497 00498 DocColour* pEndCol1 = m_pColourFill->GetEndColour(); 00499 if (pEndCol1 != NULL) 00500 { 00501 // first record our original values 00502 m_OrigEndCol1 = *pEndCol1; 00503 ApplyIncrements(pEndCol1); 00504 } 00505 00506 DocColour* pEndCol2 = m_pColourFill->GetEndColour2(); 00507 if (pEndCol2 != NULL) 00508 { 00509 // first record our original values 00510 m_OrigEndCol2 = *pEndCol2; 00511 ApplyIncrements(pEndCol2); 00512 } 00513 00514 DocColour* pEndCol3 = m_pColourFill->GetEndColour3(); 00515 if (pEndCol3 != NULL) 00516 { 00517 // first record our original values 00518 m_OrigEndCol3 = *pEndCol3; 00519 ApplyIncrements(pEndCol3); 00520 } 00521 00522 return TRUE; 00523 }
|
|
Access.
Definition at line 682 of file cnamecol.cpp. 00683 { 00684 return m_HueMultiplier; 00685 }
|
|
Access.
Definition at line 723 of file cnamecol.cpp. 00724 { 00725 return m_SaturationMultiplier; 00726 }
|
|
Reimplemented from CNamedColourReplacer. Definition at line 591 of file cnamecol.cpp. 00592 { 00593 BOOL Init = m_pReplaceColour != NULL || 00594 m_HueMultiplier != 1.0 || 00595 m_SaturationMultiplier != 1.0; 00596 00597 return Init; 00598 }
|
|
This function asks the colour fill for its colours one by one, checks to see if they are named, or if they were created by a named colour. If so it copies them and stores them. It then replaces them with our replacement colour.
Reimplemented from CNamedColourReplacer. Definition at line 455 of file cnamecol.cpp. 00456 { 00457 // if we also want to replace colours then do that first 00458 if (m_pReplaceColour != NULL) 00459 return CNamedColourReplacer::ReplaceColours(); 00460 00461 return TRUE; 00462 }
|
|
Restores the colours that were changed.
Reimplemented from CNamedColourReplacer. Definition at line 538 of file cnamecol.cpp. 00539 { 00540 if (m_pColourFill == NULL) 00541 return FALSE; 00542 00543 // here we restore any named colours we replaced 00544 if (m_pReplaceColour != NULL) 00545 return CNamedColourReplacer::RestoreColours(); 00546 00547 // we need to ask for the colours one by one 00548 DocColour* pStartCol = m_pColourFill->GetStartColour(); 00549 if (pStartCol != NULL) 00550 { 00551 *pStartCol = m_OrigStartCol; 00552 } 00553 00554 DocColour* pEndCol1 = m_pColourFill->GetEndColour(); 00555 if (pEndCol1 != NULL) 00556 { 00557 *pEndCol1 = m_OrigEndCol1; 00558 00559 } 00560 00561 DocColour* pEndCol2 = m_pColourFill->GetEndColour2(); 00562 if (pEndCol2 != NULL) 00563 { 00564 *pEndCol2 = m_OrigEndCol2; 00565 } 00566 00567 DocColour* pEndCol3 = m_pColourFill->GetEndColour3(); 00568 if (pEndCol3 != NULL) 00569 { 00570 *pEndCol3 = m_OrigEndCol3; 00571 } 00572 00573 return TRUE; 00574 00575 00576 00577 }
|
|
Sets the Hue multiplier, also calculates the value that will be added/subtracted from the colour.
Definition at line 702 of file cnamecol.cpp. 00703 { 00704 m_HueMultiplier = Value; 00705 m_HueIncrement = (INT32)Value; // * (double)MAX_HUE_VALUE); 00706 //TRACEUSER( "Diccon", _T("Hue Increment = %d\n"), m_HueIncrement); 00707 return TRUE; 00708 }
|
|
Sets the saturation multiplier, also calculates the addition/subtraction value.
Definition at line 742 of file cnamecol.cpp. 00743 { 00744 m_SaturationMultiplier = Value; 00745 00746 m_SatIncrement = (INT32)(Value * (double)MAX_SAT_VALUE); 00747 00748 //TRACEUSER( "Diccon", _T("Sat increment = %d\n"), m_SatIncrement); 00749 return TRUE; 00750 }
|
|
does a few checks to see if it is worth changing hsv values, currently we only use the multipliers so it just checks to see if they are default or not
Definition at line 612 of file cnamecol.cpp. 00613 { 00614 BOOL bShouldReplace = (m_HueIncrement != 0 || m_SatIncrement != 0); 00615 00616 return bShouldReplace; 00617 }
|
|
Definition at line 216 of file cnamecol.h. |
|
Definition at line 212 of file cnamecol.h. |
|
Definition at line 222 of file cnamecol.h. |
|
Definition at line 223 of file cnamecol.h. |
|
Definition at line 224 of file cnamecol.h. |
|
Definition at line 221 of file cnamecol.h. |
|
Definition at line 217 of file cnamecol.h. |
|
Definition at line 213 of file cnamecol.h. |
|
Definition at line 214 of file cnamecol.h. |