1 // This may look like C code, but it is really -*- C++ -*-
3 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2004
5 // Implementation of Blob
8 #define MAGICKCORE_IMPLEMENTATION 1
9 #define MAGICK_PLUSPLUS_IMPLEMENTATION 1
11 #include "Magick++/Include.h"
12 #include "Magick++/Thread.h"
13 #include "Magick++/BlobRef.h"
17 Magick::BlobRef::BlobRef(const void* data_,size_t length_)
20 allocator(Magick::Blob::NewAllocator),
26 data=new unsigned char[length_];
27 memcpy(data,data_, length_);
31 Magick::BlobRef::~BlobRef(void)
33 if (allocator == Magick::Blob::NewAllocator)
35 delete[] static_cast<unsigned char*>(data);
38 else if (allocator == Magick::Blob::MallocAllocator)
40 data=(void *) RelinquishMagickMemory(data);