JPEGExportOptions Class Reference

Allows JPEG specific export options to be manipulated. More...

#include <exjpeg.h>

Inheritance diagram for JPEGExportOptions:

BitmapExportOptions OpParam CCObject SimpleCCObject List of all members.

Public Member Functions

 JPEGExportOptions ()
 Default constructor for a JPEGExportOptions object.
 JPEGExportOptions (const FilterType FilterID, const StringBase *pFilterName)
 Constructor for a JPEGExportOptions object.
virtual BOOL RetrieveDefaults ()
 Compares the contents of this and pOther objects Provides additional implementation required for retrieving JPEG specific defaults. See Also: BitmapExportOptions::RetrieveDefaults().
virtual BOOL SetAsDefaults () const
 Provides additional implementation to set JPEG specific info as defaults See Also: BitmapExportOptions::SetAsDefaults().
virtual BOOL Write (CXaraFileRecord *pRec)
 Writes this object to the given record.
virtual BOOL Read (CXaraFileRecord *pRec)
 Reads this object from the given record.
virtual BOOL GetSupportsImageMap ()
BOOL DoAsProgressive () const
 Provides a JPEG specific export parameter.
BOOL SetMakeProgressive (BOOL bProgressive)
 Sets a JPEG specific export parameter.
JPEG_QUALITY GetQuality () const
 Provides a JPEG specific export parameter.
BOOL SetQuality (const JPEG_QUALITY &Quality)
 Sets a JPEG specific export parameter.
libJPEG::J_DCT_METHOD GetDCTMethod () const
 Provides a JPEG specific export parameter.
BOOL SetDCTMethod (const libJPEG::J_DCT_METHOD &DCTMethod)
 Sets an IJG specific parameter Notes: NOT a user (interface) option.
libJPEG::J_COLOR_SPACE GetColourModel () const
 Provides a IJG specific export parameter See Also: GetColourComponentCount().
UINT32 GetColourComponentCount () const
 Provides an IJG specific export parameter See Also: GetColourComponentCount().
BOOL SetColourModel (const libJPEG::J_COLOR_SPACE &ColourModel)
 Sets an IJG specific parameter Notes: The bitmap is expected to be of the correct format or a converter (DIBConvert) provided when the bitmap is written.
virtual BOOL CopyFrom (BitmapExportOptions *pOther)
 Sets the contents of this object from the passed object See Also: BitmapExportOptions::MakeCopy().
virtual BOOL FileTypeChangeCopyFrom (BitmapExportOptions *pOther)
 Copies the information from the BitmapExportOptions object passed in as the argument to the palette object in this class.
virtual UINT32 GetFilterNameStrID ()

Static Public Member Functions

static void SetKernelBitmap (KernelBitmap *pBitmap)
static KernelBitmapGetKernelBitmap ()
static void SetJPEGPresentAndSelected (BOOL Value)
static BOOL GetJPEGPresentAndSelected ()

Public Attributes

BOOL m_bJPEGPresentAndSelected

Protected Attributes

JPEG_QUALITY m_Quality
BOOL m_DoAsProgressive
libJPEG::J_DCT_METHOD m_DCTMethod
libJPEG::J_COLOR_SPACE m_ColourModel
UINT32 m_ColourComponents

Static Protected Attributes

static KernelBitmappKernelBitmap = NULL
static BOOL m_JPEGPresentAndSelected = FALSE

Private Member Functions

 CC_DECLARE_DYNCREATE (JPEGExportOptions)

Detailed Description

Allows JPEG specific export options to be manipulated.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/10/96

Definition at line 120 of file exjpeg.h.


Constructor & Destructor Documentation

JPEGExportOptions::JPEGExportOptions  ) 
 

Default constructor for a JPEGExportOptions object.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/10/96

Definition at line 170 of file exjpeg.cpp.

00171   : m_bJPEGPresentAndSelected(0),
00172     m_Quality(100),
00173     m_DoAsProgressive(FALSE),
00174     m_DCTMethod(libJPEG::JDCT_DEFAULT),
00175     m_ColourModel(libJPEG::JCS_UNKNOWN),
00176     m_ColourComponents(0)
00177 {
00178     // Empty.
00179 }

JPEGExportOptions::JPEGExportOptions const FilterType  FilterID,
const StringBase pFilterName
 

Constructor for a JPEGExportOptions object.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/10/96

Definition at line 191 of file exjpeg.cpp.

