ffi-gmagick 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 58d0b05a2c371242a69b022d264cf83e2dc625e0
4
- data.tar.gz: 650e927e57e5b897d6b2402fad7d4b45bdbc87be
3
+ metadata.gz: d021e49973e9b3b88904013da89cb69fd19cc07c
4
+ data.tar.gz: 7e4323801410af1914a3bea2a26b0603b46108f1
5
5
  SHA512:
6
- metadata.gz: a454c083cddfc8d96002357ed2f08cc0adc347bf79950eec2c63583a5caf833b56fd61740765836b76f1e105bcf541298737f7b69b42c815e28de2fb3fe9f521
7
- data.tar.gz: f167e6d439eb4f746a0b9e7ce283ec9786e9566d341d55983e7f800462aefe747cbee9c49309fd305b85cdda7e558618578c9e476632e0b12417ff38722ca684
6
+ metadata.gz: f21683a974c30cc2d2c835ba374260392e04c9039ed28427969f83a2295c79b5e07218c985c8e9befe7a6aeaef06e9e8676645b6f8eaa8f7a9ca47a88dfa2552
7
+ data.tar.gz: 4e8a17c593eb94bb49f42503df9cae3e404ff46c8722ea8e2386d28f7f172f541531bdbb9209c51d6e7dea55bb6cb906998d8cb30c7b8b6bd93af002dd4d96f7
data/lib/ffi/gmagick.rb CHANGED
@@ -92,49 +92,53 @@ module FFI
92
92
  typedef :size_t, :length
93
93
 
94
94
 
