#include <coplfilr.h>
Inheritance diagram for PaintShopProPaletteFilter:
Public Member Functions | |
PaintShopProPaletteFilter () | |
Constructor for a PaintShopPro palette filter. | |
~PaintShopProPaletteFilter () | |
Destructor for a PaintShopPro 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 PSP 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 Attributes | |
UINT32 | m_NumToImport |
Private Member Functions | |
CC_DECLARE_DYNAMIC (PaintShopProPaletteFilter) |
Definition at line 240 of file coplfilr.h.
|
Constructor for a PaintShopPro palette filter.
Definition at line 2113 of file coplfilr.cpp. 02114 { 02115 // Set up filter descriptions. 02116 FilterName.Load(_R(IDT_FILTERNAME_PSPPALETTE)); 02117 FilterInfo.Load(_R(IDT_FILTERINFO_PSPPALETTE)); 02118 FilterID = FILTERID_PSPPALETTE; 02119 02120 #ifndef STANDALONE 02121 Flags.CanImport = TRUE; 02122 Flags.CanExport = FALSE; 02123 #else 02124 Flags.CanImport = FALSE; 02125 Flags.CanExport = FALSE; 02126 #endif 02127 02128 #ifndef DO_EXPORT 02129 Flags.CanExport = FALSE; 02130 #endif 02131 }
|
|
Destructor for a PaintShopPro palette filter.
Definition at line 2144 of file coplfilr.cpp.
|
|
|
|
Examines a file to see how compatable it is with this filter.
Reimplemented from Filter. Definition at line 2182 of file coplfilr.cpp. 02183 { 02184 PORTNOTE("byteorder", "TODO: Check byte ordering") 02185 // Check we have enough of the file header to look at 02186 if (HeaderSize < 8) 02187 { 02188 TRACE( _T("PaintShopProPaletteFilter filter needs 8+ bytes in HowCompatible\n")); 02189 return 0; 02190 } 02191 02192 if ( HeaderStart[0] == 0x4A && // J 02193 HeaderStart[1] == 0x41 && // A 02194 HeaderStart[2] == 0x53 && // S 02195 HeaderStart[3] == 0x43 && // C 02196 HeaderStart[4] == 0x2D && // - 02197 HeaderStart[5] == 0x50 && // P 02198 HeaderStart[6] == 0x41 && // A 02199 HeaderStart[7] == 0x4C ) // L 02200 return 10; 02201 else 02202 return 0; 02203 }
|
|
Imports colours from an Adobe colour swatch.
Implements PaletteFilter. Definition at line 2257 of file coplfilr.cpp. 02258 { 02259 ERROR2IF(m_pImportFile==NULL, FALSE, "NULL pointer"); 02260 02261 BOOL ok = StartPercentage(m_NumToImport); 02262 UINT32 StillToRead = m_NumToImport; 02263 02264 while ( ok && StillToRead>0 ) 02265 { 02266 // Read the colour definition line 02267 ok = m_pImportFile->GetLineToken(); 02268 02269 // Add the colour to the imported colours list 02270 const TCHAR* Line = m_pImportFile->GetTokenBuf(); 02271 UINT32 Red = 0; 02272 UINT32 Green = 0; 02273 UINT32 Blue = 0; 02274 INT32 result = camSscanf(Line, "%d %d %d", &Red, &Green, &Blue); 02275 02276 if (result != 0) 02277 ok = ProcessRGBColour(Red/(double)0xFF, Green/(double)0xFF, Blue/(double)0xFF); 02278 02279 SetPercentage(m_NumToImport-StillToRead); 02280 StillToRead--; 02281 } 02282 02283 return ok; 02284 }
|
|
Initialise the filter, attaches OIL filter.
Implements Filter. Definition at line 2160 of file coplfilr.cpp. 02161 { 02162 // Get the OILFilter object 02163 pOILFilter = new PSPPaletteOILFilter(this); 02164 02165 return (pOILFilter != NULL); 02166 }
|
|
Called to allow post import cleanup (if required) for this filter.
Implements PaletteFilter. Definition at line 2298 of file coplfilr.cpp. 02299 { 02300 ERROR2IF( m_pImportFile==NULL, FALSE, "NULL pointer"); 02301 02302 m_pImportFile->DeinitLexer(); 02303 02304 return TRUE; 02305 }
|
|
Reads the PSP palette file header to see how many colours are in the file.
Implements PaletteFilter. Definition at line 2216 of file coplfilr.cpp. 02217 { 02218 ERROR2IF( m_pImportFile==NULL, FALSE, "NULL pointer"); 02219 02220 if (!m_pImportFile->InitLexer()) 02221 return FALSE; 02222 02223 // Read the two header lines 02224 INT32 ReadLines = 0; 02225 while (ReadLines<2 && m_pImportFile->good()) 02226 { 02227 m_pImportFile->GetLineToken(); 02228 LexTokenType TokType = m_pImportFile->GetTokenType(); 02229 if (TokType == TOKEN_LINE) 02230 ReadLines++; 02231 } 02232 02233 // Read the number of colours line 02234 if (m_pImportFile->good()) 02235 m_pImportFile->GetLineToken(); 02236 if (m_pImportFile->good()) 02237 { 02238 const TCHAR* Line = m_pImportFile->GetTokenBuf(); 02239 // BODGE - does this work in UNICODE builds? 02240 camSscanf(Line, "%d", &m_NumToImport); 02241 } 02242 02243 return m_pImportFile->good(); 02244 }
|
|
Definition at line 259 of file coplfilr.h. |