00192   : BitmapExportOptions(_R(IDD_EXPORTJPEGOPTS), FilterID, pFilterName),
00193     m_bJPEGPresentAndSelected(0),
00194     m_Quality(100),
00195     m_DoAsProgressive(FALSE),
00196     m_DCTMethod(libJPEG::JDCT_DEFAULT),
00197     m_ColourModel(libJPEG::JCS_UNKNOWN),
00198     m_ColourComponents(0)
00199 {
00200     // Empty.
00201 }


Member Function Documentation

JPEGExportOptions::CC_DECLARE_DYNCREATE JPEGExportOptions   )  [private]
 

BOOL JPEGExportOptions::CopyFrom BitmapExportOptions pSource  )  [virtual]
 

Sets the contents of this object from the passed object See Also: BitmapExportOptions::MakeCopy().

Author:
Stefan_Stoykov (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/05/97
Parameters:
pSource - the other BitmapExportOptions object to copy the data from [INPUTS]

Reimplemented from BitmapExportOptions.

Definition at line 215 of file exjpeg.cpp.

00216 {
00217     // copy the base class first
00218     if (!BitmapExportOptions::CopyFrom(pSource))
00219         return FALSE;
00220 
00221     // must be the same class, otherwise the base class  function above returns FALSE
00222     JPEGExportOptions *pOther = (JPEGExportOptions *)pSource;
00223 
00224     m_Quality           = pOther->m_Quality;
00225     m_DoAsProgressive   = pOther->m_DoAsProgressive;
00226     m_DCTMethod         = pOther->m_DCTMethod;
00227     m_ColourModel       = pOther->m_ColourModel;
00228     m_ColourComponents  = pOther->m_ColourComponents;
00229     m_bJPEGPresentAndSelected = pOther->m_bJPEGPresentAndSelected;
00230 
00231     return TRUE;
00232 };

BOOL JPEGExportOptions::DoAsProgressive  )  const
 

Provides a JPEG specific export parameter.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/10/96
Returns:
TRUE if the JPEG should be exported as a progressive file FALSE otherwise

Definition at line 403 of file exjpeg.cpp.

00404 {
00405     return m_DoAsProgressive;
00406 }

BOOL JPEGExportOptions::FileTypeChangeCopyFrom BitmapExportOptions pOther  )  [virtual]
 

Copies the information from the BitmapExportOptions object passed in as the argument to the palette object in this class.

Author:
Alex_Price (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/10/99
Parameters:
pOther - A BitmapExportOptions object we want to make a copy of. [INPUTS]
Returns:
-

Reimplemented from BitmapExportOptions.

Definition at line 235 of file exjpeg.cpp.

00236 {
00237     // copy the base class first
00238     if (!BitmapExportOptions::FileTypeChangeCopyFrom(pOther))
00239         return FALSE;
00240 
00241     //  No other options types has the JPEG options, so have to use the default values
00242     m_Quality           = 75;
00243     m_DoAsProgressive   = FALSE;
00244     m_DCTMethod         = libJPEG::JDCT_DEFAULT;
00245     m_ColourModel       = libJPEG::JCS_UNKNOWN;
00246     m_ColourComponents  = 0;
00247     m_bJPEGPresentAndSelected = 0;
00248 
00249     // Ensure that the JPEG depth is less than 32 bpp.
00250     if( GetDepth() == 32 )
00251     {
00252         SetDepth( 24 );
00253     }
00254 
00255     return TRUE;
00256 }

UINT32 JPEGExportOptions::GetColourComponentCount  )  const
 

Provides an IJG specific export parameter See Also: GetColourComponentCount().

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/10/96
Returns:
The number of colour components associated with the J_COLOR_SPACE returned by GetColourModel()

Definition at line 586 of file exjpeg.cpp.

00587 {
00588     return m_ColourComponents;
00589 }

libJPEG::J_COLOR_SPACE JPEGExportOptions::GetColourModel void   )  const
 

Provides a IJG specific export parameter See Also: GetColourComponentCount().

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/10/96
Returns:
The J_COLOR_SPACE to be used for export

Definition at line 568 of file exjpeg.cpp.

00569 {
00570     return m_ColourModel;
00571 }

libJPEG::J_DCT_METHOD JPEGExportOptions::GetDCTMethod  )  const
 

Provides a JPEG specific export parameter.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/10/96
Returns:
TRUE if the JPEG should be exported as a progressive file FALSE otherwise

Definition at line 437 of file exjpeg.cpp.

00438 {
00439     return m_DCTMethod;
00440 }

virtual UINT32 JPEGExportOptions::GetFilterNameStrID  )  [inline, virtual]
 

Reimplemented from BitmapExportOptions.

Definition at line 167 of file exjpeg.h.

00167 { return _R(IDS_JPG_EXP_FILTERNAME);}

static BOOL JPEGExportOptions::GetJPEGPresentAndSelected  )  [inline, static]
 

