[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : alex
Repository : xara
Revision : 1473
Date : Tue Jul 18 21:11:07 BST 2006
Changed paths:
M /Trunk/XaraLX/Kernel/filter_types.h
M /Trunk/XaraLX/Kernel/filters.cpp
M /Trunk/XaraLX/wxOil/imgmgkft.cpp
M /Trunk/XaraLX/wxOil/imgmgkft.h
M /Trunk/XaraLX/wxOil/oilfltrs.cpp
M /Trunk/XaraLX/wxOil/oilfltrs.h
M /Trunk/XaraLX/wxOil/xrc/EN/imagemagick-strings.xrc
Enable PSD read/write as a test of macros
Diff:
Index: Trunk/XaraLX/Kernel/filters.cpp
===================================================================
--- Trunk/XaraLX/Kernel/filters.cpp (revision 1472)
+++ Trunk/XaraLX/Kernel/filters.cpp (revision 1473)
@@ -790,7 +790,8 @@
#if _DEBUG
if (ImageMagickFilter::CheckPath())
{
- ADD_FILTER(ImageMagickFilter)
+ ADD_FILTER(ImageMagickFilterMIFF)
+ ADD_FILTER(ImageMagickFilterPSD)
}
#endif
ADD_FILTER(TI_GIFFilter)
Index: Trunk/XaraLX/Kernel/filter_types.h
===================================================================
--- Trunk/XaraLX/Kernel/filter_types.h (revision 1472)
+++ Trunk/XaraLX/Kernel/filter_types.h (revision 1473)
@@ -192,10 +192,9 @@
PNG_TRANSPARENT,
PNG_TRANSINTER,
- IMAGEMAGICK,
- IMAGEMAGICK_INTERLACED,
- IMAGEMAGICK_TRANSPARENT,
- IMAGEMAGICK_TRANSINTER,
+ IMAGEMAGICK, // This one should never be used
+ IMAGEMAGICK_MIFF,
+ IMAGEMAGICK_PSD,
// --- Insert new Filter Types just above here ---
Index: Trunk/XaraLX/wxOil/imgmgkft.cpp
===================================================================
--- Trunk/XaraLX/wxOil/imgmgkft.cpp (revision 1472)
+++ Trunk/XaraLX/wxOil/imgmgkft.cpp (revision 1473)
@@ -147,34 +147,16 @@
BOOL ImageMagickFilter::s_DoWarning = TRUE;
BOOL ImageMagickFilter::s_Disable = FALSE;
+BOOL ImageMagickFilter::s_OutputTransparent = FALSE;
+BOOL ImageMagickFilter::s_OutputInterlaced = FALSE;
+
#if 1
-UINT32 ImageMagickExportOptions::g_CompactedFlagsForDefaults = 0;
+IMFilterStringToUINT32 * ImageMagickExportOptions::s_pHash = NULL;
-
/********************************************************************************************
-> static BOOL ImageMagickExportOptions::Declare()
-
- Author: Colin_Barfoot (Xara Group Ltd) <camelotdev@xxxxxxxx> (from Neville)
- Created: 29/10/96
- Returns: TRUE if successfully declared preferences
- FALSE otherwise
- Purpose: To declare preferences associated with these export options
-
-********************************************************************************************/
-BOOL ImageMagickExportOptions::Declare()
-{
- BOOL ok = Camelot.DeclareSection(_T("Filters"), 10)
- && Camelot.DeclarePref( NULL, _T("ExportImageMagicktype"), &g_CompactedFlagsForDefaults, 0, 3 );
-
- // All ok
- return ok;
-}
-
-/********************************************************************************************
-
> ImageMagickExportOptions::ImageMagickExportOptions(const FilterType FilterID, const StringBase* pFilterName)
Author: Colin_Barfoot (Xara Group Ltd) <camelotdev@xxxxxxxx>
@@ -186,7 +168,36 @@
ImageMagickExportOptions::ImageMagickExportOptions(const FilterType FilterID, const StringBase* pFilterName) :
MaskedFilterExportOptions(_R(IDD_EXPORTBMPOPTS), FilterID, pFilterName)
{
- // just us rats in here
+ FilterName = *pFilterName;
+
+ // if we don't already have the static hash, generate one
+ // We never delete this (harmless)
+ if (!s_pHash)
+ {
+ s_pHash = new IMFilterStringToUINT32;
+ }
+
+ if (!s_pHash) // Not much we can do
+ return;
+
+ // Declare the preference if it hasn't been seen already
+ if (!GetConfigPtr((const TCHAR *)(*pFilterName)))
+ {
+ // OK, it's not in the hash already, so we need to declare it
+ (*s_pHash)[camStrdup((const TCHAR *)*pFilterName)]=0;
+ UINT32 * pPref = GetConfigPtr((const TCHAR *)(*pFilterName));
+ ERROR3IF(!pPref, "Config did not stick");
+ if (pPref)
+ {
+ if (Camelot.DeclareSection(_T("Filters"), 10))
+ {
+ String_256 PrefName = *pFilterName;
+ String_256 Prefix(_T("ExportImageMagickFlags"));
+ Prefix+=PrefName;
+ Camelot.DeclarePref( NULL, Prefix, pPref, 0, 3 );
+ }
+ }
+ }
}
/********************************************************************************************
@@ -204,7 +215,7 @@
if (!MaskedFilterExportOptions::RetrieveDefaults())
return FALSE;
- SetMakeInterlaced(g_CompactedFlagsForDefaults & 1);
+ SetMakeInterlaced(GetConfig() & 1);
return TRUE;
}
@@ -223,8 +234,7 @@
if (!MaskedFilterExportOptions::SetAsDefaults())
return FALSE;
- g_CompactedFlagsForDefaults = WantTransparent() ? 2 : 0;
- g_CompactedFlagsForDefaults |= WantInterlaced() ? 1 : 0;
+ SetConfig( ( WantTransparent() ? 2 : 0 ) | (WantInterlaced() ? 1 : 0) );
return TRUE;
}
@@ -244,18 +254,20 @@
********************************************************************************************/
ImageMagickFilter::ImageMagickFilter() : MaskedFilter()
{
- ImportMsgID = _R(IDS_IMPORTMSG_IMAGEMAGICK);
- Flags.CanImport = TRUE;
- Flags.CanExport = TRUE;
-
- FilterID = IMAGEMAGICK;
- ExportMsgID = _R(IDS_EXPORTMSG_IMAGEMAGICK); // "Preparing ImageMagick file..."
- ExportingMsgID = _R(IDS_EXPORTINGMSG_IMAGEMAGICK); // "Exporting ImageMagick file..."
-
- // Special Mask prepartion stage ID
- Export2ndStageMsgID = _R(IDN_MASKINGMSG_IMAGEMAGICK); // "Preparing mask for ImageMagick file..."
ExportRegion = NULL;
TempFile = NULL;
+
+ // Things that the derive class constructor may stamp on
+ Flags.CanImport = TRUE;
+ Flags.CanExport = TRUE;
+ FilterID = IMAGEMAGICK;
+ FilterNameID = _R(IDS_IMAGEMAGICK_FILTERNAME);
+ FilterInfoID = _R(IDS_IMAGEMAGICK_FILTERINFO);
+ FilterExtID = _R(IDS_IMAGEMAGICK_FILTEREXT);
+ ImportMsgID = _R(IDS_IMAGEMAGICK_IMPORTMSG);
+ ExportMsgID = _R(IDS_IMAGEMAGICK_PREPAREMSG); // "Preparing ImageMagick file..."
+ ExportingMsgID = _R(IDS_IMAGEMAGICK_EXPORTMSG); // "Exporting ImageMagick file..."
+ Export2ndStageMsgID = _R(IDS_IMAGEMAGICK_MASKINGMSG); // "Preparing mask for ImageMagick file..."
}
/********************************************************************************************
@@ -272,17 +284,14 @@
********************************************************************************************/
BOOL ImageMagickFilter::Init()
{
- if (!ImageMagickExportOptions::Declare())
- return FALSE;
-
// Get the OILFilter object
- pOILFilter = new ImageMagickOILFilter(this);
+ pOILFilter = new ImageMagickOILFilter(this, FilterNameID, FilterExtID);
if (pOILFilter==NULL)
return FALSE;
// Load the description strings
- FilterName.Load(_R(IDS_IMAGEMAGICK_FILTERNAME));
- FilterInfo.Load(_R(IDS_IMAGEMAGICK_FILTERINFO));
+ FilterName.Load(FilterNameID);
+ FilterInfo.Load(FilterInfoID);
// All ok
return TRUE;
@@ -309,9 +318,11 @@
{
// We need to remember what we thought of this file in our class variable.
// So, set it to a nice default value at the start.
- ImageMagickHowCompatible = ((Filename.GetType() == _T("miff")) ||
- (Filename.GetType() == _T("miff")) ) ? 10:0;
+ String_256 fextension = Filename.GetType();
+ fextension.toLower();
+ ImageMagickHowCompatible = (fextension == (String_256)GetExtension()) ? GetCompatibility():0;
+
// Return the found value to the caller.
return ImageMagickHowCompatible;
}
@@ -527,21 +538,15 @@
// do the specific to this class options
// Filter type can be changed by the export options dialog box from say
- // ImageMagick to ImageMagick_INTERLACED
+
+ s_OutputTransparent = pImageMagickOptions->WantTransparent();
+ s_OutputInterlaced = pImageMagickOptions->WantInterlaced();
UINT32 Silliness = pImageMagickOptions->WantTransparent() ? 2 : 0;
Silliness |= pImageMagickOptions->WantInterlaced() ? 1 : 0;
if (Silliness >= 0 && Silliness <= 4)
{
Compression = Silliness;
- // Compression ranges from 0 .. 4 so map this onto our filter types
-// s_FilterType = ImageMagick + Silliness;
- switch (Silliness)
- {
- case 0: s_FilterType = IMAGEMAGICK; break;
- case 1: s_FilterType = IMAGEMAGICK_INTERLACED; break;
- case 2: s_FilterType = IMAGEMAGICK_TRANSPARENT; break;
- case 3: s_FilterType = IMAGEMAGICK_TRANSINTER; break;
- }
+ s_FilterType = IMAGEMAGICK;
if (pImageMagickOptions->WantTransparent() && pImageMagickOptions->GetSelectionType() == SELECTION)
DoingMask = TRUE;
@@ -1026,31 +1031,10 @@
ERROR2IF(pPalette==NULL,FALSE,"ImageMagickFilter::WriteToFile palette pointer is null");
// Set up our format type flags.
- BOOL Interlace = TRUE; // Use interlace or not
INT32 Transparent = -1; // colour or -1 = no transparency
- BOOL WantTransparent = FALSE;
+ BOOL Interlace = s_OutputInterlaced; // Use interlace or not
+ BOOL WantTransparent = s_OutputTransparent;
- switch (s_FilterType)
- {
- default:
- case IMAGEMAGICK:
- Interlace = FALSE;
- WantTransparent = FALSE;
- break;
- case IMAGEMAGICK_INTERLACED:
- Interlace = TRUE;
- WantTransparent = FALSE;
- break;
- case IMAGEMAGICK_TRANSPARENT:
- Interlace = FALSE;
- WantTransparent = TRUE;
- break;
- case IMAGEMAGICK_TRANSINTER:
- Interlace = TRUE;
- WantTransparent = TRUE;
- break;
- }
-
if (WantTransparent)
{
// We want to try and output the transparency if possible ...
@@ -1326,7 +1310,7 @@
// get filename in usable form
cifn = camStrdup(wxString(_T("png:"))+TempFileName );
- cofn = camStrdup((const TCHAR *)(OutputPath.GetPath()));
+ cofn = camStrdup(GetTag()+_T(":")+(const TCHAR *)(OutputPath.GetPath()));
// Now convert the file
IMargv[0]=pcommand;
@@ -1383,7 +1367,7 @@
wxChar * IMargv[4];
// get filename in usable form
- cifn = camStrdup(wxString(_T("miff:"))+(const TCHAR *)(InputPath.GetPath()));
+ cifn = camStrdup(GetTag()+_T(":")+(const TCHAR *)(InputPath.GetPath()));
cofn = camStrdup(wxString(_T("png:"))+TempFileName );
// Now convert the file
@@ -1517,3 +1501,21 @@
return s_HaveImageMagick;
}
+/********************************************************************************************
+
+> ImageMagickOILFilter::ImageMagickOILFilter(Filter* pFilter)
+
+ Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xxxxxxxx>
+ Created: 18/07/2006
+ Inputs: pFilter - The Filter
+ Purpose: Constructs the oily parts of the PNG File Format Filter (ie the list of
+ File Extensions that this filter understands)
+
+********************************************************************************************/
+
+ImageMagickOILFilter::ImageMagickOILFilter(Filter* pFilter, ResourceID FilterNameID, ResourceID FilterExtID) : OILFilter(pFilter)
+{
+ FilterName.Load(FilterNameID);
+ FilterExt.Load(FilterExtID);
+}
+
Index: Trunk/XaraLX/wxOil/oilfltrs.cpp
===================================================================
--- Trunk/XaraLX/wxOil/oilfltrs.cpp (revision 1472)
+++ Trunk/XaraLX/wxOil/oilfltrs.cpp (revision 1473)
@@ -1507,24 +1507,6 @@
FilterExt.Load(_R(IDS_FILTEREXT_PNG));
}
-/********************************************************************************************
-
-> ImageMagickOILFilter::ImageMagickOILFilter(Filter* pFilter)
-
- Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xxxxxxxx>
- Created: 25/4/96
- Inputs: pFilter - The Filter
- Purpose: Constructs the oily parts of the PNG File Format Filter (ie the list of
- File Extensions that this filter understands)
-
-********************************************************************************************/
-
-ImageMagickOILFilter::ImageMagickOILFilter(Filter* pFilter) : OILFilter(pFilter)
-{
- FilterName.Load(_R(IDS_FILTERNAME_IMAGEMAGICK));
- FilterExt.Load(_R(IDS_FILTEREXT_IMAGEMAGICK));
-}
-
#if !defined(EXCLUDE_FROM_RALPH)
Index: Trunk/XaraLX/wxOil/xrc/EN/imagemagick-strings.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/imagemagick-strings.xrc (revision 1472)
+++ Trunk/XaraLX/wxOil/xrc/EN/imagemagick-strings.xrc (revision 1473)
@@ -4,66 +4,150 @@
<title>String table from FILTRRESRC</title>
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
+ <object class="sizeritem">
+ <flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
+ <object class="wxStaticText" name="IDE_IMAGEMAGICK_ERROR">
+ <label>ImageMagick failed to convert the file</label>
+ </object>
+ </object>
<object class="sizeritem">
<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
- <object class="wxStaticText" name="IDS_FILTERNAME_IMAGEMAGICK">
+ <object class="wxStaticText" name="IDS_WARN_NOIMAGEMAGICK">
+ <label>Xara LX cannot find ImageMagick version 6.0.0 or above. Various bitmap filters will be disabled. To install ImageMagick, either use the package manager supplied with your distribution, or visit http://www.imagemagick.org/</label>
+ </object>
+ </object>
+
+ <object class="sizeritem">
+ <flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_FILTERNAME">
<label>ImageMagick</label>
</object>
</object>
<object class="sizeritem">
<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
- <object class="wxStaticText" name="IDS_FILTEREXT_IMAGEMAGICK">
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_FILTERINFO">
+ <label>Load ImageMagick file</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_FILTEREXT">
<label>miff</label>
</object>
</object>
<object class="sizeritem">
<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
- <object class="wxStaticText" name="IDS_IMPORTMSG_IMAGEMAGICK">
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_IMPORTMSG">
<label>Loading ImageMagick file...</label>
</object>
</object>
<object class="sizeritem">
<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
- <object class="wxStaticText" name="IDS_EXPORTMSG_IMAGEMAGICK">
- <label>Exporting ImageMagick file...</label>
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_PREPAREMSG">
+ <label>Preparing to export ImageMagick file...</label>
</object>
</object>
<object class="sizeritem">
<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
- <object class="wxStaticText" name="IDS_EXPORTINGMSG_IMAGEMAGICK">
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_EXPORTMSG">
<label>Exporting ImageMagick file...</label>
</object>
</object>
<object class="sizeritem">
<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
- <object class="wxStaticText" name="IDN_MASKINGMSG_IMAGEMAGICK">
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_MASKINGMSG">
<label>Preparing mask for ImageMagick file...</label>
</object>
</object>
+
+
<object class="sizeritem">
<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
- <object class="wxStaticText" name="IDS_IMAGEMAGICK_FILTERINFO">
- <label>Load ImageMagick file</label>
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_MIFF_FILTERNAME">
+ <label>ImageMagick MIFF</label>
</object>
</object>
<object class="sizeritem">
<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
- <object class="wxStaticText" name="IDS_IMAGEMAGICK_FILTERNAME">
- <label>ImageMagick</label>
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_MIFF_FILTERINFO">
+ <label>Load MIFF file</label>
</object>
</object>
<object class="sizeritem">
<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
- <object class="wxStaticText" name="IDE_IMAGEMAGICK_ERROR">
- <label>ImageMagick failed to convert the file</label>
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_MIFF_FILTEREXT">
+ <label>miff</label>
</object>
</object>
+ <object class="sizeritem">
+ <flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_MIFF_IMPORTMSG">
+ <label>Loading MIFF file...</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_MIFF_PREPAREMSG">
+ <label>Preparing to export MIFF file...</label>
+ </object>
+ </object>
<object class="sizeritem">
<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
- <object class="wxStaticText" name="IDS_WARN_NOIMAGEMAGICK">
- <label>Xara LX cannot find ImageMagick version 6.0.0 or above. Various bitmap filters will be disabled. To install ImageMagick, either use the package manager supplied with your distribution, or visit http://www.imagemagick.org/</label>
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_MIFF_EXPORTMSG">
+ <label>Exporting MIFF file...</label>
</object>
</object>
+ <object class="sizeritem">
+ <flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_MIFF_MASKINGMSG">
+ <label>Preparing mask for MIFF file...</label>
+ </object>
+ </object>
+
+
+ <object class="sizeritem">
+ <flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_PSD_FILTERNAME">
+ <label>Photoshop PSD</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_PSD_FILTERINFO">
+ <label>Load PSD file</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_PSD_FILTEREXT">
+ <label>psd</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_PSD_IMPORTMSG">
+ <label>Loading PSD file...</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_PSD_PREPAREMSG">
+ <label>Preparing to export PSD file...</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_PSD_EXPORTMSG">
+ <label>Exporting PSD file...</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
+ <object class="wxStaticText" name="IDS_IMAGEMAGICK_PSD_MASKINGMSG">
+ <label>Preparing mask for PSD file...</label>
+ </object>
+ </object>
+
</object>
</object>
</resource>
Index: Trunk/XaraLX/wxOil/oilfltrs.h
===================================================================
--- Trunk/XaraLX/wxOil/oilfltrs.h (revision 1472)
+++ Trunk/XaraLX/wxOil/oilfltrs.h (revision 1473)
@@ -1217,22 +1217,6 @@
/********************************************************************************************
-> class ImageMagickOILFilter : public OILFilter
-
- Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xxxxxxxx>
- Created: 25/4/96
- Purpose: The PNG File format Oil Filter (Extension etc)
-
-********************************************************************************************/
-
-class ImageMagickOILFilter : public OILFilter
-{
-public:
- ImageMagickOILFilter (Filter* pFilter);
-};
-
-/********************************************************************************************
-
> class ImagemapOILFilter : public OILFilter
Author: Graham_Walmsley (Xara Group Ltd) <camelotdev@xxxxxxxx>
Index: Trunk/XaraLX/wxOil/imgmgkft.h
===================================================================
--- Trunk/XaraLX/wxOil/imgmgkft.h (revision 1472)
+++ Trunk/XaraLX/wxOil/imgmgkft.h (revision 1473)
@@ -117,13 +117,17 @@
********************************************************************************************/
+// Need a type for the hash data or we get duplicate const error
+typedef const TCHAR * IMFilterString;
+
+// Declare the hash map from IMFilterString to UINT32
+WX_DECLARE_HASH_MAP( IMFilterString, UINT32, wxStringHash, wxStringEqual, IMFilterStringToUINT32);
+
class ImageMagickExportOptions : public MaskedFilterExportOptions
{
CC_DECLARE_DYNCREATE(ImageMagickExportOptions)
public:
- static BOOL Declare();
-
ImageMagickExportOptions(const FilterType FilterID, const StringBase* pFilterName);
ImageMagickExportOptions() {};
@@ -134,10 +138,31 @@
virtual UINT32 GetFilterNameStrID() { return _R(IDS_FILTERNAME_ImageMagick);}
+ virtual UINT32 * GetConfigPtr(const TCHAR * FilterName) const
+ {
+ if (!s_pHash)
+ return NULL;
+ IMFilterStringToUINT32::iterator i=s_pHash->find(FilterName);
+ return (UINT32 *)((i==s_pHash->end())?NULL:&(i->second));
+ }
+ virtual UINT32 GetConfig() const
+ {
+ UINT32 * pConfig = GetConfigPtr(FilterName);
+ return pConfig?(*pConfig):0;
+ }
+ virtual void SetConfig(UINT32 value) const
+ {
+ UINT32 * pConfig = GetConfigPtr(FilterName);
+ if (pConfig)
+ *pConfig = value;
+ }
+
protected:
- static UINT32 g_CompactedFlagsForDefaults;
+ String_256 FilterName;
+
+ static IMFilterStringToUINT32 * s_pHash;
};
/********************************************************************************************
@@ -184,6 +209,13 @@
// We might want to bring in the Accusoft filter to help out.
virtual INT32 GetImageMagickCompatibility() { return ImageMagickHowCompatible; }
+ // These get overridden in the derived classes
+ virtual BOOL CanDoTransparency() { return TRUE; }
+ virtual BOOL CanDoInterlace() { return FALSE; }
+ virtual wxString GetTag() { return _T("mmif"); }
+ virtual TCHAR * GetExtension() { return _T("mmif"); }
+ virtual INT32 GetCompatibility() { return 10; }
+
// Virtual overrides
virtual UINT32 GetExportMsgID();
virtual void PostGetExportOptions(BitmapExportOptions* pOptions);
@@ -236,6 +268,8 @@
// The class we use for actually outputting the ImageMagick data and converting from 32 to n bpps
static OutputPNG DestImageMagick;
#endif
+
+ ResourceID FilterExtID;
// This is so we can remember what we thought of the GIF file.
INT32 ImageMagickHowCompatible;
@@ -253,8 +287,75 @@
static BOOL s_HaveCheckedPath;
static BOOL s_DoWarning;
static BOOL s_Disable;
+
+ // These allow us to use a single filter type
+ static BOOL s_OutputTransparent;
+ static BOOL s_OutputInterlaced;
};
+/********************************************************************************************
+
+> class ImageMagickOILFilter : public OILFilter
+
+ Author: Alex Bligh <alex@xxxxxxxxxxx>
+ Created: 18/07/2006
+ Purpose: The PNG File format Oil Filter (Extension etc)
+
+********************************************************************************************/
+
+class ImageMagickOILFilter : public OILFilter
+{
+public:
+ ImageMagickOILFilter (Filter* pFilter, ResourceID FilterNameID, ResourceID FilterExtID);
+};
+
+
+#define DECLARE_IMAGEMAGICK_FILTER(IMType, IMCanInport, IMCanExport, IMTransparency, IMInterlace, IMTag, IMExtension, IMCompatibility) \
+class ImageMagickFilter ## IMType : public ImageMagickFilter \
+{ \
+public: \
+ ImageMagickFilter ## IMType() \
+ { \
+ Flags.CanImport = IMCanInport; \
+ Flags.CanExport = IMCanExport; \
+ FilterID = IMAGEMAGICK_ ## IMType ; \
+ FilterNameID = _R(IDS_IMAGEMAGICK_ ## IMType ## _FILTERNAME); \
+ FilterInfoID = _R(IDS_IMAGEMAGICK_ ## IMType ## _FILTERINFO); \
+ FilterExtID = _R(IDS_IMAGEMAGICK_ ## IMType ## _FILTEREXT); \
+ ImportMsgID = _R(IDS_IMAGEMAGICK_ ## IMType ## _IMPORTMSG); \
+ ExportMsgID = _R(IDS_IMAGEMAGICK_ ## IMType ## _PREPAREMSG); \
+ ExportingMsgID = _R(IDS_IMAGEMAGICK_ ## IMType ## _EXPORTMSG); \
+ Export2ndStageMsgID = _R(IDS_IMAGEMAGICK_ ## IMType ## _MASKINGMSG); \
+ } \
+ \
+ virtual BOOL CanDoTransparency() { return IMTransparency; } \
+ virtual BOOL CanDoInterlace() { return IMInterlace; } \
+ virtual wxString GetTag() { return IMTag; } \
+ virtual TCHAR * GetExtension() { return IMExtension; } \
+ virtual INT32 GetCompatibility() { return IMCompatibility; } \
+};
+
+// Instructions on adding a new ImageMagickFilter
+// ==============================================
+//
+// 1. Declare the filter below (let's say you give it the classname FOO)
+// 2. Add "IMAGEMAGIK_FOO" to the enum in filter_types.h
+// 3. Add "ADD_FILTER(ImageMagickFilterFOO)" to filters.cpp
+// 4. Add appropriate resources to wxOil/xrc/EN/imagemagick-strings.xrc
+// These would be
+// IDS_IMAGEMAGICK_FOO_FILTERNAME
+// IDS_IMAGEMAGICK_FOO_FILTERINFO
+// IDS_IMAGEMAGICK_FOO_FILTEREXT
+// IDS_IMAGEMAGICK_FOO_IMPORTMSG
+// IDS_IMAGEMAGICK_FOO_PREPAREMSG
+// IDS_IMAGEMAGICK_FOO_EXPORTMSG
+// IDS_IMAGEMAGICK_FOO_MASKINGMSG
+//
+
+// ClassName Improt Export Transp Int'lce Tag Extension Compat
+DECLARE_IMAGEMAGICK_FILTER(MIFF, TRUE, TRUE, TRUE, FALSE, _T("miff"), _T("miff"), 10)
+DECLARE_IMAGEMAGICK_FILTER(PSD, TRUE, TRUE, TRUE, FALSE, _T("psd"), _T("psd"), 10)
+
#endif // INC_ImageMagickFILTR
Xara