From 83c9c37e8e76d6e5d0ef32537a7a9cf80bf62e9e Mon Sep 17 00:00:00 2001 From: dirk Date: Sat, 11 Jan 2014 09:04:57 +0000 Subject: [PATCH] Code cleanup. --- Magick++/lib/Image.cpp | 2 +- Magick++/lib/Magick++/Options.h | 289 ++++++------ Magick++/lib/Options.cpp | 805 ++++++++++++++++---------------- 3 files changed, 555 insertions(+), 541 deletions(-) diff --git a/Magick++/lib/Image.cpp b/Magick++/lib/Image.cpp index 7328df3ad..d214fa39d 100644 --- a/Magick++/lib/Image.cpp +++ b/Magick++/lib/Image.cpp @@ -980,7 +980,7 @@ std::string Magick::Image::formatExpression(const std::string expression) text=DestroyString(text); } ThrowPPException; - return result; + return(result); } double Magick::Image::gamma(void) const diff --git a/Magick++/lib/Magick++/Options.h b/Magick++/lib/Magick++/Options.h index 430bd29db..8cbdd7584 100644 --- a/Magick++/lib/Magick++/Options.h +++ b/Magick++/lib/Magick++/Options.h @@ -26,181 +26,186 @@ namespace Magick class Options { - public: - Options( void ); - Options( const Options& options_ ); + + // Default constructor + Options(void); + + // Copy constructor + Options(const Options& options_); + + // Destructor ~Options(); // Remove pixel aliasing - void antiAlias( bool flag_ ); - bool antiAlias( void ) const; - + void antiAlias(bool flag_); + bool antiAlias(void) const; + // Join images into a single multi-image file - void adjoin ( bool flag_ ); - bool adjoin ( void ) const; - + void adjoin(bool flag_); + bool adjoin(void) const; + // Image background color - void backgroundColor ( const Color &color_ ); - Color backgroundColor ( void ) const; - + void backgroundColor(const Color &color_); + Color backgroundColor(void) const; + // Name of texture image to tile onto the image background - void backgroundTexture ( const std::string &backgroundTexture_ ); - std::string backgroundTexture ( void ) const; - + void backgroundTexture(const std::string &backgroundTexture_); + std::string backgroundTexture(void) const; + // Image border color - void borderColor ( const Color &color_ ); - Color borderColor ( void ) const; - + void borderColor(const Color &color_); + Color borderColor(void) const; + // Text bounding-box base color (default none) - void boxColor ( const Color &boxColor_ ); - Color boxColor ( void ) const; - + void boxColor(const Color &boxColor_); + Color boxColor(void) const; + // Colors within this distance are considered equal - void colorFuzz ( double fuzz_ ); - double colorFuzz ( void ) const; - + void colorFuzz(double fuzz_); + double colorFuzz(void) const; + // Image colorspace scheme - void colorspaceType ( ColorspaceType colorspace_ ); - ColorspaceType colorspaceType ( void ) const; - + void colorspaceType(ColorspaceType colorspace_); + ColorspaceType colorspaceType(void) const; + // Compression type ( NoCompression, BZipCompression, // FaxCompression, JPEGCompression, LZWCompression, // RLECompression, or ZipCompression ) - void compressType ( CompressionType compressType_ ); - CompressionType compressType ( void ) const; + void compressType(CompressionType compressType_); + CompressionType compressType(void) const; // Enable printing of debug messages from ImageMagick - void debug ( bool flag_ ); - bool debug ( void ) const; - + void debug(bool flag_); + bool debug(void) const; + // Vertical and horizontal resolution in pixels of the image - void density ( const Geometry &geomery_ ); - Geometry density ( void ) const; + void density(const Geometry &geomery_); + Geometry density(void) const; // Image depth (8 or 16) - void depth ( size_t depth_ ); - size_t depth ( void ) const; + void depth(size_t depth_); + size_t depth(void) const; // Endianness (little like Intel or big like SPARC) for image // formats which support endian-specific options. - void endian ( EndianType endian_ ); - EndianType endian ( void ) const; + void endian(EndianType endian_); + EndianType endian(void) const; // Image filename to read or write - void file ( FILE *file_ ); - FILE* file ( void ) const; + void file(FILE *file_); + FILE *file(void) const; // Image filename to read or write - void fileName ( const std::string &fileName_ ); - std::string fileName ( void ) const; + void fileName(const std::string &fileName_); + std::string fileName(void) const; // Color to use when filling drawn objects - void fillColor ( const Color &fillColor_ ); - Color fillColor ( void ) const; + void fillColor(const Color &fillColor_); + Color fillColor(void) const; // Fill pattern - void fillPattern ( const MagickCore::Image *fillPattern_ ); - const MagickCore::Image* fillPattern ( void ) const; + void fillPattern(const MagickCore::Image *fillPattern_); + const MagickCore::Image *fillPattern(void) const; // Rule to use when filling drawn objects - void fillRule ( const FillRule &fillRule_ ); - FillRule fillRule ( void ) const; + void fillRule(const FillRule &fillRule_); + FillRule fillRule(void) const; // Font name - void font ( const std::string &font_ ); - std::string font ( void ) const; + void font(const std::string &font_); + std::string font(void) const; // Font point size - void fontPointsize ( double pointSize_ ); - double fontPointsize ( void ) const; - - std::string format ( void ) const; + void fontPointsize(double pointSize_); + double fontPointsize(void) const; + + std::string format(void) const; // Image interlace scheme - void interlaceType ( InterlaceType interlace_ ); - InterlaceType interlaceType ( void ) const; - + void interlaceType(InterlaceType interlace_); + InterlaceType interlaceType(void) const; + // Image format to write or read - void magick ( const std::string &magick_ ); - std::string magick ( void ) const; - + void magick(const std::string &magick_); + std::string magick(void) const; + // Transparent color - void matteColor ( const Color &matteColor_ ); - Color matteColor ( void ) const; + void matteColor(const Color &matteColor_); + Color matteColor(void) const; // Write as a monochrome image - void monochrome ( bool monochromeFlag_ ); - bool monochrome ( void ) const; + void monochrome(bool monochromeFlag_); + bool monochrome(void) const; // Preferred size and location of an image canvas. - void page ( const Geometry &pageSize_ ); - Geometry page ( void ) const; + void page(const Geometry &pageSize_); + Geometry page(void) const; // Desired image quality factor - void quality ( size_t quality_ ); - size_t quality ( void ) const; - + void quality(size_t quality_); + size_t quality(void) const; + // Maximum number of colors to quantize to - void quantizeColors ( size_t colors_ ); - size_t quantizeColors ( void ) const; - + void quantizeColors(size_t colors_); + size_t quantizeColors(void) const; + // Colorspace to quantize in. - void quantizeColorSpace ( ColorspaceType colorSpace_ ); - ColorspaceType quantizeColorSpace ( void ) const; - + void quantizeColorSpace(ColorspaceType colorSpace_); + ColorspaceType quantizeColorSpace(void) const; + // Dither image during quantization. - void quantizeDither ( bool ditherFlag_ ); - bool quantizeDither ( void ) const; - + void quantizeDither(bool ditherFlag_); + bool quantizeDither(void) const; + // Quantization tree-depth - void quantizeTreeDepth ( size_t treeDepth_ ); - size_t quantizeTreeDepth ( void ) const; + void quantizeTreeDepth(size_t treeDepth_); + size_t quantizeTreeDepth(void) const; // Units of resolution to interpret density - void resolutionUnits ( ResolutionType resolutionUnits_ ); - ResolutionType resolutionUnits ( void ) const; + void resolutionUnits(ResolutionType resolutionUnits_); + ResolutionType resolutionUnits(void) const; // Image sampling factor - void samplingFactor ( const std::string &samplingFactor_ ); - std::string samplingFactor ( void ) const; + void samplingFactor(const std::string &samplingFactor_); + std::string samplingFactor(void) const; // Image size (required for raw formats) - void size ( const Geometry &geometry_ ); - Geometry size ( void ) const; + void size(const Geometry &geometry_); + Geometry size(void) const; // enabled/disable stroke anti-aliasing - void strokeAntiAlias( bool flag_ ); - bool strokeAntiAlias( void ) const ; + void strokeAntiAlias(bool flag_); + bool strokeAntiAlias(void) const ; // Color to use when drawing object outlines - void strokeColor ( const Color &strokeColor_ ); - Color strokeColor ( void ) const; + void strokeColor(const Color &strokeColor_); + Color strokeColor(void) const; // Control the pattern of dashes and gaps used to stroke // paths. The strokeDashArray represents a list of numbers that // specify the lengths of alternating dashes and gaps in user // units. If an odd number of values is provided, then the list of // values is repeated to yield an even number of values. - void strokeDashArray ( const double* strokeDashArray_ ); - const double* strokeDashArray ( void ) const; + void strokeDashArray(const double *strokeDashArray_); + const double *strokeDashArray(void) const; // While drawing using strokeDashArray, specify distance into the dash // pattern to start the dash (default 0). - void strokeDashOffset ( double strokeDashOffset_ ); - double strokeDashOffset ( void ) const; + void strokeDashOffset(double strokeDashOffset_); + double strokeDashOffset(void) const; // Specify the shape to be used at the end of open subpaths when // they are stroked. Values of LineCap are UndefinedCap, ButtCap, // RoundCap, and SquareCap. - void strokeLineCap ( LineCap lineCap_ ); - LineCap strokeLineCap ( void ) const; - + void strokeLineCap(LineCap lineCap_); + LineCap strokeLineCap(void) const; + // Specify the shape to be used at the corners of paths (or other // vector shapes) when they are stroked. Values of LineJoin are // UndefinedJoin, MiterJoin, RoundJoin, and BevelJoin. - void strokeLineJoin ( LineJoin lineJoin_ ); - LineJoin strokeLineJoin ( void ) const; + void strokeLineJoin(LineJoin lineJoin_); + LineJoin strokeLineJoin(void) const; // Specify miter limit. When two line segments meet at a sharp // angle and miter joins have been specified for 'lineJoin', it is @@ -208,84 +213,84 @@ namespace Magick // the line stroking the path. The miterLimit' imposes a limit on // the ratio of the miter length to the 'stroke_width'. The default // value of this parameter is 4. - void strokeMiterLimit ( size_t miterLimit_ ); - size_t strokeMiterLimit ( void ) const; + void strokeMiterLimit(size_t miterLimit_); + size_t strokeMiterLimit(void) const; // Pattern image to use for stroked outlines - void strokePattern ( const MagickCore::Image *strokePattern_ ); - const MagickCore::Image* strokePattern ( void ) const; + void strokePattern(const MagickCore::Image *strokePattern_); + const MagickCore::Image *strokePattern(void) const; // Stroke width for drawing vector objects (default one) - void strokeWidth ( double strokeWidth_ ); - double strokeWidth ( void ) const; + void strokeWidth(double strokeWidth_); + double strokeWidth(void) const; - void subImage ( size_t subImage_ ); - size_t subImage ( void ) const; + void subImage(size_t subImage_); + size_t subImage(void) const; // Sub-frame number to return - void subRange ( size_t subRange_ ); - size_t subRange ( void ) const; + void subRange(size_t subRange_); + size_t subRange(void) const; // Annotation text encoding (e.g. "UTF-16") - void textEncoding ( const std::string &encoding_ ); - std::string textEncoding ( void ) const; - - // Image representation type - void type ( const ImageType type_ ); - ImageType type ( void ) const; + void textEncoding(const std::string &encoding_); + std::string textEncoding(void) const; + void tileName(const std::string &tileName_); + std::string tileName(void) const; // Origin of coordinate system to use when annotating with text or drawing - void transformOrigin ( double tx_, double ty_ ); + void transformOrigin(double tx_,double ty_); // Reset transformation parameters to default - void transformReset ( void ); + void transformReset(void); // Rotation to use when annotating with text or drawing - void transformRotation ( double angle_ ); + void transformRotation(double angle_); // Scale to use when annotating with text or drawing - void transformScale ( double sx_, double sy_ ); + void transformScale(double sx_,double sy_); // Skew to use in X axis when annotating with text or drawing - void transformSkewX ( double skewx_ ); + void transformSkewX(double skewx_); // Skew to use in Y axis when annotating with text or drawing - void transformSkewY ( double skewy_ ); + void transformSkewY(double skewy_); + + // Image representation type + void type(const ImageType type_); + ImageType type(void) const; // Return verbose information about an image, or an operation - void verbose ( bool verboseFlag_ ); - bool verbose ( void ) const; - - void view ( const std::string &view_ ); - std::string view ( void ) const; + void verbose(bool verboseFlag_); + bool verbose(void) const; + + void view(const std::string &view_); + std::string view(void) const; // X11 display name - void x11Display ( const std::string &display_ ); - std::string x11Display ( void ) const; - + void x11Display(const std::string &display_); + std::string x11Display(void) const; + // // Internal implementation methods. Please do not use. // - MagickCore::DrawInfo* drawInfo( void ); - MagickCore::ImageInfo * imageInfo( void ); - MagickCore::QuantizeInfo * quantizeInfo( void ); + MagickCore::DrawInfo *drawInfo(void); + MagickCore::ImageInfo *imageInfo(void); + MagickCore::QuantizeInfo *quantizeInfo(void); // Construct using raw structures - Options( const MagickCore::ImageInfo* imageInfo_, - const MagickCore::QuantizeInfo* quantizeInfo_, - const MagickCore::DrawInfo* drawInfo_ ); - - protected: + Options(const MagickCore::ImageInfo *imageInfo_, + const MagickCore::QuantizeInfo *quantizeInfo_, + const MagickCore::DrawInfo *drawInfo_); private: - + // Assignment not supported - Options& operator= ( const Options& ); + Options& operator=(const Options&); - MagickCore::ImageInfo* _imageInfo; - MagickCore::QuantizeInfo* _quantizeInfo; - MagickCore::DrawInfo* _drawInfo; + MagickCore::ImageInfo *_imageInfo; + MagickCore::QuantizeInfo *_quantizeInfo; + MagickCore::DrawInfo *_drawInfo; }; } // namespace Magick diff --git a/Magick++/lib/Options.cpp b/Magick++/lib/Options.cpp index 7ff7bfe4e..ca299a26b 100644 --- a/Magick++/lib/Options.cpp +++ b/Magick++/lib/Options.cpp @@ -21,645 +21,629 @@ #include "Magick++/Exception.h" #define DegreesToRadians(x) (MagickPI*(x)/180.0) - -// Constructor -Magick::Options::Options( void ) - : _imageInfo(static_cast(AcquireMagickMemory(sizeof(ImageInfo)))), - _quantizeInfo(static_cast(AcquireMagickMemory(sizeof(QuantizeInfo)))), - _drawInfo(static_cast(AcquireMagickMemory( sizeof(DrawInfo)))) +#define GetPPException \ + ExceptionInfo \ + exceptionInfo; \ + GetExceptionInfo(&exceptionInfo) +#define ThrowPPException \ + throwException(exceptionInfo); \ + (void) DestroyExceptionInfo(&exceptionInfo) + +Magick::Options::Options(void) + : _imageInfo(static_cast(AcquireMagickMemory( + sizeof(ImageInfo)))), + _quantizeInfo(static_cast(AcquireMagickMemory( + sizeof(QuantizeInfo)))), + _drawInfo(static_cast(AcquireMagickMemory(sizeof(DrawInfo)))) { // Initialize image info with defaults - GetImageInfo( _imageInfo ); - + GetImageInfo(_imageInfo); + // Initialize quantization info - GetQuantizeInfo( _quantizeInfo ); + GetQuantizeInfo(_quantizeInfo); // Initialize drawing info - GetDrawInfo( _imageInfo, _drawInfo ); + GetDrawInfo(_imageInfo,_drawInfo); } -// Copy constructor -Magick::Options::Options( const Magick::Options& options_ ) - : _imageInfo(CloneImageInfo( options_._imageInfo )), +Magick::Options::Options(const Magick::Options& options_) + : _imageInfo(CloneImageInfo(options_._imageInfo )), _quantizeInfo(CloneQuantizeInfo(options_._quantizeInfo)), - _drawInfo(CloneDrawInfo(_imageInfo, options_._drawInfo)) + _drawInfo(CloneDrawInfo(_imageInfo,options_._drawInfo)) { } -// Construct using raw structures -Magick::Options::Options( const MagickCore::ImageInfo* imageInfo_, - const MagickCore::QuantizeInfo* quantizeInfo_, - const MagickCore::DrawInfo* drawInfo_ ) -: _imageInfo(0), - _quantizeInfo(0), - _drawInfo(0) -{ - _imageInfo = CloneImageInfo(imageInfo_); - _quantizeInfo = CloneQuantizeInfo(quantizeInfo_); - _drawInfo = CloneDrawInfo(imageInfo_,drawInfo_); -} - -// Destructor Magick::Options::~Options() { // Destroy image info - _imageInfo =DestroyImageInfo( _imageInfo ); - _imageInfo=0; + _imageInfo=DestroyImageInfo(_imageInfo); // Destroy quantization info - _quantizeInfo =DestroyQuantizeInfo( _quantizeInfo ); - _quantizeInfo=0; + _quantizeInfo=DestroyQuantizeInfo(_quantizeInfo); // Destroy drawing info - _drawInfo =DestroyDrawInfo( _drawInfo ); - _drawInfo=0; + _drawInfo=DestroyDrawInfo(_drawInfo); } -/* - * Methods for setting image attributes - * - */ - -// Anti-alias Postscript and TrueType fonts (default true) -void Magick::Options::antiAlias( bool flag_ ) +void Magick::Options::antiAlias(bool flag_) { - _drawInfo->text_antialias = static_cast - (flag_ ? MagickTrue : MagickFalse); + _drawInfo->text_antialias=static_cast( + flag_ ? MagickTrue : MagickFalse); } -bool Magick::Options::antiAlias( void ) const + +bool Magick::Options::antiAlias(void) const { - return static_cast(_drawInfo->text_antialias); + return(static_cast(_drawInfo->text_antialias)); } -void Magick::Options::adjoin ( bool flag_ ) +void Magick::Options::adjoin(bool flag_) { - _imageInfo->adjoin = static_cast - (flag_ ? MagickTrue : MagickFalse); + _imageInfo->adjoin=static_cast( + flag_ ? MagickTrue : MagickFalse); } -bool Magick::Options::adjoin ( void ) const + +bool Magick::Options::adjoin(void) const { - return static_cast(_imageInfo->adjoin); + return(static_cast(_imageInfo->adjoin)); } -void Magick::Options::backgroundColor ( const Magick::Color &color_ ) +void Magick::Options::backgroundColor(const Magick::Color &color_) { - _imageInfo->background_color = color_; + _imageInfo->background_color=color_; } -Magick::Color Magick::Options::backgroundColor ( void ) const + +Magick::Color Magick::Options::backgroundColor(void) const { - return Magick::Color( _imageInfo->background_color ); + return(Magick::Color(_imageInfo->background_color)); } -void Magick::Options::backgroundTexture ( const std::string &backgroundTexture_ ) +void Magick::Options::backgroundTexture(const std::string &backgroundTexture_) { - if ( backgroundTexture_.length() == 0 ) + if (backgroundTexture_.length() == 0) _imageInfo->texture=(char *) RelinquishMagickMemory(_imageInfo->texture); else - Magick::CloneString( &_imageInfo->texture, backgroundTexture_ ); + Magick::CloneString(&_imageInfo->texture,backgroundTexture_); } -std::string Magick::Options::backgroundTexture ( void ) const + +std::string Magick::Options::backgroundTexture(void) const { - if ( _imageInfo->texture ) - return std::string( _imageInfo->texture ); + if (_imageInfo->texture) + return(std::string(_imageInfo->texture)); else - return std::string(); + return(std::string()); } -void Magick::Options::borderColor ( const Color &color_ ) +void Magick::Options::borderColor(const Color &color_) { - _imageInfo->border_color = color_; - _drawInfo->border_color = color_; + _imageInfo->border_color=color_; + _drawInfo->border_color=color_; } -Magick::Color Magick::Options::borderColor ( void ) const + +Magick::Color Magick::Options::borderColor(void) const { - return Magick::Color( _imageInfo->border_color ); + return(Magick::Color(_imageInfo->border_color)); } -// Text bounding-box base color -void Magick::Options::boxColor ( const Magick::Color &boxColor_ ) +void Magick::Options::boxColor(const Magick::Color &boxColor_) { - _drawInfo->undercolor = boxColor_; + _drawInfo->undercolor=boxColor_; } -Magick::Color Magick::Options::boxColor ( void ) const + +Magick::Color Magick::Options::boxColor(void) const { - return Magick::Color( _drawInfo->undercolor ); + return(Magick::Color(_drawInfo->undercolor)); } -void Magick::Options::colorspaceType ( Magick::ColorspaceType colorspace_ ) +void Magick::Options::colorspaceType(Magick::ColorspaceType colorspace_) { - _imageInfo->colorspace = colorspace_; + _imageInfo->colorspace=colorspace_; } -Magick::ColorspaceType Magick::Options::colorspaceType ( void ) const + +Magick::ColorspaceType Magick::Options::colorspaceType(void) const { - return static_cast(_imageInfo->colorspace); + return(static_cast(_imageInfo->colorspace)); } -void Magick::Options::compressType ( CompressionType compressType_ ) +void Magick::Options::compressType(CompressionType compressType_) { - _imageInfo->compression = compressType_; + _imageInfo->compression=compressType_; } -Magick::CompressionType Magick::Options::compressType ( void ) const + +Magick::CompressionType Magick::Options::compressType(void) const { - return static_cast(_imageInfo->compression); + return(static_cast(_imageInfo->compression)); } -void Magick::Options::colorFuzz ( double fuzz_ ) +void Magick::Options::colorFuzz(double fuzz_) { - _imageInfo->fuzz = fuzz_; + _imageInfo->fuzz=fuzz_; } -double Magick::Options::colorFuzz ( void ) const + +double Magick::Options::colorFuzz(void) const { - return _imageInfo->fuzz; + return(_imageInfo->fuzz); } -// Enable printing of debug messages from ImageMagick -void Magick::Options::debug ( bool flag_ ) +void Magick::Options::debug(bool flag_) { - if(flag_) - { - SetLogEventMask("All"); - } + if (flag_) + SetLogEventMask("All"); else - { - SetLogEventMask("None"); - } + SetLogEventMask("None"); } -bool Magick::Options::debug ( void ) const + +bool Magick::Options::debug(void) const { - if( IsEventLogging() ) - { - return true; - } - return false; + if (IsEventLogging()) + return(true); + return(false); } -void Magick::Options::density ( const Magick::Geometry &density_ ) +void Magick::Options::density(const Magick::Geometry &density_) { if ( !density_.isValid() ) _imageInfo->density=(char *) RelinquishMagickMemory(_imageInfo->density); else - Magick::CloneString( &_imageInfo->density, density_ ); + Magick::CloneString(&_imageInfo->density,density_); } -Magick::Geometry Magick::Options::density ( void ) const + +Magick::Geometry Magick::Options::density(void) const { - if ( _imageInfo->density ) - return Geometry( _imageInfo->density ); + if (_imageInfo->density) + return(Geometry(_imageInfo->density)); - return Geometry(); + return(Geometry()); } -void Magick::Options::depth ( size_t depth_ ) +void Magick::Options::depth(size_t depth_) { - _imageInfo->depth = depth_; + _imageInfo->depth=depth_; } -size_t Magick::Options::depth ( void ) const + +size_t Magick::Options::depth(void) const { - return _imageInfo->depth; + return(_imageInfo->depth); } -// Endianness (little like Intel or big like SPARC) for image -// formats which support endian-specific options. -void Magick::Options::endian ( Magick::EndianType endian_ ) +void Magick::Options::endian(Magick::EndianType endian_) { - _imageInfo->endian = endian_; + _imageInfo->endian=endian_; } -Magick::EndianType Magick::Options::endian ( void ) const + +Magick::EndianType Magick::Options::endian(void) const { - return _imageInfo->endian; + return(_imageInfo->endian); } -void Magick::Options::file ( FILE *file_ ) +void Magick::Options::file(FILE *file_) { - SetImageInfoFile( _imageInfo, file_ ); + SetImageInfoFile(_imageInfo,file_); } -FILE *Magick::Options::file ( void ) const + +FILE *Magick::Options::file(void) const { - return GetImageInfoFile( _imageInfo ); + return(GetImageInfoFile(_imageInfo)); } -void Magick::Options::fileName ( const std::string &fileName_ ) +void Magick::Options::fileName(const std::string &fileName_) { - fileName_.copy( _imageInfo->filename, MaxTextExtent-1 ); - _imageInfo->filename[ fileName_.length() ] = 0; + fileName_.copy(_imageInfo->filename,MaxTextExtent-1); + if (fileName_.length() > MaxTextExtent-1) + _imageInfo->filename[MaxTextExtent-1]=0; + else + _imageInfo->filename[fileName_.length()]=0; } -std::string Magick::Options::fileName ( void ) const + +std::string Magick::Options::fileName(void) const { - return std::string( _imageInfo->filename ); + return(std::string(_imageInfo->filename)); } -// Color to use when drawing inside an object -void Magick::Options::fillColor ( const Magick::Color &fillColor_ ) +void Magick::Options::fillColor(const Magick::Color &fillColor_) { - _drawInfo->fill = fillColor_; + _drawInfo->fill=fillColor_; if (fillColor_ == Magick::Color()) fillPattern((const MagickCore::Image*) NULL); } -Magick::Color Magick::Options::fillColor ( void ) const + +Magick::Color Magick::Options::fillColor(void) const { - return _drawInfo->fill; + return(_drawInfo->fill); } -// Pattern image to use when filling objects -void Magick::Options::fillPattern ( const MagickCore::Image *fillPattern_ ) + +void Magick::Options::fillPattern(const MagickCore::Image *fillPattern_) { - if ( _drawInfo->fill_pattern ) - { - DestroyImageList( _drawInfo->fill_pattern ); - _drawInfo->fill_pattern = 0; - } - if ( fillPattern_ ) + if (_drawInfo->fill_pattern) + _drawInfo->fill_pattern=DestroyImageList(_drawInfo->fill_pattern); + + if (fillPattern_) { - ExceptionInfo exceptionInfo; - GetExceptionInfo( &exceptionInfo ); - _drawInfo->fill_pattern = - CloneImage( const_cast(fillPattern_), - 0, - 0, - static_cast(MagickTrue), - &exceptionInfo ); - throwException( exceptionInfo ); - (void) DestroyExceptionInfo( &exceptionInfo ); + GetPPException; + _drawInfo->fill_pattern=CloneImage(const_cast( + fillPattern_),0,0,static_cast(MagickTrue), + &exceptionInfo); + ThrowPPException; } } -const MagickCore::Image* Magick::Options::fillPattern ( void ) const + +const MagickCore::Image *Magick::Options::fillPattern(void) const { - return _drawInfo->fill_pattern; + return(_drawInfo->fill_pattern); } -// Rule to use when filling drawn objects -void Magick::Options::fillRule ( const Magick::FillRule &fillRule_ ) +void Magick::Options::fillRule(const Magick::FillRule &fillRule_) { - _drawInfo->fill_rule = fillRule_; + _drawInfo->fill_rule=fillRule_; } -Magick::FillRule Magick::Options::fillRule ( void ) const + +Magick::FillRule Magick::Options::fillRule(void) const { - return _drawInfo->fill_rule; + return(_drawInfo->fill_rule); } -void Magick::Options::font ( const std::string &font_ ) +void Magick::Options::font(const std::string &font_) { - if ( font_.length() == 0 ) + if (font_.length() == 0) { _imageInfo->font=(char *) RelinquishMagickMemory(_imageInfo->font); _drawInfo->font=(char *) RelinquishMagickMemory(_drawInfo->font); } else { - Magick::CloneString( &_imageInfo->font, font_ ); - Magick::CloneString( &_drawInfo->font, font_ ); + Magick::CloneString(&_imageInfo->font,font_); + Magick::CloneString(&_drawInfo->font,font_); } } -std::string Magick::Options::font ( void ) const + +std::string Magick::Options::font(void) const { - if ( _imageInfo->font ) - return std::string( _imageInfo->font ); + if (_imageInfo->font) + return(std::string(_imageInfo->font)); - return std::string(); + return(std::string()); } -void Magick::Options::fontPointsize ( double pointSize_ ) +void Magick::Options::fontPointsize(double pointSize_) { - _imageInfo->pointsize = pointSize_; - _drawInfo->pointsize = pointSize_; + _imageInfo->pointsize=pointSize_; + _drawInfo->pointsize=pointSize_; } -double Magick::Options::fontPointsize ( void ) const + +double Magick::Options::fontPointsize(void) const { - return _imageInfo->pointsize; + return(_imageInfo->pointsize); } -std::string Magick::Options::format ( void ) const +std::string Magick::Options::format(void) const { - ExceptionInfo exception; + const MagickInfo + *magick_info=0; - const MagickInfo * magick_info = 0; - GetExceptionInfo(&exception); - if ( *_imageInfo->magick != '\0' ) - magick_info = GetMagickInfo( _imageInfo->magick , &exception); - throwException( exception ); - (void) DestroyExceptionInfo( &exception ); - - if (( magick_info != 0 ) && - ( *magick_info->description != '\0' )) - return std::string( magick_info->description ); + GetPPException; + if (*_imageInfo->magick != '\0' ) + magick_info = GetMagickInfo(_imageInfo->magick,&exceptionInfo); + ThrowPPException; + + if ((magick_info != 0) && (*magick_info->description != '\0')) + return(std::string( magick_info->description)); - return std::string(); + return(std::string()); } -void Magick::Options::interlaceType ( Magick::InterlaceType interlace_ ) +void Magick::Options::interlaceType(Magick::InterlaceType interlace_) { - _imageInfo->interlace = interlace_; + _imageInfo->interlace=interlace_; } -Magick::InterlaceType Magick::Options::interlaceType ( void ) const + +Magick::InterlaceType Magick::Options::interlaceType(void) const { - return static_cast(_imageInfo->interlace); + return(static_cast(_imageInfo->interlace)); } -void Magick::Options::magick ( const std::string &magick_ ) +void Magick::Options::magick(const std::string &magick_) { - ExceptionInfo exception; - - FormatLocaleString( _imageInfo->filename, MaxTextExtent, "%.1024s:", magick_.c_str() ); - GetExceptionInfo(&exception); - SetImageInfo( _imageInfo, 1, &exception); - if ( *_imageInfo->magick == '\0' ) - throwExceptionExplicit( OptionWarning, "Unrecognized image format", - magick_.c_str() ); - (void) DestroyExceptionInfo( &exception ); + FormatLocaleString(_imageInfo->filename,MaxTextExtent,"%.1024s:", + magick_.c_str()); + GetPPException; + SetImageInfo(_imageInfo,1,&exceptionInfo); + if (*_imageInfo->magick == '\0') + throwExceptionExplicit(OptionWarning, "Unrecognized image format", + magick_.c_str()); + (void) DestroyExceptionInfo(&exceptionInfo); } -std::string Magick::Options::magick ( void ) const + +std::string Magick::Options::magick(void) const { - if ( _imageInfo->magick && *_imageInfo->magick ) - return std::string( _imageInfo->magick ); - - return std::string(); + if (_imageInfo->magick && *_imageInfo->magick) + return(std::string(_imageInfo->magick)); + + return(std::string()); } -void Magick::Options::matteColor ( const Magick::Color &matteColor_ ) +void Magick::Options::matteColor(const Magick::Color &matteColor_) { - _imageInfo->matte_color = matteColor_; + _imageInfo->matte_color=matteColor_; } -Magick::Color Magick::Options::matteColor ( void ) const + +Magick::Color Magick::Options::matteColor(void) const { - return Magick::Color( _imageInfo->matte_color ); + return(Magick::Color(_imageInfo->matte_color)); } -void Magick::Options::monochrome ( bool monochromeFlag_ ) +void Magick::Options::monochrome(bool monochromeFlag_) { - _imageInfo->monochrome = (MagickBooleanType) monochromeFlag_; + _imageInfo->monochrome=(MagickBooleanType) monochromeFlag_; } -bool Magick::Options::monochrome ( void ) const + +bool Magick::Options::monochrome(void) const { - return static_cast(_imageInfo->monochrome); + return(static_cast(_imageInfo->monochrome)); } -void Magick::Options::page ( const Magick::Geometry &pageSize_ ) +void Magick::Options::page(const Magick::Geometry &pageSize_) { - if ( !pageSize_.isValid() ) + if (!pageSize_.isValid()) _imageInfo->page=(char *) RelinquishMagickMemory(_imageInfo->page); else - Magick::CloneString( &_imageInfo->page, pageSize_ ); + Magick::CloneString(&_imageInfo->page,pageSize_); } -Magick::Geometry Magick::Options::page ( void ) const + +Magick::Geometry Magick::Options::page(void) const { - if ( _imageInfo->page ) - return Geometry( _imageInfo->page ); + if (_imageInfo->page) + return(Geometry(_imageInfo->page)); - return Geometry(); + return(Geometry()); } -void Magick::Options::quality ( size_t quality_ ) +void Magick::Options::quality(size_t quality_) { - _imageInfo->quality = quality_; + _imageInfo->quality=quality_; } -size_t Magick::Options::quality ( void ) const + +size_t Magick::Options::quality(void) const { - return _imageInfo->quality; + return(_imageInfo->quality); } -void Magick::Options::quantizeColors ( size_t colors_ ) +void Magick::Options::quantizeColors(size_t colors_) { - _quantizeInfo->number_colors = colors_; + _quantizeInfo->number_colors=colors_; } -size_t Magick::Options::quantizeColors ( void ) const + +size_t Magick::Options::quantizeColors(void) const { - return _quantizeInfo->number_colors; + return(_quantizeInfo->number_colors); } -void Magick::Options::quantizeColorSpace ( Magick::ColorspaceType colorSpace_ ) +void Magick::Options::quantizeColorSpace(Magick::ColorspaceType colorSpace_) { - _quantizeInfo->colorspace = colorSpace_; + _quantizeInfo->colorspace=colorSpace_; } -Magick::ColorspaceType Magick::Options::quantizeColorSpace ( void ) const + +Magick::ColorspaceType Magick::Options::quantizeColorSpace(void) const { - return static_cast(_quantizeInfo->colorspace); + return(static_cast(_quantizeInfo->colorspace)); } -void Magick::Options::quantizeDither ( bool ditherFlag_ ) +void Magick::Options::quantizeDither(bool ditherFlag_) { - _imageInfo->dither = (MagickBooleanType) ditherFlag_; - _quantizeInfo->dither_method = ditherFlag_ ? RiemersmaDitherMethod : + _imageInfo->dither=(MagickBooleanType) ditherFlag_; + _quantizeInfo->dither_method=ditherFlag_ ? RiemersmaDitherMethod : NoDitherMethod; } -bool Magick::Options::quantizeDither ( void ) const + +bool Magick::Options::quantizeDither(void) const { - return static_cast(_imageInfo->dither); + return(static_cast(_imageInfo->dither)); } -void Magick::Options::quantizeTreeDepth ( size_t treeDepth_ ) +void Magick::Options::quantizeTreeDepth(size_t treeDepth_) { - _quantizeInfo->tree_depth = treeDepth_; + _quantizeInfo->tree_depth=treeDepth_; } -size_t Magick::Options::quantizeTreeDepth ( void ) const + +size_t Magick::Options::quantizeTreeDepth(void) const { - return _quantizeInfo->tree_depth; + return(_quantizeInfo->tree_depth); } -void Magick::Options::resolutionUnits ( Magick::ResolutionType resolutionUnits_ ) +void Magick::Options::resolutionUnits(Magick::ResolutionType resolutionUnits_) { - _imageInfo->units = resolutionUnits_; + _imageInfo->units=resolutionUnits_; } -Magick::ResolutionType Magick::Options::resolutionUnits ( void ) const + +Magick::ResolutionType Magick::Options::resolutionUnits(void) const { - return static_cast(_imageInfo->units); + return(static_cast(_imageInfo->units)); } -void Magick::Options::samplingFactor ( const std::string &samplingFactor_ ) +void Magick::Options::samplingFactor(const std::string &samplingFactor_) { - if ( samplingFactor_.length() == 0 ) - _imageInfo->sampling_factor=(char *) RelinquishMagickMemory(_imageInfo->sampling_factor); + if (samplingFactor_.length() == 0) + _imageInfo->sampling_factor=(char *) RelinquishMagickMemory( + _imageInfo->sampling_factor); else - Magick::CloneString( &_imageInfo->sampling_factor, samplingFactor_ ); + Magick::CloneString(&_imageInfo->sampling_factor,samplingFactor_); } -std::string Magick::Options::samplingFactor ( void ) const + +std::string Magick::Options::samplingFactor(void) const { - if ( _imageInfo->sampling_factor ) - return std::string( _imageInfo->sampling_factor ); + if (_imageInfo->sampling_factor) + return(std::string(_imageInfo->sampling_factor)); - return std::string(); + return(std::string()); } -void Magick::Options::size ( const Geometry &geometry_ ) +void Magick::Options::size(const Geometry &geometry_) { _imageInfo->size=(char *) RelinquishMagickMemory(_imageInfo->size); - if ( geometry_.isValid() ) - Magick::CloneString( &_imageInfo->size, geometry_ ); + if (geometry_.isValid()) + Magick::CloneString(&_imageInfo->size,geometry_); } -Magick::Geometry Magick::Options::size ( void ) const + +Magick::Geometry Magick::Options::size(void) const { - if ( _imageInfo->size ) - return Geometry( _imageInfo->size ); + if (_imageInfo->size) + return(Geometry(_imageInfo->size)); - return Geometry(); + return(Geometry()); } -void Magick::Options::strokeAntiAlias( bool flag_ ) +void Magick::Options::strokeAntiAlias(bool flag_) { - flag_ ? _drawInfo->stroke_antialias=MagickTrue : _drawInfo->stroke_antialias=MagickFalse; + flag_ ? _drawInfo->stroke_antialias=MagickTrue : + _drawInfo->stroke_antialias=MagickFalse; } -bool Magick::Options::strokeAntiAlias( void ) const + +bool Magick::Options::strokeAntiAlias(void) const { - return (_drawInfo->stroke_antialias != 0 ? true : false); + return(_drawInfo->stroke_antialias != 0 ? true : false); } -// Color to use when drawing object outlines -void Magick::Options::strokeColor ( const Magick::Color &strokeColor_ ) +void Magick::Options::strokeColor(const Magick::Color &strokeColor_) { - _drawInfo->stroke = strokeColor_; + _drawInfo->stroke=strokeColor_; } -Magick::Color Magick::Options::strokeColor ( void ) const + +Magick::Color Magick::Options::strokeColor(void) const { - return _drawInfo->stroke; + return(_drawInfo->stroke); } -void Magick::Options::strokeDashArray ( const double* strokeDashArray_ ) +void Magick::Options::strokeDashArray(const double *strokeDashArray_) { - _drawInfo->dash_pattern=(double *) - RelinquishMagickMemory(_drawInfo->dash_pattern); + _drawInfo->dash_pattern=(double *) RelinquishMagickMemory( + _drawInfo->dash_pattern); if(strokeDashArray_) { + size_t + x; // Count elements in dash array - size_t x; for (x=0; strokeDashArray_[x]; x++) ; // Allocate elements - _drawInfo->dash_pattern = - static_cast(AcquireMagickMemory((x+1)*sizeof(double))); + _drawInfo->dash_pattern=static_cast(AcquireMagickMemory((x+1)* + sizeof(double))); // Copy elements - memcpy(_drawInfo->dash_pattern,strokeDashArray_, - (x+1)*sizeof(double)); + memcpy(_drawInfo->dash_pattern,strokeDashArray_,(x+1)*sizeof(double)); } } -const double* Magick::Options::strokeDashArray ( void ) const + +const double *Magick::Options::strokeDashArray(void) const { - return _drawInfo->dash_pattern; + return(_drawInfo->dash_pattern); } -void Magick::Options::strokeDashOffset ( double strokeDashOffset_ ) +void Magick::Options::strokeDashOffset(double strokeDashOffset_) { - _drawInfo->dash_offset = strokeDashOffset_; + _drawInfo->dash_offset=strokeDashOffset_; } -double Magick::Options::strokeDashOffset ( void ) const + +double Magick::Options::strokeDashOffset(void) const { - return _drawInfo->dash_offset; + return(_drawInfo->dash_offset); } -// Specify the shape to be used at the end of open subpaths when they -// are stroked. Values of LineCap are ButtCap, RoundCap, and -// SquareCap. -void Magick::Options::strokeLineCap ( Magick::LineCap lineCap_ ) +void Magick::Options::strokeLineCap(Magick::LineCap lineCap_) { - _drawInfo->linecap = lineCap_; + _drawInfo->linecap=lineCap_; } -Magick::LineCap Magick::Options::strokeLineCap ( void ) const + +Magick::LineCap Magick::Options::strokeLineCap(void) const { - return _drawInfo->linecap; + return(_drawInfo->linecap); } -// Specify the shape to be used at the corners of paths (or other -// vector shapes) when they are stroked. -void Magick::Options::strokeLineJoin ( Magick::LineJoin lineJoin_ ) +void Magick::Options::strokeLineJoin(Magick::LineJoin lineJoin_) { - _drawInfo->linejoin = lineJoin_; + _drawInfo->linejoin=lineJoin_; } -Magick::LineJoin Magick::Options::strokeLineJoin ( void ) const + +Magick::LineJoin Magick::Options::strokeLineJoin(void) const { - return _drawInfo->linejoin; + return(_drawInfo->linejoin); } -// miterLimit for drawing lines, circles, ellipses, etc. -void Magick::Options::strokeMiterLimit ( size_t miterLimit_ ) +void Magick::Options::strokeMiterLimit(size_t miterLimit_) { - _drawInfo->miterlimit = miterLimit_; + _drawInfo->miterlimit=miterLimit_; } -size_t Magick::Options::strokeMiterLimit ( void ) const + +size_t Magick::Options::strokeMiterLimit(void) const { - return _drawInfo->miterlimit; + return(_drawInfo->miterlimit); } -// Pattern image to use for stroked outlines -void Magick::Options::strokePattern ( const MagickCore::Image *strokePattern_ ) +void Magick::Options::strokePattern(const MagickCore::Image *strokePattern_) { - if ( _drawInfo->stroke_pattern ) - { - DestroyImageList( _drawInfo->stroke_pattern ); - _drawInfo->stroke_pattern = 0; - } + if (_drawInfo->stroke_pattern) + _drawInfo->stroke_pattern=DestroyImageList(_drawInfo->stroke_pattern); - if ( strokePattern_ ) + if (strokePattern_) { - ExceptionInfo exceptionInfo; - GetExceptionInfo( &exceptionInfo ); - _drawInfo->stroke_pattern = - CloneImage( const_cast(strokePattern_), - 0, - 0, - MagickTrue, - &exceptionInfo ); - throwException( exceptionInfo ); - (void) DestroyExceptionInfo( &exceptionInfo ); + GetPPException; + _drawInfo->stroke_pattern=CloneImage( const_cast( + strokePattern_),0,0,MagickTrue,&exceptionInfo); + ThrowPPException; } } -const MagickCore::Image* Magick::Options::strokePattern ( void ) const + +const MagickCore::Image *Magick::Options::strokePattern(void) const { - return _drawInfo->stroke_pattern; + return(_drawInfo->stroke_pattern); } -// Stroke width for drawing lines, circles, ellipses, etc. -void Magick::Options::strokeWidth ( double strokeWidth_ ) +void Magick::Options::strokeWidth(double strokeWidth_) { - _drawInfo->stroke_width = strokeWidth_; + _drawInfo->stroke_width=strokeWidth_; } -double Magick::Options::strokeWidth ( void ) const + +double Magick::Options::strokeWidth(void) const { - return _drawInfo->stroke_width; + return(_drawInfo->stroke_width); } -void Magick::Options::subImage ( size_t subImage_ ) +void Magick::Options::subImage(size_t subImage_) { - _imageInfo->scene = subImage_; + _imageInfo->scene=subImage_; } -size_t Magick::Options::subImage ( void ) const + +size_t Magick::Options::subImage(void) const { - return _imageInfo->scene; + return(_imageInfo->scene); } -void Magick::Options::subRange ( size_t subRange_ ) +void Magick::Options::subRange(size_t subRange_) { - _imageInfo->number_scenes = subRange_; + _imageInfo->number_scenes=subRange_; } -size_t Magick::Options::subRange ( void ) const + +size_t Magick::Options::subRange(void) const { - return _imageInfo->number_scenes; + return(_imageInfo->number_scenes); } -// Annotation text encoding (e.g. "UTF-16") -void Magick::Options::textEncoding ( const std::string &encoding_ ) +void Magick::Options::textEncoding(const std::string &encoding_) { CloneString(&_drawInfo->encoding, encoding_.c_str()); } -std::string Magick::Options::textEncoding ( void ) const -{ - if ( _drawInfo->encoding && *_drawInfo->encoding ) - return std::string( _drawInfo->encoding ); - - return std::string(); -} -// Image representation type -void Magick::Options::type ( const Magick::ImageType type_ ) +std::string Magick::Options::textEncoding(void) const { - _imageInfo->type = type_; -} -Magick::ImageType Magick::Options::type ( void ) const -{ - return _imageInfo->type; + if (_drawInfo->encoding && *_drawInfo->encoding) + return(std::string(_drawInfo->encoding)); + + return(std::string()); } -// Origin of coordinate system to use when annotating with text or drawing -void Magick::Options::transformOrigin ( double tx_, double ty_ ) +void Magick::Options::transformOrigin(double tx_,double ty_) { - AffineMatrix current = _drawInfo->affine; - AffineMatrix affine; + AffineMatrix + affine, + current=_drawInfo->affine; + affine.sx=1.0; affine.rx=0.0; affine.ry=0.0; @@ -667,8 +651,8 @@ void Magick::Options::transformOrigin ( double tx_, double ty_ ) affine.tx=0.0; affine.ty=0.0; - affine.tx = tx_; - affine.ty = ty_; + affine.tx=tx_; + affine.ty=ty_; _drawInfo->affine.sx=current.sx*affine.sx+current.ry*affine.rx; _drawInfo->affine.rx=current.rx*affine.sx+current.sy*affine.rx; @@ -678,8 +662,7 @@ void Magick::Options::transformOrigin ( double tx_, double ty_ ) _drawInfo->affine.ty=current.rx*affine.tx+current.sy*affine.ty+current.ty; } -// Reset transformation parameters to default -void Magick::Options::transformReset ( void ) +void Magick::Options::transformReset(void) { _drawInfo->affine.sx=1.0; _drawInfo->affine.rx=0.0; @@ -689,11 +672,12 @@ void Magick::Options::transformReset ( void ) _drawInfo->affine.ty=0.0; } -// Rotation to use when annotating with text or drawing -void Magick::Options::transformRotation ( double angle_ ) +void Magick::Options::transformRotation(double angle_) { - AffineMatrix current = _drawInfo->affine; - AffineMatrix affine; + AffineMatrix + affine, + current=_drawInfo->affine; + affine.sx=1.0; affine.rx=0.0; affine.ry=0.0; @@ -714,11 +698,12 @@ void Magick::Options::transformRotation ( double angle_ ) _drawInfo->affine.ty=current.rx*affine.tx+current.sy*affine.ty+current.ty; } -// Scale to use when annotating with text or drawing -void Magick::Options::transformScale ( double sx_, double sy_ ) +void Magick::Options::transformScale(double sx_,double sy_) { - AffineMatrix current = _drawInfo->affine; - AffineMatrix affine; + AffineMatrix + affine, + current=_drawInfo->affine; + affine.sx=1.0; affine.rx=0.0; affine.ry=0.0; @@ -726,8 +711,8 @@ void Magick::Options::transformScale ( double sx_, double sy_ ) affine.tx=0.0; affine.ty=0.0; - affine.sx = sx_; - affine.sy = sy_; + affine.sx=sx_; + affine.sy=sy_; _drawInfo->affine.sx=current.sx*affine.sx+current.ry*affine.rx; _drawInfo->affine.rx=current.rx*affine.sx+current.sy*affine.rx; @@ -737,11 +722,12 @@ void Magick::Options::transformScale ( double sx_, double sy_ ) _drawInfo->affine.ty=current.rx*affine.tx+current.sy*affine.ty+current.ty; } -// Skew to use in X axis when annotating with text or drawing -void Magick::Options::transformSkewX ( double skewx_ ) +void Magick::Options::transformSkewX(double skewx_) { - AffineMatrix current = _drawInfo->affine; - AffineMatrix affine; + AffineMatrix + affine, + current=_drawInfo->affine; + affine.sx=1.0; affine.rx=0.0; affine.ry=0.0; @@ -761,11 +747,12 @@ void Magick::Options::transformSkewX ( double skewx_ ) _drawInfo->affine.ty=current.rx*affine.tx+current.sy*affine.ty+current.ty; } -// Skew to use in Y axis when annotating with text or drawing -void Magick::Options::transformSkewY ( double skewy_ ) +void Magick::Options::transformSkewY(double skewy_) { - AffineMatrix current = _drawInfo->affine; - AffineMatrix affine; + AffineMatrix + affine, + current=_drawInfo->affine; + affine.sx=1.0; affine.rx=0.0; affine.ry=0.0; @@ -785,60 +772,82 @@ void Magick::Options::transformSkewY ( double skewy_ ) _drawInfo->affine.ty=current.rx*affine.tx+current.sy*affine.ty+current.ty; } -void Magick::Options::verbose ( bool verboseFlag_ ) +void Magick::Options::type(const Magick::ImageType type_) +{ + _imageInfo->type=type_; +} + +Magick::ImageType Magick::Options::type(void) const { - _imageInfo->verbose = (MagickBooleanType) verboseFlag_; + return(_imageInfo->type); } -bool Magick::Options::verbose ( void ) const + +void Magick::Options::verbose(bool verboseFlag_) { - return static_cast(_imageInfo->verbose); + _imageInfo->verbose=(MagickBooleanType) verboseFlag_; } -void Magick::Options::view ( const std::string &view_ ) +bool Magick::Options::verbose(void) const { - if ( view_.length() == 0 ) + return(static_cast(_imageInfo->verbose)); +} + +void Magick::Options::view(const std::string &view_) +{ + if (view_.length() == 0) _imageInfo->view=(char *) RelinquishMagickMemory(_imageInfo->view); else - Magick::CloneString( &_imageInfo->view, view_ ); + Magick::CloneString(&_imageInfo->view, view_); } -std::string Magick::Options::view ( void ) const + +std::string Magick::Options::view(void) const { - if ( _imageInfo->view ) - return std::string( _imageInfo->view ); + if (_imageInfo->view) + return(std::string(_imageInfo->view)); - return std::string(); + return(std::string()); } -void Magick::Options::x11Display ( const std::string &display_ ) +void Magick::Options::x11Display(const std::string &display_) { - if ( display_.length() == 0 ) - _imageInfo->server_name=(char *) RelinquishMagickMemory(_imageInfo->server_name); + if (display_.length() == 0) + _imageInfo->server_name=(char *) RelinquishMagickMemory( + _imageInfo->server_name); else - Magick::CloneString( &_imageInfo->server_name, display_ ); + Magick::CloneString(&_imageInfo->server_name,display_); } -std::string Magick::Options::x11Display ( void ) const + +std::string Magick::Options::x11Display(void) const { - if ( _imageInfo->server_name ) - return std::string( _imageInfo->server_name ); + if (_imageInfo->server_name) + return(std::string( _imageInfo->server_name)); - return std::string(); + return(std::string()); } -// -// Internal implementation methods. Please do not use. -// - -MagickCore::DrawInfo * Magick::Options::drawInfo( void ) +MagickCore::DrawInfo *Magick::Options::drawInfo(void) { - return _drawInfo; + return(_drawInfo); } -MagickCore::ImageInfo * Magick::Options::imageInfo( void ) +MagickCore::ImageInfo *Magick::Options::imageInfo(void) { - return _imageInfo; + return(_imageInfo); } -MagickCore::QuantizeInfo * Magick::Options::quantizeInfo( void ) +MagickCore::QuantizeInfo *Magick::Options::quantizeInfo(void) { - return _quantizeInfo; + return(_quantizeInfo); } + +Magick::Options::Options(const MagickCore::ImageInfo* imageInfo_, + const MagickCore::QuantizeInfo* quantizeInfo_, + const MagickCore::DrawInfo* drawInfo_) +: _imageInfo(0), + _quantizeInfo(0), + _drawInfo(0) +{ + _imageInfo=CloneImageInfo(imageInfo_); + _quantizeInfo=CloneQuantizeInfo(quantizeInfo_); + _drawInfo=CloneDrawInfo(imageInfo_,drawInfo_); +} \ No newline at end of file -- 2.40.0