[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1319
Date       : Wed Jun 14 13:22:59 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/ai_epsrr.cpp
   M /Trunk/XaraLX/Kernel/aw_eps.cpp
   M /Trunk/XaraLX/Kernel/cameleps.cpp
   M /Trunk/XaraLX/Kernel/cmxrendr.cpp
   M /Trunk/XaraLX/Kernel/document.cpp
   M /Trunk/XaraLX/Kernel/filters.cpp
   M /Trunk/XaraLX/Kernel/kerneldc.cpp
   M /Trunk/XaraLX/Kernel/nativeps.cpp
   M /Trunk/XaraLX/Kernel/saveeps.cpp
   M /Trunk/XaraLX/wxOil/oilbitmap.cpp

More EPS work. It now does a credible job of exporting non-complex artwork (i.e. without transparency)


Diff:
Index: Trunk/XaraLX/Kernel/filters.cpp
===================================================================
--- Trunk/XaraLX/Kernel/filters.cpp	(revision 1318)
+++ Trunk/XaraLX/Kernel/filters.cpp	(revision 1319)
@@ -5313,10 +5313,7 @@
 GenericEPSFilter::GenericEPSFilter()
 {
 	// This is the generic EPS filter, so we want all EPS filters in it.
-PORTNOTE("filter","Removed EPSFilter usage")
-#ifndef EXCLUDE_FROM_XARALX
-		pFilterType = CC_RUNTIME_CLASS(EPSFilter);
-#endif
+	pFilterType = CC_RUNTIME_CLASS(EPSFilter);
 }
 
 /********************************************************************************************
Index: Trunk/XaraLX/Kernel/cmxrendr.cpp
===================================================================
--- Trunk/XaraLX/Kernel/cmxrendr.cpp	(revision 1318)
+++ Trunk/XaraLX/Kernel/cmxrendr.cpp	(revision 1319)
@@ -192,7 +192,7 @@
 	ENSURE(RenderView->GetDoc() != NULL, "View's document is NULL!");
 	Document *TheDocument = RenderView->GetDoc();
 
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 	cmxDC = (CMXExportDC *)RenderDC;
 
 	// Set up render region
@@ -243,7 +243,7 @@
 BOOL CMXRenderRegion::ExportPath ( Path *DrawPath, BOOL DataOnly )
 {
 	// Get the device context for our export file.
-	KernelDC	*pDC		= ( KernelDC * ) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	DocCoord*	Coords		= DrawPath->GetCoordArray();
 	PathVerb*	Verbs		= DrawPath->GetVerbArray();
Index: Trunk/XaraLX/Kernel/aw_eps.cpp
===================================================================
--- Trunk/XaraLX/Kernel/aw_eps.cpp	(revision 1318)
+++ Trunk/XaraLX/Kernel/aw_eps.cpp	(revision 1319)
@@ -2313,7 +2313,7 @@
 void ArtWorksEPSRenderRegion::GetValidPathAttributes()
 {
 #ifdef DO_EXPORT
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	FillGeometryAttribute *pFillAttr = (FillGeometryAttribute *) CurrentAttrs[ATTR_FILLGEOMETRY].pAttr;
 
Index: Trunk/XaraLX/Kernel/saveeps.cpp
===================================================================
--- Trunk/XaraLX/Kernel/saveeps.cpp	(revision 1318)
+++ Trunk/XaraLX/Kernel/saveeps.cpp	(revision 1319)
@@ -510,7 +510,7 @@
 	GetValidTextAttributes();
 
 // BODGE TEXT - need to account for unicode!
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	TCHAR Buf[64];
 
@@ -583,7 +583,7 @@
 
 void EPSRenderRegion::OutputFontName()
 {
-   	KernelDC *pDC = (KernelDC *) RenderDC;
+   	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	String_64 FontName;
 	String_64 EncodedFontName;
@@ -753,7 +753,7 @@
 
 void EPSRenderRegion::OutputTextRenderMode ()
 {
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	INT32 Style=0;
 
@@ -796,7 +796,7 @@
 
 void EPSRenderRegion::OutputTextAspectRatio ()
 {
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
    	pDC->OutputReal(RR_TXTASPECTRATIO().MakeDouble()*100.0);	// convert from ratio to %
    	pDC->OutputToken(_T("Tz"));
@@ -817,7 +817,7 @@
 
 void EPSRenderRegion::OutputTextTracking ()
 {
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	// Must be output in 1/1000 of an em.
 	// 1 em = point size of font.
@@ -841,7 +841,7 @@
 
 void EPSRenderRegion::OutputTextJustification ()
 {
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	// Output aspect ratio in %, 100 is default
    	switch (RR_TXTJUSTIFICATION())
@@ -875,7 +875,7 @@
 
 void EPSRenderRegion::OutputTextLineSpacing ()
 {
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	// Output line spacing in points.
 	// format - paraspace linespace Tl
@@ -928,7 +928,7 @@
 
 void EPSRenderRegion::OutputTextBaselineShift ()
 {
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	// Output baseline shift in points
 	// format = rise Ts
@@ -951,7 +951,7 @@
 
 void EPSRenderRegion::OutputTextSubSuperScript ()
 {
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	// Output sub/superscript
 	double FontSize = ((double)RR_TXTFONTSIZE())/1000;			    	// in millipoints	 12pt = 12000 mp
@@ -1089,7 +1089,7 @@
 
 void EPSRenderRegion::OutputLineWidth()
 {
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	// Set line width
 	pDC->OutputUserSpaceValue(RR_LINEWIDTH());
@@ -1110,7 +1110,7 @@
 
 void EPSRenderRegion::OutputJoinType()
 {
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	// Set line Join Type
 	pDC->OutputValue((UINT32)RR_JOINTYPE());
@@ -1172,7 +1172,7 @@
 
 void EPSRenderRegion::OutputDashPattern()
 {
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	// Set dash pattern
 	INT32 NumEls = RR_DASHPATTERN().Elements;
@@ -1241,7 +1241,7 @@
 
 void EPSRenderRegion::OutputStartCap()
 {
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	// Set line cap style
 	pDC->OutputValue((UINT32)RR_STARTCAP());
@@ -1262,7 +1262,7 @@
 
 void EPSRenderRegion::OutputMitreLimit()
 {
-//	KernelDC *pDC = (KernelDC *) RenderDC;
+//	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 		// Set mitre limit
 
@@ -1320,7 +1320,7 @@
 
 void EPSRenderRegion::OutputStrokeCMYKColour()
 {
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	PColourCMYK CMYK;
 
@@ -1389,7 +1389,7 @@
 
 void EPSRenderRegion::OutputStrokeRGBColour()
 {
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	// Colour values.
 	INT32 red;
@@ -1493,7 +1493,7 @@
 
 void EPSRenderRegion::OutputFillCMYKColour()
 {
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	PColourCMYK CMYK;
 
@@ -1563,7 +1563,7 @@
 
 void EPSRenderRegion::OutputFillRGBColour()
 {
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	INT32 red;
 	INT32 green;
@@ -1739,7 +1739,7 @@
 	}
 
 	// Get the device context for our export file.
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	DocCoord* Coords = DrawPath->GetCoordArray();
 	PathVerb* Verbs  = DrawPath->GetVerbArray();
@@ -2491,7 +2491,7 @@
 		RenderRegion::SetClipRegion(pClipAttr, Temp);
 
 		// Get the device context for our export file.
-		KernelDC *pDC = (KernelDC *) RenderDC;
+		KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 		// export a 'gsave' command.
 		pDC->OutputToken(TEXT("gsave"));
@@ -2556,7 +2556,7 @@
 		RenderRegion::RestoreClipRegion(pClipAttr, Temp);
 
 		// Get the device context for our export file.
-		KernelDC *pDC = (KernelDC *) RenderDC;
+		KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 		// export a 'grestore' command.
 		pDC->OutputToken(TEXT("grestore"));
Index: Trunk/XaraLX/Kernel/kerneldc.cpp
===================================================================
--- Trunk/XaraLX/Kernel/kerneldc.cpp	(revision 1318)
+++ Trunk/XaraLX/Kernel/kerneldc.cpp	(revision 1319)
@@ -823,7 +823,7 @@
 		// Convert the next chunk to hex and write it out
 		TCHAR HexBuf[80];
 		ConvertToHex(Data, ChunkLength, HexBuf);
-		if (!OutputDirect((BYTE *) HexBuf, ChunkLength * 2))
+		if (!OutputTCHARAsChar(HexBuf, ChunkLength * 2))
 		{
 			// Error
 			return -1;
@@ -845,7 +845,7 @@
 			// Output it however many times we need to
 			while (Padding > 0)
 			{
-				if (!OutputDirect((BYTE *) HexBuf, 2))
+				if (!OutputTCHARAsChar(HexBuf, 2))
 					// Error
 					return -1;
 
@@ -969,7 +969,7 @@
 
 	// End of ASCII85 data, so output the ASCII85 EOD marker.
 	TCHAR EOD[] = _T("~>");
-	OutputDirect((LPBYTE) EOD, 2);
+	OutputTCHARAsChar(EOD, 2);
 	OutputNewLine();
 
 	// Free up the buffers
Index: Trunk/XaraLX/Kernel/ai_epsrr.cpp
===================================================================
--- Trunk/XaraLX/Kernel/ai_epsrr.cpp	(revision 1318)
+++ Trunk/XaraLX/Kernel/ai_epsrr.cpp	(revision 1319)
@@ -306,7 +306,7 @@
 									   DocRect		&Bounds )
 {
 	// Set up the local variables.
-//	KernelDC	*pDC			= static_cast<KernelDC *> ( RenderDC );
+//	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 	DocCoord	Position		( Bounds.lo.x, Bounds.hi.y );
 	double		Width			= static_cast<double> ( Bounds.Width () ) / 1000;
 	double		Height			= static_cast<double> ( Bounds.Height () ) / 1000;
@@ -458,7 +458,7 @@
 		// Only do this for text on paths
 		if (ExportingOnPath ())
 		{
-			KernelDC *pDC = (KernelDC *) RenderDC;
+			KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 			pDC->OutputMatrix(pMatrix);
 			pDC->OutputToken(_T("Tm"));
@@ -588,7 +588,7 @@
 BOOL AIEPSRenderRegion::WriteEPSProcessColours ( void )
 {
 	// Cast a pointer to the appropriate DC.
-	KernelDC *pDC = ( KernelDC * ) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	// Output the process colours
 	pDC->OutputToken	( _T("%%DocumentProcessColors: Cyan Magenta Yellow Black") );
@@ -617,7 +617,7 @@
 											Document	*pDocument )
 {
 	// Cast a pointer to the appropriate DC.
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 	
 	// Call the export method in the document.
 	pDocument->WriteEPSResources ( pFilter );
@@ -1008,7 +1008,7 @@
 	INT32 blue;											//
 	PColourCMYK	CMYKColour;								// The colour to be stored.
 
-	KernelDC	*pDC		= (KernelDC *) RenderDC;	// A pointer to the export DC used.
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 	TCHAR		Line [80];								// Contains the string to be stored.
 
 	// (ChrisG 3/4/2001) 
@@ -1258,7 +1258,7 @@
 
 void AIEPSRenderRegion::WriteGradientFillInstance ()
 {
-	KernelDC				*pDC		= ( KernelDC* ) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 	FillGeometryAttribute	*pFillAttr	= ( FillGeometryAttribute* )
 											CurrentAttrs[ATTR_FILLGEOMETRY].pAttr;
 	DocCoord				StartPoint	= *( pFillAttr->GetStartPoint () );
@@ -2631,7 +2631,7 @@
 	// copy info into actual EPS file.
 	char cbuffer [1025];
 	TCHAR buffer [1025];
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 	FILE * fp;
 
 		// Write out the Extra info.
@@ -3663,7 +3663,7 @@
 ********************************************************************************************/
 void AIEPSRenderRegion::WriteGradientCount ()
 {
-	KernelDC * pDC		= ( KernelDC* ) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 	ListFill * pList	= m_pLinearGradList;
 	INT32 numFills		= 0;
 
Index: Trunk/XaraLX/Kernel/document.cpp
===================================================================
--- Trunk/XaraLX/Kernel/document.cpp	(revision 1318)
+++ Trunk/XaraLX/Kernel/document.cpp	(revision 1319)
@@ -139,8 +139,8 @@
 #include "saveeps.h"
 #include "zoomops.h"
 #include "qualops.h"
-//#include "ai_eps.h"
-//#include "ai_epsrr.h"
+#include "ai_eps.h"
+#include "ai_epsrr.h"
 #include "fontlist.h"
 #include "fontman.h"
 #include "progress.h"
@@ -2901,12 +2901,7 @@
 BOOL Document::WriteEPSFonts(EPSFilter *pFilter)
 {
 	if ( (pFilter->IS_KIND_OF(CamelotNativeEPSFilter)) ||
-PORTNOTE("filters", "Disabled AIPESFilter")
-#ifndef EXCLUDE_FROM_XARALX
 	     (pFilter->IS_KIND_OF(AIEPSFilter))
-#else
-		FALSE
-#endif
 	   )
 	{
 		EPSExportDC *pDC = pFilter->GetExportDC();
@@ -3001,8 +2996,6 @@
 
 BOOL Document::WriteEPSSetup(EPSFilter *pFilter)
 {
-	PORTNOTETRACE("filters","Document::WriteEPSFonts ignore AIEPS");
-#ifndef EXCLUDE_FROM_XARALX
 	// only do something if the filter is an Illustrator one
 	if (pFilter->IS_KIND_OF(AIEPSFilter))
 	{
@@ -3013,7 +3006,6 @@
 		AIExportCharEncoding(pDC);
 		AIExportFontEncoding(pDC);
 	}
-#endif
 	return TRUE;
 }
 
@@ -3133,15 +3125,12 @@
 
 BOOL Document::WriteEPSTrailer(EPSFilter *pFilter)
 {
-	PORTNOTETRACE("filters","Document::WriteEPSTrailer - ignore AIEPS");
-#ifndef EXCLUDE_FROM_XARALX
 	// only do something if the filter is an Illustrator one
 	if (pFilter->IS_KIND_OF(AIEPSFilter))
 	{
 		EPSExportDC *pDC = pFilter->GetExportDC();
 		AIExportTrailer(pDC);
 	}	
-#endif
 	ExportTextTrailer(pFilter);
 
 	return TRUE;
@@ -4514,12 +4503,7 @@
 BOOL Document::ExportTextSetup(EPSFilter* pFilter)
 {
 	if ( (pFilter->IS_KIND_OF(CamelotNativeEPSFilter)) ||
-PORTNOTE("filters", "Disabled AIPESFilter")
-#ifndef EXCLUDE_FROM_XARALX
 	     (pFilter->IS_KIND_OF(AIEPSFilter))
-#else
-		FALSE
-#endif
 	   )
 	{
 		// Output the colour table in ArtWorks format.
Index: Trunk/XaraLX/Kernel/nativeps.cpp
===================================================================
--- Trunk/XaraLX/Kernel/nativeps.cpp	(revision 1318)
+++ Trunk/XaraLX/Kernel/nativeps.cpp	(revision 1319)
@@ -1809,7 +1809,7 @@
 
 void NativeRenderRegion::GetValidPathAttributes()
 {
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	// Find out what this render region can do.
 	RRCaps Caps;
@@ -1885,7 +1885,7 @@
 		// No - so don't do anything
 		return;
 
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	if (SetLastOutputAttribute(ATTR_STROKETRANSP))
 	{
@@ -2147,7 +2147,7 @@
 
 void NativeRenderRegion::GetValidTextAttributes()
 {
-   	KernelDC *pDC = (KernelDC *) RenderDC;
+   	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	/* In native format documents we output 
 		fontname			= <fontname> ctf
@@ -2323,7 +2323,7 @@
 	GetValidPathAttributes();
 	GetValidTextAttributes();
 
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	INT32 CharOut = (INT32)ch;
 	INT32 NumCodes = 1;
@@ -2575,7 +2575,7 @@
 
 BOOL NativeRenderRegion::OutputGradFillColours(DocColour* StartCol, DocColour* EndCol, ColourContext* pContext)
 {
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 	bool outputNames = FALSE;
 
 	if ((StartCol->FindParentIndexedColour() == NULL) &&
Index: Trunk/XaraLX/Kernel/cameleps.cpp
===================================================================
--- Trunk/XaraLX/Kernel/cameleps.cpp	(revision 1318)
+++ Trunk/XaraLX/Kernel/cameleps.cpp	(revision 1319)
@@ -3348,7 +3348,7 @@
 
 void CamelotEPSRenderRegion::GetValidPathAttributes()
 {
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	FillGeometryAttribute *pFillAttr = 
 		(FillGeometryAttribute *) CurrentAttrs[ATTR_FILLGEOMETRY].pAttr;
@@ -3782,7 +3782,7 @@
 
 BOOL CamelotEPSRenderRegion::OutputGradFillColours(DocColour* StartCol, DocColour* EndCol, ColourContext* pContext)
 {
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 	bool outputNames = FALSE;
 
 	if ((StartCol->FindParentIndexedColour() == NULL) &&
@@ -4039,7 +4039,7 @@
 	// (ChrisG 3/1/01) - Output some code so that we stop using our dictionary, Since
 	//	this is no longer controlled by Start- and StopRender, we have restore here. This should 
 	//	be done to close the 'save-restore' block started in WriteSetup.
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 	pDC->OutputToken(_T("end restore"));
 	pDC->OutputNewLine();
 
@@ -4315,7 +4315,7 @@
 {
 #ifndef STANDALONE
 
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	// Make sure the world is in one piece
 	if ((pBitmap==NULL) || (pMask==NULL))
@@ -4757,7 +4757,7 @@
 	}
 
 	// Render the character in the specified position...
-	KernelDC *pKernelDC = (KernelDC *) RenderDC;
+	KernelDC *pKernelDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	// Output character
 
@@ -4963,7 +4963,7 @@
 		CorrectedSize = ((Size + 500) / 1000) * 1000;
 
 	// Select this font by prefixing with a forward slash to make it into a name.
-	KernelDC *pKernelDC = (KernelDC *) RenderDC;
+	KernelDC *pKernelDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 	String_8 Slash(TEXT("/"));
 	MappedFontName.Insert(Slash, 0);
 	pKernelDC->OutputToken((TCHAR *) MappedFontName);
@@ -5048,7 +5048,7 @@
 	}
 
 	// Select this font by prefixing with a forward slash to make it into a name.
-	KernelDC *pKernelDC = (KernelDC *) RenderDC;
+	KernelDC *pKernelDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 	String_8 Slash(TEXT("/"));
 	MappedFontName.Insert(Slash, 0);
 	pKernelDC->OutputToken((TCHAR *) MappedFontName);
@@ -5260,7 +5260,7 @@
 //	INT32 DestX = 0;
 //	INT32 DestY = 0;
 
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	pDC->OutputToken(_T("sv"));
 
@@ -5706,7 +5706,7 @@
 BOOL CamelotEPSRenderRegion::DrawClippedBitmap(Path *DrawPath)
 {
 	// Get a device context
-	KernelDC *pDC = (KernelDC *) RenderDC;
+	KernelDC *pDC = (KernelDC*)CCDC::ConvertFromNativeDC(RenderDC);
 
 	// What we do is: export the path, save the graphics context, use the path as a clipping 
 	// region, render the bitmap, restore the graphics context, and optionally stroke the
Index: Trunk/XaraLX/wxOil/oilbitmap.cpp
===================================================================
--- Trunk/XaraLX/wxOil/oilbitmap.cpp	(revision 1318)
+++ Trunk/XaraLX/wxOil/oilbitmap.cpp	(revision 1319)
@@ -126,8 +126,9 @@
 //#include "printctl.h"
 //#include "richard2.h"
 //#include "view.h" - in camtypes.h [AUTOMATICALLY REMOVED]
-//#include "colcontx.h"
-//#include "colormgr.h"
+#include "colcontx.h"
+#include "colormgr.h"
+#include "colplate.h"
 
 #include "bitfilt.h"	// BaseBitmapFilter
 //#include "camfiltr.h"	// BaseCamelotFilter - in camtypes.h [AUTOMATICALLY REMOVED]
@@ -1150,7 +1151,7 @@
 
 BOOL CWxBitmap::ExportBitmap(RenderRegion *pRegion)
 {
-#if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
+#if !defined(EXCLUDE_FROM_RALPH)
 RebuildXPEBitmap();
 	// Check the render region type
 	if (pRegion->IsKindOf(CC_RUNTIME_CLASS(CamelotEPSRenderRegion)))
@@ -1164,6 +1165,8 @@
 			// Error!
 			return FALSE;
 	}
+PORTNOTE("cmx", "Disabled CMXRenderRegion")
+#ifndef EXCLUDE_FROM_XARALX
 	else if (pRegion->IsKindOf(CC_RUNTIME_CLASS(CMXRenderRegion)))
 	{
 		// CMX render region... get the DC
@@ -1388,6 +1391,7 @@
 		return TRUE;
 	}
 #endif
+#endif
 	// If we got here, no errors occured.
 	return TRUE;
 }
@@ -1424,7 +1428,7 @@
 
 BOOL CWxBitmap::ExportBitmapPaletteInternal(RenderRegion *pRegion, INT32 NumColours, RGBQUAD *pSrcCLUT)
 {
-#if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
+#if !defined(EXCLUDE_FROM_RALPH)
 RebuildXPEBitmap();
 	// Sanity check
 	ERROR3IF((BMInfo->bmiHeader.biBitCount != 1) &&
@@ -1447,7 +1451,7 @@
 	}
 
 	// Find the output DC
-	KernelDC *pDC = (KernelDC *) pRegion->GetRenderDC();
+	KernelDC *pDC = (KernelDC *) CCDC::ConvertFromNativeDC(pRegion->GetRenderDC());
 
 	// First, clear all entries to black
 	memset(pCLUT, 0, ClutSize);
@@ -1483,9 +1487,9 @@
 
 	// Greyscale palette complete - output it as a hex string
 	pDC->OutputNewLine();
-	pDC->OutputToken("<");
+	pDC->OutputToken(_T("<"));
 	pDC->OutputRawBinary(pCLUT, ClutSize);
-	pDC->OutputToken(">");
+	pDC->OutputToken(_T(">"));
 	pDC->OutputNewLine();
 
 	// Ok, now do the colour palette.
@@ -1509,9 +1513,9 @@
 
 	// RGB palette complete - output it as a hex string
 	pDC->OutputNewLine();
-	pDC->OutputToken("<");
+	pDC->OutputToken(_T("<"));
 	pDC->OutputRawBinary(pCLUT, ClutSize * 3);
-	pDC->OutputToken(">");
+	pDC->OutputToken(_T(">"));
 	pDC->OutputNewLine();
 
 	// Clean up
@@ -1545,7 +1549,7 @@
 
 BOOL CWxBitmap::ExportBitmapPalette(RenderRegion *pRegion)
 {
-#if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
+#if !defined(EXCLUDE_FROM_RALPH)
 RebuildXPEBitmap();
 	// Check the render region type
 	if (!pRegion->IsKindOf(CC_RUNTIME_CLASS(CamelotEPSRenderRegion)))
@@ -1574,9 +1578,9 @@
 
 
 	// Not renderable (it's CamelotEPS), so we can output the bitmap as raw binary
-	KernelDC *pDC = (KernelDC *) pRegion->GetRenderDC();
+	KernelDC *pDC = (KernelDC *) CCDC::ConvertFromNativeDC(pRegion->GetRenderDC());
 
-	pDC->OutputToken("%Camelot: Bitmap palette");
+	pDC->OutputToken(_T("%Camelot: Bitmap palette"));
 	pDC->OutputRawBinary((BYTE *) BMInfo->bmiColors, 
 						 BMInfo->bmiHeader.biClrUsed * sizeof(RGBQUAD));
 	pDC->OutputNewLine();
@@ -1616,7 +1620,7 @@
 
 BOOL CWxBitmap::ExportSeparatedPalette(RenderRegion *pRegion)
 {
-#if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
+#if !defined(EXCLUDE_FROM_RALPH)
 	ERROR3IF(pRegion == NULL, "Illegal NULL params");
 	if (!pRegion->IsKindOf(CC_RUNTIME_CLASS(CamelotEPSRenderRegion)))
 	{
@@ -1632,17 +1636,18 @@
 			"Not colour separating in ExportSeparatedBitmapPalette");
 
 RebuildXPEBitmap();
-	KernelDC *pDC = (KernelDC *) pRegion->GetRenderDC();
+	KernelDC *pDC = (KernelDC *) CCDC::ConvertFromNativeDC(pRegion->GetRenderDC());
 	BYTE pCLUT[256 * 3];
 
+	INT32 i;
 	// Do a greyscale intensity CLUT
-	for (INT32 i = 0; i < 256; i++)
+	for (i = 0; i < 256; i++)
 		pCLUT[i] = i;
 
 	pDC->OutputNewLine();
-	pDC->OutputToken("<");
+	pDC->OutputToken(_T("<"));
 	pDC->OutputRawBinary(pCLUT, 256);
-	pDC->OutputToken(">");
+	pDC->OutputToken(_T(">"));
 	pDC->OutputNewLine();
 
 	// And do a 24bit RGB CLUT
@@ -1650,9 +1655,9 @@
 		pCLUT[i] = pCLUT[i+1] = pCLUT[i+2] = i/3;
 
 	pDC->OutputNewLine();
-	pDC->OutputToken("<");
+	pDC->OutputToken(_T("<"));
 	pDC->OutputRawBinary(pCLUT, 256 * 3);
-	pDC->OutputToken(">");
+	pDC->OutputToken(_T(">"));
 	pDC->OutputNewLine();
 
 #endif
@@ -1684,7 +1689,7 @@
 
 BOOL CWxBitmap::ExportContonePalette(RenderRegion *pRegion)
 {
-#if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
+#if !defined(EXCLUDE_FROM_RALPH)
 RebuildXPEBitmap();
 	ERROR2IF(m_pContonePalette == NULL, FALSE, "No contone palette to export!");
 
@@ -1735,13 +1740,13 @@
 
 BOOL CWxBitmap::ExportBitmapData(RenderRegion *pRegion)
 {
-#if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
+#if !defined(EXCLUDE_FROM_RALPH)
 RebuildXPEBitmap();
 	// Check the render region type
 	if (pRegion->IsKindOf(CC_RUNTIME_CLASS(CamelotEPSRenderRegion)))
 	{
 		// It's Camelot EPS - export the bitmap.
-		KernelDC *pDC = (KernelDC *) pRegion->GetRenderDC();
+		KernelDC *pDC = (KernelDC *) CCDC::ConvertFromNativeDC(pRegion->GetRenderDC());
 		Filter *pFilter = pDC->GetParentFilter();
 
 		// Find out if it needs to be renderable
@@ -1752,6 +1757,8 @@
 
 		if (Renderable)
 		{
+PORTNOTE("printing", "Disabled printing")
+#ifndef EXCLUDE_FROM_XARALX
 // WEBSTER-ranbirr-12/11/96
 #ifndef WEBSTER
 			if (pRegion->IsPrinting())
@@ -1773,6 +1780,7 @@
 			}
 			else
 #endif //webster
+#endif // EXCLUDE_FROM_XARALX
 			{
 				// Use the EPS preference.
 				if (EPSFilter::XSEPSExportPSType == 2)
@@ -1782,7 +1790,7 @@
 
 		// Export the bitmap pixel data itself.
 		if (!Renderable)
-			pDC->OutputToken("%Camelot: Bitmap data");
+			pDC->OutputToken(_T("%Camelot: Bitmap data"));
 		pDC->OutputNewLine();
 		
 		// Do each scanline...
@@ -1981,8 +1989,6 @@
 BOOL CWxBitmap::ExportSeparatedData(RenderRegion *pRegion, BYTE *SepTables)
 {
 #ifndef STANDALONE
-	PORTNOTETRACE("other","CWxBitmap::ExportSeparatedData - do nothing");
-#ifndef EXCLUDE_FROM_XARALX
 	ERROR3IF(pRegion == NULL || SepTables == NULL, "Illegal NULL params");
 
 	if (!pRegion->IsKindOf(CC_RUNTIME_CLASS(CamelotEPSRenderRegion)))
@@ -1992,7 +1998,7 @@
 	}
 
 RebuildXPEBitmap();
-	KernelDC *pDC = (KernelDC *) pRegion->GetRenderDC();
+	KernelDC *pDC = (KernelDC *) CCDC::ConvertFromNativeDC(pRegion->GetRenderDC());
 	Filter *pFilter = pDC->GetParentFilter();
 
 	// If it is renderable, find out if we can use Level 2 features.
@@ -2001,6 +2007,8 @@
 
 	if (Renderable)
 	{
+PORTNOTE("printing", "Disabled printing")
+#ifndef EXCLUDE_FROM_XARALX
 //	WEBSTER-ranbirr-12/11/96
 #ifndef WEBSTER
 		if (pRegion->IsPrinting())
@@ -2015,16 +2023,17 @@
 		}
 		else
 #endif //webster
+#endif
 			UseLevel2 = (EPSFilter::XSEPSExportPSType == 2);			// Use the EPS preference.
 	}
 
 	// Export the bitmap pixel data itself.
 	if (!Renderable)
-		pDC->OutputToken("%Camelot: Bitmap data");
+		pDC->OutputToken(_T("%Camelot: Bitmap data"));
 	pDC->OutputNewLine();
 	
 	// Get some useful constants...
-	const INT32 BitsPerPixel	= BMInfo->bmiHeader.biBitCount;
+//	const INT32 BitsPerPixel	= BMInfo->bmiHeader.biBitCount;
 	const INT32 PixelWidth	= BMInfo->bmiHeader.biWidth;
 	const INT32 PixelHeight	= BMInfo->bmiHeader.biHeight;
 	const INT32 ByteWidth	= PixelWidth;
@@ -2094,7 +2103,6 @@
 		ERROR3("EndASCII85Output failed");
 		return(FALSE);
 	}
-#endif
 	return(TRUE);
 #else
 	ERROR2(FALSE,"CWxBitmap::SeparateBitmapData being called in Viewer version!");
@@ -2258,8 +2266,6 @@
 												BYTE *DestBuffer, Pixel32bpp *SrcBuffer,
 												INT32 PixelWidth)
 {
-	PORTNOTETRACE("other","CWxBitmap::ColourSeparateScanline32to8 - do nothing");
-#ifndef EXCLUDE_FROM_XARALX
 	ERROR3IF(DestBuffer == NULL || SrcBuffer == NULL || PixelWidth < 1, "Illegal params");
 	ERROR3IF(SepTables == NULL, "No separation tables!?");
 	ERROR3IF(OutputContext == NULL || OutputContext->GetColourPlate() == NULL,
@@ -2313,28 +2319,44 @@
 			break;
 	}
 
+PORTNOTE("printing", "Disabled XaraCMS")
+#ifndef EXCLUDE_FROM_XARALX
+	BOOL PrintRGBBlackAsKey = XaraCMS::PrintRGBBlackAsKey;
+#else
+	BOOL PrintRGBBlackAsKey = TRUE;
+#endif
+
 	for (i = 0; i < PixelWidth; i++)
 	{
 		// It's colour, so get the maximum of R,G,B into Temp
 		TEMPMAX(SrcBuffer[i].Red, SrcBuffer[i].Green, SrcBuffer[i].Blue);
 
-		if (!XaraCMS::PrintRGBBlackAsKey || Temp > 0)
+		if (!PrintRGBBlackAsKey || Temp > 0)
 		{
 			switch (Plate)
 			{
 				case COLOURPLATE_CYAN:
 					Ink = 255 - SrcBuffer[i].Red;		// Cyan ink is (255 - Red)
-					Ink -= UCR[-Temp];
+					if (Ink>UCR[-Temp])
+						Ink -= UCR[-Temp];
+					else
+						Ink=0;
 					break;
 
 				case COLOURPLATE_MAGENTA:
 					Ink = 255 - SrcBuffer[i].Green;		// Magenta ink is (255 - Green)
-					Ink -= UCR[-Temp];
+					if (Ink>UCR[-Temp])
+						Ink -= UCR[-Temp];
+					else
+						Ink=0;
 					break;
 
 				case COLOURPLATE_YELLOW:
 					Ink = 255 - SrcBuffer[i].Blue;		// Yellow ink is (255 - Blue)
-					Ink -= UCR[-Temp];
+					if (Ink>UCR[-Temp])
+						Ink -= UCR[-Temp];
+					else
+						Ink=0;
 					break;
 
 				default:
@@ -2342,9 +2364,6 @@
 					break;
 			}
 
-			if (Ink < 0)
-				Ink = 0;
-
 			Ink = LUT[Ink];
 		}
 		else
@@ -2357,7 +2376,6 @@
 		else
 			DestBuffer[i] = 255 - Ink;
 	} 
-#endif
 	// And finally, vape our helper macro
 	#undef TEMPMAX
 }
@@ -2381,8 +2399,6 @@
 
 void CWxBitmap::ColourSeparate32to32(ColourPlate *pPlate, BYTE *SepTables)
 {
-	PORTNOTETRACE("other","CWxBitmap::ColourSeparateScanline32to32 - do nothing");
-#ifndef EXCLUDE_FROM_XARALX
 	ERROR3IF(SepTables == NULL, "No separation tables!?");
 	ERROR3IF(pPlate == NULL, "The separation ColourPlate has gone missing!");
 
@@ -2434,28 +2450,44 @@
 			break;
 	}
 
+PORTNOTE("printing", "Disabled XaraCMS")
+#ifndef EXCLUDE_FROM_XARALX
+	BOOL PrintRGBBlackAsKey = XaraCMS::PrintRGBBlackAsKey;
+#else
+	BOOL PrintRGBBlackAsKey = TRUE;
+#endif
+
 	for (i = 0; i < NumPixels; i++)
 	{
 		// It's colour, so get the maximum of R,G,B into Temp
 		TEMPMAX(pPixel[i].Red, pPixel[i].Green, pPixel[i].Blue);
 
-		if (!XaraCMS::PrintRGBBlackAsKey || Temp > 0)
+		if (!PrintRGBBlackAsKey || Temp > 0)
 		{
 			switch (Plate)
 			{
 				case COLOURPLATE_CYAN:
 					Ink = 255 - pPixel[i].Red;		// Cyan ink is (255 - Red)
-					Ink -= UCR[-Temp];
+					if (Ink>UCR[-Temp])
+						Ink -= UCR[-Temp];
+					else
+						Ink=0;
 					break;
 
 				case COLOURPLATE_MAGENTA:
 					Ink = 255 - pPixel[i].Green;	// Magenta ink is (255 - Green)
-					Ink -= UCR[-Temp];
+					if (Ink>UCR[-Temp])
+						Ink -= UCR[-Temp];
+					else
+						Ink=0;
 					break;
 
 				case COLOURPLATE_YELLOW:
 					Ink = 255 - pPixel[i].Blue;		// Yellow ink is (255 - Blue)
-					Ink -= UCR[-Temp];
+					if (Ink>UCR[-Temp])
+						Ink -= UCR[-Temp];
+					else
+						Ink=0;
 					break;
 
 				default:
@@ -2463,9 +2495,6 @@
 					break;
 			}
 
-			if (Ink < 0)
-				Ink = 0;
-
 			Ink = LUT[Ink];
 		}
 		else
@@ -2503,7 +2532,6 @@
 				break;
 		}
 	} 
-#endif
 	// And finally, vape our helper macro
 	#undef TEMPMAX
 }
@@ -2523,8 +2551,6 @@
 
 OILBitmap* CWxBitmap::MakeSeparatedCopy(ColourPlate *pPlate, BYTE *SepTables)
 {
-	PORTNOTETRACE("other","CWxBitmap::MakeSeparatedCopy - do nothing");
-#ifndef EXCLUDE_FROM_XARALX
 	ERROR3IF(SepTables == NULL, "No separation tables!?");
 	ERROR3IF(pPlate == NULL, "The separation ColourPlate has gone missing!");
 
@@ -2597,6 +2623,13 @@
 			break;
 	}
 
+PORTNOTE("printing", "Disabled XaraCMS")
+#ifndef EXCLUDE_FROM_XARALX
+	BOOL PrintRGBBlackAsKey = XaraCMS::PrintRGBBlackAsKey;
+#else
+	BOOL PrintRGBBlackAsKey = TRUE;
+#endif
+
 	for (scan = 0; scan < BMInfo->bmiHeader.biHeight; scan++)
 	{
 		GetScanline32bpp(scan, TRUE, pScanline);
@@ -2605,23 +2638,32 @@
 			// It's colour, so get the maximum of R,G,B into Temp
 			TEMPMAX(pScanline[i].Red, pScanline[i].Green, pScanline[i].Blue);
 
-			if (!XaraCMS::PrintRGBBlackAsKey || Temp > 0)
+			if (!PrintRGBBlackAsKey || Temp > 0)
 			{
 				switch (Plate)
 				{
 					case COLOURPLATE_CYAN:
 						Ink = 255 - pScanline[i].Red;		// Cyan ink is (255 - Red)
-						Ink -= UCR[-Temp];
+						if (Ink>UCR[-Temp])
+							Ink -= UCR[-Temp];
+						else
+							Ink=0;
 						break;
 
 					case COLOURPLATE_MAGENTA:
 						Ink = 255 - pScanline[i].Green;		// Magenta ink is (255 - Green)
-						Ink -= UCR[-Temp];
+						if (Ink>UCR[-Temp])
+							Ink -= UCR[-Temp];
+						else
+							Ink=0;
 						break;
 
 					case COLOURPLATE_YELLOW:
 						Ink = 255 - pScanline[i].Blue;		// Yellow ink is (255 - Blue)
-						Ink -= UCR[-Temp];
+						if (Ink>UCR[-Temp])
+							Ink -= UCR[-Temp];
+						else
+							Ink=0;
 						break;
 
 					default:
@@ -2629,9 +2671,6 @@
 						break;
 				}
 
-				if (Ink < 0)
-					Ink = 0;
-
 				Ink = LUT[Ink];
 			}
 			else
@@ -2686,9 +2725,6 @@
 		FreeDIB(pNewInfo, pNewBits);
 	}
 	return pNewBitmap;
-#else
-	return NULL;
-#endif
 }
 
 


Xara