#include <bmpfiltr.h>
Inheritance diagram for BMPFilter:
Public Member Functions | |
BMPFilter () | |
Constructor for an BMPFilter object. The object should be initialised before use. | |
BOOL | Init () |
Initialise an BMPFilter object. | |
virtual INT32 | HowCompatible (PathName &Filename, ADDR HeaderStart, UINT32 HeaderSize, UINT32 FileSize) |
Determine if this filter can load the specified file. | |
virtual FilterType | GetFilterType () const |
virtual BOOL | ReadFromFile (OILBitmap *pOilBitmap) |
Actually does the process of reading a bitmap from a file. Inherited classes override this to read in different file formats. | |
virtual BOOL | ReadFromFile (OILBitmap *pOilBitmap, BaseCamelotFilter *pFilter, CCLexFile *pFile, BOOL IsCompressed) |
Actually does the process of reading a bitmap from a file. Inherited classes override this to read in different file formats. It is used by the web/native filters to pull out a bitmap definition from inside a bitmap definition record. IsCompressed is only used for BMP/BMPZIP type bitmaps at present. Assumes: pFile has already been opened up for reading pFilter has been set up for reading the data e.g. progress bar. | |
void | AlterPaletteContents (LPLOGPALETTE pPalette) |
virtual void | PostGetExportOptions (BitmapExportOptions *pOptions) |
virtual BOOL | WriteBitmapToFile (KernelBitmap *pKernelBitmap, BaseCamelotFilter *pFilter, CCLexFile *pFile, INT32 Compression) |
Physically put the bitmap into the disk. Inherited classes override this to write in different file formats. This is used by the native/web format to output the actual bitmap data content of a bitmap definition record. The function can assume that the CCFile is open and ready for writing and must use the functions provided by pFilter to update the progress system. | |
virtual BOOL | IsThisBppOk (UINT32 Bpp) |
Check if this Bitmap filter can cope with saving at this Bpp/Colour depth. | |
INT32 | GetBmpCompatibility () |
Determine if this filter can load the specified file. | |
Static Public Member Functions | |
static UINT32 | GetDefaultExportDepth () |
Allows a default export dots per inch size to be remembered when exporting either as a BMP or via the Accusoft loaders. Allows a default export bits per pixel amount to be remembered when exporting either as a BMP or via the Accusoft loaders. Allows other bitmap export filters to get at this value. Needs to be here rather than in BaseBitmapFilter as that Init is never used. | |
static double | GetDefaultExportDPI () |
Allows other bitmap export filters to get at this value. Needs to be here rather than in BaseBitmapFilter as that Init is never used. | |
static void | SetDefaultExportDepth (UINT32) |
Allows other bitmap export filters to set this value. Needs to be here rather than in BaseBitmapFilter as that Init is never used. | |
static void | SetDefaultExportDPI (double) |
Allows other bitmap export filters to set this value. Needs to be here rather than in BaseBitmapFilter as that Init is never used. | |
static UINT32 | GetDefaultExportDither () |
static void | SetDefaultExportDither (UINT32) |
Protected Member Functions | |
virtual BitmapExportOptions * | CreateExportOptions () const |
Allows derived classes to override this function to provide their own class derived from BitmapExportInfo containing filter specific information. | |
virtual BOOL | WriteToFile (BOOL End) |
Physically put the bitmap into the disk. NOTE - ONLY COPES WITH End=TRUE currently Most of the work now is down by WriteDataToFile as this is a static form and there is a similar version in the Accusoft DLL. This can therefore be used to pass work onto the Accusoft DLL, for the cases we don't cope with. End is ignored now and should always be set to TRUE. | |
virtual BOOL | EndWriteToFile () |
Cleans up after writing the bitmap data out to a file. Inherited classes override this to write in different file formats. | |
virtual BOOL | GetExportOptions (BitmapExportOptions *pOptions) |
See BaseBitmapClass for interface details Notes: Initializes BMP specific members Scope: Protected. | |
virtual void | CleanUpAfterExport () |
Allows the filter to clean up any allocated resources. | |
virtual BOOL | WriteBitmapToFile (KernelBitmap *pKernelBitmap, double Dpi) |
Physically put the bitmap into the disk. | |
virtual BOOL | WriteDataToFile (BOOL End, UINT32 Bpp, UINT32 Compression) |
Physically put the bitmap into the disk. NOTE - ONLY COPES WITH End=TRUE currently End is ignored now and should always be set to TRUE. | |
BOOL | ExportViaAccusoftFilters () |
Function to see if we should export via Accusoft filters or not as we cannot cope with this format. | |
virtual BOOL | GetRenderBottomToTop () |
Find out which way we need to render. | |
Static Protected Member Functions | |
static BOOL | EndWriteDataToFile () |
Actually does the job of cleaning up after writing the bitmap data out to a file. Usually called by EndWriteToFile. | |
Protected Attributes | |
INT32 | BMPHowCompatible |
Static Protected Attributes | |
static OutputDIB | DestDIB |
Private Member Functions | |
CC_DECLARE_DYNAMIC (BMPFilter) |
Definition at line 179 of file bmpfiltr.h.
|
Constructor for an BMPFilter object. The object should be initialised before use.
Definition at line 605 of file bmpfiltr.cpp. 00605 : BaseBitmapFilter() 00606 { 00607 ImportMsgID = _R(IDT_IMPORTMSG_BMP); 00608 00609 #ifndef STANDALONE 00610 Flags.CanImport = TRUE; 00611 Flags.CanExport = TRUE; 00612 #else 00613 Flags.CanImport = TRUE; 00614 Flags.CanExport = FALSE; 00615 #endif 00616 00617 FilterID = FILTERID_BMP; 00618 00619 ExportRegion = NULL; 00620 ExportMsgID = _R(IDT_EXPORTMSG_BMP); 00621 00622 ExportingMsgID = _R(IDT_EXPORTMSG_BMP); 00623 }
|
|
Reimplemented from BaseBitmapFilter. Definition at line 1553 of file bmpfiltr.cpp. 01554 { 01555 DestDIB.AlterExportPalette( pPalette ); 01556 }
|
|
|
|
Allows the filter to clean up any allocated resources.
Reimplemented from BaseBitmapFilter. Definition at line 1544 of file bmpfiltr.cpp. 01545 { 01546 // call the base filter first 01547 BaseBitmapFilter::CleanUpAfterExport(); 01548 01549 WrittenHeader = FALSE; 01550 }
|
|
Allows derived classes to override this function to provide their own class derived from BitmapExportInfo containing filter specific information.
Reimplemented from BaseBitmapFilter. Definition at line 1525 of file bmpfiltr.cpp. 01526 { 01527 BMPExportOptions* pExportOptions = new BMPExportOptions(BMP_UNCOMPRESSED, &FilterName); 01528 01529 return (BitmapExportOptions*)pExportOptions; 01530 }
|
|
Actually does the job of cleaning up after writing the bitmap data out to a file. Usually called by EndWriteToFile.
Definition at line 1246 of file bmpfiltr.cpp. 01247 { 01248 #ifdef DO_EXPORT 01249 if (GeneratingOptimisedPalette()) 01250 return TRUE; // No need to output anything 01251 01252 return DestDIB.TidyUp(); 01253 #else 01254 return FALSE; 01255 #endif 01256 }
|
|
Cleans up after writing the bitmap data out to a file. Inherited classes override this to write in different file formats.
Reimplemented from BaseBitmapFilter. Definition at line 1051 of file bmpfiltr.cpp. 01052 { 01053 #ifdef DO_EXPORT 01054 // Must use the same check here and trasnfer the clean up process to the same filter 01055 // that we used to actually write the data to the file 01056 if ( ExportViaAccusoftFilters() ) 01057 #ifndef WEBSTER 01058 PORTNOTE("ExtFilt", "Removed use of external filters") 01059 #ifndef EXCLUDE_FROM_XARALX 01060 return AccusoftFilters::EndWriteDataToFile(); 01061 #else 01062 return FALSE; 01063 #endif 01064 #else 01065 //WEBSTER-Martin-07/01/97 01066 return FALSE; 01067 #endif //WEBSTER 01068 else 01069 return EndWriteDataToFile(); 01070 #else 01071 return FALSE; 01072 #endif 01073 }
|
|
Function to see if we should export via Accusoft filters or not as we cannot cope with this format.
Definition at line 937 of file bmpfiltr.cpp. 00938 { 00939 #ifdef DO_EXPORT 00940 // Check if Accusoft filters are present 00941 // 8 and 4 as we cannot export as RLE in these formats 00942 #ifndef WEBSTER 00943 PORTNOTE("ExtFilt", "Removed use of external filters") 00944 #ifndef EXCLUDE_FROM_XARALX 00945 return (DefaultExportDepth==8 || DefaultExportDepth==4 || DefaultExportDepth==1) && 00946 (AccusoftFilters::GetVersionNumber() > 0); 00947 #else 00948 return FALSE; 00949 #endif 00950 #else 00951 //WEBSTER-Martin-07/01/97 00952 return FALSE; 00953 #endif //WEBSTER 00954 #else 00955 return FALSE; 00956 #endif 00957 }
|
|
Determine if this filter can load the specified file.
Definition at line 1359 of file bmpfiltr.cpp. 01360 { 01361 return BMPHowCompatible; 01362 }
|
|
Allows a default export dots per inch size to be remembered when exporting either as a BMP or via the Accusoft loaders. Allows a default export bits per pixel amount to be remembered when exporting either as a BMP or via the Accusoft loaders. Allows other bitmap export filters to get at this value. Needs to be here rather than in BaseBitmapFilter as that Init is never used.
Definition at line 518 of file bmpfiltr.cpp. 00519 { 00520 return DefaultExportDepth; 00521 }
|
|
Definition at line 583 of file bmpfiltr.cpp. 00584 { 00585 return DefaultExportDither; 00586 }
|
|
Allows other bitmap export filters to get at this value. Needs to be here rather than in BaseBitmapFilter as that Init is never used.
Definition at line 538 of file bmpfiltr.cpp. 00539 { 00540 return DefaultExportDPI; 00541 }
|
|
See BaseBitmapClass for interface details Notes: Initializes BMP specific members Scope: Protected.
Reimplemented from BaseBitmapFilter. Reimplemented in PreviewFilterBMP. Definition at line 812 of file bmpfiltr.cpp. 00813 { 00814 #ifdef DO_EXPORT 00815 ERROR2IF(pOptions == NULL, FALSE, "NULL Args"); 00816 00817 BMPExportOptions* pBMPOptions = (BMPExportOptions*)pOptions; 00818 ERROR3IF(!pBMPOptions->IS_KIND_OF(BMPExportOptions), "pBMPOptions isn't"); 00819 00820 WrittenHeader = FALSE; 00821 00822 // Set up the variables which the export dialog box uses 00823 UINT32 BitmapDepth = 0; 00824 if (pBMPOptions->GetSelectionType() == ABITMAP) 00825 { 00826 // Exporting the bitmap itself 00827 // dpi should be set to the dpi of the bitmap itself 00828 BitmapDepth = pBMPOptions->GetDepth(); 00829 } 00830 00831 // Determine the filter type currently in use in Accusoft format 00832 // INT32 FilterID = BMP_UNCOMPRESSED; 00833 00834 // Sets the Accusoft filter type to the same specified value just in case 00835 // we wish to use the Accusoft DLL to do some of the BMP saving for us 00836 //WEBSTER-Martin-07/01/97 00837 #ifndef WEBSTER 00838 PORTNOTE("ExtFilt", "Removed use of external filters") 00839 #ifndef EXCLUDE_FROM_XARALX 00840 AccusoftFilters::SetFilterType(BMP_UNCOMPRESSED); 00841 #endif 00842 #endif 00843 00844 // When saving a bitmap directly then only use the dialog box for 8 and 4 bpp export 00845 // as these are the only forms that can request a compression type. 00846 // Otherwise, always use it. 00847 BOOL Ok = TRUE; 00848 if ( pBMPOptions->GetSelectionType() != ABITMAP ) 00849 { 00850 // This is ok as we are using a modal dialog box 00851 00852 OpDescriptor* pOpDes = OpDescriptor::FindOpDescriptor(OPTOKEN_GIFTABDLG); 00853 if (pOpDes != NULL) 00854 { 00855 // set up the data for the export options dialog 00856 OpParam Param((void *)pOptions, (void *)this); 00857 00858 // invoke the dialog 00859 pOpDes->Invoke(&Param); 00860 00861 // SMFIX 00862 // we have brought the dlg up so get the options from the dlg as the graphic type may have changed 00863 PORTNOTE("BmpPrevDlg", "Removed use of bitmap preview dialog") 00864 #ifndef EXCLUDE_FROM_XARALX 00865 pOptions = BmapPrevDlg::m_pExportOptions; 00866 00867 // check for valid options 00868 //Ok = pOptions->IsValid(); 00869 00870 // This line decides if we will create a file on disk for the bmp or not 00871 Ok = BmapPrevDlg::m_bClickedOnExport; 00872 #else 00873 pOptions = NULL; 00874 Ok = FALSE; 00875 #endif 00876 } 00877 else 00878 { 00879 ERROR3("Unable to find OPTOKEN_BMAPPREVDLG"); 00880 Ok = FALSE; 00881 } 00882 } 00883 00884 // Return with the ok/cancel state used on the dialog box 00885 return Ok; 00886 00887 #else 00888 return FALSE; 00889 #endif 00890 }
|
|
Reimplemented from BaseBitmapFilter. Definition at line 198 of file bmpfiltr.h. 00198 { return BMP_UNCOMPRESSED; }
|
|
Find out which way we need to render.
Reimplemented from BaseBitmapFilter. Definition at line 972 of file bmpfiltr.cpp. 00973 { 00974 // We may be exporting via the Accusoft filters but when rendering BMPs they are 00975 // the correct way round already. 00976 return TRUE; 00977 }
|
|
Determine if this filter can load the specified file.
Reimplemented from Filter. Definition at line 1277 of file bmpfiltr.cpp. 01279 { 01280 // We need to remember what we thought of this file in our class variable. 01281 // So, set it to a nice default value at the start. 01282 BMPHowCompatible = 0; 01283 01284 // Check that we've got enough data to do our check 01285 if (HeaderSize < sizeof(BITMAPFILEHEADER)) 01286 // Not enough data - ignore this file. 01287 return 0; 01288 01289 // Check the header for the "BM" signature, and a sensible image size. 01290 LPBITMAPFILEHEADER pHeader = (LPBITMAPFILEHEADER) HeaderStart; 01291 01292 if (pHeader->bfType != ( ('M'<<8) | 'B' ) ) 01293 // No BMP signature - we don't want this file. 01294 return 0; 01295 01296 // the other fields in the BITMAPFILEHEADER cannot be relied upon. The bfSize 01297 // field seems particularly random. We can check the size of the structure following 01298 // it though 01299 01300 const DWORD HdrSize = *(DWORD*)(HeaderStart + sizeof(BITMAPFILEHEADER) ); 01301 01302 // If the header is of the correct size then now see what we think of this bitmap 01303 // header that we have been given. Cope with old OS/2 style headers and more up 01304 // to date ones. 01305 // If the header was ok we used to just say 'we like it' immediately. What we want 01306 // to do now instead is only say we are really interested if it is special types of 01307 // BMP, such as 32bpp, if it is anything else then say we are less interested in it. 01308 // This should allow the Accusoft BMP filter to take over the loading of BMPs which 01309 // we do not support. 01310 // Pointer to the info header should be the next one after the file header 01311 INT32 FileCompatibility = 0; // default, didn't like this file value 01312 if ( 01313 (HdrSize==sizeof( BITMAPCOREHEADER )) // old OS/2 1.0 01314 ) 01315 { 01316 LPBITMAPCOREHEADER pCoreHeader = (LPBITMAPCOREHEADER)(pHeader+1); 01317 01318 if ( DIBUtil::CanReadFromFile(pCoreHeader) ) 01319 FileCompatibility = 10; 01320 else 01321 FileCompatibility = 9; 01322 } 01323 else if 01324 ( 01325 (HdrSize==sizeof( BITMAPINFOHEADER )) // Win 3.0+ 01326 ) 01327 { 01328 LPBITMAPINFOHEADER pInfoHeader = (LPBITMAPINFOHEADER)(pHeader+1); 01329 01330 // Use the function in DIBUtil to say if we like this file or not 01331 if ( DIBUtil::CanReadFromFile(pInfoHeader) ) 01332 FileCompatibility = 10; 01333 else 01334 FileCompatibility = 9; 01335 } 01336 01337 TRACEUSER( "Neville", _T("BMPFilter::HowCompatible FileCompatibility = %d\n"),FileCompatibility); 01338 // Remember what we thought in our class variable. 01339 BMPHowCompatible = FileCompatibility; 01340 01341 // Return the found value to the caller. 01342 return FileCompatibility; 01343 }
|
|
Initialise an BMPFilter object.
Reimplemented from BaseBitmapFilter. Reimplemented in PreviewFilterBMP. Definition at line 638 of file bmpfiltr.cpp. 00639 { 00640 // Get the OILFilter object 00641 pOILFilter = new BMPOILFilter(this); 00642 if (pOILFilter==NULL) 00643 return FALSE; 00644 00645 // Load the description strings 00646 FilterName.Load(_R(IDT_BMP_FILTERNAME)); 00647 FilterInfo.Load(_R(IDT_BMP_FILTERINFO)); 00648 00649 if (Camelot.DeclareSection(_T("Filters"), 10)) 00650 { 00651 // Requested that we don't store DPI for export (see bug 6757) 00652 // Camelot.DeclarePref( NULL, "ExportBitmapDPI", &DefaultExportDPI, 1.0, 3000.0 ); 00653 Camelot.DeclarePref( NULL, _T("ExportBitmapDepth"), &DefaultExportDepth, 1, 32 ); 00654 } 00655 00656 // All ok 00657 return TRUE; 00658 }
|
|
Check if this Bitmap filter can cope with saving at this Bpp/Colour depth.
Reimplemented from BaseBitmapFilter. Definition at line 1508 of file bmpfiltr.cpp.
|
|
Reimplemented from BaseBitmapFilter. Definition at line 897 of file bmpfiltr.cpp. 00898 { 00899 // should be of this type 00900 BMPExportOptions* pBMPOptions = (BMPExportOptions*)pOptions; 00901 ERROR3IF(!pBMPOptions->IS_KIND_OF(BMPExportOptions), "pBMPOptions isn't"); 00902 00903 // do the baseclass first 00904 BaseBitmapFilter::PostGetExportOptions(pOptions); 00905 00906 // do the filter specific stuff 00907 SetDepthToRender(pBMPOptions->GetDepth()); 00908 PaletteType = pBMPOptions->GetPalette() ? 1 : 0; // 1 for an optimised palette 00909 // Make sure that the Accusoft form of the stored dither is correctly set 00910 // as we may be calling this to do the exporting for us! 00911 //WEBSTER-Martin-07/01/97 00912 #ifndef WEBSTER 00913 PORTNOTE("ExtFilt", "Removed use of external filters") 00914 #ifndef EXCLUDE_FROM_XARALX 00915 AccusoftFilters::SetDitherToUse(pBMPOptions->GetDither()); 00916 //Mark Howitt, 24/10/97. Reset the FilterType as import uses FilterType as something else! 00917 AccusoftFilters::SetFilterType(pBMPOptions->GetFilterType()); 00918 #endif 00919 #endif 00920 }
|
|
Actually does the process of reading a bitmap from a file. Inherited classes override this to read in different file formats. It is used by the web/native filters to pull out a bitmap definition from inside a bitmap definition record. IsCompressed is only used for BMP/BMPZIP type bitmaps at present. Assumes: pFile has already been opened up for reading pFilter has been set up for reading the data e.g. progress bar.
Reimplemented from BaseBitmapFilter. Definition at line 685 of file bmpfiltr.cpp. 00687 { 00688 ERROR2IF(pOilBitmap == NULL,FALSE,"BMPFilter::ReadFromFile null OilBitmap pointer"); 00689 ERROR2IF(pFilter == NULL,FALSE,"BMPFilter::ReadFromFile null pFilter pointer"); 00690 ERROR2IF(pFile == NULL,FALSE,"BMPFilter::ReadFromFile null pFile pointer"); 00691 00692 // Try to import bitmap as usual binary BMP file. 00693 CWxBitmap* pWBitmap = (CWxBitmap*)pOilBitmap; 00694 00695 LPBITMAPINFO *pInfo = &(pWBitmap->BMInfo); 00696 LPBYTE *pBytes = &(pWBitmap->BMBytes); 00697 00698 if (IsCompressed) 00699 { 00700 // We want compression on so turn it on 00701 if (!pFile->SetCompression(TRUE)) 00702 return FALSE; 00703 } 00704 00705 // Read from file, no header and using pFilter for progress bar updates 00706 if (!DIBUtil::ReadFromFile(pFile, pInfo, pBytes, FALSE, NULL, pFilter)) 00707 return FALSE; 00708 00709 if (IsCompressed) 00710 { 00711 // We have finished with compression, so turn it off 00712 if (!pFile->SetCompression(FALSE)) 00713 return FALSE; 00714 } 00715 00716 // Everything went ok and we imported the bitmap ok 00717 return TRUE; 00718 }
|
|
Actually does the process of reading a bitmap from a file. Inherited classes override this to read in different file formats.
Reimplemented from BaseBitmapFilter. Definition at line 736 of file bmpfiltr.cpp. 00737 { 00738 ERROR2IF(pOilBitmap == NULL,FALSE,"BMPFilter::ReadFromFile null OilBitmap pointer"); 00739 00740 // Try to import bitmap as usual binary BMP file. 00741 // The only problem is that if the user has chosen to use the BMP filter explicitly 00742 // then this may not be what they really want. The BMP filter may not cope with all 00743 // BMP types, whereas we may possibly have an AccusoftFilter which might cope better. 00744 // If the user has not chosen explicitly then the BMP will be directed towards the 00745 // correct filter by the HowCompatible call. 00746 // Generally, if the filter has been chosen at this point then HowCompatible will have 00747 // been called and so we can ask the BMP filter what it found when asked this and use 00748 // this result to determine whether to load the file or not. 00749 00750 UINT32 ImportMsgId = GetImportMsgID(); 00751 String_64 ProgressString(ImportMsgId); 00752 00753 CCLexFile *pImportFile = GetImportFile(); 00754 ERROR2IF(pImportFile==NULL,FALSE,"BMPFilter::ReadFromFile - No import file"); 00755 00756 ProgressString = GetImportProgressString(pImportFile, ImportMsgId); 00757 00758 CWxBitmap* pWBitmap = (CWxBitmap*)pOilBitmap; 00759 00760 LPBITMAPINFO *pInfo = &(pWBitmap->BMInfo); 00761 LPBYTE *pBytes = &(pWBitmap->BMBytes); 00762 00763 PORTNOTE("ExtFilt", "Removed use of external filters") 00764 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX) 00765 #ifndef WEBSTER 00766 if ( 00767 (GetBmpCompatibility() == 10) || (AccusoftFilters::GetVersionNumber() == 0) 00768 ) 00769 { 00770 // The BMP filter liked it very much and so use it, showing progress bar 00771 if (!DIBUtil::ReadFromFile(pImportFile, pInfo, pBytes, TRUE, &ProgressString)) 00772 return FALSE; 00773 } 00774 else 00775 { 00776 // The BMP filter was not totally sure about that file and so we should try and 00777 // see if the Accusoft loader is present and if so give this an attempt at 00778 // loading that file. 00779 // Get a cast version of a pointer to the filter 00780 PORTNOTE("ExtFilt", "Removed use of external filters") 00781 #ifndef EXCLUDE_FROM_XARALX 00782 if (!AccusoftFilters::ReadFromFile(pImportFile, pInfo, pBytes, TRUE, &ProgressString)) 00783 return FALSE; 00784 #endif 00785 } 00786 #else //WEBSTER 00787 //WEBSTER-Martin-07/01/97 all we can do is try to read it 00788 if (!DIBUtil::ReadFromFile(pImportFile, pInfo, pBytes, TRUE, &ProgressString)) 00789 return FALSE; 00790 #endif //WEBSTER 00791 #else //EXCLUDE_FROM_RALPH 00792 if (!DIBUtil::ReadFromFile(pImportFile, pInfo, pBytes, TRUE, &ProgressString)) 00793 return FALSE; 00794 #endif //EXCLUDE_FROM_RALPH 00795 00796 // Everything went ok and we imported the bitmap ok 00797 SetLastBitmap(); // can only import one bitmap at the moment 00798 return TRUE; 00799 }
|
|
Allows other bitmap export filters to set this value. Needs to be here rather than in BaseBitmapFilter as that Init is never used.
Definition at line 558 of file bmpfiltr.cpp. 00559 { 00560 DefaultExportDepth = Depth; 00561 }
|
|
Definition at line 588 of file bmpfiltr.cpp. 00589 { 00590 DefaultExportDither = Dither; 00591 }
|
|
Allows other bitmap export filters to set this value. Needs to be here rather than in BaseBitmapFilter as that Init is never used.
Definition at line 578 of file bmpfiltr.cpp. 00579 { 00580 DefaultExportDPI = DPI; 00581 }
|
|
Physically put the bitmap into the disk. Inherited classes override this to write in different file formats. This is used by the native/web format to output the actual bitmap data content of a bitmap definition record. The function can assume that the CCFile is open and ready for writing and must use the functions provided by pFilter to update the progress system.
Reimplemented from BaseBitmapFilter. Definition at line 1452 of file bmpfiltr.cpp. 01454 { 01455 #ifdef DO_EXPORT 01456 ERROR2IF(pKernelBitmap == NULL,FALSE, "BMPFilter::WriteBitmapToFile null pKernelBitmap"); 01457 ERROR2IF(pFilter == NULL,FALSE, "BMPFilter::WriteBitmapToFile null pFilter"); 01458 ERROR2IF(pFile == NULL,FALSE, "BMPFilter::WriteBitmapToFile null pFile"); 01459 01460 // Get a pointer to the actual bitmap so that we can get some details from it. 01461 OILBitmap *pOilBitmap = pKernelBitmap->ActualBitmap; 01462 ERROR2IF(pOilBitmap == NULL,FALSE,"BMPFilter::WriteBitmapToFile null oil bitmap pointer"); 01463 01464 // Now get the pointer to the info header and actual bits data. 01465 // Need to use the actual bitmap pointer 01466 CWxBitmap* pWBitmap = (CWxBitmap*)pOilBitmap; 01467 LPBITMAPINFO Info = pWBitmap->BMInfo; 01468 LPBYTE Bytes = pWBitmap->BMBytes; 01469 // UINT32 Bpp = pWBitmap->GetBPP(); 01470 01471 // Now, save the data out showing the correct progress string 01472 BOOL ok = FALSE; 01473 01474 // We never worry about compresion of bmps for the present moment 01475 // Just changed that so we zlib the bitmaps 01476 // Start up the compressor 01477 BOOL Ok = pFile->InitCompression(); 01478 if (!Ok) 01479 return FALSE; 01480 // Now start the compression 01481 pFile->SetCompression(TRUE); 01482 01483 // Write to file, no header and using pFilter for progress bar updates 01484 ok = DIBUtil::WriteToFile(pFile, Info, Bytes, NULL, FALSE, pFilter); 01485 01486 // Now that we have finished, close the compressor down 01487 pFile->SetCompression(FALSE); 01488 01489 return ok; 01490 #else 01491 return FALSE; 01492 #endif 01493 }
|
|
Physically put the bitmap into the disk.
Reimplemented from BaseBitmapFilter. Definition at line 1378 of file bmpfiltr.cpp. 01379 { 01380 #ifdef DO_EXPORT 01381 ERROR2IF(pKernelBitmap == NULL,FALSE,"BMPFilter::WriteBitmapToFile null bitmap pointer specified"); 01382 01383 // Get a pointer to the actual bitmap so that we can get some details from it. 01384 OILBitmap *pOilBitmap = pKernelBitmap->ActualBitmap; 01385 ERROR2IF(pOilBitmap == NULL,FALSE,"BMPFilter::WriteBitmapToFile null oil bitmap pointer"); 01386 01387 // Now get the pointer to the info header and actual bits data. 01388 // Need to use the actual bitmap pointer 01389 CWxBitmap* pWBitmap = (CWxBitmap*)pOilBitmap; 01390 LPBITMAPINFO Info = pWBitmap->BMInfo; 01391 LPBYTE Bytes = pWBitmap->BMBytes; 01392 01393 // Now, save the data out showing the correct progress string 01394 String_64 ProgressString(ExportingMsgID); 01395 BOOL ok = FALSE; 01396 // If the user has chosen a compressed BMP then we must use the Accusoft code, 01397 // if it is present as the built in one cannot do RLE compression. 01398 //WEBSTER-Martin-07/01/97 01399 #ifndef WEBSTER 01400 PORTNOTE("ExtFilt", "Removed use of external filters") 01401 #ifndef EXCLUDE_FROM_XARALX 01402 BOOL Compression = FALSE; 01403 UINT32 Bpp = pWBitmap->GetBPP(); 01404 if ( 01405 (DefaultExportCompression && (Bpp == 4)) || 01406 (DefaultExportCompression && (Bpp == 8)) 01407 ) 01408 01409 { 01410 // Set Compression TRUE and force the Accusoft filter type to be compressed. 01411 Compression = TRUE; 01412 AccusoftFilters::SetFilterType(BMP_COMPRESSED); 01413 AccusoftFilters::SetExportDpi(TheDpi); 01414 } 01415 01416 if ( Compression && (AccusoftFilters::GetVersionNumber() > 0) ) 01417 ok = AccusoftFilters::WriteToFile(OutputFile, Info, Bytes, &ProgressString); 01418 else 01419 #endif 01420 #endif //WEBSTER 01421 ok = DIBUtil::WriteToFile(OutputFile, Info, Bytes, &ProgressString); 01422 01423 return ok; 01424 #else 01425 return FALSE; 01426 #endif 01427 }
|
|
Physically put the bitmap into the disk. NOTE - ONLY COPES WITH End=TRUE currently End is ignored now and should always be set to TRUE.
Definition at line 1093 of file bmpfiltr.cpp. 01094 { 01095 #ifdef DO_EXPORT 01096 if (GeneratingOptimisedPalette()) 01097 return TRUE; // No need to output anything 01098 01099 01100 BMPExportOptions* pBMPOptions = (BMPExportOptions*)GetBitmapExportOptions(); 01101 ERROR2IF(pBMPOptions == NULL, FALSE, "NULL Args"); 01102 ERROR3IF(!pBMPOptions->IS_KIND_OF(BMPExportOptions), "pBMPOptions isn't"); 01103 01104 LPBITMAPINFO lpBitmapInfo; 01105 LPBYTE lpBits; 01106 01107 // Get the bitmap data from the Render Region 01108 ExportRegion->GetBitmapData(&lpBitmapInfo, &lpBits); 01109 01110 ERROR3IF(lpBitmapInfo == NULL, "Bitmap has no info in BMPFilter::WriteDataToFile"); 01111 if (lpBitmapInfo == NULL) 01112 return FALSE; 01113 01114 ERROR3IF(lpBits == NULL, "Bitmap has no data in BMPFilter::WriteDataToFile"); 01115 if (lpBits == NULL) 01116 return FALSE; 01117 01118 // First time through, lets write out a suitable header. 01119 // As we write it in one big chunk (currently), its easy 01120 // If we are rendering in strips then the bitmap information in the render region will 01121 // be set for the height of the strip and not the height of the entire bitmap. 01122 if (!WrittenHeader) 01123 { 01124 WrittenHeader = TRUE; 01125 01126 LPBITMAPINFO lpInfo = lpBitmapInfo; 01127 LPLOGPALETTE lpPalette = NULL; 01128 ERROR2IF(lpInfo==NULL,FALSE,"BMPFilter::WriteDataToFile null export region bitmap"); 01129 01130 // Set up some useful variables giving details on the bitmap to save 01131 const UINT32 OutputDepth = Bpp; 01132 // First, get the size of the bitmap we are going to export not just the simple 01133 // lpInfo->bmiHeader.biHeight as this might just be the height of the first 01134 // strip to be exported. With the width we can use the old method. 01135 // const UINT32 OutputWidth = lpInfo->bmiHeader.biWidth; 01136 const UINT32 OutputHeight = (INT32)ExportRegion->GetFullRegionHeight(); 01137 TRACEUSER( "Neville", _T("BMPFilter::WriteDataToFile Total output height = %d\n"),OutputHeight); 01138 TRACEUSER( "Neville", _T("BMPFilter::WriteDataToFile height of 1st strip = %d\n"),lpInfo->bmiHeader.biHeight); 01139 01140 if (OutputDepth==8 || OutputDepth==4 || OutputDepth==1 ) 01141 { 01142 // SMFIX 01143 lpPalette = pBMPOptions->GetLogicalPalette(); 01144 01145 /* 01146 if (pOptimisedPalette) 01147 { 01148 lpPalette = pOptimisedPalette; 01149 TRACEUSER( "Will", _T("BMP filter is using an Optimised Palette\n")); 01150 } 01151 else 01152 { 01153 GDrawContext *GDC = GRenderRegion::GetDrawContext(); 01154 // In the 4 or 1 bpp this will not necessarily be the palette that we 01155 // should export with as it will just be the default 8bpp palette. 01156 // Must tell it what depth (BPP) we want. The other information is superfluous 01157 // at present as this should be called again when the info is correct. 01158 GDC->SetupBitmap(OutputWidth, OutputHeight, OutputDepth, NULL ); 01159 01160 // WEBSTER - markn 8/2/97 01161 // Centralised the palette creation code for all bitmap filters 01162 lpPalette = Create8bppPalette(); 01163 01164 if (OutputDepth == 1) 01165 { 01166 // The easy one, I think black and white might be the correct choice here! 01167 OutputDIB::FixBlackAndWhitePalette(lpPalette); 01168 } 01169 else if (OutputDepth == 4) 01170 { 01171 // Bit more tricky this one, Gavin uses a fixed 16 colour palette 01172 OutputDIB::Fix16ColourPalette(lpPalette); 01173 } 01174 } 01175 */ 01176 } 01177 01178 // Set up the compression flag only if the output depth is correct 01179 UINT32 Compress = BI_RGB; 01180 if (OutputDepth==4 && Compression) 01181 Compress = BI_RLE4; 01182 if (OutputDepth==8 && Compression) 01183 Compress = BI_RLE8; 01184 01185 if (!DestDIB.StartFile( OutputFile, 01186 &lpInfo->bmiHeader, // pointer to BITMAPINFOHEADER 01187 lpPalette, 01188 01189 OutputDepth, // actual file depth 01190 Compress, // compression (BI_RGB = none) 01191 OutputHeight, // all of it 01192 01193 SizeOfExport, // progress bar size 01194 FALSE, 01195 pBMPOptions->GetDither() ) 01196 ) 01197 { 01198 // if (lpPalette != pOptimisedPalette) 01199 // CCFree(lpPalette); 01200 01201 return FALSE; 01202 } 01203 01204 // if (lpPalette != pOptimisedPalette) 01205 // CCFree(lpPalette); 01206 } 01207 01208 01209 if (!End) 01210 { 01211 ENSURE(FALSE, "WriteToFile cannot do segmented writes"); 01212 return FALSE; 01213 } 01214 01215 // now lets write out our block 01216 const UINT32 StripHeight = lpBitmapInfo->bmiHeader.biHeight; 01217 if (!DestDIB.WriteBlock( 0, // Ypos 01218 StripHeight, // height of this strip 01219 lpBits, // pointer to actual bitmap data 01220 32, // input bpp 01221 ProgressOffset // value to add to progress bar updats 01222 ) 01223 ) 01224 return FALSE; 01225 01226 // Add in the height of the strip that we have just exported to the progress offset value 01227 ProgressOffset += StripHeight; 01228 01229 #endif 01230 return TRUE; 01231 }
|
|
Physically put the bitmap into the disk. NOTE - ONLY COPES WITH End=TRUE currently Most of the work now is down by WriteDataToFile as this is a static form and there is a similar version in the Accusoft DLL. This can therefore be used to pass work onto the Accusoft DLL, for the cases we don't cope with. End is ignored now and should always be set to TRUE.
Reimplemented from BaseBitmapFilter. Definition at line 997 of file bmpfiltr.cpp. 00998 { 00999 #ifdef DO_EXPORT 01000 // Functionality transferred to new static function so that we can share 01001 // the work between this built in BMP filter and the external Accusoft DLL. 01002 // if we are at the low depths of the bpp range then use the Accusoft DLL as on 01003 // 8 and 4 bpp the user may have chosen RLE compression and this filter cannot 01004 // cope with that. 01005 // Of course, only use the Accusoft DLL if it is present. 01006 if ( ExportViaAccusoftFilters() ) 01007 #ifndef WEBSTER 01008 { 01009 PORTNOTE("ExtFilt", "Removed use of external filters") 01010 #ifndef EXCLUDE_FROM_XARALX 01011 // Graeme (26-1-00) - I've added a call to the static SetFilterType method in the 01012 // AccusoftFilters class to set up the bitmap type to be an uncompressed bitmap. 01013 // This line isn't strictly necessary - the filter contains code to catch an unset 01014 // FilterType value, and set it to BMP_UNCOMPRESSED, but there potentially could be 01015 // problems if a JPEG or GIF value is passed in. Besides, it stops Camelot from 01016 // throwing an error message in debug builds, which adds just a little polish. 01017 AccusoftFilters::SetFilterType ( BMP_UNCOMPRESSED ); 01018 01019 return AccusoftFilters::WriteDataToFile ( End, DefaultExportDepth, 01020 DefaultExportCompression, 01021 GetBitmapExportOptions()); 01022 #else 01023 return FALSE; 01024 #endif 01025 } 01026 #else 01027 //WEBSTER-Martin-07/01/97 01028 return FALSE; 01029 #endif 01030 else 01031 return WriteDataToFile(End, DefaultExportDepth, DefaultExportCompression); 01032 #else 01033 return FALSE; 01034 #endif 01035 }
|
|
Definition at line 227 of file bmpfiltr.h. |
|
Definition at line 224 of file bmpfiltr.h. |