#include <ppmfiltr.h>
Inheritance diagram for PBMFilter:
Public Member Functions | |
PBMFilter () | |
Constructor for an PBMFilter object. The object should be initialised before use. | |
BOOL | Init () |
Initialise an PBMFilter object. | |
Protected Member Functions | |
virtual BOOL | CheckString (TCHAR *pHeader) |
To see if the header of a PBM file is correct or not. | |
virtual BOOL | ReadDataIntoBitmap (INT32 Number, INT32 *Count, LPBYTE *pData, BOOL *NextPixel) |
Place the number read in into the specified place in the bitmap. | |
Private Member Functions | |
CC_DECLARE_DYNAMIC (PBMFilter) |
Definition at line 259 of file ppmfiltr.h.
|
Constructor for an PBMFilter object. The object should be initialised before use.
Definition at line 408 of file ppmfiltr.cpp. 00408 : BasePMFilter() 00409 { 00410 ImportMsgID = _R(IDN_IMPORTMSG_PBM); 00411 Flags.CanImport = TRUE; 00412 Flags.CanExport = FALSE; 00413 FilterID = FILTERID_PBM; 00414 00415 ExportRegion = NULL; 00416 ExportMsgID = _R(IDN_EXPORTMSG_PBM); // "Preparing PBM file..." 00417 00418 ExportingMsgID = _R(IDN_EXPORTINGMSG_PBM); // "Exporting PBM file..." 00419 00420 // CurrentSelection = DRAWING; 00421 }
|
|
|
|
To see if the header of a PBM file is correct or not.
Reimplemented from BasePMFilter. Definition at line 464 of file ppmfiltr.cpp. 00465 { 00466 if ( 00467 (camStrncmp(pHeader, _T("P1"), 2) == 0) || // ASCII PBM 00468 (camStrncmp(pHeader, _T("P4"), 2) == 0) // BINARY PBM 00469 ) 00470 { 00471 // finding PBM should be good enough to determine that there is 00472 // a high chance that this is the right file. 00473 00474 return TRUE; 00475 } 00476 00477 return FALSE; 00478 }
|
|
Initialise an PBMFilter object.
Reimplemented from BasePMFilter. Definition at line 436 of file ppmfiltr.cpp. 00437 { 00438 // Get the OILFilter object 00439 pOILFilter = new PBMOILFilter(this); 00440 if (pOILFilter==NULL) 00441 return FALSE; 00442 00443 // Load the description strings 00444 FilterName.Load(_R(IDN_PBM_FILTERNAME)); 00445 FilterInfo.Load(_R(IDN_PBM_FILTERINFO)); 00446 00447 // All ok 00448 return TRUE; 00449 }
|
|
Place the number read in into the specified place in the bitmap.
Reimplemented from BasePMFilter. Definition at line 1748 of file ppmfiltr.cpp. 01749 { 01750 // (ChrisG 24/01/01) NextPixel should never be set to false for single component images, 01751 // as it is supposed to show whether we're halfway through a pixel (e.g. we've written 01752 // the R and G parts of an RGB pixel, but still have to write the B part), NOT halfway 01753 // through a byte. That's what the Count variable is for. 01754 *NextPixel = TRUE; 01755 01756 if (TypeOfPPM == PBM_BINARY) 01757 { 01758 // The bits are stored eight per byte, high bit first low bit last. 01759 // Work out what to do with the data 01760 switch (RGBBits) 01761 { 01762 case 1: 01763 // Poke this monochrome byte into the next byte in memory 01764 *((*pData)++) = Number; 01765 break; 01766 01767 default: 01768 // Shouldn't get here so error 2 01769 ERROR2(FALSE, "PBMFilter::ReadDataIntoBitmap bad ColoursPerRGB"); 01770 break; 01771 } 01772 01773 // Reset the count 01774 *Count = 0; 01775 } 01776 else 01777 { 01778 // Must be 1 bpp 01779 Bits = (Bits << 1) | (Number & RGBBits); 01780 01781 // Increment our count and see if we have enough info yet 01782 (*Count)++; 01783 01784 if (*Count == 8) 01785 { 01786 // Work out what to do with the data 01787 switch (RGBBits) 01788 { 01789 case 1: 01790 // Poke those RGB bytes into the next three bytes in memory 01791 *((*pData)++) = Bits; 01792 break; 01793 01794 default: 01795 // Shouldn't get here so error 2 01796 ERROR2(FALSE, "PBMFilter::ReadDataIntoBitmap bad ColoursPerRGB"); 01797 break; 01798 } 01799 01800 // Reset the count 01801 *Count = 0; 01802 01803 // Reset the bits accumulator 01804 Bits = 0; 01805 } 01806 } 01807 01808 return TRUE; 01809 }
|