maskfilt.h

Go to the documentation of this file.
00001 // $Id: maskfilt.h 809 2006-04-13 11:28:42Z phil $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 //
00099 
00100 #ifndef INC_MASKEDFILTER
00101 #define INC_MASKEDFILTER
00102 
00103 #include "bitfilt.h"
00104 //#include "bmpprefs.h"     // SelectionType
00105 #include "exphint.h"
00106 
00107 class CXaraFileRecord;
00108 class KernelBitmap;
00109 class OutputDIB;
00110 
00111 /********************************************************************************************
00112 
00113 >   class MaskedFilterExportOptions : public BitmapExportOptions
00114 
00115     Author:     Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
00116     Created:    30/10/96
00117     Purpose:    Base class for storing information about the bitmap we're exporting.
00118 
00119 ********************************************************************************************/
00120 
00121 class MaskedFilterExportOptions : public BitmapExportOptions
00122 {
00123     CC_DECLARE_DYNAMIC(MaskedFilterExportOptions)
00124 
00125 public:
00126 
00127     static BOOL Declare();
00128 
00129     MaskedFilterExportOptions();
00130     MaskedFilterExportOptions(const CDlgResID& Dialog, 
00131                               const FilterType FilterID, const StringBase* pFilterName);
00132 
00133     virtual BOOL    RetrieveDefaults();
00134     virtual BOOL    SetAsDefaults() const;
00135 
00136     // Save and load from named export set properties.
00137     virtual BOOL Write(CXaraFileRecord* pRec);
00138     virtual BOOL Read(CXaraFileRecord* pRec);
00139 
00140     virtual DITHER  GetDither() const { return m_Dither; }
00141     virtual BOOL    SetDither(const DITHER& Dither);
00142 
00143     BOOL    WantTransparent() const;
00144     BOOL    WantInterlaced() const { return m_bInterlaced; }
00145     BOOL    SetMakeInterlaced(BOOL bInterlaced);
00146 
00147     void    SetFilterType(FilterType ID)    {   m_FilterID = ID;    }
00148 
00149 // WEBSTER - markn 21/1/97
00150     virtual BOOL UseSpecificNumColsInPalette();
00151 
00152     // for object copying and comparing
00153     virtual BOOL CopyFrom(BitmapExportOptions *pOther);
00154 
00155     //  Same as above, except it is used to copy information when changing file types
00156     virtual BOOL FileTypeChangeCopyFrom(BitmapExportOptions *pOther);
00157 //  virtual BOOL Equal(BitmapExportOptions *pOther);
00158 
00159     // needed for the make bitmap copy options preview dialog
00160     BOOL CopyFromMasked(MaskedFilterExportOptions *pOther);
00161 
00162 protected:
00163 
00164     // Parameters that the dialog can set
00165     DITHER  m_Dither;                   // Dither type
00166     BOOL    m_bInterlaced;
00167 
00168     // Persistant buffer
00169     static DITHER   g_Dither;
00170     static PALETTE  g_Palette;
00171     static BOOL     g_bTransparent;
00172     static BOOL     g_bInterlaced;
00173 
00174 };
00175 
00176 /********************************************************************************************
00177 
00178 >   class MaskedFilter : public BitmapFilter
00179 
00180     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00181     Created:    26/4/96
00182     Purpose:    Encapsulates a masked filter which provides funcitonality for doing masked
00183                 bitmap export and import.
00184 
00185 ********************************************************************************************/
00186 
00187 class MaskedFilter : public BaseBitmapFilter
00188 {
00189     CC_DECLARE_DYNAMIC(MaskedFilter);
00190     
00191 public:
00192 
00193     MaskedFilter();
00194     BOOL Init();
00195 
00196     INT32   SetTransColour(INT32 NewColour);
00197     INT32   GetTransColour() { return TransColour; }
00198 
00199     // SMFIX - Sets All the appropriate colour to being Transparent!
00200     BOOL ApplyTransparentColoursToBitmap(KernelBitmap* pExportBitmap = NULL, BitmapExportOptions* pExportOptions = NULL);
00201     BOOL ApplyTransparentColoursToBitmap(BITMAPINFOHEADER* pInfoHeader = NULL, BYTE* pBMPBits = NULL,
00202                                          BitmapExportOptions* pExportOptions = NULL, UINT32 YOffset = 0,
00203                                          UINT32 StripHeight = 0);
00204 
00205     // Virtual overrides
00206     virtual UINT32 GetNumReservedColours();
00207     virtual BOOL ExportSelectionOnly(BOOL MaskedRender = FALSE); 
00208 
00209     virtual BOOL CheckSingleBitmapsOnSpread ( Spread    *pSpread,
00210                                               BOOL      *pSamePalettes,
00211                                               BOOL      *pOurBrowserPalette,
00212                                               BOOL      *pAllHaveBitmaps,
00213                                               BOOL      *pAllWithinCount,
00214                                               UINT32        *pPaletteEntries = NULL );
00215 
00216 protected:
00217 
00218     // Export a bitmap.
00219     virtual BOOL WriteToFile ( BOOL End );
00220 
00221     // Get a pointer to the OutputDIB.
00222     virtual OutputDIB* GetOutputDIB(void) { return NULL; }
00223 
00224     // Base Class version - See PNG Filter
00225     virtual void InvertAlpha(LPBITMAPINFO lpBitmapInfo, LPBYTE lpBits) { return; }
00226 
00227     INT32 FindUnusedColour(LPBITMAPINFO pBMInfo, LPBYTE pBMBits);
00228 
00229     UINT32 Compression;         // Compression to use (JPEG = %, others = TRUE, FALSE)
00230 
00231     BOOL SecondPass;            // flag for whether we are rendering second pass on export
00232     BOOL DoingMask;             // flag for whether we are rendering the mask or not
00233 
00234     // Storage for the 8bpp mask that is made up in the first pass rendering on export
00235     LPBITMAPINFO pDestBMInfo;   
00236     LPBYTE pDestBMBytes;
00237     BYTE* pTempBitmapMask;              // WhiteArea mask generated during 1st pass render
00238     UINT32 CurrentScanline;             // Current scanline in the WhiteArea mask.
00239 
00240     INT32 TransColour;                  // -1 == none, or the transparent colour.
00241 
00242     virtual BOOL SetExportHint(Document* pDoc);
00243     
00244     // Override this to provide the correct hint type
00245     virtual UINT32 GetHintType(void) { return(HINTTYPE_BAD); }
00246 
00247     INT32 m_BandNumber; //  Tells you which band of the bitmap we are working on.
00248     //  Tells you if the user made a selection before opening the export dialog.
00249     BOOL m_bSelection;  
00250 };
00251 
00252 #endif // INC_MASKEDFILTER
00253 
00254 

Generated on Sat Nov 10 03:48:38 2007 for Camelot by  doxygen 1.4.4