ffi-gmagick 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ffi/gmagick.rb +46 -42
- data/lib/ffi/gmagick/image.rb +16 -3
- data/lib/ffi/gmagick/version.rb +1 -1
- data/test/image_test.rb +6 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d021e49973e9b3b88904013da89cb69fd19cc07c
|
|
4
|
+
data.tar.gz: 7e4323801410af1914a3bea2a26b0603b46108f1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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,
|
|
96
|
-
attach_function :DestroyMagickWand,
|
|
97
|
-
attach_function :CloneMagickWand,
|
|
98
|
-
|
|
99
|
-
attach_function :MagickReadImage,
|
|
100
|
-
attach_function :MagickReadImageBlob,
|
|
101
|
-
attach_function :MagickWriteImage,
|
|
102
|
-
attach_function :MagickWriteImageBlob,
|
|
103
|
-
|
|
104
|
-
attach_function :MagickGetImageFormat,
|
|
105
|
-
attach_function :MagickSetImageFormat,
|
|
106
|
-
attach_function :MagickGetImageHeight,
|
|
107
|
-
attach_function :MagickGetImageWidth,
|
|
108
|
-
attach_function :MagickGetImageType,
|
|
109
|
-
attach_function :MagickSetImageType,
|
|
110
|
-
attach_function :
|
|
111
|
-
attach_function :
|
|
112
|
-
attach_function :
|
|
113
|
-
attach_function :
|
|
114
|
-
attach_function :
|
|
115
|
-
attach_function :
|
|
116
|
-
|
|
117
|
-
attach_function :
|
|
118
|
-
|
|
119
|
-
attach_function :
|
|
120
|
-
attach_function :
|
|
121
|
-
attach_function :
|
|
122
|
-
attach_function :
|
|
123
|
-
attach_function :
|
|
124
|
-
attach_function :
|
|
125
|
-
attach_function :
|
|
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 :
|
|
130
|
-
|
|
131
|
-
attach_function :
|
|
132
|
-
attach_function :
|
|
133
|
-
attach_function :
|
|
134
|
-
attach_function :
|
|
135
|
-
|
|
136
|
-
attach_function :
|
|
137
|
-
|
|
138
|
-
attach_function :
|
|
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
|
data/lib/ffi/gmagick/image.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
163
|
-
|
|
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
|
data/lib/ffi/gmagick/version.rb
CHANGED
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
|
|
76
|
+
skip
|
|
72
77
|
@image.type = :TrueColorType
|
|
73
78
|
assert @image.valid?
|
|
74
79
|
assert_equal :TrueColorType, @image.type, "invalid type"
|