ruby-vips 2.1.4 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -96,6 +96,13 @@ module Vips
96
96
  Vips::Operation.call name.to_s, [self, *args], options
97
97
  end
98
98
 
99
+ # Draw a point on an image.
100
+ #
101
+ # See {Image#draw_rect}.
102
+ def draw_point! ink, left, top, **opts
103
+ draw_rect! ink, left, top, 1, 1, **opts
104
+ end
105
+
99
106
  # Create a metadata item on an image of the specifed type. Ruby types
100
107
  # are automatically transformed into the matching glib type (eg.
101
108
  # {GObject::GINT_TYPE}), if possible.
@@ -151,7 +151,7 @@ module Vips
151
151
  flags = details[:flags]
152
152
  gtype = details[:gtype]
153
153
 
154
- details[:yard_name] = arg_name == "in" ? "im" : arg_name
154
+ details[:yard_name] = (arg_name == "in") ? "im" : arg_name
155
155
  pspec = @op.get_pspec arg_name
156
156
  details[:blurb] = GObject.g_param_spec_get_blurb pspec
157
157
 
data/lib/vips/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vips
2
- VERSION = "2.1.4"
2
+ VERSION = "2.2.0"
3
3
  end
data/lib/vips.rb CHANGED
@@ -625,7 +625,12 @@ module Vips
625
625
 
626
626
  attach_function :vips_leak_set, [:int], :void
627
627
  attach_function :vips_vector_set_enabled, [:int], :void
628
+ attach_function :vips_vector_isenabled, [], :int
628
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
629
634
 
630
635
  # vips_foreign_get_suffixes was added in libvips 8.8
631
636
  begin
@@ -640,20 +645,66 @@ module Vips
640
645
  vips_leak_set((leak ? 1 : 0))
641
646
  end
642
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
643
655
  attach_function :vips_cache_set_max, [:int], :void
644
656
  attach_function :vips_cache_set_max_mem, [:int], :void
645
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
646
695
 
647
696
  # Set the maximum number of operations that libvips should cache. Set 0 to
648
697
  # disable the operation cache. The default is 1000.
649
698
  def self.cache_set_max size
650
699
  vips_cache_set_max size
700
+ cache_max
651
701
  end
652
702
 
653
703
  # Set the maximum amount of memory that libvips should use for the operation
654
704
  # cache. Set 0 to disable the operation cache. The default is 100mb.
655
705
  def self.cache_set_max_mem size
656
706
  vips_cache_set_max_mem size
707
+ cache_max_mem
657
708
  end
658
709
 
659
710
  # Set the maximum number of files libvips should keep open in the
@@ -661,12 +712,43 @@ module Vips
661
712
  # 100.
662
713
  def self.cache_set_max_files size
663
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
726
+ end
727
+
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
664
732
  end
665
733
 
666
- # Set the size of the libvips worker pool. This defaults to the number of
667
- # hardware threads on your computer. Set to 1 to disable threading.
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.
668
741
  def self.concurrency_set n
742
+ n = DEFAULT_CONCURRENCY if n.to_i == 0
669
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
670
752
  end
671
753
 
672
754
  # Enable or disable SIMD and the run-time compiler. This can give a nice
@@ -674,6 +756,7 @@ module Vips
674
756
  # of the run-time compiler.
675
757
  def self.vector_set enabled
676
758
  vips_vector_set_enabled(enabled ? 1 : 0)
759
+ vector?
677
760
  end
678
761
 
679
762
  # Deprecated compatibility function.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-vips
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Cupitt
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-20 00:00:00.000000000 Z
11
+ date: 2023-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -135,6 +135,7 @@ files:
135
135
  - example/example5.rb
136
136
  - example/inheritance_with_refcount.rb
137
137
  - example/progress.rb
138
+ - example/revalidate.rb
138
139
  - example/thumb.rb
139
140
  - example/trim8.rb
140
141
  - example/watermark.rb
@@ -189,7 +190,7 @@ metadata:
189
190
  homepage_uri: http://github.com/libvips/ruby-vips
190
191
  source_code_uri: https://github.com/libvips/ruby-vips
191
192
  msys2_mingw_dependencies: libvips
192
- post_install_message:
193
+ post_install_message:
193
194
  rdoc_options: []
194
195
  require_paths:
195
196
  - lib
@@ -204,8 +205,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
204
205
  - !ruby/object:Gem::Version
205
206
  version: '0'
206
207
  requirements: []
207
- rubygems_version: 3.2.5
208
- signing_key:
208
+ rubygems_version: 3.3.15
209
+ signing_key:
209
210
  specification_version: 4
210
211
  summary: A fast image processing library with low memory needs
211
212
  test_files: []