95
- attach_function :NewMagickWand, [], :wand
96
- attach_function :DestroyMagickWand, [ :wand ], :void
97
- attach_function :CloneMagickWand, [ :wand ], :wand
98
-
99
- attach_function :MagickReadImage, [ :wand, :filename ], :magick_pass_fail
100
- attach_function :MagickReadImageBlob, [ :wand, :blob, :length ], :magick_pass_fail
101
- attach_function :MagickWriteImage, [ :wand, :filename ], :magick_pass_fail
102
- attach_function :MagickWriteImageBlob, [ :wand, :pointer ], :pointer
103
-
104
- attach_function :MagickGetImageFormat, [ :wand ], :string
105
- attach_function :MagickSetImageFormat, [ :wand, :format ], :uint
106
- attach_function :MagickGetImageHeight, [ :wand ], :ulong
107
- attach_function :MagickGetImageWidth, [ :wand ], :ulong
108
- attach_function :MagickGetImageType, [ :wand ], :image_type
109
- attach_function :MagickSetImageType, [ :wand, :image_type ], :magick_pass_fail
110
- attach_function :MagickGetImageAttribute, [ :wand, :string ], :string
111
- attach_function :MagickGetImageColorspace, [ :wand ], :colorspace
112
- attach_function :MagickSetImageColorspace, [ :wand, :colorspace ], :magick_pass_fail
113
- attach_function :MagickGetImageDepth, [ :wand ], :depth
114
- attach_function :MagickSetImageDepth, [ :wand, :depth ], :magick_pass_fail
115
- attach_function :MagickGetImageSize, [ :wand ], :ulong
116
-
117
- attach_function :MagickSetCompressionQuality, [ :wand, :quality ], :magick_pass_fail
118
- attach_function :MagickStripImage, [ :wand ], :magick_pass_fail
119
- attach_function :MagickUnsharpMaskImage, [ :wand, :radius, :sigma, :amount, :threshold ], :magick_pass_fail
120
- attach_function :MagickQuantizeImage, [ :wand, :number_colors, :colorspace, :tree_depth, :dither, :measure_error ], :magick_pass_fail
121
- attach_function :MagickNegateImageChannel, [ :wand, :channel_type, :gray ], :magick_pass_fail
122
- attach_function :MagickGammaImageChannel, [ :wand, :channel_type, :gamma ], :magick_pass_fail
123
- attach_function :MagickProfileImage, [ :wand, :name, :profile, :length], :magick_pass_fail
124
- attach_function :MagickGetImageProfile, [ :wand, :name, :profile ], :profile
125
- attach_function :MagickSetImageProfile, [ :wand, :name, :profile, :ulong ], :magick_pass_fail
95
+ attach_function :NewMagickWand, [], :wand
96
+ attach_function :DestroyMagickWand, [ :wand ], :void
97
+ attach_function :CloneMagickWand, [ :wand ], :wand
98
+
99
+ attach_function :MagickReadImage, [ :wand, :filename ], :magick_pass_fail
100
+ attach_function :MagickReadImageBlob, [ :wand, :blob, :length ], :magick_pass_fail
101
+ attach_function :MagickWriteImage, [ :wand, :filename ], :magick_pass_fail
102
+ attach_function :MagickWriteImageBlob, [ :wand, :pointer ], :pointer
103
+
104
+ attach_function :MagickGetImageFormat, [ :wand ], :string
105
+ attach_function :MagickSetImageFormat, [ :wand, :format ], :uint
106
+ attach_function :MagickGetImageHeight, [ :wand ], :ulong
107
+ attach_function :MagickGetImageWidth, [ :wand ], :ulong
108
+ attach_function :MagickGetImageType, [ :wand ], :image_type
109
+ attach_function :MagickSetImageType, [ :wand, :image_type ], :magick_pass_fail
110
+ attach_function :MagickGetImageSavedType, [ :wand ], :image_type
111
+ attach_function :MagickSetImageSavedType, [ :wand, :image_type ], :magick_pass_fail
112
+ attach_function :MagickGetImageAttribute, [ :wand, :string ], :string
113
+ attach_function :MagickGetImageColorspace, [ :wand ], :colorspace
114
+ attach_function :MagickSetImageColorspace, [ :wand, :colorspace ], :magick_pass_fail
115
+ attach_function :MagickGetImageDepth, [ :wand ], :depth
116
+ attach_function :MagickSetImageDepth, [ :wand, :depth ], :magick_pass_fail
117
+ attach_function :MagickGetImageSize, [ :wand ], :ulong
118
+
119
+ attach_function :MagickSetCompressionQuality, [ :wand, :quality ], :magick_pass_fail
120
+ attach_function :MagickStripImage, [ :wand ], :magick_pass_fail
121
+ attach_function :MagickUnsharpMaskImage, [ :wand, :radius, :sigma, :amount, :threshold ], :magick_pass_fail
122
+ attach_function :MagickQuantizeImage, [ :wand, :number_colors, :colorspace, :tree_depth, :dither, :measure_error ], :magick_pass_fail
123
+ attach_function :MagickNegateImageChannel, [ :wand, :channel_type, :gray ], :magick_pass_fail
124
+ attach_function :MagickGammaImageChannel, [ :wand, :channel_type, :gamma ], :magick_pass_fail
125
+ attach_function :MagickProfileImage, [ :wand, :name, :profile, :length], :magick_pass_fail
126
+ attach_function :MagickGetImageProfile, [ :wand, :name, :profile ], :profile
127
+ attach_function :MagickSetImageProfile, [ :wand, :name, :profile, :ulong ], :magick_pass_fail
126
128
  attach_function :MagickGetImageInterlaceScheme, [ :wand ], :interlace_type
127
129
  attach_function :MagickSetImageInterlaceScheme, [ :wand, :interlace_type ], :magick_pass_fail
