ruby-vips 2.1.3 → 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.
@@ -48,7 +48,8 @@ module Vips
48
48
  class Introspect
49
49
  attr_reader :name, :description, :flags, :args, :required_input,
50
50
  :optional_input, :required_output, :optional_output, :member_x,
51
- :method_args, :vips_name, :destructive
51
+ :method_args, :vips_name, :destructive, :doc_optional_input,
52
+ :doc_optional_output
52
53
 
53
54
  @@introspect_cache = {}
54
55
 
@@ -142,13 +143,15 @@ module Vips
142
143
  @flags = Vips.vips_operation_get_flags @op
143
144
  @member_x = nil
144
145
  @method_args = []
146
+ @doc_optional_input = {}
147
+ @doc_optional_output = {}
145
148
 
146
149
  @args.each do |details|
147
150
  arg_name = details[:arg_name]
148
151
  flags = details[:flags]
149
152
  gtype = details[:gtype]
150
153
 
151
- details[:yard_name] = arg_name == "in" ? "im" : arg_name
154
+ details[:yard_name] = (arg_name == "in") ? "im" : arg_name
152
155
  pspec = @op.get_pspec arg_name
153
156
  details[:blurb] = GObject.g_param_spec_get_blurb pspec
154
157
 
@@ -164,6 +167,17 @@ module Vips
164
167
  end
165
168
  end
166
169
  end
170
+
171
+ # and make the arg sets to document by filtering out deprecated args
172
+ @optional_input.each do |arg_name, details|
173
+ next if (details[:flags] & ARGUMENT_DEPRECATED) != 0
174
+ @doc_optional_input[details[:arg_name]] = details
175
+ end
176
+
177
+ @optional_output.each do |arg_name, details|
178
+ next if (details[:flags] & ARGUMENT_DEPRECATED) != 0
179
+ @doc_optional_output[details[:arg_name]] = details
180
+ end
167
181
  end
168
182
 
169
183
  def self.get name
data/lib/vips/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vips
2
- VERSION = "2.1.3"
2
+ VERSION = "2.2.0"
3
3
  end
data/lib/vips.rb CHANGED
@@ -584,6 +584,8 @@ module Vips
584
584
 
585
585
  attach_function :vips_error_buffer, [], :string
586
586
  attach_function :vips_error_clear, [], :void
587
+ attach_function :vips_error_freeze, [], :void
588
+ attach_function :vips_error_thaw, [], :void
587
589
 
588
590
  # The ruby-vips error class.
589
591
  class Error < RuntimeError
@@ -623,7 +625,12 @@ module Vips
623
625
 
624
626
  attach_function :vips_leak_set, [:int], :void
625
627
  attach_function :vips_vector_set_enabled, [:int], :void
628
+ attach_function :vips_vector_isenabled, [], :int
626
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
627
634
 
628
635
  # vips_foreign_get_suffixes was added in libvips 8.8
629
636
  begin
@@ -638,20 +645,66 @@ module Vips
638
645
  vips_leak_set((leak ? 1 : 0))
639
646
  end
640
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
641
655
  attach_function :vips_cache_set_max, [:int], :void
642
656
  attach_function :vips_cache_set_max_mem, [:int], :void
643
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
644
695
 
645
696
  # Set the maximum number of operations that libvips should cache. Set 0 to
646
697
  # disable the operation cache. The default is 1000.
647
698
  def self.cache_set_max size
648
699
  vips_cache_set_max size
700
+ cache_max
649
701
  end
650
702
 
651
703
  # Set the maximum amount of memory that libvips should use for the operation
652
704
  # cache. Set 0 to disable the operation cache. The default is 100mb.
653
705
  def self.cache_set_max_mem size
654
706
  vips_cache_set_max_mem size
707
+ cache_max_mem
655
708
  end
656
709
 
657
710
  # Set the maximum number of files libvips should keep open in the
@@ -659,12 +712,43 @@ module Vips
659
712
  # 100.
660
713
  def self.cache_set_max_files size
661
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
662
732
  end
663
733
 
664
- # Set the size of the libvips worker pool. This defaults to the number of
665
- # 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.
666
741
  def self.concurrency_set n
742
+ n = DEFAULT_CONCURRENCY if n.to_i == 0
667
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
668
752
  end
669
753
 
670
754
  # Enable or disable SIMD and the run-time compiler. This can give a nice
@@ -672,6 +756,7 @@ module Vips
672
756
  # of the run-time compiler.
673
757
  def self.vector_set enabled
674
758
  vips_vector_set_enabled(enabled ? 1 : 0)
759
+ vector?
675
760
  end
676
761
 
677
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.3
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-08-23 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: []