]> git.pld-linux.org Git - packages/pfstools.git/blob - imagemagick7.patch
- fix building with ImageMagick 7
[packages/pfstools.git] / imagemagick7.patch
1 diff -ur pfstools-2.0.4/src/fileformat/pfsinimgmagick.cpp pfstools-2.0.4-im7/src/fileformat/pfsinimgmagick.cpp
2 --- pfstools-2.0.4/src/fileformat/pfsinimgmagick.cpp    2015-07-15 11:58:19.000000000 +0200
3 +++ pfstools-2.0.4-im7/src/fileformat/pfsinimgmagick.cpp        2016-12-26 23:03:33.929300971 +0100
4 @@ -35,6 +35,7 @@
5  
6  #define PROG_NAME "pfsinimgmagick"
7  
8 +using namespace Magick;
9  
10  class QuietException 
11  {
12 @@ -112,7 +113,7 @@
13      Magick::Image imImage( ff.fileName );
14  
15      VERBOSE_STR << "input image gamma:  " << imImage.gamma() << std::endl;
16 -    bool hasAlpha = imImage.matte();
17 +    bool hasAlpha = imImage.alpha();
18      if( hasAlpha )
19        VERBOSE_STR << "alpha channel found" << std::endl;    
20      
21 @@ -127,18 +128,19 @@
22      
23      // Copy line by line to pfs::Frame
24      int pixInd = 0;
25 -    const float maxValue = (float)(1<<QuantumDepth) - 1;
26 +    const float maxValue = (float)QuantumRange;
27      for( int r = 0; r < imImage.rows(); r++ ) {
28 -      const Magick::PixelPacket *pixels =
29 +      const Magick::Quantum *pixels =
30          imImage.getConstPixels( 0, r, imImage.columns(), 1 );
31  
32        for( int c = 0; c < imImage.columns(); c++ ) {
33 -        (*X)(pixInd) = (float)pixels[c].red / maxValue;
34 -        (*Y)(pixInd) = (float)pixels[c].green / maxValue;
35 -        (*Z)(pixInd) = (float)pixels[c].blue / maxValue;
36 +        (*X)(pixInd) = (float)MagickCore::GetPixelRed(imImage.image(), pixels) / maxValue;
37 +        (*Y)(pixInd) = (float)MagickCore::GetPixelGreen(imImage.image(), pixels) / maxValue;
38 +        (*Z)(pixInd) = (float)MagickCore::GetPixelBlue(imImage.image(), pixels) / maxValue;
39          if( alpha != NULL )
40 -          (*alpha)(pixInd) = (float)pixels[c].opacity / maxValue;
41 +          (*alpha)(pixInd) = (float)MagickCore::GetPixelAlpha(imImage.image(), pixels) / maxValue;
42          pixInd++;
43 +       pixels += GetPixelChannels(imImage.image());
44        } 
45      }    
46  
This page took 0.080367 seconds and 3 git commands to generate.