Definition at line 155 of file exjpeg.h.

00155 { return m_JPEGPresentAndSelected;  }

static KernelBitmap* JPEGExportOptions::GetKernelBitmap  )  [inline, static]
 

Definition at line 152 of file exjpeg.h.

00152 { return pKernelBitmap; }

JPEG_QUALITY JPEGExportOptions::GetQuality  )  const
 

Provides a JPEG specific export parameter.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/10/96
Returns:
A JPEG_QUALITY value (0..100) indicating FALSE otherwise

Definition at line 420 of file exjpeg.cpp.

00421 {
00422     return m_Quality;
00423 }

virtual BOOL JPEGExportOptions::GetSupportsImageMap  )  [inline, virtual]
 

Reimplemented from BitmapExportOptions.

Definition at line 135 of file exjpeg.h.

00135 { return TRUE; }

BOOL JPEGExportOptions::Read CXaraFileRecord pRec  )  [virtual]
 

Reads this object from the given record.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/2/00
Parameters:
pRec --- record to read [INPUTS]
Returns:
TRUE if successful.
See also:
JPEGExportOptions::Write

Reimplemented from BitmapExportOptions.

Definition at line 379 of file exjpeg.cpp.

00380 {
00381     m_DoAsProgressive = FALSE;
00382     return BitmapExportOptions::Read(pRec) &&
00383            pRec->ReadUINT32((UINT32*) &m_Quality) &&
00384            pRec->ReadBYTEtoBOOL(&m_DoAsProgressive) &&
00385            pRec->ReadINT16((INT16*) &m_DCTMethod) &&
00386            pRec->ReadINT16((INT16*) &m_ColourModel) &&
00387            pRec->ReadUINT32((UINT32*) &m_ColourComponents);
00388 }

BOOL JPEGExportOptions::RetrieveDefaults  )  [virtual]
 

Compares the contents of this and pOther objects Provides additional implementation required for retrieving JPEG specific defaults. See Also: BitmapExportOptions::RetrieveDefaults().

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/10/96

Reimplemented from BitmapExportOptions.

Definition at line 303 of file exjpeg.cpp.

00304 {
00305     if (!BitmapExportOptions::RetrieveDefaults())
00306     {
00307         return FALSE;
00308     }
00309     m_Quality           = g_DefaultCompression;
00310     m_DoAsProgressive   = g_bExportProgressive;
00311     m_DCTMethod         = g_DefaultDCTMethod;
00312     SetDepth(24); // all jpegs are 24 after all -sjk
00313 
00314     return TRUE;
00315 }

BOOL JPEGExportOptions::SetAsDefaults  )  const [virtual]
 

Provides additional implementation to set JPEG specific info as defaults See Also: BitmapExportOptions::SetAsDefaults().

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/10/96

Reimplemented from BitmapExportOptions.

Definition at line 328 of file exjpeg.cpp.

00329 {
00330     if (!BitmapExportOptions::SetAsDefaults())
00331     {
00332         return FALSE;
00333     }
00334     
00335     // TODO: Fill in JPEG specific statics need sorting
00336     g_DefaultCompression    = m_Quality;
00337     g_bExportProgressive    = m_DoAsProgressive;
00338     g_DefaultDCTMethod      = m_DCTMethod;
00339     
00340     return TRUE;
00341 }

BOOL JPEGExportOptions::SetColourModel const libJPEG::J_COLOR_SPACE &  ColourModel  ) 
 

Sets an IJG specific parameter Notes: The bitmap is expected to be of the correct format or a converter (DIBConvert) provided when the bitmap is written.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/10/96
Parameters:
ColourModel : The J_COLOR_SPACE that the bitmap is to be exported as [INPUTS]
Returns:
TRUE if set successfully FALSE otherwise

Errors: ERROR2IF DCTMethod not one of: JCS_RGB or JCS_GRAYSCALE See Also: JPEGExportFilter::WriteRawBitmap()

Definition at line 533 of file exjpeg.cpp.

00534 {
00535     switch (ColourModel)
00536     {
00537         case libJPEG::JCS_RGB:
00538             // This really should be RGB_PIXELSIZE (in jmorecfg.h), but this isn't exported!
00539             m_ColourComponents = 3;
00540             break;
00541 
00542         case libJPEG::JCS_GRAYSCALE:
00543             m_ColourComponents = 1;
00544             break;
00545 
00546         default:
00547             ERROR2(FALSE, "Invalid Colour Model method");
00548             
00549     }
00550 
00551     m_ColourModel = ColourModel;
00552 
00553     return TRUE;        // success
00554 }

