#include <impcol.h>
Inheritance diagram for NewColour:
Public Member Functions | |
NewColour (IndexedColour *, BOOL) | |
Create a new colour list item from the given indexed colour. | |
BOOL | AddDuplicateColour (IndexedColour **pNewCol, BOOL AlreadyExists) |
Add another definition of a colour to an existing colour definition. i.e. We have a new colour but we have already found a definition of this colour name while importing, so we have duplicate colour names, so the IndexedColour object pointed to by pNewCol should be linked to the existing item (with which it shares a colour name). | |
Public Attributes | |
IndexedColour * | pCol |
BOOL | AlreadyExistsInDoc |
BOOL | Duplicate |
PColourCMYK | ColDefn |
NewColour * | pNextDuplicate |
INT32 | RecordNumber |
UINT32 | EntryNumber |
Definition at line 143 of file impcol.h.
|
Create a new colour list item from the given indexed colour.
Definition at line 305 of file impcol.cpp. 00306 { 00307 // Initialise to sensible values. 00308 pCol = pNewCol; 00309 AlreadyExistsInDoc = AlreadyExists; 00310 Duplicate = FALSE; 00311 pNextDuplicate = NULL; 00312 00313 // Get CMYK version of this colour for comparisons - this looks a bit nasty, but 00314 // actually I think it's the cleanest way of doing this. 00315 DocColour TempCol; 00316 TempCol.MakeRefToIndexedColour(pNewCol); 00317 TempCol.GetCMYKValue(&ColDefn); 00318 00319 // New web/native filter bits 00320 RecordNumber = 0L; 00321 EntryNumber = 0L; 00322 }
|
|
Add another definition of a colour to an existing colour definition. i.e. We have a new colour but we have already found a definition of this colour name while importing, so we have duplicate colour names, so the IndexedColour object pointed to by pNewCol should be linked to the existing item (with which it shares a colour name).
1) Duplicated name, but different colour definitions. In this case, the dupes are remembered and added to the document (the colour list will ensure they have unique names when finally added) 2) Exact duplicate (now possible with parents of shade colours which might be defined twice in a CamEPS document). These are deleted out of hand, and the pNewCol pointer is updated to point at the original/first definition of the identical colour.
Definition at line 368 of file impcol.cpp. 00369 { 00370 ERROR3IF(pNewCol == NULL || *pNewCol == NULL, "Illegal NULL param"); 00371 00372 // --- First, check if this colour is a real duplicate or just a duplicate in name 00373 // If it is a duplicate name, then we keep a copy around, but if it is a complete 00374 // duplicate, then we want to vape it and NOT put it in the dupes list - Jason 00375 00376 // NOTE: We *ONLY* do this if the colour is not already part of the existing document 00377 // (i.e. was merged with an existing exact match colour in the doc), i.e. if !AlreadyExists 00378 00379 if (!AlreadyExists) 00380 { 00381 NewColour *Ptr = this; 00382 while (Ptr != NULL) 00383 { 00384 if (!(*pNewCol)->IsDifferent(*(Ptr->pCol))) 00385 { 00386 delete (*pNewCol); // delete the identical twin 00387 *pNewCol = Ptr->pCol; // and return the pointer pointing at the original definition 00388 return(TRUE); 00389 } 00390 00391 Ptr = Ptr->pNextDuplicate; 00392 } 00393 } 00394 00395 // --- And now back to our regularly scheduled programme... 00396 00397 00398 00399 // First, try to make a new item 00400 NewColour *pNewItem = new NewColour(*pNewCol, AlreadyExists); 00401 if (pNewItem == NULL) 00402 return FALSE; 00403 00404 // Mark this object as being a duplicate 00405 Duplicate = TRUE; 00406 00407 // Ok, link to this object (at end of the one-way list)... 00408 NewColour *pLast = this; 00409 while (pLast->pNextDuplicate != NULL) 00410 pLast = pLast->pNextDuplicate; 00411 00412 // Found end of list - link it in and mark it as being a duplicate 00413 pLast->pNextDuplicate = pNewItem; 00414 pNewItem->Duplicate = TRUE; 00415 00416 // Worked ok 00417 return TRUE; 00418 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|