128
-
129
- attach_function :MagickResizeImage, [ :wand, :columns, :rows, :filter_type, :blur ], :magick_pass_fail
130
- attach_function :MagickResampleImage, [ :wand, :x_resolution, :y_resolution, :filter_type, :blur ], :magick_pass_fail
131
- attach_function :MagickTransformImage, [ :wand, :crop, :geometry ], :wand
132
- attach_function :MagickScaleImage, [ :wand, :columns, :rows ], :magick_pass_fail
133
- attach_function :MagickCropImage, [ :wand, :width, :height, :x, :y ], :magick_pass_fail
134
- attach_function :MagickCompositeImage, [ :wand, :composite_wand, :composite_operator, :x, :y ], :magick_pass_fail
135
-
136
- attach_function :MagickGetConfigureInfo, [ :wand, :string ], :string
137
- attach_function :MagickGetVersion, [ :pointer ], :string
138
- attach_function :MagickGetCopyright, [], :string
130
+ attach_function :MagickSetInterlaceScheme, [ :wand, :interlace_type ], :magick_pass_fail
131
+ attach_function :MagickFlattenImages, [ :wand ], :wand
132
+
133
+ attach_function :MagickResizeImage, [ :wand, :columns, :rows, :filter_type, :blur ], :magick_pass_fail
134
+ attach_function :MagickResampleImage, [ :wand, :x_resolution, :y_resolution, :filter_type, :blur ], :magick_pass_fail
135
+ attach_function :MagickTransformImage, [ :wand, :crop, :geometry ], :wand
136
+ attach_function :MagickScaleImage, [ :wand, :columns, :rows ], :magick_pass_fail
137
+ attach_function :MagickCropImage, [ :wand, :width, :height, :x, :y ], :magick_pass_fail
138
+ attach_function :MagickCompositeImage, [ :wand, :composite_wand, :composite_operator, :x, :y ], :magick_pass_fail
139
+
140
+ attach_function :MagickGetConfigureInfo, [ :wand, :string ], :string
141
+ attach_function :MagickGetVersion, [ :pointer ], :string
142
+ attach_function :MagickGetCopyright, [], :string
139
143
  end
140
144
  end
@@ -113,12 +113,16 @@ module FFI
113
113
  # Return the image type
114
114
  def type
115
115
  FFI::GMagick.MagickGetImageType( @wand )
116
+ # FFI::GMagick.MagickGetImageSavedType( @wand )
116
117
  end
117
118
 
118
119
  # Set the image type to one of the valid
119
120
  # <a href="http://www.graphicsmagick.org/api/types.html#imagetype">image types</a>
120
121
  def type=(type)
121
- @status = FFI::GMagick.MagickSetImageType( @wand, type )
122
+ status = FFI::GMagick.MagickSetImageType( @wand, type )
123
+ status += FFI::GMagick.MagickSetImageSavedType( @wand, type )
124
+ raise "invalid image type" unless 2 == status
125
+ @status = 1
122
126
  end
123
127
 
124
128
  # Return the colorspace
@@ -159,8 +163,11 @@ module FFI
159
163
  # Set the interlace information to one of the valid
160
164
  # <a href="http://www.graphicsmagick.org/api/types.html#interlacetype">interlace types</a>.
161
165
  def interlace=(interlace)
162
- @status = FFI::GMagick.MagickSetImageInterlaceScheme( @wand, interlace )
163
- raise "invalid interlace type" unless 1 == status
166
+ # Apparently, you have to set *both* of these for it stick.
167
+ status = FFI::GMagick.MagickSetImageInterlaceScheme( @wand, interlace )
168
+ status += FFI::GMagick.MagickSetInterlaceScheme( @wand, interlace )
169
+ raise "invalid interlace type" unless 2 == status
170
+ @status = 1
164
171
  end
165
172
 
166
173
  # Strip the image of extra data (comments, profiles, etc.)
@@ -168,6 +175,12 @@ module FFI
168
175
  @status = FFI::GMagick.MagickStripImage( @wand )
169
176
  end
170
177
 
178
+ # Merge existing layers into a single flattened image
179
+ def flatten
180
+ local_wand = FFI::GMagick.MagickFlattenImages( @wand )
181
+ return FFI::GMagick::Image.new(local_wand)
182
+ end
183
+
171
184
  def quality=(quality)
172
185
  @status = FFI::GMagick.MagickSetCompressionQuality( @wand, quality )
173
186
  end
@@ -1,5 +1,5 @@
1
1
  module FFI
2
2
  module GMagick
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
data/test/image_test.rb CHANGED
@@ -67,8 +67,13 @@ class ImageTest < MiniTest::Unit::TestCase
67
67
  assert_equal :TrueColorMatteType, @image.type, "invalid type"
68
68
  end
69
69
 
70
+ def test_set_interlace
71
+ @image.interlace = :PlaneInterlace
72
+ assert_equal :PlaneInterlace, @image.interlace, "invalid interlace"
73
+ end
74
+
70
75
  def test_set_type
71
- skip # not yet working
76
+ skip
72
77
  @image.type = :TrueColorType
73
78
  assert @image.valid?
74
79
  assert_equal :TrueColorType, @image.type, "invalid type"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-gmagick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Hurt