vips 8.8.0.3 → 8.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -2
- data/CHANGELOG.md +8 -1
- data/example/daltonize8.rb +13 -15
- data/example/example1.rb +1 -2
- data/example/example4.rb +2 -2
- data/example/example5.rb +4 -5
- data/example/inheritance_with_refcount.rb +2 -19
- data/example/thumb.rb +2 -4
- data/example/trim8.rb +4 -4
- data/lib/vips.rb +10 -16
- data/lib/vips/align.rb +0 -1
- data/lib/vips/angle.rb +0 -1
- data/lib/vips/angle45.rb +0 -1
- data/lib/vips/bandformat.rb +0 -2
- data/lib/vips/blend_mode.rb +0 -2
- data/lib/vips/coding.rb +0 -1
- data/lib/vips/compass_direction.rb +0 -1
- data/lib/vips/direction.rb +0 -1
- data/lib/vips/extend.rb +0 -1
- data/lib/vips/gobject.rb +0 -4
- data/lib/vips/gvalue.rb +3 -9
- data/lib/vips/image.rb +64 -67
- data/lib/vips/interesting.rb +0 -1
- data/lib/vips/interpolate.rb +0 -5
- data/lib/vips/interpretation.rb +0 -1
- data/lib/vips/kernel.rb +0 -1
- data/lib/vips/methods.rb +150 -59
- data/lib/vips/object.rb +10 -14
- data/lib/vips/operation.rb +26 -34
- data/lib/vips/operationboolean.rb +0 -1
- data/lib/vips/operationcomplex.rb +0 -1
- data/lib/vips/operationcomplex2.rb +0 -1
- data/lib/vips/operationcomplexget.rb +0 -1
- data/lib/vips/operationmath.rb +0 -1
- data/lib/vips/operationmath2.rb +0 -1
- data/lib/vips/operationrelational.rb +0 -1
- data/lib/vips/operationround.rb +0 -1
- data/lib/vips/size.rb +0 -1
- data/lib/vips/version.rb +1 -1
- metadata +3 -3
data/lib/vips/object.rb
CHANGED
@@ -78,7 +78,6 @@ module Vips
|
|
78
78
|
attach_function :type_find, :vips_type_find, [:string, :string], :GType
|
79
79
|
|
80
80
|
class Object < GObject::GObject
|
81
|
-
|
82
81
|
# print all active VipsObjects, with their reference counts. Handy for
|
83
82
|
# debugging ruby-vips.
|
84
83
|
def self.print_all
|
@@ -107,12 +106,10 @@ module Vips
|
|
107
106
|
|
108
107
|
class Struct < GObject::GObject::Struct
|
109
108
|
include ObjectLayout
|
110
|
-
|
111
109
|
end
|
112
110
|
|
113
111
|
class ManagedStruct < GObject::GObject::ManagedStruct
|
114
112
|
include ObjectLayout
|
115
|
-
|
116
113
|
end
|
117
114
|
|
118
115
|
# return a pspec, or nil ... nil wil leave a message in the error log
|
@@ -155,13 +152,13 @@ module Vips
|
|
155
152
|
GObject::g_object_get_property self, name, gvalue
|
156
153
|
result = gvalue.get
|
157
154
|
|
158
|
-
GLib::logger.debug("Vips::Object.get") {"#{name} == #{result}"}
|
155
|
+
GLib::logger.debug("Vips::Object.get") { "#{name} == #{result}" }
|
159
156
|
|
160
157
|
return result
|
161
158
|
end
|
162
159
|
|
163
160
|
def set name, value
|
164
|
-
GLib::logger.debug("Vips::Object.set") {"#{name} = #{value}"}
|
161
|
+
GLib::logger.debug("Vips::Object.set") { "#{name} = #{value}" }
|
165
162
|
|
166
163
|
gtype = get_typeof_error name
|
167
164
|
gvalue = GObject::GValue.alloc
|
@@ -169,7 +166,6 @@ module Vips
|
|
169
166
|
gvalue.set value
|
170
167
|
GObject::g_object_set_property self, name, gvalue
|
171
168
|
end
|
172
|
-
|
173
169
|
end
|
174
170
|
|
175
171
|
class ObjectClass < FFI::Struct
|
@@ -196,14 +192,14 @@ module Vips
|
|
196
192
|
ARGUMENT_MODIFY = 128
|
197
193
|
|
198
194
|
ARGUMENT_FLAGS = {
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
195
|
+
required: ARGUMENT_REQUIRED,
|
196
|
+
construct: ARGUMENT_CONSTRUCT,
|
197
|
+
set_once: ARGUMENT_SET_ONCE,
|
198
|
+
set_always: ARGUMENT_SET_ALWAYS,
|
199
|
+
input: ARGUMENT_INPUT,
|
200
|
+
output: ARGUMENT_OUTPUT,
|
201
|
+
deprecated: ARGUMENT_DEPRECATED,
|
202
|
+
modify: ARGUMENT_MODIFY
|
207
203
|
}
|
208
204
|
|
209
205
|
class ArgumentClass < Argument
|
data/lib/vips/operation.rb
CHANGED
@@ -28,15 +28,14 @@ module Vips
|
|
28
28
|
OPERATION_DEPRECATED = 8
|
29
29
|
|
30
30
|
OPERATION_FLAGS = {
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
sequential: OPERATION_SEQUENTIAL,
|
32
|
+
nocache: OPERATION_NOCACHE,
|
33
|
+
deprecated: OPERATION_DEPRECATED
|
34
34
|
}
|
35
35
|
|
36
36
|
attach_function :vips_operation_get_flags, [:pointer], :int
|
37
37
|
|
38
38
|
class Operation < Object
|
39
|
-
|
40
39
|
# the layout of the VipsOperation struct
|
41
40
|
module OperationLayout
|
42
41
|
def self.included base
|
@@ -49,12 +48,10 @@ module Vips
|
|
49
48
|
|
50
49
|
class Struct < Object::Struct
|
51
50
|
include OperationLayout
|
52
|
-
|
53
51
|
end
|
54
52
|
|
55
53
|
class ManagedStruct < Object::ManagedStruct
|
56
54
|
include OperationLayout
|
57
|
-
|
58
55
|
end
|
59
56
|
|
60
57
|
def initialize value
|
@@ -78,7 +75,7 @@ module Vips
|
|
78
75
|
end
|
79
76
|
|
80
77
|
def argument_map &block
|
81
|
-
fn = Proc.new do |
|
78
|
+
fn = Proc.new do |_op, pspec, argument_class, argument_instance, _a, _b|
|
82
79
|
block.call pspec, argument_class, argument_instance
|
83
80
|
end
|
84
81
|
|
@@ -93,7 +90,7 @@ module Vips
|
|
93
90
|
def get_construct_args
|
94
91
|
args = []
|
95
92
|
|
96
|
-
argument_map do |pspec, argument_class,
|
93
|
+
argument_map do |pspec, argument_class, _argument_instance|
|
97
94
|
flags = argument_class[:flags]
|
98
95
|
if (flags & ARGUMENT_CONSTRUCT) != 0
|
99
96
|
# names can include - as punctuation, but we always use _ in
|
@@ -113,7 +110,7 @@ module Vips
|
|
113
110
|
return object if block.call object
|
114
111
|
|
115
112
|
if object.is_a? Enumerable
|
116
|
-
object.find {|value| block.call value, block}
|
113
|
+
object.find { |value| block.call value, block }
|
117
114
|
end
|
118
115
|
|
119
116
|
return nil
|
@@ -126,7 +123,7 @@ module Vips
|
|
126
123
|
# 2D array values become tiny 2D images
|
127
124
|
# if there's nothing to match to, we also make a 2D image
|
128
125
|
if (value.is_a?(Array) && value[0].is_a?(Array)) ||
|
129
|
-
|
126
|
+
match_image == nil
|
130
127
|
return Image.new_from_array value
|
131
128
|
else
|
132
129
|
# we have a 1D array ... use that as a pixel constant and
|
@@ -148,7 +145,7 @@ module Vips
|
|
148
145
|
value = value.copy.copy_memory
|
149
146
|
end
|
150
147
|
elsif gtype == ARRAY_IMAGE_TYPE
|
151
|
-
value = value.map {|x| Operation::imageize match_image, x}
|
148
|
+
value = value.map { |x| Operation::imageize match_image, x }
|
152
149
|
end
|
153
150
|
|
154
151
|
super name, value
|
@@ -226,7 +223,7 @@ module Vips
|
|
226
223
|
def self.call name, supplied, optional = {}, option_string = ""
|
227
224
|
GLib::logger.debug("Vips::VipsOperation.call") {
|
228
225
|
"name = #{name}, supplied = #{supplied}, " +
|
229
|
-
|
226
|
+
"optional = #{optional}, option_string = #{option_string}"
|
230
227
|
}
|
231
228
|
|
232
229
|
op = Operation.new name
|
@@ -237,55 +234,54 @@ module Vips
|
|
237
234
|
optional_input = {}
|
238
235
|
required_output = []
|
239
236
|
optional_output = {}
|
240
|
-
args.each do |
|
237
|
+
args.each do |arg_name, flags|
|
241
238
|
next if (flags & ARGUMENT_DEPRECATED) != 0
|
242
239
|
|
243
240
|
if (flags & ARGUMENT_INPUT) != 0
|
244
241
|
if (flags & ARGUMENT_REQUIRED) != 0
|
245
|
-
required_input << [
|
242
|
+
required_input << [arg_name, flags]
|
246
243
|
else
|
247
|
-
optional_input[
|
244
|
+
optional_input[arg_name] = flags
|
248
245
|
end
|
249
246
|
end
|
250
247
|
|
251
248
|
# MODIFY INPUT args count as OUTPUT as well
|
252
249
|
if (flags & ARGUMENT_OUTPUT) != 0 ||
|
253
|
-
|
254
|
-
|
250
|
+
((flags & ARGUMENT_INPUT) != 0 &&
|
251
|
+
(flags & ARGUMENT_MODIFY) != 0)
|
255
252
|
if (flags & ARGUMENT_REQUIRED) != 0
|
256
|
-
required_output << [
|
253
|
+
required_output << [arg_name, flags]
|
257
254
|
else
|
258
|
-
optional_output[
|
255
|
+
optional_output[arg_name] = flags
|
259
256
|
end
|
260
257
|
end
|
261
|
-
|
262
258
|
end
|
263
259
|
|
264
260
|
# so we should have been supplied with n_required_input values, or
|
265
261
|
# n_required_input + 1 if there's a hash of options at the end
|
266
262
|
unless supplied.is_a? Array
|
267
263
|
raise Vips::Error, "unable to call #{name}: " +
|
268
|
-
|
264
|
+
"argument array is not an array"
|
269
265
|
end
|
270
266
|
unless optional.is_a? Hash
|
271
267
|
raise Vips::Error, "unable to call #{name}: " +
|
272
|
-
|
268
|
+
"optional arguments are not a hash"
|
273
269
|
end
|
274
270
|
if supplied.length != required_input.length
|
275
271
|
raise Vips::Error, "unable to call #{name}: " +
|
276
|
-
|
277
|
-
|
272
|
+
"you supplied #{supplied.length} arguments, " +
|
273
|
+
"but operation needs #{required_input.length}."
|
278
274
|
end
|
279
275
|
|
280
276
|
# very that all supplied_optional keys are in optional_input or
|
281
277
|
# optional_output
|
282
|
-
optional.each do |key,
|
278
|
+
optional.each do |key, _value|
|
283
279
|
arg_name = key.to_s
|
284
280
|
|
285
281
|
unless optional_input.has_key?(arg_name) ||
|
286
|
-
|
282
|
+
optional_output.has_key?(arg_name)
|
287
283
|
raise Vips::Error, "unable to call #{name}: " +
|
288
|
-
|
284
|
+
"unknown option #{arg_name}"
|
289
285
|
end
|
290
286
|
end
|
291
287
|
|
@@ -331,18 +327,16 @@ module Vips
|
|
331
327
|
|
332
328
|
# get all required results
|
333
329
|
result = []
|
334
|
-
required_output.each do |arg_name,
|
330
|
+
required_output.each do |arg_name, _flags|
|
335
331
|
result << op.get(arg_name)
|
336
332
|
end
|
337
333
|
|
338
334
|
# fetch all optional ones
|
339
335
|
optional_results = {}
|
340
|
-
optional.each do |key,
|
336
|
+
optional.each do |key, _value|
|
341
337
|
arg_name = key.to_s
|
342
338
|
|
343
339
|
if optional_output.has_key? arg_name
|
344
|
-
flags = optional_output[arg_name]
|
345
|
-
|
346
340
|
optional_results[arg_name] = op.get arg_name
|
347
341
|
end
|
348
342
|
end
|
@@ -355,13 +349,11 @@ module Vips
|
|
355
349
|
result = nil
|
356
350
|
end
|
357
351
|
|
358
|
-
GLib::logger.debug("Vips::Operation.call") {"result = #{result}"}
|
352
|
+
GLib::logger.debug("Vips::Operation.call") { "result = #{result}" }
|
359
353
|
|
360
354
|
Vips::vips_object_unref_outputs op
|
361
355
|
|
362
356
|
return result
|
363
357
|
end
|
364
|
-
|
365
358
|
end
|
366
|
-
|
367
359
|
end
|
data/lib/vips/operationmath.rb
CHANGED
data/lib/vips/operationmath2.rb
CHANGED
data/lib/vips/operationround.rb
CHANGED
data/lib/vips/size.rb
CHANGED
data/lib/vips/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vips
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.8.
|
4
|
+
version: 8.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Cupitt
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-09-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|
@@ -203,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
203
|
- !ruby/object:Gem::Version
|
204
204
|
version: '0'
|
205
205
|
requirements: []
|
206
|
-
rubygems_version: 3.0.
|
206
|
+
rubygems_version: 3.0.3
|
207
207
|
signing_key:
|
208
208
|
specification_version: 4
|
209
209
|
summary: Vips is a high-performance image manipulation library.
|