]> granicus.if.org Git - imagemagick/commitdiff
Fixed opening and saving file in IMDisplay.
authordirk <dirk@git.imagemagick.org>
Sun, 17 Nov 2013 15:54:38 +0000 (15:54 +0000)
committerdirk <dirk@git.imagemagick.org>
Sun, 17 Nov 2013 15:54:38 +0000 (15:54 +0000)
Magick++/lib/Image.cpp
Magick++/lib/Magick++/Image.h
Magick++/lib/Magick++/Pixels.h
Magick++/lib/Pixels.cpp

index 6f89163eb8a4a86239a9d4dee4895cfee553e5a2..2b5f7983437f7d6f4acfed40de34313340a18b0c 100644 (file)
@@ -3193,6 +3193,11 @@ void Magick::Image::cacheThreshold ( const MagickSizeType threshold_ )
   SetMagickResourceLimit( MemoryResource, threshold_ );
 }
 
+size_t Magick::Image::channels() const
+{
+  return constImage()->number_channels;
+}
+
 void Magick::Image::chromaBluePrimary ( const double x_, const double y_ )
 {
   modifyImage();
index 98a8a8b93e9c1edaf08322ef97679f44a8236cf1..9e1f3cffb2463d97e453e16e70cbe1c3caa2d84b 100644 (file)
@@ -989,7 +989,10 @@ namespace Magick
     // is exceeded, all subsequent pixels cache operations are to/from
     // disk.  This setting is shared by all Image objects.
     static void     cacheThreshold ( const MagickSizeType threshold_ );
-    
+
+    // Returns the number of channels in this image.
+    size_t channels() const;
+
     // Chromaticity blue primary point (e.g. x=0.15, y=0.06)
     void            chromaBluePrimary ( const double x_, const double y_ );
     void            chromaBluePrimary ( double *x_, double *y_ ) const;
index 8d0a1d4490867caea92213abc2585c42a61c0556..93ce3c0ff5f26ba9c2129a7323e14db28ae43082 100644 (file)
@@ -23,25 +23,28 @@ namespace Magick
 
     // Destroy pixel view
     ~Pixels(void);
-    
+
     // Transfer pixels from the image to the pixel view as defined by
     // the specified region. Modified pixels may be subsequently
     // transferred back to the image via sync.
-    Quantumget(const ::ssize_t x_,const ::ssize_t y_,
+    Quantum *get(const ::ssize_t x_,const ::ssize_t y_,
       const size_t columns_,const size_t rows_);
 
     // Transfer read-only pixels from the image to the pixel view as
     // defined by the specified region.
-    const QuantumgetConst(const ::ssize_t x_,const ::ssize_t y_,
+    const Quantum *getConst(const ::ssize_t x_,const ::ssize_t y_,
       const size_t columns_,const size_t rows_);
 
     // Return pixel colormap index array
-    //Quantum* metacontent(void);
+    //Quantum *metacontent(void);
+
+    // Returns the offset for the specified channel.
+    ssize_t offset(PixelChannel channel) const;
 
     // Allocate a pixel view region to store image pixels as defined
     // by the region rectangle.  This area is subsequently transferred
     // from the pixel view to the image via sync.
-    Quantumset(const ::ssize_t x_,const ::ssize_t y_,const size_t columns_,
+    Quantum *set(const ::ssize_t x_,const ::ssize_t y_,const size_t columns_,
       const size_t rows_ );
 
     // Transfers the image view pixels to the image.
@@ -66,7 +69,7 @@ namespace Magick
     const Pixels& operator=(const Pixels& pixels_);
 
     Magick::Image             _image;     // Image reference
-    MagickCore::CacheView*    _view;      // Image view handle
+    MagickCore::CacheView     *_view;     // Image view handle
     ::ssize_t                 _x;         // Left ordinate of view
     ::ssize_t                 _y;         // Top ordinate of view
     size_t                    _columns;   // Width of view
index 6677dc6795c73a0449e99db2afbfa1d1790668b1..f42ad6d82b72960183f071753b0c12a3fb50ac70 100644 (file)
@@ -71,6 +71,13 @@ const Magick::Quantum* Magick::Pixels::getConst(const ssize_t x_,
   return pixels;
 }
 
+ssize_t Magick::Pixels::offset(PixelChannel channel) const
+{
+  if (_image.constImage()->channel_map[channel].traits == UndefinedPixelTrait)
+    return -1;
+  return _image.constImage()->channel_map[channel].offset;
+}
+
 Magick::Quantum* Magick::Pixels::set(const ssize_t x_,const ssize_t y_,
   const size_t columns_,const size_t rows_)
 {