class MagickPPExport Montage
{
public:
- Montage( void );
- virtual ~Montage( void );
-
- void backgroundColor ( const Color &backgroundColor_ );
- Color backgroundColor ( void ) const;
-
- void compose ( CompositeOperator compose_ );
- CompositeOperator compose ( void ) const;
-
- void fileName( const std::string &fileName_ );
- std::string fileName( void ) const;
-
- void fillColor ( const Color &fill_ );
- Color fillColor ( void ) const;
-
- void font ( const std::string &font_ );
- std::string font ( void ) const;
-
- void geometry ( const Geometry &geometry_ );
- Geometry geometry ( void ) const;
-
- void gravity ( GravityType gravity_ );
- GravityType gravity ( void ) const;
-
- // Apply as attribute to all images before montage
- void label( const std::string &label_ );
- std::string label( void ) const;
-
- // Same as fill color
- void penColor ( const Color &pen_ );
- Color penColor ( void ) const;
-
- void pointSize ( size_t pointSize_ );
- size_t pointSize ( void ) const;
-
- void shadow ( bool shadow_ );
- bool shadow ( void ) const;
-
- void strokeColor ( const Color &stroke_ );
- Color strokeColor ( void ) const;
-
- void texture ( const std::string &texture_ );
- std::string texture ( void ) const;
-
- void tile ( const Geometry &tile_ );
- Geometry tile ( void ) const;
-
- void title ( const std::string &title_ );
- std::string title ( void ) const;
-
- // Apply to montage with TransparentPaintImage()
- void transparentColor ( const Color &transparentColor_ );
- Color transparentColor ( void ) const;
- //
- // Implementation methods/members
- //
+ Montage(void);
+ virtual ~Montage(void);
- // Update elements in existing MontageInfo structure
- virtual void updateMontageInfo ( MagickCore::MontageInfo &montageInfo_ ) const;
-
- protected:
+ // Color that thumbnails are composed on
+ void backgroundColor(const Color &backgroundColor_);
+ Color backgroundColor(void) const;
- private:
- Color _backgroundColor; // Color that thumbnails are composed on
- CompositeOperator _compose; // Composition algorithm to use (e.g. ReplaceCompositeOp)
- std::string _fileName; // Filename to save montages to
- Color _fill; // Fill color
- std::string _font; // Label font
- Geometry _geometry; // Thumbnail width & height plus border width & height
- GravityType _gravity; // Thumbnail position (e.g. SouthWestGravity)
- std::string _label; // Thumbnail label (applied to image prior to montage)
- size_t _pointSize; // Font point size
- bool _shadow; // Enable drop-shadows on thumbnails
- Color _stroke; // Outline color
- std::string _texture; // Background texture image
- Geometry _tile; // Thumbnail rows and colmns
- std::string _title; // Montage title
- Color _transparentColor; // Transparent color
- };
+ // Composition algorithm to use (e.g. ReplaceCompositeOp)
+ void compose(CompositeOperator compose_);
+ CompositeOperator compose(void) const;
- //
- // Montage With Frames (Extends Basic Montage)
- //
- class MagickPPExport MontageFramed : public Montage
- {
- public:
- MontageFramed ( void );
- /* virtual */ ~MontageFramed ( void );
-
- void borderColor ( const Color &borderColor_ );
- Color borderColor ( void ) const;
-
- void borderWidth ( size_t borderWidth_ );
- size_t borderWidth ( void ) const;
-
- void frameGeometry ( const Geometry &frame_ );
- Geometry frameGeometry ( void ) const;
-
- void matteColor ( const Color &matteColor_ );
- Color matteColor ( void ) const;
+ // Filename to save montages to
+ void fileName(const std::string &fileName_);
+ std::string fileName(void) const;
- //
- // Implementation methods/members
- //
+ // Fill color
+ void fillColor(const Color &fill_);
+ Color fillColor(void) const;
- // Update elements in existing MontageInfo structure
- /* virtual */ void updateMontageInfo ( MagickCore::MontageInfo &montageInfo_ ) const;
-
- protected:
+ // Label font
+ void font(const std::string &font_);
+ std::string font(void) const;
- private:
-
- Color _borderColor; // Frame border color
- size_t _borderWidth; // Pixels between thumbnail and surrounding frame
- Geometry _frame; // Frame geometry (width & height frame thickness)
- Color _matteColor; // Frame foreground color
- };
-} // namespace Magick
+ // Thumbnail width & height plus border width & height
+ void geometry(const Geometry &geometry_);
+ Geometry geometry(void) const;
-//
-// Inlines
-//
+ // Thumbnail position (e.g. SouthWestGravity)
+ void gravity(GravityType gravity_);
+ GravityType gravity(void) const;
-//
-// Implementation of Montage
-//
+ // Thumbnail label (applied to image prior to montage)
+ void label(const std::string &label_);
+ std::string label(void) const;
-inline void Magick::Montage::backgroundColor ( const Magick::Color &backgroundColor_ )
-{
- _backgroundColor = backgroundColor_;
-}
-inline Magick::Color Magick::Montage::backgroundColor ( void ) const
-{
- return _backgroundColor;
-}
+ // Font point size
+ void pointSize(size_t pointSize_);
+ size_t pointSize(void) const;
-inline void Magick::Montage::compose ( Magick::CompositeOperator compose_ )
-{
- _compose = compose_;
-}
-inline Magick::CompositeOperator Magick::Montage::compose ( void ) const
-{
- return _compose;
-}
+ // Enable drop-shadows on thumbnails
+ void shadow(bool shadow_);
+ bool shadow(void) const;
-inline void Magick::Montage::fileName( const std::string &fileName_ )
-{
- _fileName = fileName_;
-}
-inline std::string Magick::Montage::fileName( void ) const
-{
- return _fileName;
-}
+ // Outline color
+ void strokeColor(const Color &stroke_);
+ Color strokeColor(void) const;
-inline void Magick::Montage::fillColor ( const Color &fill_ )
-{
- _fill=fill_;
-}
-inline Magick::Color Magick::Montage::fillColor ( void ) const
-{
- return _fill;
-}
+ // Background texture image
+ void texture(const std::string &texture_);
+ std::string texture(void) const;
-inline void Magick::Montage::font ( const std::string &font_ )
-{
- _font = font_;
-}
-inline std::string Magick::Montage::font ( void ) const
-{
- return _font;
-}
+ // Thumbnail rows and colmns
+ void tile(const Geometry &tile_);
+ Geometry tile(void) const;
-inline void Magick::Montage::geometry ( const Magick::Geometry &geometry_ )
-{
- _geometry = geometry_;
-}
-inline Magick::Geometry Magick::Montage::geometry ( void ) const
-{
- return _geometry;
-}
+ // Montage title
+ void title(const std::string &title_);
+ std::string title(void) const;
-inline void Magick::Montage::gravity ( Magick::GravityType gravity_ )
-{
- _gravity = gravity_;
-}
-inline Magick::GravityType Magick::Montage::gravity ( void ) const
-{
- return _gravity;
-}
+ // Transparent color
+ void transparentColor(const Color &transparentColor_);
+ Color transparentColor(void) const;
-// Apply as attribute to all images before doing montage
-inline void Magick::Montage::label( const std::string &label_ )
-{
- _label = label_;
-}
-inline std::string Magick::Montage::label( void ) const
-{
- return _label;
-}
+ //
+ // Implementation methods/members
+ //
-inline void Magick::Montage::penColor ( const Color &pen_ )
-{
- _fill=pen_;
- _stroke=Color("none");
-}
-inline Magick::Color Magick::Montage::penColor ( void ) const
-{
- return _fill;
-}
+ // Update elements in existing MontageInfo structure
+ virtual void updateMontageInfo(MagickCore::MontageInfo &montageInfo_) const;
-inline void Magick::Montage::pointSize ( size_t pointSize_ )
-{
- _pointSize = pointSize_;
-}
-inline size_t Magick::Montage::pointSize ( void ) const
-{
- return _pointSize;
-}
+ private:
-inline void Magick::Montage::shadow ( bool shadow_ )
-{
- _shadow = shadow_;
-}
-inline bool Magick::Montage::shadow ( void ) const
-{
- return _shadow;
-}
+ Color _backgroundColor;
+ CompositeOperator _compose;
+ std::string _fileName;
+ Color _fill;
+ std::string _font;
+ Geometry _geometry;
+ GravityType _gravity;
+ std::string _label;
+ size_t _pointSize;
+ bool _shadow;
+ Color _stroke;
+ std::string _texture;
+ Geometry _tile;
+ std::string _title;
+ Color _transparentColor;
+ };
-inline void Magick::Montage::strokeColor ( const Color &stroke_ )
-{
- _stroke=stroke_;
-}
-inline Magick::Color Magick::Montage::strokeColor ( void ) const
-{
- return _stroke;
-}
+ //
+ // Montage With Frames (Extends Basic Montage)
+ //
+ class MagickPPExport MontageFramed : public Montage
+ {
+ public:
-inline void Magick::Montage::texture ( const std::string &texture_ )
-{
- _texture = texture_;
-}
-inline std::string Magick::Montage::texture ( void ) const
-{
- return _texture;
-}
+ MontageFramed(void);
+ ~MontageFramed(void);
-inline void Magick::Montage::tile ( const Geometry &tile_ )
-{
- _tile = tile_;
-}
-inline Magick::Geometry Magick::Montage::tile ( void ) const
-{
- return _tile;
-}
+ // Frame border color
+ void borderColor(const Color &borderColor_);
+ Color borderColor(void) const;
-inline void Magick::Montage::title ( const std::string &title_ )
-{
- _title = title_;
-}
-inline std::string Magick::Montage::title ( void ) const
-{
- return _title;
-}
+ // Pixels between thumbnail and surrounding frame
+ void borderWidth(size_t borderWidth_);
+ size_t borderWidth(void) const;
-// Applied after the fact to montage with TransparentPaintImage()
-inline void Magick::Montage::transparentColor ( const Magick::Color &transparentColor_ )
-{
- _transparentColor = transparentColor_;
-}
-inline Magick::Color Magick::Montage::transparentColor ( void ) const
-{
- return _transparentColor;
-}
+ // Frame geometry (width & height frame thickness)
+ void frameGeometry(const Geometry &frame_);
+ Geometry frameGeometry(void) const;
-//
-// Implementation of MontageFramed
-//
+ // Frame foreground color
+ void matteColor(const Color &matteColor_);
+ Color matteColor(void) const;
-inline void Magick::MontageFramed::borderColor ( const Magick::Color &borderColor_ )
-{
- _borderColor = borderColor_;
-}
-inline Magick::Color Magick::MontageFramed::borderColor ( void ) const
-{
- return _borderColor;
-}
+ //
+ // Implementation methods/members
+ //
-inline void Magick::MontageFramed::borderWidth ( size_t borderWidth_ )
-{
- _borderWidth = borderWidth_;
-}
-inline size_t Magick::MontageFramed::borderWidth ( void ) const
-{
- return _borderWidth;
-}
+ // Update elements in existing MontageInfo structure
+ void updateMontageInfo(MagickCore::MontageInfo &montageInfo_) const;
-inline void Magick::MontageFramed::frameGeometry ( const Magick::Geometry &frame_ )
-{
- _frame = frame_;
-}
-inline Magick::Geometry Magick::MontageFramed::frameGeometry ( void ) const
-{
- return _frame;
-}
+ private:
-inline void Magick::MontageFramed::matteColor ( const Magick::Color &matteColor_ )
-{
- _matteColor = matteColor_;
-}
-inline Magick::Color Magick::MontageFramed::matteColor ( void ) const
-{
- return _matteColor;
-}
+ Color _borderColor;
+ size_t _borderWidth;
+ Geometry _frame;
+ Color _matteColor;
+ };
+} // namespace Magick
#endif // Magick_Montage_header
// Create a composite image by combining several separate images.
template <class Container, class InputIterator>
- void montageImages( Container *montageImages_,
- InputIterator first_,
- InputIterator last_,
- const Montage &montageOpts_ ) {
+ void montageImages(Container *montageImages_,InputIterator first_,
+ InputIterator last_,const Montage &options_)
+ {
+ MagickCore::Image
+ *images;
- MagickCore::MontageInfo* montageInfo =
- static_cast<MagickCore::MontageInfo*>(MagickCore::AcquireMagickMemory(sizeof(MagickCore::MontageInfo)));
+ MagickCore::MontageInfo
+ *montageInfo;
+
+ montageInfo=static_cast<MagickCore::MontageInfo*>(
+ MagickCore::AcquireMagickMemory(sizeof(MagickCore::MontageInfo)));
// Update montage options with those set in montageOpts_
- montageOpts_.updateMontageInfo( *montageInfo );
+ options_.updateMontageInfo(*montageInfo);
// Update options which must transfer to image options
- if ( montageOpts_.label().length() != 0 )
- first_->label( montageOpts_.label() );
+ if (options_.label().length() != 0)
+ first_->label(options_.label());
// Create linked image list
- linkImages( first_, last_ );
+ linkImages(first_,last_);
// Reset output container to pristine state
montageImages_->clear();
// Do montage
- MagickCore::ExceptionInfo exceptionInfo;
- MagickCore::GetExceptionInfo( &exceptionInfo );
- MagickCore::Image *images = MagickCore::MontageImages( first_->image(),
- montageInfo,
- &exceptionInfo );
- if ( images != 0 )
- {
- insertImages( montageImages_, images );
- }
+ GetPPException;
+ images=MagickCore::MontageImages(first_->image(),montageInfo,
+ &exceptionInfo);
+ if (images != (MagickCore::Image *) NULL)
+ insertImages(montageImages_,images);
// Clean up any allocated data in montageInfo
- MagickCore::DestroyMontageInfo( montageInfo );
+ MagickCore::DestroyMontageInfo(montageInfo);
// Unlink linked image list
- unlinkImages( first_, last_ );
+ unlinkImages(first_,last_);
// Report any montage error
- throwException( exceptionInfo );
+ throwException(exceptionInfo);
// Apply transparency to montage images
- if ( montageImages_->size() > 0 && montageOpts_.transparentColor().isValid() )
- {
- for_each( first_, last_, transparentImage( montageOpts_.transparentColor() ) );
- }
+ if (montageImages_->size() > 0 && options_.transparentColor().isValid())
+ for_each(first_,last_,transparentImage(options_.transparentColor()));
- // Report any transparentImage() error
- throwException( exceptionInfo );
- (void) MagickCore::DestroyExceptionInfo( &exceptionInfo );
+ (void) MagickCore::DestroyExceptionInfo(&exceptionInfo);
}
// Morph a set of images
#include "Magick++/Montage.h"
#include "Magick++/Functions.h"
-Magick::Montage::Montage ( void )
+Magick::Montage::Montage(void)
: _backgroundColor("#ffffff"),
_compose(OverCompositeOp),
_fileName(),
{
}
-Magick::Montage::~Montage( void )
+Magick::Montage::~Montage(void)
{
- // Nothing to do
}
-Magick::MontageFramed::MontageFramed ( void )
- : _borderColor("#dfdfdf"),
- _borderWidth(0),
- _frame(),
- _matteColor("#bdbdbd")
+inline void Magick::Montage::backgroundColor(const Magick::Color &backgroundColor_)
+{
+ _backgroundColor=backgroundColor_;
+}
+
+inline Magick::Color Magick::Montage::backgroundColor(void) const
+{
+ return(_backgroundColor);
+}
+
+inline void Magick::Montage::compose(Magick::CompositeOperator compose_)
+{
+ _compose=compose_;
+}
+
+inline Magick::CompositeOperator Magick::Montage::compose(void) const
+{
+ return(_compose);
+}
+
+inline void Magick::Montage::fileName(const std::string &fileName_)
+{
+ _fileName=fileName_;
+}
+
+inline std::string Magick::Montage::fileName(void) const
+{
+ return(_fileName);
+}
+
+inline void Magick::Montage::fillColor(const Color &fill_)
+{
+ _fill=fill_;
+}
+
+inline Magick::Color Magick::Montage::fillColor(void) const
+{
+ return(_fill);
+}
+
+inline void Magick::Montage::font(const std::string &font_)
+{
+ _font=font_;
+}
+
+inline std::string Magick::Montage::font(void) const
+{
+ return(_font);
+}
+
+inline void Magick::Montage::geometry(const Magick::Geometry &geometry_)
+{
+ _geometry=geometry_;
+}
+
+inline Magick::Geometry Magick::Montage::geometry(void) const
+{
+ return(_geometry);
+}
+
+inline void Magick::Montage::gravity(Magick::GravityType gravity_)
+{
+ _gravity=gravity_;
+}
+
+inline Magick::GravityType Magick::Montage::gravity(void) const
+{
+ return(_gravity);
+}
+
+inline void Magick::Montage::label(const std::string &label_)
+{
+ _label=label_;
+}
+
+inline std::string Magick::Montage::label(void) const
+{
+ return(_label);
+}
+
+inline void Magick::Montage::pointSize(size_t pointSize_)
+{
+ _pointSize=pointSize_;
+}
+
+inline size_t Magick::Montage::pointSize(void) const
+{
+ return(_pointSize);
+}
+
+inline void Magick::Montage::shadow(bool shadow_)
+{
+ _shadow=shadow_;
+}
+
+inline bool Magick::Montage::shadow(void) const
{
+ return(_shadow);
}
-/* virtual */ Magick::MontageFramed::~MontageFramed ( void )
+inline void Magick::Montage::strokeColor(const Color &stroke_)
{
- // Nothing to do
+ _stroke=stroke_;
}
-void Magick::Montage::updateMontageInfo ( MontageInfo &montageInfo_ ) const
+inline Magick::Color Magick::Montage::strokeColor(void) const
{
+ return(_stroke);
+}
+
+inline void Magick::Montage::texture(const std::string &texture_)
+{
+ _texture=texture_;
+}
+
+inline std::string Magick::Montage::texture(void) const
+{
+ return(_texture);
+}
+
+inline void Magick::Montage::tile(const Geometry &tile_)
+{
+ _tile=tile_;
+}
+
+inline Magick::Geometry Magick::Montage::tile(void) const
+{
+ return(_tile);
+}
- memset(&montageInfo_,0,sizeof(MontageInfo));
+inline void Magick::Montage::title(const std::string &title_)
+{
+ _title=title_;
+}
+
+inline std::string Magick::Montage::title(void) const
+{
+ return(_title);
+}
+
+inline void Magick::Montage::transparentColor(const Magick::Color &transparentColor_)
+{
+ _transparentColor=transparentColor_;
+}
+
+inline Magick::Color Magick::Montage::transparentColor(void) const
+{
+ return(_transparentColor);
+}
+
+void Magick::Montage::updateMontageInfo(MontageInfo &montageInfo_ ) const
+{
+ (void) MagickCore::ResetMagickMemory(&montageInfo_,0,sizeof(montageInfo_));
// background_color
- montageInfo_.background_color = _backgroundColor;
+ montageInfo_.background_color=_backgroundColor;
// border_color
- montageInfo_.border_color = Color();
+ montageInfo_.border_color=Color();
// border_width
- montageInfo_.border_width = 0;
+ montageInfo_.border_width=0;
// filename
- _fileName.copy( montageInfo_.filename, MaxTextExtent - 1 );
- montageInfo_.filename[ _fileName.length() ] = 0; // null terminate
+ if (_font.length() != 0)
+ {
+ _fileName.copy(montageInfo_.filename,MaxTextExtent-1);
+ montageInfo_.filename[ _fileName.length() ] = 0; // null terminate
+ }
// fill
- montageInfo_.fill = _fill;
+ montageInfo_.fill=_fill;
// font
- if ( _font.length() != 0 )
- Magick::CloneString( &montageInfo_.font, _font );
- else
- montageInfo_.font=(char *) RelinquishMagickMemory(montageInfo_.font);
- // frame
- montageInfo_.frame=(char *) montageInfo_.frame;
+ if (_font.length() != 0)
+ Magick::CloneString(&montageInfo_.font,_font);
// geometry
- if ( _geometry.isValid() )
- Magick::CloneString( &montageInfo_.geometry, _geometry );
- else
- montageInfo_.geometry=(char *)
- RelinquishMagickMemory(montageInfo_.geometry);
+ if (_geometry.isValid())
+ Magick::CloneString(&montageInfo_.geometry,_geometry);
// gravity
- montageInfo_.gravity = _gravity;
+ montageInfo_.gravity=_gravity;
// matte_color
- montageInfo_.matte_color = Color();
+ montageInfo_.matte_color=Color();
// pointsize
- montageInfo_.pointsize = _pointSize;
+ montageInfo_.pointsize=_pointSize;
// shadow
- montageInfo_.shadow = static_cast<MagickBooleanType>
+ montageInfo_.shadow=static_cast<MagickBooleanType>
(_shadow ? MagickTrue : MagickFalse);
// signature (validity stamp)
- montageInfo_.signature = MagickSignature;
+ montageInfo_.signature=MagickSignature;
// stroke
- montageInfo_.stroke = _stroke;
+ montageInfo_.stroke=_stroke;
// texture
- if ( _texture.length() != 0 )
- Magick::CloneString( &montageInfo_.texture, _texture );
- else
- montageInfo_.texture=(char *) RelinquishMagickMemory(montageInfo_.texture);
+ if (_texture.length() != 0)
+ Magick::CloneString(&montageInfo_.texture,_texture);
// tile
- if ( _tile.isValid() )
- Magick::CloneString( &montageInfo_.tile, _tile );
- else
- montageInfo_.tile=(char *) RelinquishMagickMemory(montageInfo_.tile);
+ if (_tile.isValid())
+ Magick::CloneString(&montageInfo_.tile,_tile);
// title
- if ( _title.length() != 0 )
- Magick::CloneString( &montageInfo_.title, _title );
- else
- montageInfo_.title=(char *) RelinquishMagickMemory(montageInfo_.title);
+ if (_title.length() != 0)
+ Magick::CloneString(&montageInfo_.title,_title);
}
//
// Implementation of MontageFramed
//
-/* virtual */ void
-Magick::MontageFramed::updateMontageInfo ( MontageInfo &montageInfo_ ) const
+Magick::MontageFramed::MontageFramed(void)
+ : _borderColor("#dfdfdf"),
+ _borderWidth(0),
+ _frame(),
+ _matteColor("#bdbdbd")
+{
+}
+
+Magick::MontageFramed::~MontageFramed(void)
+{
+}
+
+inline void Magick::MontageFramed::borderColor(const Magick::Color &borderColor_)
+{
+ _borderColor=borderColor_;
+}
+
+inline Magick::Color Magick::MontageFramed::borderColor(void) const
+{
+ return(_borderColor);
+}
+
+inline void Magick::MontageFramed::borderWidth(size_t borderWidth_)
+{
+ _borderWidth=borderWidth_;
+}
+
+inline size_t Magick::MontageFramed::borderWidth(void) const
+{
+ return(_borderWidth);
+}
+
+inline void Magick::MontageFramed::frameGeometry(const Magick::Geometry &frame_)
+{
+ _frame=frame_;
+}
+
+inline Magick::Geometry Magick::MontageFramed::frameGeometry(void) const
+{
+ return(_frame);
+}
+
+inline void Magick::MontageFramed::matteColor(const Magick::Color &matteColor_)
+{
+ _matteColor=matteColor_;
+}
+
+inline Magick::Color Magick::MontageFramed::matteColor(void) const
+{
+ return(_matteColor);
+}
+
+void Magick::MontageFramed::updateMontageInfo(MontageInfo &montageInfo_) const
{
// Do base updates
- Montage::updateMontageInfo ( montageInfo_ );
+ Montage::updateMontageInfo(montageInfo_);
// border_color
- montageInfo_.border_color = _borderColor;
+ montageInfo_.border_color=_borderColor;
// border_width
- montageInfo_.border_width = _borderWidth;
+ montageInfo_.border_width=_borderWidth;
// frame
- if ( _frame.isValid() )
- Magick::CloneString( &montageInfo_.frame, _frame );
- else
- montageInfo_.frame=(char *) RelinquishMagickMemory(montageInfo_.frame);
+ if (_frame.isValid())
+ Magick::CloneString(&montageInfo_.frame,_frame);
// matte_color
- montageInfo_.matte_color = _matteColor;
+ montageInfo_.matte_color=_matteColor;
}