vips 8.10.5 → 8.12.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/vips/target.rb CHANGED
@@ -4,10 +4,10 @@
4
4
  # Author:: John Cupitt (mailto:jcupitt@gmail.com)
5
5
  # License:: MIT
6
6
 
7
- require 'ffi'
7
+ require "ffi"
8
8
 
9
9
  module Vips
10
- if Vips::at_least_libvips?(8, 9)
10
+ if Vips.at_least_libvips?(8, 9)
11
11
  attach_function :vips_target_new_to_descriptor, [:int], :pointer
12
12
  attach_function :vips_target_new_to_file, [:string], :pointer
13
13
  attach_function :vips_target_new_to_memory, [], :pointer
@@ -43,45 +43,44 @@ module Vips
43
43
  #
44
44
  # Pass targets to {Image#write_to_target} to write images to
45
45
  # them.
46
- #
46
+ #
47
47
  # @param descriptor [Integer] the file descriptor
48
48
  # @return [Target] the new Vips::Target
49
49
  def self.new_to_descriptor(descriptor)
50
- ptr = Vips::vips_target_new_to_descriptor descriptor
50
+ ptr = Vips.vips_target_new_to_descriptor descriptor
51
51
  raise Vips::Error if ptr.null?
52
52
 
53
53
  Vips::Target.new ptr
54
54
  end
55
55
 
56
- # Create a new target to a file name.
56
+ # Create a new target to a file name.
57
57
  #
58
58
  # Pass targets to {Image#write_to_target} to write images to
59
59
  # them.
60
- #
60
+ #
61
61
  # @param filename [String] the name of the file
62
62
  # @return [Target] the new Vips::Target
63
63
  def self.new_to_file(filename)
64
- raise Vips::Error, 'filename is nil' if filename.nil?
65
- ptr = Vips::vips_target_new_to_file filename
64
+ raise Vips::Error, "filename is nil" if filename.nil?
65
+ ptr = Vips.vips_target_new_to_file filename
66
66
  raise Vips::Error if ptr.null?
67
67
 
68
68
  Vips::Target.new ptr
69
69
  end
70
70
 
71
- # Create a new target to an area of memory.
71
+ # Create a new target to an area of memory.
72
72
  #
73
73
  # Pass targets to {Image#write_to_target} to write images to
74
74
  # them.
75
75
  #
76
- # Once the image has been written, use {Object#get}`("blob")` to read out
76
+ # Once the image has been written, use {Object#get}`("blob")` to read out
77
77
  # the data.
78
- #
78
+ #
79
79
  # @return [Target] the new Vips::Target
80
80
  def self.new_to_memory
81
- ptr = Vips::vips_target_new_to_memory
81
+ ptr = Vips.vips_target_new_to_memory
82
82
 
83
83
  Vips::Target.new ptr
84
84
  end
85
-
86
85
  end
87
86
  end
@@ -4,14 +4,14 @@
4
4
  # Author:: John Cupitt (mailto:jcupitt@gmail.com)
5
5
  # License:: MIT
6
6
 
7
- require 'ffi'
7
+ require "ffi"
8
8
 
9
9
  module Vips
10
- if Vips::at_least_libvips?(8, 9)
10
+ if Vips.at_least_libvips?(8, 9)
11
11
  attach_function :vips_target_custom_new, [], :pointer
12
12
  end
13
13
 
14
- # A target you can attach action signal handlers to to implememt
14
+ # A target you can attach action signal handlers to to implememt
15
15
  # custom output types.
16
16
  #
17
17
  # For example:
@@ -23,7 +23,7 @@ module Vips
23
23
  # image.write_to_target target, ".png"
24
24
  # ```
25
25
  #
26
- # (just an example -- of course in practice you'd use {Target#new_to_file}
26
+ # (just an example -- of course in practice you'd use {Target#new_to_file}
27
27
  # to write to a named file)
28
28
  class TargetCustom < Vips::Target
29
29
  module TargetCustomLayout
@@ -44,17 +44,17 @@ module Vips
44
44
  end
