ruby-vips 2.0.14 → 2.0.15

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.
@@ -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
- - version bump
10
+ - lint
11
11
 
12
- edit lib/vips/version.rb
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.14
1
+ 2.0.15
@@ -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
-
@@ -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
@@ -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 # always fatal
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
- 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
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, user_data|
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 wanrings by defining the `VIPS_WARNING` environment variable.
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 (leak ? 1 : 0)
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
-
@@ -1,5 +1,4 @@
1
1
  module Vips
2
-
3
2
  # Various types of alignment. See {Image#join}, for example.
4
3
  #
5
4
  # * `:low` Align on the low coordinate edge
@@ -1,5 +1,4 @@
1
1
  module Vips
2
-
3
2
  # Various fixed 90 degree rotation angles. See {Image#rot}.
4
3
  #
5
4
  # * `:d0` no rotate
@@ -1,5 +1,4 @@
1
1
  module Vips
2
-
3
2
  # Various fixed 45 degree rotation angles. See {Image#rot45}.
4
3
  #
5
4
  # * `:d0` no rotate
@@ -1,5 +1,4 @@
1
1
  module Vips
2
-
3
2
  # The format used for each band element. Each corresponds to a native C type
4
3
  # for the current machine.
5
4
  #
@@ -16,5 +15,4 @@ module Vips
16
15
  # * `:dpcomplex` double complex (two double) format
17
16
  class BandFormat < Symbol
18
17
  end
19
-
20
18
  end
@@ -1,5 +1,4 @@
1
1
  module Vips
2
-
3
2
  # Blend mode to use when compositing images. See {Image#composite}.
4
3
  #
5
4
  # `:clear` - where the second object is drawn, the first is removed
@@ -31,4 +30,3 @@ module Vips
31
30
  class BlendMode < Symbol
32
31
  end
33
32
  end
34
-
@@ -1,5 +1,4 @@
1
1
  module Vips
2
-
3
2
  # How pixels are coded.
4
3
  #
5
4
  # Normally, pixels are uncoded and can be manipulated as you would expect.
@@ -1,5 +1,4 @@
1
1
  module Vips
2
-
3
2
  # A direction on a compass used for placing images. See {Image#gravity}.
4
3
  #
5
4
  # * `:centre`
@@ -1,5 +1,4 @@
1
1
  module Vips
2
-
3
2
  # Operations like {Image#flip} need to be told whether to flip
4
3
  # left-right or top-bottom.
5
4
  #
@@ -1,5 +1,4 @@
1
1
  module Vips
2
-
3
2
  # When the edges of an image are extended, you can specify
4
3
  # how you want the extension done.
5
4
  # See {Image#embed}, {Image#conv}, {Image#affine} and
@@ -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