#include <coplfilr.h>
Inheritance diagram for AdobeColourSwatchFilter:
Public Member Functions | |
AdobeColourSwatchFilter () | |
Constructor for a Adobe Colour Swatch palette filter. | |
~AdobeColourSwatchFilter () | |
Destructor for a Adobe Colour Swatch palette filter. | |
BOOL | Init () |
Initialise the filter, attaches OIL filter. | |
INT32 | HowCompatible (PathName &Filename, ADDR HeaderStart, UINT32 HeaderSize, UINT32 FileSize) |
Examines a file to see how compatable it is with this filter. | |
virtual BOOL | PreImport () |
Reads the MS palette file header to see how many colours are in the file. | |
virtual BOOL | ImportPalette () |
Imports colours from an Adobe colour swatch. | |
virtual BOOL | PostImport () |
Called to allow post import cleanup (if required) for this filter. | |
Protected Member Functions | |
WORD | ReverseWord (WORD Orig) |
WORDs in swatch files have the wrong byte order. This function swaps the bytes. | |
Protected Attributes | |
UINT32 | m_NumToImport |
BOOL | m_MetUnknownModel |
Private Member Functions | |
CC_DECLARE_DYNAMIC (AdobeColourSwatchFilter) |
Definition at line 298 of file coplfilr.h.
|
Constructor for a Adobe Colour Swatch palette filter.
Definition at line 1882 of file coplfilr.cpp. 01883 { 01884 // Set up filter descriptions. 01885 FilterName.Load(_R(IDT_FILTERNAME_ADOBECOLOURSWATCH)); 01886 FilterInfo.Load(_R(IDT_FILTERINFO_ADOBECOLOURSWATCH)); 01887 FilterID = FILTERID_ADOBECOLOURSWATCH; 01888 01889 #ifndef STANDALONE 01890 Flags.CanImport = TRUE; 01891 Flags.CanExport = FALSE; 01892 #else 01893 Flags.CanImport = FALSE; 01894 Flags.CanExport = FALSE; 01895 #endif 01896 01897 #ifndef DO_EXPORT 01898 Flags.CanExport = FALSE; 01899 #endif 01900 }
|
|
Destructor for a Adobe Colour Swatch palette filter.
Definition at line 1913 of file coplfilr.cpp.
|
|
|
|
Examines a file to see how compatable it is with this filter.
Reimplemented from Filter. Definition at line 1951 of file coplfilr.cpp. 01952 { 01953 PORTNOTE("byteorder", "TODO: Check byte ordering") 01954 // Adobe colour swatchs appear to be just raw data. We have to go on file extension 01955 ERROR2IF(pOILFilter==NULL, 0, "No oil filter present"); 01956 return ((AdobeColourSwatchOILFilter*)pOILFilter)->HowCompatible(Filename); 01957 }
|
|
Imports colours from an Adobe colour swatch.
Implements PaletteFilter. Definition at line 2005 of file coplfilr.cpp. 02006 { 02007 ERROR2IF(m_pImportFile==NULL, FALSE, "NULL pointer"); 02008 02009 BOOL ok = StartPercentage(m_NumToImport); 02010 UINT32 StillToRead = m_NumToImport; 02011 02012 while ( ok && m_pImportFile->good() && StillToRead>0 ) 02013 { 02014 // Read the values for this colour from the file 02015 WORD ColourDef[5]; 02016 m_pImportFile->read(ColourDef, 10); 02017 02018 // Add the colour to the imported colours list 02019 if (m_pImportFile->good()) 02020 { 02021 switch (ReverseWord(ColourDef[0])) 02022 { 02023 case 0 : ok = ProcessRGBColour(ReverseWord(ColourDef[1])/(double)0xFFFF, 02024 ReverseWord(ColourDef[2])/(double)0xFFFF, 02025 ReverseWord(ColourDef[3])/(double)0xFFFF ); 02026 break; 02027 02028 case 1 : ok = ProcessHSVColour(ReverseWord(ColourDef[1])/(double)0xFFFF, 02029 ReverseWord(ColourDef[2])/(double)0xFFFF, 02030 ReverseWord(ColourDef[3])/(double)0xFFFF ); 02031 break; 02032 02033 case 2 : ok = ProcessCMYKColour((0xFFFF-ReverseWord(ColourDef[1]))/(double)0xFFFF, 02034 (0xFFFF-ReverseWord(ColourDef[2]))/(double)0xFFFF, 02035 (0xFFFF-ReverseWord(ColourDef[3]))/(double)0xFFFF, 02036 (0xFFFF-ReverseWord(ColourDef[4]))/(double)0xFFFF ); 02037 break; 02038 02039 case 7 : ok = ProcessLabColour(ReverseWord(ColourDef[1])/100.0, 02040 (signed short)(ReverseWord(ColourDef[2]))/100.0, 02041 (signed short)(ReverseWord(ColourDef[3]))/100.0 ); 02042 break; 02043 02044 case 8 : ok = ProcessGreyColour((0x2710-ReverseWord(ColourDef[1]))/10000.0); 02045 break; 02046 02047 default : if (!m_MetUnknownModel) 02048 { 02049 InformWarning(_R(IDE_PALETTEIMPORT_ACOUNKNOWN)); 02050 m_MetUnknownModel = TRUE; 02051 } 02052 break; 02053 } 02054 } 02055 02056 SetPercentage(m_NumToImport-StillToRead); 02057 StillToRead--; 02058 } 02059 02060 return ok && m_pImportFile->good(); 02061 }
|
|
Initialise the filter, attaches OIL filter.
Implements Filter. Definition at line 1929 of file coplfilr.cpp. 01930 { 01931 // Get the OILFilter object 01932 pOILFilter = new AdobeColourSwatchOILFilter(this); 01933 01934 return (pOILFilter != NULL); 01935 }
|
|
Called to allow post import cleanup (if required) for this filter.
Implements PaletteFilter. Definition at line 2074 of file coplfilr.cpp. 02075 { 02076 // Nothing to do, no cleanup required. 02077 return TRUE; 02078 }
|
|
Reads the MS palette file header to see how many colours are in the file.
Implements PaletteFilter. Definition at line 1970 of file coplfilr.cpp. 01971 { 01972 ERROR2IF( m_pImportFile==NULL, FALSE, "NULL pointer"); 01973 ERROR3IF( sizeof(WORD)!=2, "How come a WORD is not two bytes?"); 01974 01975 m_MetUnknownModel = FALSE; 01976 01977 // Read info out of the header. 01978 WORD HeaderBuffer[2]; 01979 m_pImportFile->read(HeaderBuffer, 4); 01980 01981 if (m_pImportFile->good()) 01982 { 01983 m_NumToImport = ReverseWord(HeaderBuffer[1]); 01984 return TRUE; 01985 } 01986 else 01987 { 01988 m_NumToImport = 0; 01989 return FALSE; 01990 } 01991 }
|
|
WORDs in swatch files have the wrong byte order. This function swaps the bytes.
Definition at line 2091 of file coplfilr.cpp. 02092 { 02093 BYTE NewLow = (Orig & 0xFF00) >> 8; 02094 Orig = Orig << 8; 02095 02096 return Orig | NewLow; 02097 }
|
|
Definition at line 321 of file coplfilr.h. |
|
Definition at line 320 of file coplfilr.h. |