ruby-vips 2.0.10 → 2.0.11

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: 07d28520a0b6b7e8fee09e6392b0e1904f6391e1
4
- data.tar.gz: d7302466fa01d9713edae0594cecac2f70c43807
3
+ metadata.gz: b0c1cc6cf18a1a7bb3260070b968c19289e01bfd
4
+ data.tar.gz: d76e0a16f34f6ef7ea347029c0a9b781d3d96a81
5
5
  SHA512:
6
- metadata.gz: 128911db0a865b714554b4540d113d9276fa077aa9f08a1fc69f8d6c227a11c7379665eb24d6996acd0af2b268829603fc28232d71aca97bb943a4a293bf0851
7
- data.tar.gz: 240dba73bfca4a96ea82046ee83dc5db413b00d1b8ff19bd2d2228e94ac29a6d4bca09fab4bd9b45522066ffed63c0aed8fb25583dee0deeca5839ceec78af23
6
+ metadata.gz: c9176ae611ca930ba60f1656cef1af41a8b0c9a056cbbdf12d4a99087f3cd219395d47caeec02c95ac03a398a43c846cf484190364db750f2819fc9ec77ec3c3
7
+ data.tar.gz: a43fd7d898961b8d5b94379e76a3c668c80b32200c2bafdbb48d5696da5d1c181adbfffb8ced1bd210303d2e377ce2f7fcd2aee3ef06ad12cdfebffedbdd8798
@@ -47,6 +47,7 @@ rvm:
47
47
  - 2.2
48
48
  - 2.3
49
49
  - 2.4
50
+ - 2.5
50
51
 
51
52
  script: "bundle exec rake"
52
53
 
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## Version 2.0.11 (2018-4-23)
6
+
7
+ * fix init with older glib [lsat12357]
8
+ * add `Vips::Image#has_alpha?` and `#add_alpha` [aried3r]
9
+
5
10
  ## Version 2.0.10 (2017-12-21)
6
11
 
7
12
  * add support for uint64 parameters
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.10
1
+ 2.0.11
@@ -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"
@@ -35,7 +35,13 @@ module Vips
35
35
  rescue FFI::NotFoundError
36
36
  end
37
37
 
38
- attach_function :vips_image_set,
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
- # handy for overloads ... want to be able to apply a function to an
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
@@ -1,4 +1,4 @@
1
1
  module Vips
2
- VERSION = "2.0.10"
2
+ VERSION = "2.0.11"
3
3
  end
4
4
 
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.10
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-03 00:00:00.000000000 Z
11
+ date: 2018-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi