ffi-gmagick 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ffi-gmagick.gemspec +2 -4
- data/lib/ffi/gmagick/enum.rb +99 -0
- data/lib/ffi/gmagick/image.rb +117 -0
- data/lib/ffi/gmagick/pixel.rb +43 -0
- data/lib/ffi/gmagick/struct.rb +17 -0
- data/lib/ffi/gmagick/version.rb +1 -1
- data/lib/ffi/gmagick.rb +3 -118
- metadata +15 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59f0ce1781135612f0a2b4e5999184c577f6888e
|
4
|
+
data.tar.gz: a48984e425cf1f7fff85d7cb518b55c3bdfed9eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e78df4218cee2fb2f27489910d692e161821c1d286dc1eb3bddcbc74ee72fb1fac2403432d8af4dafd916b69ed496d752770ad902501d6039b4da4bb0c1d5f2
|
7
|
+
data.tar.gz: 9b16160e80a0269fa9f4f632390765a6539ce90c0abbac76f038dad754e29fa1d99588821a158ccdcd677f525ab4de00cb0e28fb5644176b419e64c0b3b251fd
|
data/ffi-gmagick.gemspec
CHANGED
@@ -23,9 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
|
24
24
|
spec.requirements << 'libGraphicsMagick, v1.3.18'
|
25
25
|
|
26
|
-
spec.add_runtime_dependency 'ffi', '~> 1.9'
|
27
|
-
|
26
|
+
spec.add_runtime_dependency 'ffi', '~> 1.9', '~> 1.9'
|
28
27
|
spec.add_development_dependency "bundler", "~> 1.3"
|
29
|
-
spec.add_development_dependency "rake"
|
30
|
-
spec.add_development_dependency 'ffi', '~> 1.9'
|
28
|
+
spec.add_development_dependency "rake", "~> 0"
|
31
29
|
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
module FFI
|
2
|
+
module GMagick
|
3
|
+
|
4
|
+
enum :interlace_type, [:UndefinedInterlace, :NoInterlace, :LineInterlace, :PlaneInterlace, :PartitionInterlace]
|
5
|
+
|
6
|
+
enum :filter_type, [:UndefinedFilter, :PointFilter, :BoxFilter, :TriangleFilter,
|
7
|
+
:HermiteFilter, :HanningFilter, :HammingFilter, :BlackmanFilter,
|
8
|
+
:GaussianFilter, :QuadraticFilter, :CubicFilter, :CatromFilter,
|
9
|
+
:MitchellFilter, :LanczosFilter, :BesselFilter, :SincFilter]
|
10
|
+
enum :channel_type, [:UndefinedChannel, :RedChannel, :CyanChannel, :GreenChannel, :MagentaChannel,
|
11
|
+
:BlueChannel, :YellowChannel, :OpacityChannel, :BlackChannel, :MatteChannel,
|
12
|
+
:AllChannels, :GrayChannel]
|
13
|
+
|
14
|
+
enum :image_type, [:UndefinedType, :BilevelType, :GrayscaleType, :PaletteType, :PaletteMatteType,
|
15
|
+
:TrueColorType, :TrueColorMatteType, :ColorSeparationType]
|
16
|
+
|
17
|
+
enum :colorspace, [:UndefinedColorspace, :RGBColorspace, :GRAYColorspace,
|
18
|
+
:TransparentColorspace, :OHTAColorspace, :XYZColorspace, :YCCColorspace,
|
19
|
+
:YIQColorspace, :YPbPrColorspace, :YUVColorspace, :CMYKColorspace,
|
20
|
+
:sRGBColorspace, :HSLColorspace, :HWBColorspace, :LABColorspace,
|
21
|
+
:CineonLogRGBColorspace, :Rec601LumaColorspace, :Rec601YCbCrColorspace,
|
22
|
+
:Rec709LumaColorspace, :Rec709YCbCrColorspace]
|
23
|
+
|
24
|
+
enum :gravity_type, [:ForgetGravity, :NorthWestGravity, :NorthGravity, :NorthEastGravity,
|
25
|
+
:WestGravity, :CenterGravity, :EastGravity, :SouthWestGravity,
|
26
|
+
:SouthGravity, :SouthEastGravity]
|
27
|
+
|
28
|
+
enum :composite_operator, [:UndefinedCompositeOp, :OverCompositeOp, :InCompositeOp, :OutCompositeOp,
|
29
|
+
:AtopCompositeOp, :XorCompositeOp, :PlusCompositeOp, :MinusCompositeOp,
|
30
|
+
:AddCompositeOp, :SubtractCompositeOp, :DifferenceCompositeOp, :BumpmapCompositeOp,
|
31
|
+
:CopyCompositeOp, :CopyRedCompositeOp, :CopyGreenCompositeOp, :CopyBlueCompositeOp,
|
32
|
+
:CopyOpacityCompositeOp, :ClearCompositeOp, :DissolveCompositeOp, :DisplaceCompositeOp,
|
33
|
+
:ModulateCompositeOp, :ThresholdCompositeOp, :NoCompositeOp, :DarkenCompositeOp,
|
34
|
+
:LightenCompositeOp, :HueCompositeOp, :SaturateCompositeOp, :ColorizeCompositeOp,
|
35
|
+
:LuminizeCompositeOp, :ScreenCompositeOp, :OverlayCompositeOp, :CopyCyanCompositeOp,
|
36
|
+
:CopyMagentaCompositeOp, :CopyYellowCompositeOp, :CopyBlackCompositeOp, :DivideCompositeOp]
|
37
|
+
|
38
|
+
enum :exception_type,
|
39
|
+
[:UndefinedException, 300,
|
40
|
+
:WarningException, 300,
|
41
|
+
:ResourceLimitWarning, 300,
|
42
|
+
:TypeWarning, 305,
|
43
|
+
:OptionWarning, 310,
|
44
|
+
:DelegateWarning, 315,
|
45
|
+
:MissingDelegateWarning, 320,
|
46
|
+
:CorruptImageWarning, 325,
|
47
|
+
:FileOpenWarning, 330,
|
48
|
+
:BlobWarning, 335,
|
49
|
+
:StreamWarning, 340,
|
50
|
+
:CacheWarning, 345,
|
51
|
+
:CoderWarning, 350,
|
52
|
+
:ModuleWarning, 355,
|
53
|
+
:DrawWarning, 360,
|
54
|
+
:ImageWarning, 365,
|
55
|
+
:XServerWarning, 380,
|
56
|
+
:MonitorWarning, 385,
|
57
|
+
:RegistryWarning, 390,
|
58
|
+
:ConfigureWarning, 395,
|
59
|
+
:ErrorException, 400,
|
60
|
+
:ResourceLimitError, 400,
|
61
|
+
:TypeError, 405,
|
62
|
+
:OptionError, 410,
|
63
|
+
:DelegateError, 415,
|
64
|
+
:MissingDelegateError, 420,
|
65
|
+
:CorruptImageError, 425,
|
66
|
+
:FileOpenError, 430,
|
67
|
+
:BlobError, 435,
|
68
|
+
:StreamError, 440,
|
69
|
+
:CacheError, 445,
|
70
|
+
:CoderError, 450,
|
71
|
+
:ModuleError, 455,
|
72
|
+
:DrawError, 460,
|
73
|
+
:ImageError, 465,
|
74
|
+
:XServerError, 480,
|
75
|
+
:MonitorError, 485,
|
76
|
+
:RegistryError, 490,
|
77
|
+
:ConfigureError, 495,
|
78
|
+
:FatalErrorException, 700,
|
79
|
+
:ResourceLimitFatalError, 700,
|
80
|
+
:TypeFatalError, 705,
|
81
|
+
:OptionFatalError, 710,
|
82
|
+
:DelegateFatalError, 715,
|
83
|
+
:MissingDelegateFatalError, 720,
|
84
|
+
:CorruptImageFatalError, 725,
|
85
|
+
:FileOpenFatalError, 730,
|
86
|
+
:BlobFatalError, 735,
|
87
|
+
:StreamFatalError, 740,
|
88
|
+
:CacheFatalError, 745,
|
89
|
+
:CoderFatalError, 750,
|
90
|
+
:ModuleFatalError, 755,
|
91
|
+
:DrawFatalError, 760,
|
92
|
+
:ImageFatalError, 765,
|
93
|
+
:XServerFatalError, 780,
|
94
|
+
:MonitorFatalError, 785,
|
95
|
+
:RegistryFatalError, 790,
|
96
|
+
:ConfigureFatalError, 795]
|
97
|
+
|
98
|
+
end
|
99
|
+
end
|
data/lib/ffi/gmagick/image.rb
CHANGED
@@ -1,6 +1,92 @@
|
|
1
1
|
module FFI
|
2
2
|
module GMagick
|
3
|
+
typedef :pointer, :wand
|
4
|
+
typedef :pointer, :composite_wand
|
5
|
+
typedef :pointer, :blob
|
6
|
+
typedef :pointer, :profile
|
7
|
+
typedef :string, :name
|
8
|
+
typedef :string, :filename
|
9
|
+
typedef :string, :format
|
10
|
+
typedef :string, :geometry
|
11
|
+
typedef :string, :crop
|
12
|
+
typedef :uint, :magick_pass_fail
|
13
|
+
typedef :uint, :dither
|
14
|
+
typedef :uint, :measure_error
|
15
|
+
typedef :uint, :gray
|
16
|
+
typedef :uint, :dither
|
17
|
+
typedef :ulong, :columns
|
18
|
+
typedef :ulong, :rows
|
19
|
+
typedef :ulong, :depth
|
20
|
+
typedef :ulong, :quality
|
21
|
+
typedef :ulong, :width
|
22
|
+
typedef :ulong, :height
|
23
|
+
typedef :ulong, :number_colors
|
24
|
+
typedef :ulong, :tree_depth
|
25
|
+
typedef :long, :x
|
26
|
+
typedef :long, :y
|
27
|
+
typedef :double, :blur
|
28
|
+
typedef :double, :radius
|
29
|
+
typedef :double, :sigma
|
30
|
+
typedef :double, :gamma
|
31
|
+
typedef :double, :amount
|
32
|
+
typedef :double, :threshold
|
33
|
+
typedef :double, :x_resolution
|
34
|
+
typedef :double, :y_resolution
|
35
|
+
typedef :size_t, :length
|
36
|
+
|
37
|
+
attach_function :NewMagickWand, [], :wand
|
38
|
+
attach_function :DestroyMagickWand, [ :wand ], :void
|
39
|
+
attach_function :CloneMagickWand, [ :wand ], :wand
|
40
|
+
|
41
|
+
attach_function :MagickReadImage, [ :wand, :filename ], :magick_pass_fail
|
42
|
+
attach_function :MagickReadImageBlob, [ :wand, :blob, :length ], :magick_pass_fail
|
43
|
+
attach_function :MagickWriteImage, [ :wand, :filename ], :magick_pass_fail
|
44
|
+
attach_function :MagickWriteImageBlob, [ :wand, :pointer ], :pointer
|
45
|
+
|
46
|
+
attach_function :MagickGetImageFormat, [ :wand ], :string
|
47
|
+
attach_function :MagickSetImageFormat, [ :wand, :format ], :uint
|
48
|
+
attach_function :MagickGetImageHeight, [ :wand ], :ulong
|
49
|
+
attach_function :MagickGetImageWidth, [ :wand ], :ulong
|
50
|
+
attach_function :MagickGetImageType, [ :wand ], :image_type
|
51
|
+
attach_function :MagickSetImageType, [ :wand, :image_type ], :magick_pass_fail
|
52
|
+
attach_function :MagickGetImageSavedType, [ :wand ], :image_type
|
53
|
+
attach_function :MagickSetImageSavedType, [ :wand, :image_type ], :magick_pass_fail
|
54
|
+
attach_function :MagickGetImageAttribute, [ :wand, :string ], :string
|
55
|
+
attach_function :MagickGetImageColorspace, [ :wand ], :colorspace
|
56
|
+
attach_function :MagickSetImageColorspace, [ :wand, :colorspace ], :magick_pass_fail
|
57
|
+
attach_function :MagickGetImageDepth, [ :wand ], :depth
|
58
|
+
attach_function :MagickSetImageDepth, [ :wand, :depth ], :magick_pass_fail
|
59
|
+
attach_function :MagickGetImageSize, [ :wand ], :ulong
|
60
|
+
|
61
|
+
attach_function :MagickSetCompressionQuality, [ :wand, :quality ], :magick_pass_fail
|
62
|
+
attach_function :MagickStripImage, [ :wand ], :magick_pass_fail
|
63
|
+
attach_function :MagickUnsharpMaskImage, [ :wand, :radius, :sigma, :amount, :threshold ], :magick_pass_fail
|
64
|
+
attach_function :MagickQuantizeImage, [ :wand, :number_colors, :colorspace, :tree_depth, :dither, :measure_error ], :magick_pass_fail
|
65
|
+
attach_function :MagickNegateImageChannel, [ :wand, :channel_type, :gray ], :magick_pass_fail
|
66
|
+
attach_function :MagickGammaImageChannel, [ :wand, :channel_type, :gamma ], :magick_pass_fail
|
67
|
+
attach_function :MagickProfileImage, [ :wand, :name, :profile, :length], :magick_pass_fail
|
68
|
+
attach_function :MagickGetImageProfile, [ :wand, :name, :profile ], :profile
|
69
|
+
attach_function :MagickSetImageProfile, [ :wand, :name, :profile, :ulong ], :magick_pass_fail
|
70
|
+
attach_function :MagickGetImageInterlaceScheme, [ :wand ], :interlace_type
|
71
|
+
attach_function :MagickSetImageInterlaceScheme, [ :wand, :interlace_type ], :magick_pass_fail
|
72
|
+
attach_function :MagickSetInterlaceScheme, [ :wand, :interlace_type ], :magick_pass_fail
|
73
|
+
attach_function :MagickFlattenImages, [ :wand ], :wand
|
74
|
+
attach_function :MagickMapImage, [ :wand, :wand, :dither ], :magick_pass_fail
|
75
|
+
attach_function :MagickGetImageHistogram, [ :wand, :pointer ], :pointer
|
76
|
+
|
77
|
+
attach_function :MagickResizeImage, [ :wand, :columns, :rows, :filter_type, :blur ], :magick_pass_fail
|
78
|
+
attach_function :MagickResampleImage, [ :wand, :x_resolution, :y_resolution, :filter_type, :blur ], :magick_pass_fail
|
79
|
+
attach_function :MagickTransformImage, [ :wand, :crop, :geometry ], :wand
|
80
|
+
attach_function :MagickScaleImage, [ :wand, :columns, :rows ], :magick_pass_fail
|
81
|
+
attach_function :MagickCropImage, [ :wand, :width, :height, :x, :y ], :magick_pass_fail
|
82
|
+
attach_function :MagickCompositeImage, [ :wand, :composite_wand, :composite_operator, :x, :y ], :magick_pass_fail
|
83
|
+
|
84
|
+
attach_function :MagickGetConfigureInfo, [ :wand, :string ], :string
|
85
|
+
attach_function :MagickGetVersion, [ :pointer ], :string
|
86
|
+
attach_function :MagickGetCopyright, [], :string
|
87
|
+
|
3
88
|
class Image
|
89
|
+
|
4
90
|
# This is a convenience class that takes care of most of the messy work
|
5
91
|
# of dealing with the raw FFI::GMagick interface.
|
6
92
|
#
|
@@ -181,6 +267,37 @@ module FFI
|
|
181
267
|
return FFI::GMagick::Image.new(local_wand)
|
182
268
|
end
|
183
269
|
|
270
|
+
# Get a simplified histogram for this image.
|
271
|
+
def get_histogram(web_safe=true)
|
272
|
+
new_wand = FFI::GMagick.CloneMagickWand( @wand )
|
273
|
+
|
274
|
+
# "WebSafe" colors are built around the original 216 colors defined by Netscape
|
275
|
+
if web_safe
|
276
|
+
netscape = FFI::GMagick.NewMagickWand
|
277
|
+
FFI::GMagick.MagickReadImage(netscape, 'NETSCAPE:')
|
278
|
+
FFI::GMagick.MagickMapImage( new_wand, netscape, 1 )
|
279
|
+
FFI::GMagick.DestroyMagickWand( netscape )
|
280
|
+
end
|
281
|
+
|
282
|
+
histogram = {}
|
283
|
+
FFI::MemoryPointer.new(:ulong, 1) do |max_colors|
|
284
|
+
pointer = FFI::GMagick.MagickGetImageHistogram( new_wand, max_colors )
|
285
|
+
number_of_colors = max_colors.read_int
|
286
|
+
|
287
|
+
pixel_wands = pointer.read_array_of_pointer(number_of_colors)
|
288
|
+
pixel_wands.each do |wand|
|
289
|
+
pixel = FFI::GMagick::Pixel.new(wand)
|
290
|
+
hex_color = "#%02X%02X%02X" % pixel.get_color.split(",").map(&:to_i)
|
291
|
+
color_count = pixel.get_color_count
|
292
|
+
histogram[hex_color] = color_count
|
293
|
+
end
|
294
|
+
end
|
295
|
+
FFI::GMagick.DestroyMagickWand( new_wand )
|
296
|
+
|
297
|
+
return histogram
|
298
|
+
end
|
299
|
+
|
300
|
+
# Change the quality (compression) of the image
|
184
301
|
def quality=(quality)
|
185
302
|
@status = FFI::GMagick.MagickSetCompressionQuality( @wand, quality )
|
186
303
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module FFI
|
2
|
+
module GMagick
|
3
|
+
# Define types used in Pixel Wand
|
4
|
+
typedef :pointer, :wand
|
5
|
+
typedef :ulong, :number_colors
|
6
|
+
typedef :uint, :magick_pass_fail
|
7
|
+
|
8
|
+
# Define C functions in the Pixel Wand library
|
9
|
+
attach_function :NewPixelWand, [], PixelWand.ptr
|
10
|
+
attach_function :NewPixelWands, [ :number_colors ], PixelWand.ptr
|
11
|
+
attach_function :ClonePixelWand, [ :wand ], PixelWand.ptr
|
12
|
+
attach_function :DestroyPixelWand, [ PixelWand.ptr ], :magick_pass_fail
|
13
|
+
attach_function :PixelGetColorAsString, [ :wand ], :string
|
14
|
+
attach_function :PixelGetColorCount, [ :wand ], :ulong
|
15
|
+
|
16
|
+
class Pixel
|
17
|
+
attr_accessor :wand, :status
|
18
|
+
|
19
|
+
def initialize(old_wand=nil)
|
20
|
+
if old_wand
|
21
|
+
@wand = FFI::GMagick.ClonePixelWand( old_wand )
|
22
|
+
else
|
23
|
+
@wand ||= FFI::GMagick.NewPixelWand
|
24
|
+
end
|
25
|
+
@status = 1
|
26
|
+
end
|
27
|
+
|
28
|
+
# Free the memory allocated to this object
|
29
|
+
def destroy!
|
30
|
+
FFI::GMagick.DestroyPixelWand( @wand )
|
31
|
+
@status = 0
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_color
|
35
|
+
return FFI::GMagick.PixelGetColorAsString( @wand )
|
36
|
+
end
|
37
|
+
|
38
|
+
def get_color_count
|
39
|
+
return FFI::GMagick.PixelGetColorCount( @wand )
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/ffi/gmagick/struct.rb
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
module FFI
|
2
2
|
module GMagick
|
3
|
+
require "ffi/gmagick/enum"
|
4
|
+
|
5
|
+
class ExceptionInfo < FFI::Struct
|
6
|
+
layout :reason, :string,
|
7
|
+
:description, :string,
|
8
|
+
:severity, :exception_type,
|
9
|
+
:signature, :ulong
|
10
|
+
end
|
11
|
+
|
3
12
|
class PixelPacket < FFI::Struct
|
4
13
|
layout :red, :uint,
|
5
14
|
:green, :uint,
|
@@ -7,6 +16,14 @@ module FFI
|
|
7
16
|
:opacity, :uint
|
8
17
|
end
|
9
18
|
|
19
|
+
class PixelWand < FFI::Struct
|
20
|
+
layout :exception, ExceptionInfo.by_ref,
|
21
|
+
:colorspace, :colorspace,
|
22
|
+
:matte, :uint,
|
23
|
+
:pixel, PixelPacket.by_ref,
|
24
|
+
:count, :ulong
|
25
|
+
end
|
26
|
+
|
10
27
|
class ImageInfo < FFI::Struct
|
11
28
|
layout :adjoin, :uint,
|
12
29
|
:antialias, :uint,
|
data/lib/ffi/gmagick/version.rb
CHANGED
data/lib/ffi/gmagick.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require "ffi"
|
2
|
-
require "ffi/gmagick/image"
|
3
2
|
require "ffi/gmagick/version"
|
4
3
|
|
5
4
|
module FFI
|
@@ -23,122 +22,8 @@ module FFI
|
|
23
22
|
ffi_lib "GraphicsMagickWand" if RUBY_PLATFORM =~ /darwin/
|
24
23
|
ffi_lib "GraphicsMagickWand.so.2" if RUBY_PLATFORM =~ /linux/
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
:HermiteFilter, :HanningFilter, :HammingFilter, :BlackmanFilter,
|
30
|
-
:GaussianFilter, :QuadraticFilter, :CubicFilter, :CatromFilter,
|
31
|
-
:MitchellFilter, :LanczosFilter, :BesselFilter, :SincFilter]
|
32
|
-
enum :channel_type, [:UndefinedChannel, :RedChannel, :CyanChannel, :GreenChannel, :MagentaChannel,
|
33
|
-
:BlueChannel, :YellowChannel, :OpacityChannel, :BlackChannel, :MatteChannel,
|
34
|
-
:AllChannels, :GrayChannel]
|
35
|
-
|
36
|
-
enum :image_type, [:UndefinedType, :BilevelType, :GrayscaleType, :PaletteType, :PaletteMatteType,
|
37
|
-
:TrueColorType, :TrueColorMatteType, :ColorSeparationType]
|
38
|
-
|
39
|
-
enum :colorspace, [:UndefinedColorspace, :RGBColorspace, :GRAYColorspace,
|
40
|
-
:TransparentColorspace, :OHTAColorspace, :XYZColorspace, :YCCColorspace,
|
41
|
-
:YIQColorspace, :YPbPrColorspace, :YUVColorspace, :CMYKColorspace,
|
42
|
-
:sRGBColorspace, :HSLColorspace, :HWBColorspace, :LABColorspace,
|
43
|
-
:CineonLogRGBColorspace, :Rec601LumaColorspace, :Rec601YCbCrColorspace,
|
44
|
-
:Rec709LumaColorspace, :Rec709YCbCrColorspace]
|
45
|
-
|
46
|
-
enum :gravity_type, [:ForgetGravity, :NorthWestGravity, :NorthGravity, :NorthEastGravity,
|
47
|
-
:WestGravity, :CenterGravity, :EastGravity, :SouthWestGravity,
|
48
|
-
:SouthGravity, :SouthEastGravity]
|
49
|
-
|
50
|
-
enum :composite_operator, [:UndefinedCompositeOp, :OverCompositeOp, :InCompositeOp, :OutCompositeOp,
|
51
|
-
:AtopCompositeOp, :XorCompositeOp, :PlusCompositeOp, :MinusCompositeOp,
|
52
|
-
:AddCompositeOp, :SubtractCompositeOp, :DifferenceCompositeOp, :BumpmapCompositeOp,
|
53
|
-
:CopyCompositeOp, :CopyRedCompositeOp, :CopyGreenCompositeOp, :CopyBlueCompositeOp,
|
54
|
-
:CopyOpacityCompositeOp, :ClearCompositeOp, :DissolveCompositeOp, :DisplaceCompositeOp,
|
55
|
-
:ModulateCompositeOp, :ThresholdCompositeOp, :NoCompositeOp, :DarkenCompositeOp,
|
56
|
-
:LightenCompositeOp, :HueCompositeOp, :SaturateCompositeOp, :ColorizeCompositeOp,
|
57
|
-
:LuminizeCompositeOp, :ScreenCompositeOp, :OverlayCompositeOp, :CopyCyanCompositeOp,
|
58
|
-
:CopyMagentaCompositeOp, :CopyYellowCompositeOp, :CopyBlackCompositeOp, :DivideCompositeOp]
|
59
|
-
|
60
|
-
|
61
|
-
typedef :pointer, :wand
|
62
|
-
typedef :pointer, :composite_wand
|
63
|
-
typedef :pointer, :blob
|
64
|
-
typedef :pointer, :profile
|
65
|
-
typedef :string, :name
|
66
|
-
typedef :string, :filename
|
67
|
-
typedef :string, :format
|
68
|
-
typedef :string, :geometry
|
69
|
-
typedef :string, :crop
|
70
|
-
typedef :uint, :magick_pass_fail
|
71
|
-
typedef :uint, :dither
|
72
|
-
typedef :uint, :measure_error
|
73
|
-
typedef :uint, :gray
|
74
|
-
typedef :ulong, :columns
|
75
|
-
typedef :ulong, :rows
|
76
|
-
typedef :ulong, :depth
|
77
|
-
typedef :ulong, :quality
|
78
|
-
typedef :ulong, :width
|
79
|
-
typedef :ulong, :height
|
80
|
-
typedef :ulong, :number_colors
|
81
|
-
typedef :ulong, :tree_depth
|
82
|
-
typedef :long, :x
|
83
|
-
typedef :long, :y
|
84
|
-
typedef :double, :blur
|
85
|
-
typedef :double, :radius
|
86
|
-
typedef :double, :sigma
|
87
|
-
typedef :double, :gamma
|
88
|
-
typedef :double, :amount
|
89
|
-
typedef :double, :threshold
|
90
|
-
typedef :double, :x_resolution
|
91
|
-
typedef :double, :y_resolution
|
92
|
-
typedef :size_t, :length
|
93
|
-
|
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 :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
|
128
|
-
attach_function :MagickGetImageInterlaceScheme, [ :wand ], :interlace_type
|
129
|
-
attach_function :MagickSetImageInterlaceScheme, [ :wand, :interlace_type ], :magick_pass_fail
|
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
|
25
|
+
require "ffi/gmagick/struct"
|
26
|
+
require "ffi/gmagick/image"
|
27
|
+
require "ffi/gmagick/pixel"
|
143
28
|
end
|
144
29
|
end
|
metadata
CHANGED
@@ -1,71 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi-gmagick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Hurt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.9'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.9'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: ffi
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.9'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ~>
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '1.9'
|
69
55
|
description: |-
|
70
56
|
This is not a simple 'Ruby'-like implementation. It is more of a
|
71
57
|
raw 'C' implementation. As such, it may be a bit more difficult to
|
@@ -77,15 +63,17 @@ executables: []
|
|
77
63
|
extensions: []
|
78
64
|
extra_rdoc_files: []
|
79
65
|
files:
|
80
|
-
- .gitignore
|
81
|
-
- .travis.yml
|
66
|
+
- ".gitignore"
|
67
|
+
- ".travis.yml"
|
82
68
|
- Gemfile
|
83
69
|
- LICENSE.txt
|
84
70
|
- README.md
|
85
71
|
- Rakefile
|
86
72
|
- ffi-gmagick.gemspec
|
87
73
|
- lib/ffi/gmagick.rb
|
74
|
+
- lib/ffi/gmagick/enum.rb
|
88
75
|
- lib/ffi/gmagick/image.rb
|
76
|
+
- lib/ffi/gmagick/pixel.rb
|
89
77
|
- lib/ffi/gmagick/struct.rb
|
90
78
|
- lib/ffi/gmagick/version.rb
|
91
79
|
- test/image_test.rb
|
@@ -100,18 +88,18 @@ require_paths:
|
|
100
88
|
- lib
|
101
89
|
required_ruby_version: !ruby/object:Gem::Requirement
|
102
90
|
requirements:
|
103
|
-
- -
|
91
|
+
- - ">="
|
104
92
|
- !ruby/object:Gem::Version
|
105
93
|
version: '0'
|
106
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
95
|
requirements:
|
108
|
-
- -
|
96
|
+
- - ">="
|
109
97
|
- !ruby/object:Gem::Version
|
110
98
|
version: '0'
|
111
99
|
requirements:
|
112
100
|
- libGraphicsMagick, v1.3.18
|
113
101
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.1
|
102
|
+
rubygems_version: 2.2.0.rc.1
|
115
103
|
signing_key:
|
116
104
|
specification_version: 4
|
117
105
|
summary: Use the C GraphicsMagick bindings to provide a Ruby interface
|