Пример #1
0
/********************************************************************************************

>	BOOL PNGFilter::EndWriteToFile( )

	Author:		Neville_Humphrys (Xara Group Ltd) <*****@*****.**>
	Created:	14/5/96
	Inputs:		-
	Purpose:	Cleans up after writing the bitmap data out to a file. Inherited classes
				override this to write in different file formats.
				This is slightly different to most other bitmap filters in that it is here
				that the data actually gets written out to file, after doing the transparency
				translation, if required.
	Returns:	TRUE if worked, FALSE if failed.

********************************************************************************************/
BOOL PNGFilter::EndWriteToFile()
{
	if (GeneratingOptimisedPalette())
		return TRUE;		// No need to output anything

	//  Can reset the band number now.
	m_BandNumber = 0;

	PNGExportOptions* pPNGOptions = (PNGExportOptions*)GetBitmapExportOptions();
	ERROR2IF(pPNGOptions == NULL, FALSE, "NULL Args");
	ERROR3IF(!pPNGOptions->IS_KIND_OF(PNGExportOptions), "pPNGOptions isn't");

	// Do the transparency translation just before we write out the data as a PNG.
	// This involves doing a 1 bpp export of the same area and using this to work
	// out which areas are transparent or not.
	// Only do this if the user has requested transparency and we outputting at 8bpp
	BOOL ok = TRUE;
	BOOL SaveDataOut = TRUE;

	if (BadExportRender)
	{
		// Delete our whitearea bitmap
		if (pTempBitmapMask != NULL)
			CCFree(pTempBitmapMask);

		pTempBitmapMask = NULL;
	}

	// Save the data out if required. Only if we exported ok.
	if (SaveDataOut && !BadExportRender)
	{
		if (ok)
		{
			// Now that we know the transparent index we can output the PNG header
			ok = DestPNG.OutputPNGHeader(OutputFile, NULL, pPNGOptions->WantInterlaced(),
										pPNGOptions->GetTransparencyIndex(),
										pPNGOptions->GetDepth() <= 8 ? pPNGOptions->GetLogicalPalette() : NULL);
		}

		// Actually write the destination bitmap out to the file showing an hourglass
		// and/or progress bar as we go. Always show the Exporting message.
		// Need to do in one go due to interlacing
		if (ok)
		{
			String_64 ProgressString(ExportingMsgID);
			ProgressString = GetExportProgressString(OutputFile, ExportingMsgID);
			BeginSlowJob(100, FALSE, &ProgressString);
			
			DestPNG.OutputPNGBits(OutputFile, DestPNG.GetDestBitmapBits());
			
			EndSlowJob();
		}
	}

	ASSERT(ok);
	
	return DestPNG.TidyUp();
}
Пример #2
0
/*******************************************************************************************

  > BOOL BitmapPreviewData::GenerateHTMLStub(BrowserPreviewOptions BrowserOptions)
  
	Author: 	Stefan_Stoykov (Xara Group Ltd) <*****@*****.**> 
	Created:	24/6/97
	Inputs: 	BrowserOptions - the options for generating the html page
	Purpose:	Generate a html file which includes our bitmap, together with some other optional 
				stuff. Used for browser preview.
				
*******************************************************************************************/
BOOL BitmapPreviewData::GenerateHTMLStub(BrowserPreviewOptions BrowserOptions)
{
PORTNOTE("other","Removed _R(IDD_TIMAPOPTIONS) - isn't wanted yet")
#ifndef EXCLUDE_FROM_XARALX
	// sanity checks
	
	// check for export options
	
	ERROR3IF(m_pOptions == NULL, "BitmapPreviewData::GenerateHTMLStub - need export options");
	if (m_pOptions == NULL) // we need export options
		return FALSE;
	
	// get the path for the exported bitmap from the options
	PathName TempPath = m_pOptions->GetPathName();
	
	// check for exported bitmap
	ERROR3IF((m_pOptions->HasTempFile() == FALSE) || (TempPath.IsValid() == FALSE), 
		"BitmapPreviewData::GenerateHTMLStub - need exported bitmap");
	if ((m_pOptions->HasTempFile() == FALSE) || (TempPath.IsValid() == FALSE)) 
		return FALSE;
	
	// delete the previous temp file, if any
	if (m_pTempHTMLPath != NULL)
		FileUtil::DeleteFile(m_pTempHTMLPath);
	else
		m_pTempHTMLPath = new PathName;
	
	// safety check
	if (m_pTempHTMLPath == NULL)
		return FALSE;
	
	// create a new temp file 
	if (FileUtil::GetTemporaryPathName( _T("htm"),m_pTempHTMLPath) == FALSE)
	{
		delete m_pTempHTMLPath;
		m_pTempHTMLPath = NULL;
		
		return FALSE;
	}
	
	// start creating the html page
	
	// create a disk file
	CCDiskFile TempDiskFile(1024, FALSE, TRUE);
	
	// get path name to server, so we can find the logo bitmaps
	CString str;
	AfxGetModuleShortFileName(AfxGetInstanceHandle(), str);
	String_256 strPathName(str.GetBuffer(0));
	
	// create a path name object from the program name
	PathName ProgramPath(strPathName);
	
	try
	{
		// open it for reading
		if (!TempDiskFile.open(*m_pTempHTMLPath, ios::out))
			return FALSE;
		
		// output header
		String_256 s(_R(IDS_HTML_HEAD));
		TempDiskFile.write(s);
		
		// set the background attributes
		switch (BrowserOptions.m_Background)
		{
		case BROWSER_BGR_DOC:
			{
				// set the background from the document page
				if (!SetBackgroundFromPage(TempDiskFile, BrowserOptions.m_pSpread))
					ERROR3("Setting the html background from the document page failed\n");
			}
			break;
			
		case BROWSER_BGR_CHECKER:
			{
				// display the checkered bitmap as background
				
				// get the checkered bitmap name
				String_256 Checker(_R(IDS_HTML_CHECKER));
				
				// set it in the path
				ProgramPath.SetFileNameAndType(Checker);
				
				// set the checkered bitmap as background image
				s.MakeMsg(_R(IDS_CHECK_BACK), (TCHAR *)ProgramPath.GetWebAddress());
				TempDiskFile.write(s);
			}
			break;
			
		case BROWSER_BGR_BITMAP:
			{
				// set our bitmap as background image
				s.MakeMsg(_R(IDS_BITMAPED_BACKGROUND), (TCHAR *)TempPath.GetWebAddress());
				TempDiskFile.write(s);
				
				
			}
			break;
			
		case BROWSER_BGR_NONE:
			{
				String_256 background(_R(IDS_PLAIN_BACKGROUND));
				TempDiskFile.write(background);
			}
			
			break;
			
		default:
			ERROR3("Unknown type of BrowserOptions.m_Background");
			break;
		} // end of switch(BrowserOptions.m_Background) block
		
		// Get a pointer to the actual bitmap so that we can get some details from it.
		//		OILBitmap *pOilBitmap = m_pBitmap->ActualBitmap;
		//		ERROR3IF(pOilBitmap == NULL,"BitmapPreviewData::GenerateBitmapInfoStrings NULL oil bitmap pointer");
		
		// Get the details from the specified bitmap
		//		BitmapInfo BmInfo;
		//		pOilBitmap->GetInfo(&BmInfo);
		
		// output our bitmap, but only if it wasn't already set as background
		String_256 s2(_R(IDS_PAGE_TITLE));
		TempDiskFile.write(s2);
		
		if (BrowserOptions.m_Background != BROWSER_BGR_BITMAP)
		{
			// output the bitmap
			
			if (m_pOptions->GetFilterType() == MAKE_BITMAP_FILTER)
			{
				// GIF animation
				s.MakeMsg(_R(IDS_DISPLAY_PIC), (const TCHAR *)TempPath.GetFileName());
			}
			else
			{
				if( m_pOptions->GetFilterNameStrID() == _R(IDN_FILTERNAME_GIF) ||
					m_pOptions->GetFilterNameStrID() == _R(IDS_JPG_EXP_FILTERNAME) ||
					m_pOptions->GetFilterNameStrID() == _R(IDT_FILTERNAME_BMP) )
				{
					s.MakeMsg(_R(IDS_DISPLAY_BMP), (const TCHAR *)TempPath.GetFileName());
				}
				else
				if( m_pOptions->GetFilterNameStrID() == _R(IDS_FILTERNAME_PNG) )
					s.MakeMsg(_R(IDS_DISPLAY_PNG), (const TCHAR *)TempPath.GetFileName());
			}	
			
			TempDiskFile.write(s);
		}
		else
		{
			s.MakeMsg(_R(IDS_EMPTY_BOX));
			TempDiskFile.write(s);
			
		}
		
		switch (m_pOptions->GetFilterNameStrID())
		{
		case _R(IDT_FILTERNAME_BMP):
			s2.MakeMsg(_R(IDS_BMP_MESSAGE));
			s.MakeMsg(_R(IDS_WARNING_BOX), (TCHAR *)s2);
			TempDiskFile.write(s);
			break;
		case _R(IDS_FILTERNAME_PNG):
			s2.MakeMsg(_R(IDS_PNG_MESSAGE));
			s.MakeMsg(_R(IDS_WARNING_BOX), (TCHAR *)s2);
			TempDiskFile.write(s);
			break;
		} // end of switch(m_pOptions->GetFilterNameStrID())
		
		s.MakeMsg(_R(IDS_DETAILS_BUILD));
		TempDiskFile.write(s);
		
		// output the bitmap info, if requested
		if (BrowserOptions.m_bInfo != FALSE)
		{
			String_64 ImageSize;
			String_64 FileSize;
			BOOL m_bTransparent = FALSE;
			INT32 count;
			count=0;
			// generate the info strings
			
			if (m_pOptions->GetFilterType() == MAKE_BITMAP_FILTER)
			{
				// This is actually the export animated GIF using the frame gallery system
				MakeBitmapExportOptions* pMkBOptions = (MakeBitmapExportOptions*)m_pOptions;
				ERROR3IF(!pMkBOptions->IS_KIND_OF(MakeBitmapExportOptions), "pMkBOptions isn't");
				
				PALETTE Palette = PAL_OPTIMISED;
				DITHER DitherType;
				UINT32 colDepth;
				String_64 sPalette;
				String_64 Dither;
				UINT32 NoOfColours;
				
				NoOfColours=m_pOptions->GetNumColsInPalette();
				//						Palette = pMkBOptions->GetPalette();
				DitherType = pMkBOptions->GetDither();
				colDepth = pMkBOptions->GetDepth();
				
				s2.MakeMsg(_R(IDS_ANIMATED_GIF));
				
				if (pMkBOptions->WantTransparent())
				{
					s2.MakeMsg(_R(IDS_TRANSPARENT),"animated GIF");
				}
				
				s.MakeMsg(_R(IDS_TEXTLINE_BR),(const TCHAR*)s2);
				TempDiskFile.write(s);
				
				switch (Palette)
				{
				case PAL_OPTIMISED:
					sPalette.MakeMsg(_R(IDS_OPTIMISED_PAL));
					break;
				case PAL_BROWSER:
				case PAL_STANDARD:
					sPalette.MakeMsg(_R(IDS_BROWSER_PAL));
					break;
				case PAL_GLOBALOPTIMISED:
					sPalette.MakeMsg(_R(IDS_GLOBAL_OPT));
					break;
					
				}
				
				if (colDepth == 8 && (Palette == PAL_STANDARD || Palette == PAL_BROWSER) )
				{
					NoOfColours = 216;
				}
				
				switch (colDepth)
				{
				case 32:
				case 24:
					s2.MakeMsg(_R(IDS_TRUECOLOUR),colDepth);
					break;
				case 8:
					{
						// Include the transparent colour in the colour depth check
						UINT32 RealNumberOfColours = NoOfColours;
						if (colDepth <= 8 && pMkBOptions->WantTransparent())
						{
							UINT32 MaxColours = UINT32(pow(2,colDepth));
							RealNumberOfColours++;
							if (RealNumberOfColours > MaxColours)
								RealNumberOfColours = MaxColours;
						}
						// We say 8 but we really mean the number of colours deep
						// We cannot say 2 colours = 2bpp as we save it as 10 colours due
						// to having 1 transparent colour and the usual lets pick 10 as the
						// transparent colour. Cannot allow the user to choose 1 as the code
						// then outputs 8bpp as GRenderOptPalette::GetOptimisedPalette has the
						// test if (ReservedColours < NumColours), which fails.
						/* if (RealNumberOfColours <= 2)
						s2.MakeMsg(_R(IDS_PALETTEINFO),2,NoOfColours,(const TCHAR*)sPalette);
						else */
						if (RealNumberOfColours <= 16)
							s2.MakeMsg(_R(IDS_PALETTEINFO),4,NoOfColours,(const TCHAR*)sPalette);
						else
							s2.MakeMsg(_R(IDS_AN_PALINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);
						break;
					}
				case 1:
					s2.MakeMsg(_R(IDS_MONO),colDepth);
					break;
				case 4:
				default:
					s2.MakeMsg(_R(IDS_PALETTEINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);					
					break;
				}
				
				TempDiskFile.write(s2); 				
				
				s.MakeMsg(_R(IDS_NODITHER));
				switch (DitherType)
				{
				case XARADITHER_ORDERED:
				case XARADITHER_ORDERED_GREY:
					Dither.MakeMsg(_R(IDS_DITH_ORDER));
					s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
					break;
				case XARADITHER_ERROR_DIFFUSION:
				case XARADITHER_SIMPLE:
					Dither.MakeMsg(_R(IDS_DITH_ERROR));
					s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
					break;
				case XARADITHER_NONE:
					s.MakeMsg(_R(IDS_NODITHER));
					break;
				}
				
				TempDiskFile.write(s);
			} // if (m_pOptions->GetFilterType() == MAKE_BITMAP_FILTER) block ends
			else
			{
				switch (m_pOptions->GetFilterNameStrID())
				{
				case _R(IDN_FILTERNAME_GIF):
					{
						GIFExportOptions* pGIFOptions = (GIFExportOptions*)m_pOptions;
						ERROR3IF(!pGIFOptions->IS_KIND_OF(GIFExportOptions), "pGIFOptions isn't");
						PALETTE Palette = PAL_OPTIMISED;
						DITHER DitherType;
						UINT32 colDepth;
						String_64 sPalette;
						String_64 Dither;
						UINT32 NoOfColours;
						
						NoOfColours=m_pOptions->GetNumColsInPalette();
						//						Palette = pGIFOptions->GetPalette();
						DitherType = pGIFOptions->GetDither();
						colDepth = pGIFOptions->GetDepth();
						
						
						if (pGIFOptions->WantTransparent())
							count=count+1;
						
						if (pGIFOptions->WantInterlaced())
							count=count+2;
						
						s.MakeMsg(_R(IDS_GIF));
						s2.MakeMsg(_R(IDS_A), (const TCHAR*)s);
						
						switch (count)
						{
						case 1:
							s2.MakeMsg(_R(IDS_TRANSPARENT),"GIF");
							break;
						case 2:
							s2.MakeMsg(_R(IDS_INTERLACED),"GIF");
							break;
						case 3:
							s2.MakeMsg(_R(IDS_INTER_TRANS),"GIF");
							break;
						case 0:
							break;
						}
						
						s.MakeMsg(_R(IDS_TEXTLINE_BR),(const TCHAR*)s2);
						TempDiskFile.write(s);
						
						switch (Palette)
						{
						case PAL_OPTIMISED:
							sPalette.MakeMsg(_R(IDS_OPTIMISED_PAL));
							break;
						case PAL_BROWSER:
						case PAL_STANDARD:
							sPalette.MakeMsg(_R(IDS_BROWSER_PAL));
							break;
						case PAL_GLOBALOPTIMISED:
							sPalette.MakeMsg(_R(IDS_GLOBAL_OPT));
							break;
							
						}
						
						if (colDepth == 8 && (Palette == PAL_STANDARD || Palette == PAL_BROWSER) )
						{
							NoOfColours = 216;
						}
						
						s2.MakeMsg(_R(IDS_PALETTEINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);					
						
						if (colDepth == 8)
							s2.MakeMsg(_R(IDS_AN_PALINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);
						
						if (colDepth == 1)
							s2.MakeMsg(_R(IDS_MONO),colDepth);
						
						if (colDepth > 8)
							s2.MakeMsg(_R(IDS_TRUECOLOUR),colDepth);
						
						TempDiskFile.write(s2); 				
						
						s.MakeMsg(_R(IDS_NODITHER));
						switch (DitherType)
						{
						case XARADITHER_ORDERED:
						case XARADITHER_ORDERED_GREY:
							Dither.MakeMsg(_R(IDS_DITH_ORDER));
							s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
							break;
						case XARADITHER_ERROR_DIFFUSION:
						case XARADITHER_SIMPLE:
							Dither.MakeMsg(_R(IDS_DITH_ERROR));
							s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
							break;
						case XARADITHER_NONE:
							s.MakeMsg(_R(IDS_NODITHER));
							break;
						}
						
						TempDiskFile.write(s);
						
						
					} // end case _R(IDN_FILTERNAME_GIF)
					break;
				case _R(IDS_JPG_EXP_FILTERNAME): 
					{
						JPEGExportOptions* pJPEGOptions = (JPEGExportOptions *)m_pOptions;
						ERROR3IF(!pJPEGOptions->IS_KIND_OF(JPEGExportOptions), "pJPEGOptions isn't");
						INT32 Quality = pJPEGOptions->GetQuality();	// Default Quality
						BOOL Progressive = pJPEGOptions->DoAsProgressive();
						if (Quality > 100)
							Quality = 100;
						
						
						s.MakeMsg(_R(IDS_JPEG));
						s2.MakeMsg(_R(IDS_A), (const TCHAR*)s);
						
						if (Progressive)
							s2.MakeMsg(_R(IDS_PROGRESSIVE));
						
						s.MakeMsg(_R(IDS_TEXTLINE_BR),(const TCHAR*)s2);
						TempDiskFile.write(s);
						
						
						s.MakeMsg(_R(IDS_JCOMPRESSION),Quality);
						TempDiskFile.write(s);					
					} // end case _R(IDS_JPG_EXP_FILTERNAME)
					break;
					
				case _R(IDT_FILTERNAME_BMP):
					{
						BMPExportOptions* pBMPOptions = (BMPExportOptions*)m_pOptions;
						ERROR3IF(!pBMPOptions->IS_KIND_OF(BMPExportOptions), "pBMPOptions isn't");
						PALETTE Palette;
						DITHER DitherType;
						UINT32 colDepth;
						String_64 sPalette;
						String_64 Dither;
						UINT32 NoOfColours;
						
						NoOfColours=m_pOptions->GetNumColsInPalette();
						Palette = pBMPOptions->GetPalette();
						DitherType = pBMPOptions->GetDither();
						colDepth = pBMPOptions->GetDepth();
						
						s.MakeMsg(_R(IDS_BMP));
						s2.MakeMsg(_R(IDS_A), (const TCHAR*)s);
						
						s.MakeMsg(_R(IDS_TEXTLINE_BR),(const TCHAR*)s2);
						TempDiskFile.write(s);
						
						switch (Palette)
						{
						case PAL_OPTIMISED:
							sPalette.MakeMsg(_R(IDS_OPTIMISED_PAL));
							break;
						case PAL_BROWSER:
						case PAL_STANDARD:
							sPalette.MakeMsg(_R(IDS_BROWSER_PAL));
							break;
						case PAL_GLOBALOPTIMISED:
							sPalette.MakeMsg(_R(IDS_GLOBAL_OPT));
							break;
						}
						
						if (colDepth == 8 && (Palette == PAL_STANDARD || Palette == PAL_BROWSER) )
						{
							NoOfColours = 216;
						}
						
						if (colDepth == 8 && NoOfColours > 256)
							NoOfColours = 256;
						
						s2.MakeMsg(_R(IDS_PALETTEINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);					
						
						if (colDepth == 8)
							s2.MakeMsg(_R(IDS_AN_PALINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);
						
						if (colDepth == 1)
							s2.MakeMsg(_R(IDS_MONO),colDepth);
						
						if (colDepth > 8)
							s2.MakeMsg(_R(IDS_TRUECOLOUR),colDepth);
						
						TempDiskFile.write(s2); 				
						
						s.MakeMsg(_R(IDS_NODITHER));
						switch (DitherType)
						{
						case XARADITHER_ORDERED:
						case XARADITHER_ORDERED_GREY:
							Dither.MakeMsg(_R(IDS_DITH_ORDER));
							s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
							break;
						case XARADITHER_ERROR_DIFFUSION:
						case XARADITHER_SIMPLE:
							Dither.MakeMsg(_R(IDS_DITH_ERROR));
							s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
							break;
						case XARADITHER_NONE:
							s.MakeMsg(_R(IDS_NODITHER));
							break;
						}
						
						TempDiskFile.write(s);
					} // end case _R(IDT_FILTERNAME_BMP)
					break;
					
				case _R(IDS_FILTERNAME_PNG):
					{
						PNGExportOptions* pPNGOptions = (PNGExportOptions*)m_pOptions;
						ERROR3IF(!pPNGOptions->IS_KIND_OF(PNGExportOptions), "pPNGOptions isn't");
						PALETTE Palette = PAL_OPTIMISED;
						DITHER DitherType;
						UINT32 colDepth;
						String_64 sPalette;
						String_64 Dither;
						UINT32 NoOfColours;
						
						NoOfColours=m_pOptions->GetNumColsInPalette();
						
						//						Palette = pPNGOptions->GetPalette();
						DitherType = pPNGOptions->GetDither();
						colDepth = pPNGOptions->GetDepth();
						
						
						if (pPNGOptions->WantTransparent())
							count=count+1;
						
						if (pPNGOptions->WantInterlaced())
							count=count+2;
						
						s.MakeMsg(_R(IDS_PNG));
						s2.MakeMsg(_R(IDS_A), (const TCHAR*)s);
						
						switch (count)
						{
						case 1:
							s2.MakeMsg(_R(IDS_TRANSPARENT),"PNG");
							break;
						case 2:
							s2.MakeMsg(_R(IDS_INTERLACED),"PNG");
							break;
						case 3:
							s2.MakeMsg(_R(IDS_INTER_TRANS),"PNG");
							break;
						case 0:
							break;
						}
						
						s.MakeMsg(_R(IDS_TEXTLINE_BR),(const TCHAR*)s2);
						TempDiskFile.write(s);
						
						switch (Palette)
						{
						case PAL_OPTIMISED:
							sPalette.MakeMsg(_R(IDS_OPTIMISED_PAL));
							break;
						case PAL_BROWSER:
						case PAL_STANDARD:
							sPalette.MakeMsg(_R(IDS_BROWSER_PAL));
							break;
						case PAL_GLOBALOPTIMISED:
							sPalette.MakeMsg(_R(IDS_GLOBAL_OPT));
							break;
						}
						
						if (colDepth == 8 && (Palette == PAL_STANDARD || Palette == PAL_BROWSER) )
						{
							NoOfColours = 216;
						}
						
						s2.MakeMsg(_R(IDS_PALETTEINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);					
						
						if (colDepth == 8)
							s2.MakeMsg(_R(IDS_AN_PALINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);
						
						if (colDepth == 1)
							s2.MakeMsg(_R(IDS_MONO),colDepth);
						
						if (colDepth > 8)
							s2.MakeMsg(_R(IDS_TRUECOLOUR),colDepth);
						
						TempDiskFile.write(s2); 				
						
						s.MakeMsg(_R(IDS_NODITHER));
						switch (DitherType)
						{
						case XARADITHER_ORDERED:
						case XARADITHER_ORDERED_GREY:
							Dither.MakeMsg(_R(IDS_DITH_ORDER));
							s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
							break;
						case XARADITHER_ERROR_DIFFUSION:
						case XARADITHER_SIMPLE:
							Dither.MakeMsg(_R(IDS_DITH_ERROR));
							s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
							break;
						case XARADITHER_NONE:
							s.MakeMsg(_R(IDS_NODITHER));
							break;
						}
						
						TempDiskFile.write(s);
					} // end case _R(IDS_FILTERNAME_PNG)
					
					break;
				} // end switch (m_pOptions->GetFilterNameStrID())
			} // end else block
			
			GenerateBitmapInfoStrings(ImageSize, FileSize);
			
			// output the bitmap info
			s.MakeMsg(_R(IDS_HTML_INFO1), (TCHAR *)ImageSize);
			TempDiskFile.write(s);
			
			// output the bitmap file size info
			s.MakeMsg(_R(IDS_HTML_INFO2), (TCHAR *)FileSize);
			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_CLOSE_CENTER));
			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_TDTR_CLOSE));
			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_BANNER_BOX));
			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_SPEED_BUILD));
			TempDiskFile.write(s);
			//			s.MakeMsg(_R(IDS_SPEED_BUILD2));
			//			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_ES_TR));
			TempDiskFile.write(s);
			
			String_64 times;
			
			s.MakeMsg(_R(IDS_TIME_ENTRY),"14.4k");
			TempDiskFile.write(s);
			CalculateTime(times,14400.0);
			TempDiskFile.write(times);
			s.MakeMsg(_R(IDS_ES_TR));
			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_TIME_ENTRY),"28.8k");
			TempDiskFile.write(s);
			CalculateTime(times,28800.0);
			TempDiskFile.write(times);
			s.MakeMsg(_R(IDS_ES_TR));
			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_TIME_ENTRY),"33.6k");
			TempDiskFile.write(s);
			CalculateTime(times,33600.0);
			TempDiskFile.write(times);
			s.MakeMsg(_R(IDS_ES_TR));
			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_TIME_ENTRY),"57.6k");
			TempDiskFile.write(s);
			CalculateTime(times,57600.0);
			TempDiskFile.write(times);
			s.MakeMsg(_R(IDS_ES_TR));
			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_TIME_ENTRY),"64k");
			TempDiskFile.write(s);
			CalculateTime(times,65536.0);
			TempDiskFile.write(times);
			s.MakeMsg(_R(IDS_ES_TR));
			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_TIME_ENTRY),"128k");
			TempDiskFile.write(s);
			CalculateTime(times,131072.0);
			TempDiskFile.write(times);
			
			//			s.MakeMsg(_R(IDS_ES_TR));
			//			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_SPEED_END));
			TempDiskFile.write(s);
			
			TRACE( _T("m_FileSize = %d"), m_FileSize);
		} // end of if (BrowserOptions.m_bInfo != FALSE)
		
		String_64 webaddy(_R(IDS_HTML_URL_PROGRAM));
		//Mark Howitt, 29/10/97. Setup the _R(IDS_HTML_URL_VISITMSG) To be a TCHAR* Also. It likes it that way!
		String_64 webvmess(_R(IDS_HTML_URL_VISITMSG));
		
		s.MakeMsg(_R(IDS_LINK_BOX),(TCHAR *)webaddy,(TCHAR *)webvmess);
		TempDiskFile.write(s);
		
		//end of my stuff
		
		s.MakeMsg(_R(IDS_END_TABLE));
		TempDiskFile.write(s);
		
		s.MakeMsg(_R(IDS_CLOSE_CENTER));
		TempDiskFile.write(s);
		
		// output the "Exported from" string
		
		// get the xara logo file name
		String_256 Logo(_R(IDS_HTML_XARALOGO));
		
		// set it in the path
		ProgramPath.SetFileNameAndType(Logo);
		
		// get the xara link
		String_256 URL(_R(IDS_HTML_URL_XARA));
		
		// output the xara link and the xara logo
		s.MakeMsg(_R(IDS_HTML_XARA), (TCHAR *)URL, (TCHAR *)ProgramPath.GetWebAddress());
		TempDiskFile.write(s);
		
		// Do not display the Xara X logo bottom right...
		/*
		// get the program logo file name
		Logo.Load(_R(IDS_HTML_PROGRAMLOGO));
		
		// set it in the path
		ProgramPath.SetFileNameAndType(Logo);
		
		// output the program link
		URL.Load(_R(IDS_HTML_URL_PROGRAM));
		s.MakeMsg(_R(IDS_HTML_PROGRAM), (TCHAR *)URL, (TCHAR *)ProgramPath.GetWebAddress());
		TempDiskFile.write(s);
		*/
		
		// output the end of the file
		s.Load(_R(IDS_HTML_END));
		TempDiskFile.write(s);
		
		// close the file
		TempDiskFile.close();
		
		// now export the image map, if the option for that is set
		if (BrowserOptions.m_bImagemap != FALSE)
		{
			// export the image map
			ExportImagemap( TempDiskFile, 
				m_pTempHTMLPath, 
				m_pOptions->GetSelectionType(), 
				m_pOptions->GetDPI(),
				BrowserOptions.m_ifoImagemapOptions);
		}
		
		TCHAR *FileWebAddress =  m_pTempHTMLPath->GetWebAddress();
		
		//Graham 17/9/97
		ProgramPath.SetFileNameAndType(PRODUCT_WEBLINKEXENAME);
		
		const TCHAR *PathToWebLink = (const TCHAR *)ProgramPath.GetPath();
		
		String_256 CmdLine = PathToWebLink + String_256(" -f ") + FileWebAddress;
		//TCHAR *CommandLine = (TCHAR *)CmdLine;
		
		if (!InvokeWeblink(CmdLine))
			return FALSE;
		
	} // end of TRY block
	
	catch( CFileException )
	{
		// any disk problems - come here
		
		// not much we can do really - just close the file and return FALSE
		if (TempDiskFile.isOpen())
			TempDiskFile.close();
		
		return FALSE;
	}
#endif
		
	return TRUE;
}