BOOL JPEGExportOptions::SetDCTMethod const libJPEG::J_DCT_METHOD &  DCTMethod  ) 
 

Sets an IJG specific parameter Notes: NOT a user (interface) option.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/10/96
Parameters:
DCTMethod : The DCT method to be used during export (See IJG library for [INPUTS] details)
Returns:
TRUE if set successfully FALSE otherwise

Errors: ERROR2IF DCTMethod not one of: fast,slow or float

Definition at line 506 of file exjpeg.cpp.

00507 {
00508     ERROR2IF(DCTMethod != libJPEG::JDCT_ISLOW && DCTMethod != libJPEG::JDCT_IFAST && DCTMethod != libJPEG::JDCT_FLOAT,
00509                 FALSE, "Invalid DCT method");
00510 
00511     m_DCTMethod = DCTMethod;
00512 
00513     return TRUE;
00514 }

static void JPEGExportOptions::SetJPEGPresentAndSelected BOOL  Value  )  [inline, static]
 

Definition at line 154 of file exjpeg.h.

00154 { m_JPEGPresentAndSelected = Value; }

static void JPEGExportOptions::SetKernelBitmap KernelBitmap pBitmap  )  [inline, static]
 

Definition at line 151 of file exjpeg.h.

00151 { pKernelBitmap = pBitmap; }

BOOL JPEGExportOptions::SetMakeProgressive BOOL  bProgressive  ) 
 

Sets a JPEG specific export parameter.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/10/96
Parameters:
bProgressive,: TRUE if the JPEG should be exported as a progressive, i.e., can [INPUTS] be rendered progressively if you've got the software. FALSE exports normally
Returns:
TRUE if set successfully FALSE otherwise

Definition at line 481 of file exjpeg.cpp.

00482 {
00483     if (m_DoAsProgressive != bProgressive)
00484         SetTempFileMatchesExportOptions(FALSE);
00485     m_DoAsProgressive = bProgressive;
00486     
00487     return TRUE;
00488 }

BOOL JPEGExportOptions::SetQuality const JPEG_QUALITY Quality  ) 
 

Sets a JPEG specific export parameter.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/10/96
Parameters:
Quality : 0 - 100 indicating some "quality" [INPUTS]
Returns:
TRUE if set successfully FALSE otherwise

Errors: ERROR2IF Quality out of range

Definition at line 456 of file exjpeg.cpp.

00457 {
00458     ERROR2IF(Quality < 0 || Quality > 100, FALSE, "Quality out of range");
00459 
00460     if (m_Quality != Quality)
00461         SetTempFileMatchesExportOptions(FALSE);
00462     m_Quality = Quality;
00463     
00464     return TRUE;
00465 }

BOOL JPEGExportOptions::Write CXaraFileRecord pRec  )  [virtual]
 

Writes this object to the given record.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/2/00
Parameters:
pRec --- record to write [INPUTS]
Returns:
TRUE if successful.
See also:
JPEGExportOptions::Read

Reimplemented from BitmapExportOptions.

Definition at line 356 of file exjpeg.cpp.

00357 {
00358     return BitmapExportOptions::Write(pRec) &&
00359            pRec->WriteUINT32(m_Quality) &&
00360            pRec->WriteBYTE((BYTE) !!m_DoAsProgressive) &&
00361            pRec->WriteINT16((INT16) m_DCTMethod) &&
00362            pRec->WriteINT16((INT16) m_ColourModel) &&
00363            pRec->WriteUINT32(m_ColourComponents);
00364 }


Member Data Documentation

BOOL JPEGExportOptions::m_bJPEGPresentAndSelected
 

Definition at line 165 of file exjpeg.h.

UINT32 JPEGExportOptions::m_ColourComponents [protected]
 

Definition at line 175 of file exjpeg.h.

libJPEG::J_COLOR_SPACE JPEGExportOptions::m_ColourModel [protected]
 

Definition at line 174 of file exjpeg.h.

libJPEG::J_DCT_METHOD JPEGExportOptions::m_DCTMethod [protected]
 

Definition at line 173 of file exjpeg.h.

BOOL JPEGExportOptions::m_DoAsProgressive [protected]
 

Definition at line 172 of file exjpeg.h.

BOOL JPEGExportOptions::m_JPEGPresentAndSelected = FALSE [static, protected]
 

Definition at line 178 of file exjpeg.h.

JPEG_QUALITY JPEGExportOptions::m_Quality [protected]
 

Definition at line 171 of file exjpeg.h.

KernelBitmap * JPEGExportOptions::pKernelBitmap = NULL [static, protected]
 

Definition at line 177 of file exjpeg.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:55:36 2007 for Camelot by  doxygen 1.4.4