summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Magick++/lib/Blob.cpp148
-rw-r--r--Magick++/lib/BlobRef.cpp33
-rw-r--r--Magick++/lib/CoderInfo.cpp92
-rw-r--r--Magick++/lib/Magick++/Blob.h29
-rw-r--r--Magick++/lib/Magick++/BlobRef.h27
-rw-r--r--Magick++/lib/Magick++/CoderInfo.h26
-rw-r--r--Magick++/lib/Magick++/Include.h27
7 files changed, 200 insertions, 182 deletions
diff --git a/Magick++/lib/Blob.cpp b/Magick++/lib/Blob.cpp
index 96b97ec6f..83e951818 100644
--- a/Magick++/lib/Blob.cpp
+++ b/Magick++/lib/Blob.cpp
@@ -18,38 +18,37 @@
// Implementation of Magick::Blob
//
-// Default constructor
-Magick::Blob::Blob ( void )
- : _blobRef(new Magick::BlobRef( 0, 0 ))
+Magick::Blob::Blob(void)
+ : _blobRef(new Magick::BlobRef(0,0))
{
}
-// Construct with data
-Magick::Blob::Blob ( const void* data_, size_t length_ )
- : _blobRef(new Magick::BlobRef( data_, length_ ))
+Magick::Blob::Blob(const void* data_,size_t length_)
+ : _blobRef(new Magick::BlobRef(data_, length_))
{
}
-// Copy constructor (reference counted)
-Magick::Blob::Blob ( const Magick::Blob& blob_ )
+Magick::Blob::Blob(const Magick::Blob& blob_)
: _blobRef(blob_._blobRef)
{
// Increase reference count
- Lock( &_blobRef->_mutexLock );
- ++_blobRef->_refCount;
+ Lock(&_blobRef->mutexLock);
+ ++_blobRef->refCount;
}
-// Destructor (reference counted)
-Magick::Blob::~Blob ()
+Magick::Blob::~Blob()
{
- bool doDelete = false;
+ bool
+ doDelete;
+
+ doDelete=false;
{
- Lock( &_blobRef->_mutexLock );
- if ( --_blobRef->_refCount == 0 )
- doDelete = true;
+ Lock(&_blobRef->mutexLock);
+ if (--_blobRef->refCount == 0)
+ doDelete=true;
}
- if ( doDelete )
+ if (doDelete)
{
// Delete old blob reference with associated data
delete _blobRef;
@@ -57,54 +56,67 @@ Magick::Blob::~Blob ()
_blobRef=0;
}
-// Assignment operator (reference counted)
-Magick::Blob& Magick::Blob::operator= ( const Magick::Blob& blob_ )
+Magick::Blob& Magick::Blob::operator=(const Magick::Blob& blob_)
{
- if(this != &blob_)
+ bool
+ doDelete;
+
+ if (this != &blob_)
{
{
- Lock( &blob_._blobRef->_mutexLock );
- ++blob_._blobRef->_refCount;
+ Lock(&blob_._blobRef->mutexLock);
+ ++blob_._blobRef->refCount;
}
- bool doDelete = false;
+ doDelete=false;
{
- Lock( &_blobRef->_mutexLock );
- if ( --_blobRef->_refCount == 0 )
- doDelete = true;
+ Lock(&_blobRef->mutexLock);
+ if (--_blobRef->refCount == 0)
+ doDelete=true;
}
- if ( doDelete )
+ if (doDelete)
{
delete _blobRef;
}
- _blobRef = blob_._blobRef;
+ _blobRef=blob_._blobRef;
}
return *this;
}
// Update object contents from Base64-encoded string representation.
-void Magick::Blob::base64 ( const std::string base64_ )
+void Magick::Blob::base64(const std::string base64_)
{
- size_t length;
+ size_t
+ length;
+
+ unsigned char
+ *decoded;
- unsigned char *decoded =
- Base64Decode( base64_.c_str(), &length );
+ decoded=Base64Decode(base64_.c_str(),&length);
if(decoded)
- updateNoCopy( static_cast<void*>(decoded), length,
- Magick::Blob::MallocAllocator );
+ updateNoCopy(static_cast<void*>(decoded),length,
+ Magick::Blob::MallocAllocator);
}
// Return Base64-encoded string representation.
-std::string Magick::Blob::base64 ( void )
+std::string Magick::Blob::base64(void)
{
- size_t encoded_length = 0;
+ size_t
+ encoded_length;
- char *encoded =
- Base64Encode(static_cast<const unsigned char*>(data()), length(), &encoded_length);
+ char
+ *encoded;
+
+ std::string
+ result;
+
+ encoded_length=0;
+ encoded=Base64Encode(static_cast<const unsigned char*>(data()),length(),
+ &encoded_length);
if(encoded)
{
- std::string result(encoded,encoded_length);
+ result=std::string(encoded,encoded_length);
encoded=(char *) RelinquishMagickMemory(encoded);
return result;
}
@@ -112,58 +124,56 @@ std::string Magick::Blob::base64 ( void )
return std::string();
}
-// Update object contents, making a copy of the supplied data.
-// Any existing data in the object is deallocated.
-void Magick::Blob::update ( const void* data_, size_t length_ )
+void Magick::Blob::update(const void* data_,size_t length_)
{
- bool doDelete = false;
+ bool
+ doDelete;
+
+ doDelete=false;
{
- Lock( &_blobRef->_mutexLock );
- if ( --_blobRef->_refCount == 0 )
- doDelete = true;
+ Lock(&_blobRef->mutexLock);
+ if (--_blobRef->refCount == 0)
+ doDelete=true;
}
- if ( doDelete )
+ if (doDelete)
{
// Delete old blob reference with associated data
delete _blobRef;
}
- _blobRef = new Magick::BlobRef( data_, length_ );
+ _blobRef=new Magick::BlobRef(data_,length_);
}
-// Update object contents, using supplied pointer directly (no copy)
-// Any existing data in the object is deallocated. The user must
-// ensure that the pointer supplied is not deleted or otherwise
-// modified after it has been supplied to this method.
-void Magick::Blob::updateNoCopy ( void* data_, size_t length_,
- Magick::Blob::Allocator allocator_ )
+void Magick::Blob::updateNoCopy(void* data_,size_t length_,
+ Magick::Blob::Allocator allocator_)
{
- bool doDelete = false;
+ bool
+ doDelete;
+
+ doDelete=false;
{
- Lock( &_blobRef->_mutexLock );
- if ( --_blobRef->_refCount == 0 )
- doDelete = true;
+ Lock(&_blobRef->mutexLock);
+ if (--_blobRef->refCount == 0)
+ doDelete=true;
}
- if ( doDelete )
+ if (doDelete)
{
// Delete old blob reference with associated data
delete _blobRef;
}
- _blobRef = new Magick::BlobRef( 0, 0 );
- _blobRef->_data = data_;
- _blobRef->_length = length_;
- _blobRef->_allocator = allocator_;
+ _blobRef=new Magick::BlobRef(0,0);
+ _blobRef->data=data_;
+ _blobRef->length=length_;
+ _blobRef->allocator=allocator_;
}
-// Obtain pointer to data
-const void* Magick::Blob::data( void ) const
+const void* Magick::Blob::data(void) const
{
- return _blobRef->_data;
+ return _blobRef->data;
}
-// Obtain data length
-size_t Magick::Blob::length( void ) const
+size_t Magick::Blob::length(void) const
{
- return _blobRef->_length;
+ return _blobRef->length;
}
diff --git a/Magick++/lib/BlobRef.cpp b/Magick++/lib/BlobRef.cpp
index d92300fbe..2236dd361 100644
--- a/Magick++/lib/BlobRef.cpp
+++ b/Magick++/lib/BlobRef.cpp
@@ -18,32 +18,29 @@
// Implementation of Magick::BlobRef
//
-// Construct with data, making private copy of data
-Magick::BlobRef::BlobRef ( const void* data_,
- size_t length_ )
- : _data(0),
- _length(length_),
- _allocator(Magick::Blob::NewAllocator),
- _refCount(1),
- _mutexLock()
+Magick::BlobRef::BlobRef(const void* data_,size_t length_)
+ : data(0),
+ length(length_),
+ allocator(Magick::Blob::NewAllocator),
+ refCount(1),
+ mutexLock()
{
- if( data_ )
+ if (data_)
{
- _data = new unsigned char[length_];
- memcpy( _data, data_, length_ );
+ data=new unsigned char[length_];
+ memcpy(data,data_, length_);
}
}
-// Destructor (actually destroys data)
-Magick::BlobRef::~BlobRef ( void )
+Magick::BlobRef::~BlobRef(void)
{
- if ( _allocator == Magick::Blob::NewAllocator )
+ if (allocator == Magick::Blob::NewAllocator)
{
- delete [] static_cast<unsigned char*>(_data);
- _data=0;
+ delete[] static_cast<unsigned char*>(data);
+ data=0;
}
- else if ( _allocator == Magick::Blob::MallocAllocator )
+ else if (allocator == Magick::Blob::MallocAllocator)
{
- _data=(void *) RelinquishMagickMemory(_data);
+ data=(void *) RelinquishMagickMemory(data);
}
}
diff --git a/Magick++/lib/CoderInfo.cpp b/Magick++/lib/CoderInfo.cpp
index f156f8233..3c146aff6 100644
--- a/Magick++/lib/CoderInfo.cpp
+++ b/Magick++/lib/CoderInfo.cpp
@@ -14,8 +14,7 @@
using namespace std;
-// Default constructor
-Magick::CoderInfo::CoderInfo ( void )
+Magick::CoderInfo::CoderInfo(void)
: _name(),
_description(),
_mimeType(),
@@ -25,18 +24,17 @@ Magick::CoderInfo::CoderInfo ( void )
{
}
-// Copy constructor
-Magick::CoderInfo::CoderInfo ( const Magick::CoderInfo &coder_ )
+Magick::CoderInfo::CoderInfo(const Magick::CoderInfo &coder_)
{
- _name = coder_._name;
- _description = coder_._description;
- _mimeType = coder_._mimeType;
- _isReadable = coder_._isReadable;
- _isWritable = coder_._isWritable;
- _isMultiFrame = coder_._isMultiFrame;
+ _name=coder_._name;
+ _description=coder_._description;
+ _mimeType=coder_._mimeType;
+ _isReadable=coder_._isReadable;
+ _isWritable=coder_._isWritable;
+ _isMultiFrame=coder_._isMultiFrame;
}
-Magick::CoderInfo::CoderInfo ( const std::string &name_ )
+Magick::CoderInfo::CoderInfo(const std::string &name_)
: _name(),
_description(),
_mimeType(),
@@ -44,86 +42,81 @@ Magick::CoderInfo::CoderInfo ( const std::string &name_ )
_isWritable(false),
_isMultiFrame(false)
{
- ExceptionInfo exceptionInfo;
- GetExceptionInfo( &exceptionInfo );
- const Magick::MagickInfo *magickInfo = GetMagickInfo( name_.c_str(),
- &exceptionInfo );
- throwException( exceptionInfo );
- (void) DestroyExceptionInfo( &exceptionInfo );
- if( magickInfo == 0 )
+ ExceptionInfo
+ exceptionInfo;
+
+ const Magick::MagickInfo
+ *magickInfo;
+
+ GetExceptionInfo(&exceptionInfo);
+ magickInfo=GetMagickInfo(name_.c_str(),&exceptionInfo);
+ throwException(exceptionInfo);
+ (void) DestroyExceptionInfo(&exceptionInfo);
+ if (magickInfo == 0)
{
- throwExceptionExplicit(OptionError, "Coder not found", name_.c_str() );
+ throwExceptionExplicit(OptionError,"Coder not found",name_.c_str());
}
else
{
- _name = string(magickInfo->name);
- _description = string(magickInfo->description);
- _mimeType = string(magickInfo->mime_type ? magickInfo->mime_type : "");
- _isReadable = ((magickInfo->decoder == 0) ? false : true);
- _isWritable = ((magickInfo->encoder == 0) ? false : true);
- _isMultiFrame = ((magickInfo->adjoin == 0) ? false : true);
+ _name=string(magickInfo->name);
+ _description=string(magickInfo->description);
+ _mimeType=string(magickInfo->mime_type ? magickInfo->mime_type : "");
+ _isReadable=((magickInfo->decoder == 0) ? false : true);
+ _isWritable=((magickInfo->encoder == 0) ? false : true);
+ _isMultiFrame=((magickInfo->adjoin == 0) ? false : true);
}
}
-Magick::CoderInfo::~CoderInfo ( void )
+Magick::CoderInfo::~CoderInfo(void)
{
- // Nothing to do
}
-// Format description
-std::string Magick::CoderInfo::description( void ) const
+std::string Magick::CoderInfo::description(void) const
{
return _description;
}
-// Format is readable
-bool Magick::CoderInfo::isReadable( void ) const
+bool Magick::CoderInfo::isReadable(void) const
{
return _isReadable;
}
-// Format is writeable
-bool Magick::CoderInfo::isWritable( void ) const
+bool Magick::CoderInfo::isWritable(void) const
{
return _isWritable;
}
-// Format supports multiple frames
-bool Magick::CoderInfo::isMultiFrame( void ) const
+bool Magick::CoderInfo::isMultiFrame(void) const
{
return _isMultiFrame;
}
-// Format mime type
-std::string Magick::CoderInfo::mimeType( void ) const
+std::string Magick::CoderInfo::mimeType(void) const
{
return _mimeType;
}
-// Format name
-std::string Magick::CoderInfo::name( void ) const
+std::string Magick::CoderInfo::name(void) const
{
return _name;
}
-// Assignment operator
-Magick::CoderInfo& Magick::CoderInfo::operator= ( const CoderInfo &coder_ )
+Magick::CoderInfo& Magick::CoderInfo::operator=(const CoderInfo &coder_)
{
// If not being set to ourself
if (this != &coder_)
{
- _name = coder_._name;
- _description = coder_._description;
- _mimeType = coder_._mimeType;
- _isReadable = coder_._isReadable;
- _isWritable = coder_._isWritable;
- _isMultiFrame = coder_._isMultiFrame;
+ _name=coder_._name;
+ _description=coder_._description;
+ _mimeType=coder_._mimeType;
+ _isReadable=coder_._isReadable;
+ _isWritable=coder_._isWritable;
+ _isMultiFrame=coder_._isMultiFrame;
}
return *this;
}
-// Construct from MagickCore::MagickInfo*
-Magick::CoderInfo::CoderInfo ( const MagickCore::MagickInfo *magickInfo_ )
+Magick::CoderInfo::CoderInfo(const MagickCore::MagickInfo *magickInfo_)
: _name(string(magickInfo_->name ? magickInfo_->name : "")),
_description(string(magickInfo_->description ? magickInfo_->description : "")),
_mimeType(string(magickInfo_->mime_type ? magickInfo_->mime_type : "")),
@@ -131,5 +124,4 @@ Magick::CoderInfo::CoderInfo ( const MagickCore::MagickInfo *magickInfo_ )
_isWritable(magickInfo_->encoder ? true : false),
_isMultiFrame(magickInfo_->adjoin ? true : false)
{
- // Nothing more to do
}
diff --git a/Magick++/lib/Magick++/Blob.h b/Magick++/lib/Magick++/Blob.h
index a3eac2974..0bea044a1 100644
--- a/Magick++/lib/Magick++/Blob.h
+++ b/Magick++/lib/Magick++/Blob.h
@@ -18,7 +18,6 @@ namespace Magick
class MagickPPExport Blob
{
-
public:
enum Allocator
@@ -28,28 +27,28 @@ namespace Magick
};
// Default constructor
- Blob ( void );
+ Blob(void);
// Construct object with data, making a copy of the supplied data.
- Blob ( const void* data_, size_t length_ );
+ Blob(const void* data_,size_t length_);
// Copy constructor (reference counted)
- Blob ( const Blob& blob_ );
+ Blob(const Blob& blob_);
// Destructor (reference counted)
- virtual ~Blob ();
+ virtual ~Blob();
// Assignment operator (reference counted)
- Blob& operator= ( const Blob& blob_ );
+ Blob& operator=(const Blob& blob_);
// Update object contents from Base64-encoded string representation.
- void base64 ( const std::string base64_ );
+ void base64(const std::string base64_);
// Return Base64-encoded string representation.
- std::string base64 ( void );
+ std::string base64(void);
// Update object contents, making a copy of the supplied data.
// Any existing data in the object is deallocated.
- void update ( const void* data_, size_t length_ );
+ void update(const void* data_,size_t length_);
// Update object contents, using supplied pointer directly (no
// copy). Any existing data in the object is deallocated. The user
@@ -58,23 +57,21 @@ namespace Magick
// Specify allocator_ as "MallocAllocator" if memory is allocated
// via the C language malloc() function, or "NewAllocator" if
// memory is allocated via C++ 'new'.
- void updateNoCopy ( void* data_, size_t length_,
- Allocator allocator_ = NewAllocator );
+ void updateNoCopy(void* data_,size_t length_,
+ Allocator allocator_=NewAllocator);
// Obtain pointer to data. The user should never try to modify or
// free this data since the Blob class manages its own data. The
// user must be finished with the data before allowing the Blob to
// be destroyed since the pointer is invalid once the Blob is
// destroyed.
- const void* data ( void ) const;
+ const void* data(void) const;
// Obtain data length
- size_t length ( void ) const;
-
- protected:
+ size_t length(void) const;
private:
- BlobRef * _blobRef;
+ BlobRef *_blobRef;
};
} // namespace Magick
diff --git a/Magick++/lib/Magick++/BlobRef.h b/Magick++/lib/Magick++/BlobRef.h
index 747ff002a..effed402c 100644
--- a/Magick++/lib/Magick++/BlobRef.h
+++ b/Magick++/lib/Magick++/BlobRef.h
@@ -17,28 +17,25 @@
namespace Magick
{
-
- class BlobRef {
+ class BlobRef
+ {
public:
- // There are no public methods in this class
-
// Construct with data, making private copy of data
- BlobRef ( const void* data_, size_t length_ );
+ BlobRef(const void* data_,size_t length_);
// Destructor (actually destroys data)
- ~BlobRef ( void );
+ ~BlobRef(void);
+
+ void* data; // Blob data
+ size_t length; // Blob length
+ Blob::Allocator allocator; // Memory allocation system in use
+ ::ssize_t refCount; // Reference count
+ MutexLock mutexLock; // Mutex lock
private:
// Copy constructor and assignment are not supported
- BlobRef (const BlobRef&);
- BlobRef& operator= (const BlobRef&);
-
- public:
- void * _data; // Blob data
- size_t _length; // Blob length
- Blob::Allocator _allocator; // Memory allocation system in use
- ::ssize_t _refCount; // Reference count
- MutexLock _mutexLock; // Mutex lock
+ BlobRef(const BlobRef&);
+ BlobRef& operator=(const BlobRef&);
};
} // namespace Magick
diff --git a/Magick++/lib/Magick++/CoderInfo.h b/Magick++/lib/Magick++/CoderInfo.h
index a89bef39f..c3a6b1c90 100644
--- a/Magick++/lib/Magick++/CoderInfo.h
+++ b/Magick++/lib/Magick++/CoderInfo.h
@@ -26,45 +26,44 @@ namespace Magick
};
// Default constructor
- CoderInfo ( void );
+ CoderInfo(void);
// Copy constructor
- CoderInfo ( const CoderInfo &coder_ );
+ CoderInfo(const CoderInfo &coder_);
// Construct with coder name
- CoderInfo ( const std::string &name_ );
+ CoderInfo(const std::string &name_);
// Destructor
- ~CoderInfo ( void );
+ ~CoderInfo(void);
// Format description
- std::string description( void ) const;
+ std::string description(void) const;
// Format supports multiple frames
- bool isMultiFrame( void ) const;
+ bool isMultiFrame(void) const;
// Format is readable
- bool isReadable( void ) const;
+ bool isReadable(void) const;
// Format is writeable
- bool isWritable( void ) const;
+ bool isWritable(void) const;
// Format mime type
- std::string mimeType( void ) const;
+ std::string mimeType(void) const;
// Format name
- std::string name( void ) const;
+ std::string name(void) const;
// Assignment operator
- CoderInfo& operator= ( const CoderInfo &coder_ );
+ CoderInfo& operator=(const CoderInfo &coder_);
//
// Implemementation methods
//
- CoderInfo ( const MagickCore::MagickInfo *magickInfo_ );
+ CoderInfo(const MagickCore::MagickInfo *magickInfo_);
private:
-
std::string _name;
std::string _description;
std::string _mimeType;
@@ -72,6 +71,7 @@ namespace Magick
bool _isWritable;
bool _isMultiFrame;
};
+
} // namespace Magick
//
diff --git a/Magick++/lib/Magick++/Include.h b/Magick++/lib/Magick++/Include.h
index 47e376af6..c7de876b3 100644
--- a/Magick++/lib/Magick++/Include.h
+++ b/Magick++/lib/Magick++/Include.h
@@ -715,6 +715,31 @@ namespace Magick
using MagickCore::FillToBorderMethod;
using MagickCore::ResetMethod;
+ using MagickCore::PixelChannel;
+ using MagickCore::UndefinedPixelChannel;
+ using MagickCore::RedPixelChannel;
+ using MagickCore::CyanPixelChannel;
+ using MagickCore::GrayPixelChannel;
+ using MagickCore::LPixelChannel;
+ using MagickCore::YPixelChannel;
+ using MagickCore::aPixelChannel;
+ using MagickCore::GreenPixelChannel;
+ using MagickCore::MagentaPixelChannel;
+ using MagickCore::CbPixelChannel;
+ using MagickCore::bPixelChannel;
+ using MagickCore::BluePixelChannel;
+ using MagickCore::YellowPixelChannel;
+ using MagickCore::CrPixelChannel;
+ using MagickCore::BlackPixelChannel;
+ using MagickCore::AlphaPixelChannel;
+ using MagickCore::IndexPixelChannel;
+ using MagickCore::ReadMaskPixelChannel;
+ using MagickCore::WriteMaskPixelChannel;
+ using MagickCore::MetaPixelChannel;
+ using MagickCore::IntensityPixelChannel;
+ using MagickCore::CompositePixelChannel;
+ using MagickCore::SyncPixelChannel;
+
// PixelInterpolate methods
using MagickCore::PixelInterpolateMethod;
using MagickCore::UndefinedInterpolatePixel;
@@ -930,7 +955,7 @@ namespace Magick
using MagickCore::CoderWarning;
using MagickCore::ColorDecisionListImage;
using MagickCore::ColorizeImage;
- using MagickCore::ColorMatrixImage;
+ using MagickCore::ColorMatrixImage;
using MagickCore::CompareImages;
using MagickCore::CompositeImage;
using MagickCore::ConfigureError;