ruby-vips 2.0.4 → 2.0.5
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/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/VERSION +1 -1
- data/lib/vips/image.rb +24 -4
- data/lib/vips/object.rb +8 -4
- data/lib/vips/version.rb +1 -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: 38b222b12b892a0cfbd9532a25e977c14e20ca4b
|
4
|
+
data.tar.gz: f21db53783fb278d10c03293b3e356a9b22c5bed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fad99e35598db1433300247d531d4fa6d2fbe82b47ce0ee7d5a9fe1224f28833d83832774db52a8b50de91b65f51e98410eaad7dda55fb76eb1757daa7e3372c
|
7
|
+
data.tar.gz: 784a0f8a3e8b4fcea5688b5c72e8b92d8901ea6ce8aa2c3d3453a660c14815871e008ad010333475748ce88b8102ab9b80e8ff308b0631a82ee8b59fe85e6a8b
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.5
|
data/lib/vips/image.rb
CHANGED
@@ -33,9 +33,7 @@ module Vips
|
|
33
33
|
# vips_image_get_fields was added in libvips 8.5
|
34
34
|
begin
|
35
35
|
attach_function :vips_image_get_fields, [:pointer], :pointer
|
36
|
-
HAS_IMAGE_GET_FIELDS = true
|
37
36
|
rescue FFI::NotFoundError
|
38
|
-
HAS_IMAGE_GET_FIELDS = false
|
39
37
|
end
|
40
38
|
|
41
39
|
attach_function :vips_image_set,
|
@@ -475,7 +473,19 @@ module Vips
|
|
475
473
|
# @param name [String] Metadata field to fetch
|
476
474
|
# @return [Integer] GType
|
477
475
|
def get_typeof name
|
478
|
-
|
476
|
+
# libvips 8.5+ has a fast path for this
|
477
|
+
if Vips::version(0) > 8 or Vips::version(1) > 4
|
478
|
+
Vips::vips_image_get_typeof self, name
|
479
|
+
else
|
480
|
+
# with older libvips, we have to look in properties first, then
|
481
|
+
# fall back to metadata
|
482
|
+
gtype = get_typeof_property name
|
483
|
+
if gtype != 0
|
484
|
+
gtype
|
485
|
+
else
|
486
|
+
Vips::vips_image_get_typeof self, name
|
487
|
+
end
|
488
|
+
end
|
479
489
|
end
|
480
490
|
|
481
491
|
# Get a metadata item from an image. Ruby types are constructed
|
@@ -492,6 +502,16 @@ module Vips
|
|
492
502
|
# @param name [String] Metadata field to get
|
493
503
|
# @return [Object] Value of field
|
494
504
|
def get name
|
505
|
+
# with old libvips, we must fetch properties (as opposed to
|
506
|
+
# metadata) via VipsObject
|
507
|
+
unless Vips::version(0) > 8 or Vips::version(1) > 4
|
508
|
+
gtype = get_typeof_property name
|
509
|
+
if gtype != 0
|
510
|
+
# found a property
|
511
|
+
return super
|
512
|
+
end
|
513
|
+
end
|
514
|
+
|
495
515
|
gvalue = GObject::GValue.alloc
|
496
516
|
result = Vips::vips_image_get self, name, gvalue
|
497
517
|
if result != 0
|
@@ -507,7 +527,7 @@ module Vips
|
|
507
527
|
# @return [[String]] array of field names
|
508
528
|
def get_fields
|
509
529
|
# vips_image_get_fields() was added in libvips 8.5
|
510
|
-
if not Vips
|
530
|
+
if not Vips.respond_to? :vips_image_get_fields
|
511
531
|
return []
|
512
532
|
end
|
513
533
|
|
data/lib/vips/object.rb
CHANGED
@@ -108,20 +108,24 @@ module Vips
|
|
108
108
|
|
109
109
|
end
|
110
110
|
|
111
|
-
def
|
111
|
+
def get_typeof_property name
|
112
112
|
pspec = GObject::GParamSpecPtr.new
|
113
113
|
argument_class = Vips::ArgumentClassPtr.new
|
114
114
|
argument_instance = Vips::ArgumentInstancePtr.new
|
115
115
|
|
116
116
|
result = Vips::vips_object_get_argument self, name,
|
117
117
|
pspec, argument_class, argument_instance
|
118
|
-
|
118
|
+
return 0 if result != 0
|
119
119
|
|
120
120
|
pspec[:value][:value_type]
|
121
121
|
end
|
122
122
|
|
123
|
+
def get_typeof name
|
124
|
+
get_typeof_property name
|
125
|
+
end
|
126
|
+
|
123
127
|
def get name
|
124
|
-
gtype =
|
128
|
+
gtype = get_typeof_property name
|
125
129
|
gvalue = GObject::GValue.alloc
|
126
130
|
gvalue.init gtype
|
127
131
|
GObject::g_object_get_property self, name, gvalue
|
@@ -135,7 +139,7 @@ module Vips
|
|
135
139
|
def set name, value
|
136
140
|
GLib::logger.debug("Vips::Object.set") {"#{name} = #{value}"}
|
137
141
|
|
138
|
-
gtype =
|
142
|
+
gtype = get_typeof_property name
|
139
143
|
gvalue = GObject::GValue.alloc
|
140
144
|
gvalue.init gtype
|
141
145
|
gvalue.set value
|
data/lib/vips/version.rb
CHANGED