vips 8.8.0.3 → 8.10.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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +5 -2
  3. data/README.md +3 -1
  4. data/example/connection.rb +17 -0
  5. data/example/daltonize8.rb +13 -15
  6. data/example/example1.rb +1 -2
  7. data/example/example4.rb +2 -2
  8. data/example/example5.rb +4 -5
  9. data/example/inheritance_with_refcount.rb +2 -19
  10. data/example/progress.rb +30 -0
  11. data/example/thumb.rb +2 -4
  12. data/example/trim8.rb +4 -4
  13. data/ext/Rakefile +2 -2
  14. data/lib/vips.rb +101 -35
  15. data/lib/vips/align.rb +0 -1
  16. data/lib/vips/angle.rb +0 -1
  17. data/lib/vips/angle45.rb +0 -1
  18. data/lib/vips/bandformat.rb +0 -2
  19. data/lib/vips/blend_mode.rb +0 -2
  20. data/lib/vips/coding.rb +0 -1
  21. data/lib/vips/compass_direction.rb +0 -1
  22. data/lib/vips/connection.rb +46 -0
  23. data/lib/vips/direction.rb +0 -1
  24. data/lib/vips/extend.rb +0 -1
  25. data/lib/vips/gobject.rb +8 -4
  26. data/lib/vips/gvalue.rb +15 -9
  27. data/lib/vips/image.rb +269 -204
  28. data/lib/vips/interesting.rb +0 -1
  29. data/lib/vips/interpolate.rb +0 -5
  30. data/lib/vips/interpretation.rb +0 -1
  31. data/lib/vips/kernel.rb +0 -1
  32. data/lib/vips/methods.rb +150 -59
  33. data/lib/vips/object.rb +126 -18
  34. data/lib/vips/operation.rb +169 -101
  35. data/lib/vips/operationboolean.rb +0 -1
  36. data/lib/vips/operationcomplex.rb +0 -1
  37. data/lib/vips/operationcomplex2.rb +0 -1
  38. data/lib/vips/operationcomplexget.rb +0 -1
  39. data/lib/vips/operationmath.rb +0 -1
  40. data/lib/vips/operationmath2.rb +0 -1
  41. data/lib/vips/operationrelational.rb +0 -1
  42. data/lib/vips/operationround.rb +0 -1
  43. data/lib/vips/region.rb +73 -0
  44. data/lib/vips/size.rb +0 -1
  45. data/lib/vips/source.rb +89 -0
  46. data/lib/vips/sourcecustom.rb +90 -0
  47. data/lib/vips/target.rb +87 -0
  48. data/lib/vips/targetcustom.rb +78 -0
  49. data/lib/vips/version.rb +1 -1
  50. metadata +14 -7
  51. data/CHANGELOG.md +0 -266
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: def8d2de5521071c5f93bda54b3856684a9aef80ee47104eac6cadcfe49af78b
4
- data.tar.gz: 02bd0cad171e6b0ed6db4b33368556c06bf531608725bd7003f692cd2b43bb3f
3
+ metadata.gz: 791911df8d8ef4556cbf891fbb62f142cc13bfa062b6dc56de5a2fbc605b5af1
4
+ data.tar.gz: 477e946c45322d528ff3e162f1bb0d12e2b8bb7774956a36fad2455281ddaf00
5
5
  SHA512:
6
- metadata.gz: 590a10204b092501c81d67e429700fd4f5226636729d5511956c2001f2486c41a1249e83d50bf3f69810abfab83bf89a7fe24458b45ccc7691ce55ce0c60f544
7
- data.tar.gz: b9c6c6231d2e415643293fb4cf634ecfce4b6d37f5db81225cc7b84c72cddeeaf0d94f6756f253dfa8214ffb00a69cdbbd0fec686afdb8d1888ea0ead9efaa38
6
+ metadata.gz: be7311014c5f94c806ecfed73f99d09acd827439e91ae04803faa171510b725e6e097e5f2e3b5da5ffa72a469bac37d5bb56aa0add446329cd673c063fe802d7
7
+ data.tar.gz: d8a1bf4e00c93f9efddab64b11d82e8e53c2b01eccad3f8c44ad699082d4c9bb721a916070a388f4a9263cace566ae1d7200d79227e64be0980643d5b4412038
@@ -24,9 +24,10 @@ addons:
24
24
  - libwebp-dev