45
45
 
46
46
  def initialize
47
- pointer = Vips::vips_target_custom_new
47
+ pointer = Vips.vips_target_custom_new
48
48
  raise Vips::Error if pointer.null?
49
49
 
50
50
  super pointer
51
51
  end
52
52
 
53
53
  # The block is executed to write data to the source. The interface is
54
- # exactly as IO::write, ie. it should write the string and return the
54
+ # exactly as IO::write, ie. it should write the string and return the
55
55
  # number of bytes written.
56
56
  #
57
- # @yieldparam bytes [String] Write these bytes to the file
57
+ # @yieldparam bytes [String] Write these bytes to the file
58
58
  # @yieldreturn [Integer] The number of bytes written, or -1 on error
59
59
  def on_write &block
60
60
  signal_connect "write" do |p, len|
@@ -69,10 +69,9 @@ module Vips
69
69
  # The block is executed at the end of write. It should do any necessary
70
70
  # finishing action, such as closing a file.
71
71
  def on_finish &block
72
- signal_connect "finish" do
73
- block.call()
72
+ signal_connect "finish" do
73
+ block.call
74
74
  end
75
75
  end
76
-
77
76
  end
78
77
  end
data/lib/vips/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Vips
3
- VERSION = "8.10.5"
3
+ VERSION = "8.12.2"
4
4
  end
data/lib/vips.rb CHANGED
@@ -4,8 +4,8 @@
4
4
  # Author:: John Cupitt (mailto:jcupitt@gmail.com)
5
5
  # License:: MIT
6
6
 
7
- require 'ffi'
8
- require 'logger'
7
+ require "ffi"
8
+ require "logger"
9
9
 
10
10
  # This module uses FFI to make a simple layer over the glib and gobject
11
11
  # libraries.
@@ -27,9 +27,9 @@ def library_name(name, abi_number)
27
27
  if FFI::Platform.windows?
28
28
  "lib#{name}-#{abi_number}.dll"
29
29
  elsif FFI::Platform.mac?
30
- "#{name}.#{abi_number}"
30
+ "lib#{name}.#{abi_number}.dylib"
31
31
  else
32
- "#{name}.so.#{abi_number}"
32
+ "lib#{name}.so.#{abi_number}"
33
33
  end
34
34
  end
35
35
 
@@ -37,12 +37,12 @@ module GLib
37
37
  class << self
38
38
  attr_accessor :logger
39
39
  end
40
- @logger = Logger.new(STDOUT)
40
+ @logger = Logger.new($stdout)
41
41
  @logger.level = Logger::WARN
42
42
 
43
43
  extend FFI::Library
44
44
 
45
- ffi_lib library_name('glib-2.0', 0)
45
+ ffi_lib library_name("glib-2.0", 0)
46
46
 
47
47
  attach_function :g_malloc, [:size_t], :pointer
48
48
 
@@ -52,20 +52,20 @@ module GLib
52
52
 
53
53
  callback :g_log_func, [:string, :int, :string, :pointer], :void
54
54
  attach_function :g_log_set_handler,
55
- [:string, :int, :g_log_func, :pointer], :int
55
+ [:string, :int, :g_log_func, :pointer], :int
56
56
  attach_function :g_log_remove_handler, [:string, :int], :void
57
57
 
58
58
  # log flags
59
- LOG_FLAG_RECURSION = 1 << 0
60
- LOG_FLAG_FATAL = 1 << 1
59
+ LOG_FLAG_RECURSION = 1 << 0
60
+ LOG_FLAG_FATAL = 1 << 1
61
61
 
62
62
  # GLib log levels
