Exemple #1
0
// SMFIX sjk 5/12/00 there used to be some junk in the call to GetExportOptions that assumed the
// filter type being used which could be changed by the GetExportOptions call itself
// therefore all this sort of stuff should be called on the correct known filter using this
// call afterwards
void PNGFilter::PostGetExportOptions(BitmapExportOptions* pOptions)
{
	// should be of this type
	PNGExportOptions* pPNGOptions = (PNGExportOptions*)pOptions;
	ERROR3IF(!pPNGOptions->IS_KIND_OF(PNGExportOptions), "pPNGOptions isn't");

	// do the baseclass options
	MaskedFilter::PostGetExportOptions(pOptions);

	// do the specific to this class options
	// Filter type can be changed by the export options dialog box from say 
	// PNG to PNG_INTERLACED
	UINT32 Silliness = pPNGOptions->WantTransparent() ? 2 : 0;
	Silliness |= pPNGOptions->WantInterlaced() ? 1 : 0;
	if (Silliness >= 0 && Silliness <= 4)
	{
		Compression = Silliness;
		// Compression ranges from 0 .. 4 so map this onto our filter types
//		s_FilterType = PNG + Silliness;
		switch (Silliness)
		{
		case 0:	s_FilterType = PNG; break;
		case 1:	s_FilterType = PNG_INTERLACED; break;
		case 2:	s_FilterType = PNG_TRANSPARENT; break;
		case 3:	s_FilterType = PNG_TRANSINTER; break;
		}

		if (pPNGOptions->WantTransparent() && pPNGOptions->GetSelectionType() == SELECTION)
			DoingMask = TRUE;
	}
}
Exemple #2
0
/********************************************************************************************

>	virtual UINT32 PNGFilter::GetExportMsgID()

	Author:		Neville_Humphrys (Xara Group Ltd) <*****@*****.**>
	Created:	10/07/96
	Returns:	The id of the message to put on the progress display whilst exporting.
	Purpose:	Used to get the message id to be used during export.
				Overides the baseclass form of the function so that during the two stage
				export process it can change the message.
	SeeAlso:	DoExport; TI_GIFFilter::GetExportMsgID;

********************************************************************************************/
UINT32 PNGFilter::GetExportMsgID()
{
	if (GeneratingOptimisedPalette())
		return _R(IDS_GENOPTPALMSGID);				// "Generating optimised palette..."

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

	// If we are exporting with transparency on and on first pass use the masking message
	// otherwise use the exporting message.
	if (pPNGOptions->GetSelectionType() == SELECTION && pPNGOptions->WantTransparent())
	{
		// Special 4 stage rendering operation
		// - Render selected objects to white background
		// - Render mask 1bpp
		// - Render all objects
		// - Save data out to disk
		if (!SecondPass)
			return Export2ndStageMsgID;			// "Preparing mask for PNG file..."
		else
			return Filter::GetExportMsgID();	// "Preparing PNG file..."
	}
	else
	{
		// Special 3 stage rendering operation
		// - Render objects to white background
		// - Render mask 1bpp
		// - Save data out to disk
		if (DoingMask)
			return Export2ndStageMsgID;			// "Preparing mask for PNG file..."
		else
			return Filter::GetExportMsgID();	// "Preparing PNG file..."
	}

	return ExportingMsgID;
}