25
25
  homebrew:
26
26
  packages:
27
- # A simple way to install all dependencies.
28
- - vips
29
27
  - glib
28
+ - libffi
29
+ - libexif
30
+ update: true
30
31
 
31
32
  cache:
32
33
  bundler: true
@@ -39,6 +40,8 @@ matrix:
39
40
  - rvm: 2.6
40
41
  - rvm: 2.6
41
42
  os: osx
43
+ env: PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
44
+ - rvm: 2.7
42
45
  - rvm: truffleruby
43
46
  - rvm: jruby-head
44
47
  - rvm: ruby-head
data/README.md CHANGED
@@ -1,10 +1,12 @@
1
1
  # Vips
2
2
 
3
+ Programs that use `vips` don't manipulate images directly, instead they create pipelines of image processing operations building on a source image. When the end of the pipe is connected to a destination, the whole pipeline executes at once, streaming the image in parallel from source to destination a section at a time. Because `ruby-vips` is parallel, it's quick, and because it doesn't need to keep entire images in memory, it's light.
4
+
3
5
  This gem is a backwards compatible fork of `ruby-vips` but also includes (and compiles) the [libvips] source code.
4
6
 
5
7
  [![Build Status](https://secure.travis-ci.org/ioquatix/vips.svg)](http://travis-ci.org/ioquatix/vips)
6
8
 
7
- [libvips]: https://jcupitt.github.io/libvips
9
+ [libvips]: https://libvips.github.io/libvips
8
10
 
9
11
  ## Installation
10
12
 
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'vips'
4
+
5
+ file = File.open ARGV[0], "rb"
6
+ source = Vips::SourceCustom.new
7
+ source.on_read { |length| file.read length }
8
+ # this method is optional
9
+ # source.on_seek { |offset, whence| file.seek(offset, whence) }
10
+
11
+ dest = File.open ARGV[1], "wb"
12
+ target = Vips::TargetCustom.new
13
+ target.on_write { |chunk| dest.write(chunk) }
14
+ target.on_finish { dest.close }
15
+
16
+ image = Vips::Image.new_from_source source, "", access: :sequential
17
+ image.write_to_target target, ".png"
@@ -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
- [0.8951, 0.2664, -0.1614],
17
- [-0.7502, 1.7135, 0.0367],
18
- [0.0389, -0.0685, 1.0296]
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
- [0.987, -0.147, 0.16],
22
- [0.432, 0.5184, 0.0493],
23
- [-0.0085, 0.04, 0.968]
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
- [1, 0, 0],
51
- [0.7, 0, 0.3],
52
- [0, 0, 1]
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
- [0, 0, 0],
66
- [0.7, 1, 0],
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
@@ -5,8 +5,7 @@ require 'vips'
5
5
 
6
6
  GLib::logger.level = Logger::DEBUG
7
7
 
8
- op = Vips::Operation.new "black"
8
+ Vips::Operation.new "black"
9
9
 
10
- op = nil
11
10
  GC.start
12
11
  Vips::Operation.print_all
@@ -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
@@ -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
- [-1, -1, -1],
27
- [-1, 16, -1],
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
- # nil being the default
35
- glib_log_domain = nil
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
-
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'vips'
4
+
5
+ image = Vips::Image.black 1, 100000
6
+ image.set_progress true
7
+
8
+ def progress_to_s(name, progress)
9
+ puts "#{name}:"
10
+ puts " progress.run = #{progress[:run]}"
11
+ puts " progress.eta = #{progress[:eta]}"
12
+ puts " progress.tpels = #{progress[:tpels]}"
13
+ puts " progress.npels = #{progress[:npels]}"
14
+ puts " progress.percent = #{progress[:percent]}"
15
+ end
16
+
17
+ image.signal_connect :preeval do |progress|
18
+ progress_to_s("preeval", progress)
19
+ end
20
+
21
+ image.signal_connect :eval do |progress|
22
+ progress_to_s("eval", progress)
23
+ image.set_kill(true) if progress[:percent] > 50
24
+ end
25
+
26
+ image.signal_connect :posteval do |progress|
27
+ progress_to_s("posteval", progress)
28
+ end
29
+
30
+ image.avg
@@ -24,8 +24,6 @@ end
24
24
 
25
25
  ARGV.each do |filename|
26
26
  puts "processing #{filename} ..."
27
- thumb = via_memory(filename, 500)
28
- # thumb = via_files(filename, 500)
27
+ _thumb = via_memory(filename, 500)
28
+ # _thumb = via_files(filename, 500)
29
29
  end
30
-
31
-
@@ -23,16 +23,16 @@ mask = (im.median - background).abs > 10
23
23
  # direction
24
24
  columns, rows = mask.project
25
25
 
26
- first_column, first_row = columns.profile
26
+ _first_column, first_row = columns.profile
27
27
  left = first_row.min
28
28
 
29
- first_column, first_row = columns.fliphor.profile
29
+ _first_column, first_row = columns.fliphor.profile
30
30
  right = columns.width - first_row.min
31
31
 
32
- first_column, first_row = rows.profile
32
+ first_column, _first_row = rows.profile
33
33
  top = first_column.min
34
34
 
35
- first_column, first_row = rows.flipver.profile
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
@@ -8,9 +8,9 @@ prefix = ENV['PREFIX'] || File.dirname(__dir__)
8
8
 
9
9
  task :fetch do
10
10
  url = "https://github.com/libvips/libvips/releases/download/v#{version}/#{archive_path}"
11
-
11
+
12
12
  unless File.exist? archive_path
13
- sh "wget #{url}"
13
+ sh "wget #{url} -O #{archive_path}"
14
14
  end
15
15
  end
16
16
 
@@ -10,6 +10,29 @@ require 'logger'
10
10
  # This module uses FFI to make a simple layer over the glib and gobject
11
11
  # libraries.
12
12
 
13
+ # Generate a library name for ffi.
14
+ #
15
+ # Platform notes:
16
+ # linux:
17
+ # Some distros allow "libvips.so", but only if the -dev headers have been
18
+ # installed. To work everywhere, you must include the ABI number.
19
+ # Confusingly, the file extension is not at the end. ffi adds the "lib"
20
+ # prefix.
21
+ # mac:
22
+ # As linux, but the extension is at the end and is added by ffi.
23
+ # windows:
24
+ # The ABI number must be included, but with a hyphen. ffi does not add a
25
+ # "lib" prefix or a ".dll" suffix.
26
+ def library_name(name, abi_number)
27
+ if FFI::Platform.windows?
28
+ "lib#{name}-#{abi_number}.dll"
29
+ elsif FFI::Platform.mac?
30
+ "#{name}.#{abi_number}"
31
+ else
32
+ "#{name}.so.#{abi_number}"
33
+ end
34
+ end
35
+
13
36
  module GLib
14
37
  class << self
15
38
  attr_accessor :logger
@@ -19,13 +42,7 @@ module GLib
19
42
 
20
43
  extend FFI::Library
21
44
 
22
- if FFI::Platform.windows?
23
- glib_libname = 'libglib-2.0-0.dll'
24
- else
25
- glib_libname = 'glib-2.0'
26
- end
27
-
28
- ffi_lib glib_libname
45
+ ffi_lib library_name('glib-2.0', 0)
29
46
 
30
47
  attach_function :g_malloc, [:size_t], :pointer
31
48
 
@@ -43,7 +60,7 @@ module GLib
43
60
  LOG_FLAG_FATAL = 1 << 1
44
61
 
45
62
  # GLib log levels
46
- LOG_LEVEL_ERROR = 1 << 2 # always fatal
63
+ LOG_LEVEL_ERROR = 1 << 2 # always fatal
47
64
  LOG_LEVEL_CRITICAL = 1 << 3
48
65
  LOG_LEVEL_WARNING = 1 << 4
49
66
  LOG_LEVEL_MESSAGE = 1 << 5
@@ -52,12 +69,12 @@ module GLib
52
69
 
53
70
  # map glib levels to Logger::Severity
54
71
  GLIB_TO_SEVERITY = {
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
72
+ LOG_LEVEL_ERROR => Logger::ERROR,
73
+ LOG_LEVEL_CRITICAL => Logger::FATAL,
74
+ LOG_LEVEL_WARNING => Logger::WARN,
75
+ LOG_LEVEL_MESSAGE => Logger::UNKNOWN,
76
+ LOG_LEVEL_INFO => Logger::INFO,
77
+ LOG_LEVEL_DEBUG => Logger::DEBUG
61
78
  }
62
79
  GLIB_TO_SEVERITY.default = Logger::UNKNOWN
63
80
 
@@ -66,7 +83,7 @@ module GLib
66
83
  @glib_log_handler_id = 0
67
84
 
68
85
  # module-level, so it's not GCd away
69
- LOG_HANDLER = Proc.new do |domain, level, message, user_data|
86
+ LOG_HANDLER = Proc.new do |domain, level, message, _user_data|
70
87
  @logger.log(GLIB_TO_SEVERITY[level], message, domain)
71
88
  end
72
89
 
@@ -111,21 +128,13 @@ module GLib
111
128
  GLib::remove_log_handler
112
129
  }
113
130
  end
114
-
115
131
  end
116
-
117
132
  end
118
133
 
119
134
  module GObject
120
135
  extend FFI::Library
121
136
 
122
- if FFI::Platform.windows?
123
- gobject_libname = 'libgobject-2.0-0.dll'
124
- else
125
- gobject_libname = 'gobject-2.0'
126
- end
127
-
128
- ffi_lib gobject_libname
137
+ ffi_lib library_name('gobject-2.0', 0)
129
138
 
130
139
  # we can't just use ulong, windows has different int sizing rules
131
140
  if FFI::Platform::ADDRESS_SIZE == 64
@@ -151,14 +160,13 @@ module GObject
151
160
  GFLAGS_TYPE = g_type_from_name "GFlags"
152
161
  GSTR_TYPE = g_type_from_name "gchararray"
153
162
  GOBJECT_TYPE = g_type_from_name "GObject"
154
-
155
163
  end
156
164
 
157
165
  require 'vips/gobject'
158
166
  require 'vips/gvalue'
159
167
 
160
168
  # This module provides a binding for the [libvips image processing
161
- # library](https://jcupitt.github.io/libvips/).
169
+ # library](https://libvips.github.io/libvips/).
162
170
  #
163
171
  # # Example
164
172
  #
@@ -204,6 +212,9 @@ require 'vips/gvalue'
204
212
  # memory buffers, create images that wrap C-style memory arrays, or make images
205
213
  # from constants.
206
214
  #
215
+ # Use {Source} and {Image.new_from_source} to load images from any data
216
+ # source, for example URIs.
217
+ #
207
218
  # The next line:
208
219
  #
209
220
  # ```ruby
@@ -245,6 +256,9 @@ require 'vips/gvalue'
245
256
  # suffix. You can also write formatted images to memory buffers, or dump
246
257
  # image data to a raw memory array.
247
258
  #
259
+ # Use {Target} and {Image#write_to_target} to write formatted images to
260
+ # any data sink, for example URIs.
261
+ #
248
262
  # # How it works
249
263
  #
250
264
  # The binding uses [ruby-ffi](https://github.com/ffi/ffi) to open the libvips
@@ -385,7 +399,7 @@ require 'vips/gvalue'
385
399
  #
386
400
  # https://developer.gnome.org/glib/stable/glib-Message-Logging.html
387
401
  #
388
- # You can disable wanrings by defining the `VIPS_WARNING` environment variable.
402
+ # You can disable warnings by defining the `VIPS_WARNING` environment variable.
389
403
  # You can enable info output by defining `VIPS_INFO`.
390
404
  #
391
405
  # # Exceptions
@@ -396,12 +410,12 @@ require 'vips/gvalue'
396
410
  # # Automatic YARD documentation
397
411
  #
398
412
  # The bulk of these API docs are generated automatically by
399
- # {Vips::generate_yard}. It examines
413
+ # {Vips::Yard::generate}. It examines
400
414
  # libvips and writes a summary of each operation and the arguments and options
401
415
  # that that operation expects.
402
416
  #
403
417
  # Use the [C API
404
- # docs](https://jcupitt.github.io/libvips/API/current)
418
+ # docs](https://libvips.github.io/libvips/API/current)
405
419
  # for more detail.
406
420
  #
407
421
  # # Enums
@@ -426,6 +440,55 @@ require 'vips/gvalue'
426
440
  # If you want to avoid the copies, you'll need to call drawing operations
427
441
  # yourself.
428
442
  #
443
+ # # Progress
444
+ #
445
+ # You can attach signal handlers to images to watch computation progress. For
446
+ # example:
447
+ #
448
+ # ```ruby
449
+ # image = Vips::Image.black 1, 100000
450
+ # image.set_progress true
451
+ #
452
+ # def progress_to_s(name, progress)
453
+ # puts "#{name}:"
454
+ # puts " run = #{progress[:run]}"
455
+ # puts " eta = #{progress[:eta]}"
456
+ # puts " tpels = #{progress[:tpels]}"
457
+ # puts " npels = #{progress[:npels]}"
458
+ # puts " percent = #{progress[:percent]}"
459
+ # end
460
+ #
461
+ # image.signal_connect :preeval do |progress|
462
+ # progress_to_s("preeval", progress)
463
+ # end
464
+ #
465
+ # image.signal_connect :eval do |progress|
466
+ # progress_to_s("eval", progress)
467
+ # image.set_kill(true) if progress[:percent] > 50
468
+ # end
469
+ #
470
+ # image.signal_connect :posteval do |progress|
471
+ # progress_to_s("posteval", progress)
472
+ # end
473
+ #
474
+ # image.avg
475
+ # ```
476
+ #
477
+ # The `:eval` signal will fire for every tile that is processed. You can stop
478
+ # progress with {Image#set_kill} and processing will end with an exception.
479
+ #
480
+ # User streams
481
+ #
482
+ # You can make your own input and output stream objects with {SourceCustom} and
483
+ # {TargetCustom}. For example:
484
+ #
485
+ # ```ruby
486
+ # file = File.open "some/file", "rb"
487
+ # source = Vips::SourceCustom.new
488
+ # source.on_read { |length| file.read length }
489
+ # image = Vips::Image.new_from_source source, "", access: "sequential"
490
+ # ```
491
+ #
429
492
  # # Overloads
430
493
  #
431
494
  # The wrapper defines the usual set of arithmetic, boolean and relational
@@ -465,7 +528,7 @@ module Vips
465
528
  if FFI::Platform.windows?
466
529
  vips_libname = 'libvips-42.dll'
467
530
  else
468
- vips_libname = File.expand_path(FFI::map_library_name('vips'), __dir__)
531
+ vips_libname = File.expand_path(FFI.map_library_name('vips'), __dir__)
469
532
  end
470
533
 
471
534
  ffi_lib vips_libname
@@ -528,7 +591,7 @@ module Vips
528
591
  # Turn libvips leak testing on and off. Handy for debugging ruby-vips, not
529
592
  # very useful for user code.
530
593
  def self.leak_set leak
531
- vips_leak_set (leak ? 1 : 0)
594
+ vips_leak_set((leak ? 1 : 0))
532
595
  end
533
596
 
534
597
  attach_function :vips_cache_set_max, [:int], :void
@@ -612,15 +675,18 @@ module Vips
612
675
  LIBRARY_VERSION = Vips::version_string
613
676
 
614
677
  # libvips has this arbitrary number as a sanity-check upper bound on image
615
- # size. It's sometimes useful for know whan calculating image ratios.
678
+ # size. It's sometimes useful to know when calculating scale factors.
616
679
  MAX_COORD = 10000000
617
-
618
680
  end
619
681
 
620
682
  require 'vips/object'
621
683
  require 'vips/operation'
622
684
  require 'vips/image'
623
685
  require 'vips/interpolate'
686
+ require 'vips/region'
624
687
  require 'vips/version'
625
-
626
-
688
+ require 'vips/connection'
689
+ require 'vips/source'
690
+ require 'vips/sourcecustom'
691
+ require 'vips/target'
692
+ require 'vips/targetcustom'