ruby-vips 2.0.14 → 2.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +13 -1
- data/.rubocop_todo.yml +32 -247
- data/CHANGELOG.md +6 -0
- data/TODO +11 -3
- data/VERSION +1 -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 +3 -3
- data/lib/vips/object.rb +10 -17
- 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 -2
- data/ruby-vips.gemspec +0 -1
- metadata +3 -4
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## Version 2.0.15 (2019-6-12)
|
6
|
+
|
7
|
+
* better error messages from `write_to_memory` [linkyndy]
|
8
|
+
* fix doc generation typo for array return [jcupitt]
|
9
|
+
* update tests for libvips 8.8 [jcupitt]
|
10
|
+
|
5
11
|
## Version 2.0.14 (2018-10-3)
|
6
12
|
|
7
13
|
* update links for new home [jcupitt]
|
data/TODO
CHANGED
@@ -7,10 +7,9 @@
|
|
7
7
|
|
8
8
|
# Common operations
|
9
9
|
|
10
|
-
-
|
10
|
+
- lint
|
11
11
|
|
12
|
-
|
13
|
-
edit VERSION
|
12
|
+
bundle exec rake rubocop
|
14
13
|
|
15
14
|
- reinstall local copy of gem after a change
|
16
15
|
|
@@ -20,6 +19,11 @@
|
|
20
19
|
|
21
20
|
bundle exec rake
|
22
21
|
|
22
|
+
- version bump
|
23
|
+
|
24
|
+
edit lib/vips/version.rb
|
25
|
+
edit VERSION
|
26
|
+
|
23
27
|
- regenerate autodocs
|
24
28
|
|
25
29
|
cd lib/vips
|
@@ -27,6 +31,10 @@
|
|
27
31
|
require 'vips'; Vips::generate_yard
|
28
32
|
^D
|
29
33
|
|
34
|
+
- regenerate .rubocop_todo.yml
|
35
|
+
|
36
|
+
bundle exec rubocop --auto-gen-config
|
37
|
+
|
30
38
|
- regenerate docs
|
31
39
|
|
32
40
|
bundle exec rake yard
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.15
|
data/example/daltonize8.rb
CHANGED
@@ -9,18 +9,18 @@
|
|
9
9
|
|
10
10
|
require 'vips'
|
11
11
|
|
12
|
-
#Vips.set_debug true
|
12
|
+
# Vips.set_debug true
|
13
13
|
|
14
14
|
# matrices to convert D65 XYZ to and from bradford cone space
|
15
15
|
xyz_to_brad = [
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
[0.8951, 0.2664, -0.1614],
|
17
|
+
[-0.7502, 1.7135, 0.0367],
|
18
|
+
[0.0389, -0.0685, 1.0296]
|
19
19
|
]
|
20
20
|
brad_to_xyz = [
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
[0.987, -0.147, 0.16],
|
22
|
+
[0.432, 0.5184, 0.0493],
|
23
|
+
[-0.0085, 0.04, 0.968]
|
24
24
|
]
|
25
25
|
|
26
26
|
im = Vips::Image.new_from_file ARGV[0]
|
@@ -47,9 +47,9 @@ brad = xyz.recomb xyz_to_brad
|
|
47
47
|
# we need rows to sum to 1 in Bradford space --- the matrix in the original
|
48
48
|
# Python code sums to 1.742
|
49
49
|
deut = brad.recomb [
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
[1, 0, 0],
|
51
|
+
[0.7, 0, 0.3],
|
52
|
+
[0, 0, 1]
|
53
53
|
]
|
54
54
|
|
55
55
|
xyz = deut.recomb brad_to_xyz
|
@@ -61,11 +61,9 @@ rgb = xyz.colourspace :srgb
|
|
61
61
|
err = im - rgb
|
62
62
|
|
63
63
|
# add the error back to other channels to make a compensated image
|
64
|
-
im = im + err.recomb([
|
65
|
-
|
66
|
-
|
67
|
-
[0.7, 0, 1]
|
68
|
-
])
|
64
|
+
im = im + err.recomb([[0, 0, 0],
|
65
|
+
[0.7, 1, 0],
|
66
|
+
[0.7, 0, 1]])
|
69
67
|
|
70
68
|
# reattach any alpha we saved above
|
71
69
|
if alpha
|
data/example/example1.rb
CHANGED
data/example/example4.rb
CHANGED
@@ -6,10 +6,10 @@ require 'vips'
|
|
6
6
|
Vips::leak_set true
|
7
7
|
|
8
8
|
# disable the operation cache
|
9
|
-
#Vips::cache_set_max 0
|
9
|
+
# Vips::cache_set_max 0
|
10
10
|
|
11
11
|
# turn on debug logging
|
12
|
-
#Vips.set_debug true
|
12
|
+
# Vips.set_debug true
|
13
13
|
|
14
14
|
ARGV.each do |filename|
|
15
15
|
im = Vips::Image.new_from_file filename
|
data/example/example5.rb
CHANGED
@@ -9,7 +9,7 @@ require 'vips'
|
|
9
9
|
# Vips::cache_set_max 0
|
10
10
|
|
11
11
|
# turn on debug logging
|
12
|
-
#Vips.set_debug true
|
12
|
+
# Vips.set_debug true
|
13
13
|
|
14
14
|
if ARGV.length < 2
|
15
15
|
raise "usage: #{$PROGRAM_NAME}: input-file output-file"
|
@@ -22,10 +22,9 @@ im *= [1, 2, 1]
|
|
22
22
|
# we want to be able to specify a scale for the convolution mask, so we have to
|
23
23
|
# make it ourselves
|
24
24
|
# if you are OK with scale=1, you can just pass the array directly to .conv()
|
25
|
-
mask = Vips::Image.new_from_array [
|
26
|
-
|
27
|
-
|
28
|
-
[-1, -1, -1]], 8
|
25
|
+
mask = Vips::Image.new_from_array [[-1, -1, -1],
|
26
|
+
[-1, 16, -1],
|
27
|
+
[-1, -1, -1]], 8
|
29
28
|
im = im.conv mask
|
30
29
|
|
31
30
|
im.write_to_file ARGV[1]
|
@@ -31,11 +31,8 @@ module GLib
|
|
31
31
|
extend FFI::Library
|
32
32
|
ffi_lib 'gobject-2.0'
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
def self.set_log_domain(domain)
|
38
|
-
glib_log_domain = domain
|
34
|
+
def self.set_log_domain(_domain)
|
35
|
+
# FIXME: this needs hooking up
|
39
36
|
end
|
40
37
|
|
41
38
|
# we have a set of things we need to inherit in different ways:
|
@@ -90,7 +87,6 @@ module GLib
|
|
90
87
|
log "GLib::GObject::ManagedStruct.release: unreffing #{ptr}"
|
91
88
|
GLib::g_object_unref(ptr) unless ptr.null?
|
92
89
|
end
|
93
|
-
|
94
90
|
end
|
95
91
|
|
96
92
|
# the plain struct ... cast with this
|
@@ -101,7 +97,6 @@ module GLib
|
|
101
97
|
log "GLib::GObject::Struct.new: #{ptr}"
|
102
98
|
super
|
103
99
|
end
|
104
|
-
|
105
100
|
end
|
106
101
|
|
107
102
|
# don't allow ptr == nil, we never want to allocate a GObject struct
|
@@ -135,12 +130,10 @@ module GLib
|
|
135
130
|
self.const_get(:ManagedStruct)
|
136
131
|
end
|
137
132
|
end
|
138
|
-
|
139
133
|
end
|
140
134
|
|
141
135
|
# :gtype will usually be 64-bit, but will be 32-bit on 32-bit Windows
|
142
136
|
typedef :ulong, :GType
|
143
|
-
|
144
137
|
end
|
145
138
|
|
146
139
|
module Vips
|
@@ -189,7 +182,6 @@ module Vips
|
|
189
182
|
end
|
190
183
|
|
191
184
|
class VipsObject < GLib::GObject
|
192
|
-
|
193
185
|
# the layout of the VipsObject struct
|
194
186
|
module VipsObjectLayout
|
195
187
|
def self.included(base)
|
@@ -216,7 +208,6 @@ module Vips
|
|
216
208
|
log "Vips::VipsObject::Struct.new: #{ptr}"
|
217
209
|
super
|
218
210
|
end
|
219
|
-
|
220
211
|
end
|
221
212
|
|
222
213
|
class ManagedStruct < GLib::GObject::ManagedStruct
|
@@ -226,13 +217,10 @@ module Vips
|
|
226
217
|
log "Vips::VipsObject::ManagedStruct.new: #{ptr}"
|
227
218
|
super
|
228
219
|
end
|
229
|
-
|
230
220
|
end
|
231
|
-
|
232
221
|
end
|
233
222
|
|
234
223
|
class VipsImage < VipsObject
|
235
|
-
|
236
224
|
# the layout of the VipsImage struct
|
237
225
|
module VipsImageLayout
|
238
226
|
def self.included(base)
|
@@ -250,7 +238,6 @@ module Vips
|
|
250
238
|
log "Vips::VipsImage::Struct.new: #{ptr}"
|
251
239
|
super
|
252
240
|
end
|
253
|
-
|
254
241
|
end
|
255
242
|
|
256
243
|
class ManagedStruct < VipsObject::ManagedStruct
|
@@ -260,17 +247,14 @@ module Vips
|
|
260
247
|
log "Vips::VipsImage::ManagedStruct.new: #{ptr}"
|
261
248
|
super
|
262
249
|
end
|
263
|
-
|
264
250
|
end
|
265
251
|
|
266
252
|
def self.new_partial
|
267
253
|
VipsImage.new(Vips::vips_image_new)
|
268
254
|
end
|
269
|
-
|
270
255
|
end
|
271
256
|
|
272
257
|
attach_function :vips_image_new, [], :pointer
|
273
|
-
|
274
258
|
end
|
275
259
|
|
276
260
|
puts "creating image"
|
@@ -283,4 +267,3 @@ begin
|
|
283
267
|
puts "x[:parent][:description] = #{x[:parent][:description]}"
|
284
268
|
puts ""
|
285
269
|
end
|
286
|
-
|
data/example/thumb.rb
CHANGED
data/example/trim8.rb
CHANGED
@@ -23,16 +23,16 @@ mask = (im.median - background).abs > 10
|
|
23
23
|
# direction
|
24
24
|
columns, rows = mask.project
|
25
25
|
|
26
|
-
|
26
|
+
_first_column, first_row = columns.profile
|
27
27
|
left = first_row.min
|
28
28
|
|
29
|
-
|
29
|
+
_first_column, first_row = columns.fliphor.profile
|
30
30
|
right = columns.width - first_row.min
|
31
31
|
|
32
|
-
first_column,
|
32
|
+
first_column, _first_row = rows.profile
|
33
33
|
top = first_column.min
|
34
34
|
|
35
|
-
first_column,
|
35
|
+
first_column, _first_row = rows.flipver.profile
|
36
36
|
bottom = rows.height - first_column.min
|
37
37
|
|
38
38
|
# and now crop the original image
|
data/lib/vips.rb
CHANGED
@@ -43,7 +43,7 @@ module GLib
|
|
43
43
|
LOG_FLAG_FATAL = 1 << 1
|
44
44
|
|
45
45
|
# GLib log levels
|
46
|
-
LOG_LEVEL_ERROR = 1 << 2
|
46
|
+
LOG_LEVEL_ERROR = 1 << 2 # always fatal
|
47
47
|
LOG_LEVEL_CRITICAL = 1 << 3
|
48
48
|
LOG_LEVEL_WARNING = 1 << 4
|
49
49
|
LOG_LEVEL_MESSAGE = 1 << 5
|
@@ -52,12 +52,12 @@ module GLib
|
|
52
52
|
|
53
53
|
# map glib levels to Logger::Severity
|
54
54
|
GLIB_TO_SEVERITY = {
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
55
|
+
LOG_LEVEL_ERROR => Logger::ERROR,
|
56
|
+
LOG_LEVEL_CRITICAL => Logger::FATAL,
|
57
|
+
LOG_LEVEL_WARNING => Logger::WARN,
|
58
|
+
LOG_LEVEL_MESSAGE => Logger::UNKNOWN,
|
59
|
+
LOG_LEVEL_INFO => Logger::INFO,
|
60
|
+
LOG_LEVEL_DEBUG => Logger::DEBUG
|
61
61
|
}
|
62
62
|
GLIB_TO_SEVERITY.default = Logger::UNKNOWN
|
63
63
|
|
@@ -66,7 +66,7 @@ module GLib
|
|
66
66
|
@glib_log_handler_id = 0
|
67
67
|
|
68
68
|
# module-level, so it's not GCd away
|
69
|
-
LOG_HANDLER = Proc.new do |domain, level, message,
|
69
|
+
LOG_HANDLER = Proc.new do |domain, level, message, _user_data|
|
70
70
|
@logger.log(GLIB_TO_SEVERITY[level], message, domain)
|
71
71
|
end
|
72
72
|
|
@@ -111,9 +111,7 @@ module GLib
|
|
111
111
|
GLib::remove_log_handler
|
112
112
|
}
|
113
113
|
end
|
114
|
-
|
115
114
|
end
|
116
|
-
|
117
115
|
end
|
118
116
|
|
119
117
|
module GObject
|
@@ -151,7 +149,6 @@ module GObject
|
|
151
149
|
GFLAGS_TYPE = g_type_from_name "GFlags"
|
152
150
|
GSTR_TYPE = g_type_from_name "gchararray"
|
153
151
|
GOBJECT_TYPE = g_type_from_name "GObject"
|
154
|
-
|
155
152
|
end
|
156
153
|
|
157
154
|
require 'vips/gobject'
|
@@ -385,7 +382,7 @@ require 'vips/gvalue'
|
|
385
382
|
#
|
386
383
|
# https://developer.gnome.org/glib/stable/glib-Message-Logging.html
|
387
384
|
#
|
388
|
-
# You can disable
|
385
|
+
# You can disable warnings by defining the `VIPS_WARNING` environment variable.
|
389
386
|
# You can enable info output by defining `VIPS_INFO`.
|
390
387
|
#
|
391
388
|
# # Exceptions
|
@@ -528,7 +525,7 @@ module Vips
|
|
528
525
|
# Turn libvips leak testing on and off. Handy for debugging ruby-vips, not
|
529
526
|
# very useful for user code.
|
530
527
|
def self.leak_set leak
|
531
|
-
vips_leak_set
|
528
|
+
vips_leak_set((leak ? 1 : 0))
|
532
529
|
end
|
533
530
|
|
534
531
|
attach_function :vips_cache_set_max, [:int], :void
|
@@ -614,7 +611,6 @@ module Vips
|
|
614
611
|
# libvips has this arbitrary number as a sanity-check upper bound on image
|
615
612
|
# size. It's sometimes useful for know whan calculating image ratios.
|
616
613
|
MAX_COORD = 10000000
|
617
|
-
|
618
614
|
end
|
619
615
|
|
620
616
|
require 'vips/object'
|
@@ -622,5 +618,3 @@ require 'vips/operation'
|
|
622
618
|
require 'vips/image'
|
623
619
|
require 'vips/interpolate'
|
624
620
|
require 'vips/version'
|
625
|
-
|
626
|
-
|
data/lib/vips/align.rb
CHANGED
data/lib/vips/angle.rb
CHANGED
data/lib/vips/angle45.rb
CHANGED
data/lib/vips/bandformat.rb
CHANGED
data/lib/vips/blend_mode.rb
CHANGED
data/lib/vips/coding.rb
CHANGED
data/lib/vips/direction.rb
CHANGED
data/lib/vips/extend.rb
CHANGED
data/lib/vips/gobject.rb
CHANGED
@@ -8,7 +8,6 @@ require 'ffi'
|
|
8
8
|
require 'forwardable'
|
9
9
|
|
10
10
|
module GObject
|
11
|
-
|
12
11
|
# we have a number of things we need to inherit in different ways:
|
13
12
|
#
|
14
13
|
# - we want to be able to subclass GObject in Ruby in a simple way
|
@@ -64,7 +63,6 @@ module GObject
|
|
64
63
|
# the plain struct ... cast with this
|
65
64
|
class Struct < FFI::Struct
|
66
65
|
include GObjectLayout
|
67
|
-
|
68
66
|
end
|
69
67
|
|
70
68
|
# don't allow ptr == nil, we never want to allocate a GObject struct
|
@@ -98,7 +96,6 @@ module GObject
|
|
98
96
|
self.const_get :ManagedStruct
|
99
97
|
end
|
100
98
|
end
|
101
|
-
|
102
99
|
end
|
103
100
|
|
104
101
|
class GParamSpec < FFI::Struct
|
@@ -118,5 +115,4 @@ module GObject
|
|
118
115
|
|
119
116
|
attach_function :g_object_ref, [:pointer], :void
|
120
117
|
attach_function :g_object_unref, [:pointer], :void
|
121
|
-
|
122
118
|
end
|