63
- LOG_LEVEL_ERROR = 1 << 2 # always fatal
64
- LOG_LEVEL_CRITICAL = 1 << 3
65
- LOG_LEVEL_WARNING = 1 << 4
66
- LOG_LEVEL_MESSAGE = 1 << 5
67
- LOG_LEVEL_INFO = 1 << 6
68
- LOG_LEVEL_DEBUG = 1 << 7
63
+ LOG_LEVEL_ERROR = 1 << 2 # always fatal
64
+ LOG_LEVEL_CRITICAL = 1 << 3
65
+ LOG_LEVEL_WARNING = 1 << 4
66
+ LOG_LEVEL_MESSAGE = 1 << 5
67
+ LOG_LEVEL_INFO = 1 << 6
68
+ LOG_LEVEL_DEBUG = 1 << 7
69
69
 
70
70
  # map glib levels to Logger::Severity
71
71
  GLIB_TO_SEVERITY = {
@@ -83,9 +83,9 @@ module GLib
83
83
  @glib_log_handler_id = 0
84
84
 
85
85
  # module-level, so it's not GCd away
86
- LOG_HANDLER = Proc.new do |domain, level, message, _user_data|
86
+ LOG_HANDLER = proc { |domain, level, message, _user_data|
87
87
  @logger.log(GLIB_TO_SEVERITY[level], message, domain)
88
- end
88
+ }
89
89
 
90
90
  def self.remove_log_handler
91
91
  if @glib_log_handler_id != 0 && @glib_log_domain
@@ -95,7 +95,7 @@ module GLib
95
95
  end
96
96
 
97
97
  def self.set_log_domain domain
98
- GLib::remove_log_handler
98
+ GLib.remove_log_handler
99
99
 
100
100
  @glib_log_domain = domain
101
101
 
@@ -125,7 +125,7 @@ module GLib
125
125
  # on shutdown and we don't want LOG_HANDLER to be invoked
126
126
  # after Ruby has gone
127
127
  at_exit {
128
- GLib::remove_log_handler
128
+ GLib.remove_log_handler
129
129
  }
130
130
  end
131
131
  end
@@ -134,7 +134,7 @@ end
134
134
  module GObject
135
135
  extend FFI::Library
136
136
 
137
- ffi_lib library_name('gobject-2.0', 0)
137
+ ffi_lib library_name("gobject-2.0", 0)
138
138
 
139
139
  # we can't just use ulong, windows has different int sizing rules
140
140
  if FFI::Platform::ADDRESS_SIZE == 64
@@ -162,8 +162,8 @@ module GObject
162
162
  GOBJECT_TYPE = g_type_from_name "GObject"
163
163
  end
164
164
 
165
- require 'vips/gobject'
166
- require 'vips/gvalue'
165
+ require "vips/gobject"
166
+ require "vips/gvalue"
167
167
 
168
168
  # This module provides a binding for the [libvips image processing
169
169
  # library](https://libvips.github.io/libvips/).
@@ -208,12 +208,10 @@ require 'vips/gvalue'
208
208
  # for full details
209
209
  # on the various modes available.
210
210
  #
211
- # You can also load formatted images from
212
- # memory buffers, create images that wrap C-style memory arrays, or make images
213
- # from constants.
214
- #
215
- # Use {Source} and {Image.new_from_source} to load images from any data
216
- # source, for example URIs.
211
+ # You can also load formatted images from memory buffers, create images that
212
+ # wrap C-style memory arrays, or make images from constants. Use {Source}
213
+ # and {Image.new_from_source} to load images from any data source, for
214
+ # example URIs.
217
215
  #
218
216
  # The next line:
219
217
  #
@@ -256,7 +254,7 @@ require 'vips/gvalue'
256
254
  # suffix. You can also write formatted images to memory buffers, or dump
257
255
  # image data to a raw memory array.
258
256
  #
259
- # Use {Target} and {Image#write_to_target} to write formatted images to
257
+ # Use {Target} and {Image#write_to_target} to write formatted images to
260
258
  # any data sink, for example URIs.
261
259
  #
262
260
  # # How it works
@@ -409,36 +407,83 @@ require 'vips/gvalue'
409
407
  #
410
408
  # # Automatic YARD documentation
411
409
  #
412
- # The bulk of these API docs are generated automatically by
413
- # {Vips::Yard::generate}. It examines
414
- # libvips and writes a summary of each operation and the arguments and options
415
- # that that operation expects.
410
+ # The bulk of these API docs are generated automatically by {Yard#generate}.
411
+ # It examines libvips and writes a summary of each operation and the arguments
412
+ # and options that that operation expects.
416
413
  #
417
- # Use the [C API
418
- # docs](https://libvips.github.io/libvips/API/current)
414
+ # Use the [C API # docs](https://libvips.github.io/libvips/API/current)
419
415
  # for more detail.
420
416
  #
421
417
  # # Enums
422
418
  #
423
419
  # The libvips enums, such as `VipsBandFormat` appear in ruby-vips as Symbols
424
420
  # like `:uchar`. They are documented as a set of classes for convenience, see
425
- # the class list.
421
+ # {Vips::BandFormat}, for example.
426
422
  #
427
423
  # # Draw operations
428
424
  #
429
- # Paint operations like {Image#draw_circle} and {Image#draw_line}
430
- # modify their input image. This
431
- # makes them hard to use with the rest of libvips: you need to be very careful
432
- # about the order in which operations execute or you can get nasty crashes.
425
+ # There are two ways of calling the libvips draw operations, like
426
+ # {Image#draw_circle} and {Image#draw_line}.
427
+ #
428
+ # First, you can use them like functions. For example:
429
+ #
430
+ # ```ruby
431
+ # y = x.draw_line 255, 0, 0, x.width, x.height
432
+ # ```
433
+ #
434
+ # This will make a new image, `y`, which is a copy of `x` but with a line
435
+ # drawn across it. `x` is unchanged.
436
+ #
437
+ # This is simple, but will be slow if you want to draw many lines, since
438
+ # ruby-vips will make a copy of the whole image each time.
439
+ #
440
+ # You can use {Image#mutate} to make a {MutableImage}. This is an image which
441
+ # is unshared and is only available inside the {Image#mutate} block. Within
442
+ # this block, you can use `!` versions of the draw operations to modify images
443
+ # and avoid the copy. For example:
444
+ #
445
+ # ```ruby
446
+ # image = image.mutate do |mutable|
447
+ # (0 ... 1).step(0.01) do |i|
448
+ # mutable.draw_line! 255, mutable.width * i, 0, 0, mutable.height * (1 - i)
449
+ # end
450
+ # end
451
+ # ```
452
+ #
453
+ # Now each {Image#draw_line} will directly modify the mutable image, saving
454
+ # the copy. This is much faster and needs much less memory.
455
+ #
456
+ # # Metadata read
457
+ #
458
+ # Use {Image#get_fields} to get a list of the metadata fields that an image
459
+ # supports. ICC profiles, for example, are in a field called
460
+ # `icc-profile-data`. Use `vipsheader -a something.jpg` at the command-line
461
+ # to see all the fields on an image.
433
462
  #
434
- # The wrapper spots operations of this type and makes a private copy of the
435
- # image in memory before calling the operation. This stops crashes, but it does
436
- # make it inefficient. If you draw 100 lines on an image, for example, you'll
437
- # copy the image 100 times. The wrapper does make sure that memory is recycled
438
- # where possible, so you won't have 100 copies in memory.
463
+ # Use {Image#get_typeof} to get the type of a field. Types are integers, with
464
+ # 0 meaning "no such field". Constants like {GObject::GINT_TYPE} are useful for
465
+ # testing field types.
439
466
  #
440
- # If you want to avoid the copies, you'll need to call drawing operations
441
- # yourself.
467
+ # You can read image metadata using {Image#get}. The field value is converted
468
+ # to a Ruby value in the obvious way.
469
+ #
470
+ # # Metadata write
471
+ #
472
+ # You can also set and remove image metadata fields. Images are immutable, so
473
+ # you must make any changes inside a {Image#mutate} block. For example:
474
+ #
475
+ # ```ruby
476
+ # image = image.mutate do |mutable|
477
+ # image.get_fields.each do |field|
478
+ # mutable.remove! field unless field == "icc-profile-data"
479
+ # end
480
+ # end
481
+ # ```
482
+ #
483
+ # To remove all metadata except the icc profile.
484
+ #
485
+ # You can use {MutableImage#set!} to change the value of an existing field,
486
+ # and {MutableImage#set_type!} to create a new field with a specified type.
442
487
  #
443
488
  # # Progress
444
489
  #
@@ -448,7 +493,7 @@ require 'vips/gvalue'
448
493
  # ```ruby
449
494
  # image = Vips::Image.black 1, 100000
450
495
  # image.set_progress true
451
- #
496
+ #
452
497
  # def progress_to_s(name, progress)
453
498
  # puts "#{name}:"
454
499
  # puts " run = #{progress[:run]}"
@@ -457,23 +502,23 @@ require 'vips/gvalue'
457
502
  # puts " npels = #{progress[:npels]}"
458
503
  # puts " percent = #{progress[:percent]}"
459
504
  # end
460
- #
505
+ #
461
506
  # image.signal_connect :preeval do |progress|
462
507
  # progress_to_s("preeval", progress)
463
508
  # end
464
- #
509
+ #
465
510
  # image.signal_connect :eval do |progress|
466
511
  # progress_to_s("eval", progress)
467
512
  # image.set_kill(true) if progress[:percent] > 50
468
513
  # end
469
- #
514
+ #
470
515
  # image.signal_connect :posteval do |progress|
471
516
  # progress_to_s("posteval", progress)
472
517
  # end
473
- #
518
+ #
474
519
  # image.avg
475
520
  # ```
476
- #
521
+ #
477
522
  # The `:eval` signal will fire for every tile that is processed. You can stop
478
523
  # progress with {Image#set_kill} and processing will end with an exception.
479
524
  #
@@ -525,21 +570,22 @@ require 'vips/gvalue'
525
570
  module Vips
526
571
  extend FFI::Library
527
572
 
528
- if FFI::Platform.windows?
529
- vips_libname = 'libvips-42.dll'
530
- else
531
- vips_libname = File.expand_path(FFI.map_library_name('vips'), __dir__)
532
- end
533
-
534
- ffi_lib vips_libname
573
+ ffi_lib File.expand_path(library_name("vips", 42), __dir__)
535
574
 
536
575
  LOG_DOMAIN = "VIPS"
537
- GLib::set_log_domain LOG_DOMAIN
576
+ GLib.set_log_domain LOG_DOMAIN
538
577
 
539
- typedef :ulong, :GType
578
+ # we can't just use ulong, windows has different int sizing rules
579
+ if FFI::Platform::ADDRESS_SIZE == 64
580
+ typedef :uint64, :GType
581
+ else
582
+ typedef :uint32, :GType
583
+ end
540
584
 
541
585
  attach_function :vips_error_buffer, [], :string
542
586
  attach_function :vips_error_clear, [], :void
587
+ attach_function :vips_error_freeze, [], :void
588
+ attach_function :vips_error_thaw, [], :void
543
589
 
544
590
  # The ruby-vips error class.
545
591
  class Error < RuntimeError
@@ -548,9 +594,9 @@ module Vips
548
594
  def initialize msg = nil
549
595
  if msg
550
596
  @details = msg
551
- elsif Vips::vips_error_buffer != ""
552
- @details = Vips::vips_error_buffer
553
- Vips::vips_error_clear
597
+ elsif Vips.vips_error_buffer != ""
598
+ @details = Vips.vips_error_buffer
599
+ Vips.vips_error_clear
554
600
  else
555
601
  @details = nil
556
602
  end
@@ -560,7 +606,7 @@ module Vips
560
606
  #
561
607
  # @return [String] The error message
562
608
  def to_s
563
- if @details != nil
609
+ if !@details.nil?
564
610
  @details
565
611
  else
566
612
  super.to_s
@@ -570,8 +616,8 @@ module Vips
570
616
 
571
617
  attach_function :vips_init, [:string], :int
572
618
 
573
- if Vips::vips_init($0) != 0
574
- throw Vips::get_error
619
+ if Vips.vips_init($0) != 0
620
+ throw Vips.get_error
575
621
  end
576
622
 
577
623
  # don't use at_exit to call vips_shutdown, it causes problems with fork, and
@@ -579,7 +625,12 @@ module Vips
579
625
 
580
626
  attach_function :vips_leak_set, [:int], :void
581
627
  attach_function :vips_vector_set_enabled, [:int], :void
628
+ attach_function :vips_vector_isenabled, [], :int
582
629
  attach_function :vips_concurrency_set, [:int], :void
630
+ attach_function :vips_concurrency_get, [], :int
631
+
632
+ # Track the original default concurrency so we can reset to it.
633
+ DEFAULT_CONCURRENCY = vips_concurrency_get
583
634
 
584
635
  # vips_foreign_get_suffixes was added in libvips 8.8
585
636
  begin
@@ -594,20 +645,66 @@ module Vips
594
645
  vips_leak_set((leak ? 1 : 0))
595
646
  end
596
647
 
648
+ attach_function :vips_tracked_get_mem, [], :int
649
+ attach_function :vips_tracked_get_mem_highwater, [], :int
650
+ attach_function :vips_tracked_get_allocs, [], :int
651
+ attach_function :vips_tracked_get_files, [], :int
652
+ attach_function :vips_cache_get_max, [], :int
653
+ attach_function :vips_cache_get_max_mem, [], :int
654
+ attach_function :vips_cache_get_max_files, [], :int
597
655
  attach_function :vips_cache_set_max, [:int], :void
598
656
  attach_function :vips_cache_set_max_mem, [:int], :void
599
657
  attach_function :vips_cache_set_max_files, [:int], :void
658
+ attach_function :vips_cache_print, [], :void
659
+ attach_function :vips_cache_drop_all, [], :void
660
+
661
+ # Get the number of bytes currently allocated via vips_malloc.
662
+ def self.tracked_mem
663
+ vips_tracked_get_mem
664
+ end
665
+
666
+ # Get the greatest number of bytes ever actively allocated via vips_malloc.
667
+ def self.tracked_mem_highwater
668
+ vips_tracked_get_mem_highwater
669
+ end
670
+
671
+ # Get the number of active allocations.
672
+ def self.tracked_allocs
673
+ vips_tracked_get_allocs
674
+ end
675
+
676
+ # Get the number of open files.
677
+ def self.tracked_files
678
+ vips_tracked_get_files
679
+ end
680
+
681
+ # Get the maximum number of operations that libvips should cache.
682
+ def self.cache_max
683
+ vips_cache_get_max
684
+ end
685
+
686
+ # Get the maximum amount of memory that libvips uses for the operation cache.
687
+ def self.cache_max_mem
688
+ vips_cache_get_max_mem
689
+ end
690
+
691
+ # Get the maximum number of files libvips keeps open in the operation cache.
692
+ def self.cache_max_files
693
+ vips_cache_get_max_files
694
+ end
600
695
 
601
696
  # Set the maximum number of operations that libvips should cache. Set 0 to
602
697
  # disable the operation cache. The default is 1000.
603
698
  def self.cache_set_max size
604
699
  vips_cache_set_max size
700
+ cache_max
605
701
  end
606
702
 
607
703
  # Set the maximum amount of memory that libvips should use for the operation
608
704
  # cache. Set 0 to disable the operation cache. The default is 100mb.
609
705
  def self.cache_set_max_mem size
610
706
  vips_cache_set_max_mem size
707
+ cache_max_mem
611
708
  end
612
709
 
613
710
  # Set the maximum number of files libvips should keep open in the
@@ -615,12 +712,43 @@ module Vips
615
712
  # 100.
616
713
  def self.cache_set_max_files size
617
714
  vips_cache_set_max_files size
715
+ cache_max_files
716
+ end
717
+
718
+ # Print the libvips operation cache to stdout. Handy for debugging.
719
+ def self.cache_print # :nodoc:
720
+ vips_cache_print
721
+ end
722
+
723
+ # Drop the libvips operation cache. Handy for leak tracking.
724
+ def self.cache_drop_all # :nodoc:
725
+ vips_cache_drop_all
618
726
  end
619
727
 
620
- # Set the size of the libvips worker pool. This defaults to the number of
621
- # hardware threads on your computer. Set to 1 to disable threading.
728
+ # Get the size of libvips worker pools. Defaults to the VIPS_CONCURRENCY env
729
+ # var or the number of hardware threads on your computer.
730
+ def self.concurrency
731
+ vips_concurrency_get
732
+ end
733
+
734
+ # Get the default size of libvips worker pools.
735
+ def self.concurrency_default
736
+ DEFAULT_CONCURRENCY
737
+ end
738
+
739
+ # Set the size of each libvips worker pool. Max 1024 threads. Set to 1 to
740
+ # disable threading. Set to 0 or nil to reset to default.
622
741
  def self.concurrency_set n
742
+ n = DEFAULT_CONCURRENCY if n.to_i == 0
623
743
  vips_concurrency_set n
744
+ concurrency
745
+ end
746
+
747
+ # Whether SIMD and the run-time compiler are enabled. This can give a nice
748
+ # speed-up, but can also be unstable on some systems or with some versions
749
+ # of the run-time compiler.
750
+ def self.vector?
751
+ vips_vector_isenabled == 1
624
752
  end
625
753
 
626
754
  # Enable or disable SIMD and the run-time compiler. This can give a nice
@@ -628,6 +756,7 @@ module Vips
628
756
  # of the run-time compiler.
629
757
  def self.vector_set enabled
630
758
  vips_vector_set_enabled(enabled ? 1 : 0)
759
+ vector?
631
760
  end
632
761
 
633
762
  # Deprecated compatibility function.
@@ -635,7 +764,7 @@ module Vips
635
764
  # Don't use this, instead change GLib::logger.level.
636
765
  def self.set_debug debug
637
766
  if debug
638
- GLib::logger.level = Logger::DEBUG
767
+ GLib.logger.level = Logger::DEBUG
639
768
  end
640
769
  end
641
770
 
@@ -657,36 +786,37 @@ module Vips
657
786
  # vips_foreign_get_suffixes() was added in libvips 8.8
658
787
  return [] unless Vips.respond_to? :vips_foreign_get_suffixes
659
788
 
660
- array = Vips::vips_foreign_get_suffixes
789
+ array = Vips.vips_foreign_get_suffixes
661
790
 
662
791
  names = []
663
792
  p = array
664
793
  until (q = p.read_pointer).null?
665
794
  suff = q.read_string
666
- GLib::g_free q
795
+ GLib.g_free q
667
796
  names << suff unless names.include? suff
668
797
  p += FFI::Type::POINTER.size
669
798
  end
670
- GLib::g_free array
799
+ GLib.g_free array
671
800
 
672
801
  names
673
802
  end
674
803
 
675
- LIBRARY_VERSION = Vips::version_string
804
+ LIBRARY_VERSION = Vips.version_string
676
805
 
677
806
  # libvips has this arbitrary number as a sanity-check upper bound on image
678
807
  # size. It's sometimes useful to know when calculating scale factors.
679
808
  MAX_COORD = 10000000
680
809
  end
681
810
 
682
- require 'vips/object'
683
- require 'vips/operation'
684
- require 'vips/image'
685
- require 'vips/interpolate'
686
- require 'vips/region'
687
- require 'vips/version'
688
- require 'vips/connection'
689
- require 'vips/source'
690
- require 'vips/sourcecustom'
691
- require 'vips/target'
692
- require 'vips/targetcustom'
811
+ require "vips/object"
812
+ require "vips/operation"
813
+ require "vips/image"
814
+ require "vips/mutableimage"
815
+ require "vips/interpolate"
816
+ require "vips/region"
817
+ require "vips/version"
818
+ require "vips/connection"
819
+ require "vips/source"
820
+ require "vips/sourcecustom"
821
+ require "vips/target"
822
+ require "vips/targetcustom"