ruby-vips 2.0.10 → 2.0.11
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/.travis.yml +1 -0
- data/CHANGELOG.md +5 -0
- data/VERSION +1 -1
- data/lib/vips.rb +4 -0
- data/lib/vips/image.rb +33 -2
- data/lib/vips/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0c1cc6cf18a1a7bb3260070b968c19289e01bfd
|
4
|
+
data.tar.gz: d76e0a16f34f6ef7ea347029c0a9b781d3d96a81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9176ae611ca930ba60f1656cef1af41a8b0c9a056cbbdf12d4a99087f3cd219395d47caeec02c95ac03a398a43c846cf484190364db750f2819fc9ec77ec3c3
|
7
|
+
data.tar.gz: a43fd7d898961b8d5b94379e76a3c668c80b32200c2bafdbb48d5696da5d1c181adbfffb8ced1bd210303d2e377ce2f7fcd2aee3ef06ad12cdfebffedbdd8798
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.11
|
data/lib/vips.rb
CHANGED
@@ -134,10 +134,14 @@ module GObject
|
|
134
134
|
typedef :uint32, :GType
|
135
135
|
end
|
136
136
|
|
137
|
+
attach_function :g_type_init, [], :void
|
137
138
|
attach_function :g_type_name, [:GType], :string
|
138
139
|
attach_function :g_type_from_name, [:string], :GType
|
139
140
|
attach_function :g_type_fundamental, [:GType], :GType
|
140
141
|
|
142
|
+
# glib before 2.36 needed this, does nothing in current glib
|
143
|
+
g_type_init
|
144
|
+
|
141
145
|
# look up some common gtypes
|
142
146
|
GBOOL_TYPE = g_type_from_name "gboolean"
|
143
147
|
GINT_TYPE = g_type_from_name "gint"
|
data/lib/vips/image.rb
CHANGED
@@ -35,7 +35,13 @@ module Vips
|
|
35
35
|
rescue FFI::NotFoundError
|
36
36
|
end
|
37
37
|
|
38
|
-
|
38
|
+
# vips_addalpha was added in libvips 8.6
|
39
|
+
if Vips::at_least_libvips?(8, 6)
|
40
|
+
attach_function :vips_addalpha, [:pointer, :pointer, :varargs], :int
|
41
|
+
end
|
42
|
+
attach_function :vips_image_hasalpha, [:pointer], :int
|
43
|
+
|
44
|
+
attach_function :vips_image_set,
|
39
45
|
[:pointer, :string, GObject::GValue.ptr], :void
|
40
46
|
attach_function :vips_image_remove, [:pointer, :string], :void
|
41
47
|
|
@@ -74,7 +80,11 @@ module Vips
|
|
74
80
|
|
75
81
|
end
|
76
82
|
|
77
|
-
|
83
|
+
class GenericPtr < FFI::Struct
|
84
|
+
layout :value, :pointer
|
85
|
+
end
|
86
|
+
|
87
|
+
# handy for overloads ... want to be able to apply a function to an
|
78
88
|
# array or to a scalar
|
79
89
|
def self.smap x, &block
|
80
90
|
x.is_a?(Array) ? x.map {|y| smap(y, &block)} : block.(x)
|
@@ -692,6 +702,27 @@ module Vips
|
|
692
702
|
[width, height]
|
693
703
|
end
|
694
704
|
|
705
|
+
# Detect if image has an alpha channel
|
706
|
+
#
|
707
|
+
# @return [Boolean] true if image has an alpha channel.
|
708
|
+
def has_alpha?
|
709
|
+
return Vips::vips_image_hasalpha(self) != 0
|
710
|
+
end
|
711
|
+
|
712
|
+
# vips_addalpha was added in libvips 8.6
|
713
|
+
if Vips::at_least_libvips?(8, 6)
|
714
|
+
# Append an alpha channel to an image.
|
715
|
+
#
|
716
|
+
# @return [Image] new image
|
717
|
+
def add_alpha
|
718
|
+
ptr = GenericPtr.new
|
719
|
+
result = Vips::vips_addalpha self, ptr
|
720
|
+
raise Vips::Error if result != 0
|
721
|
+
|
722
|
+
Vips::Image.new ptr[:value]
|
723
|
+
end
|
724
|
+
end
|
725
|
+
|
695
726
|
# Copy an image to a memory area.
|
696
727
|
#
|
697
728
|
# This can be useful for reusing results, but can obviously use a lot of
|
data/lib/vips/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-vips
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Cupitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|