ruby-vips 2.2.0 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/test.yml +4 -6
- data/CHANGELOG.md +11 -0
- data/VERSION +1 -1
- data/lib/vips/image.rb +8 -1
- data/lib/vips/interpolate.rb +3 -3
- data/lib/vips/mutableimage.rb +1 -1
- data/lib/vips/object.rb +1 -3
- data/lib/vips/operation.rb +15 -10
- data/lib/vips/region.rb +3 -3
- data/lib/vips/sourcecustom.rb +1 -1
- data/lib/vips/targetcustom.rb +1 -1
- data/lib/vips/version.rb +1 -1
- data/lib/vips.rb +60 -5
- data/ruby-vips.gemspec +1 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f57995edbbad929820ab97faae77cefac5596a6c4e440abfd86dc67a1a3ef6e3
|
4
|
+
data.tar.gz: 2cf84c9faced0678582b7858a1eac8c870e800bbf275c54427cf6f9564a76c13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48a29e47be77eca5d376af0f52969b7cf051eced8467c10206ae7ab10d8e48a25482a9c4402116ceb5dbc6fbc034fcc6aa340324bd77330d191d8920af1efb8b
|
7
|
+
data.tar.gz: e3ee97a320b95e9d897cd79754e1db0124c32c2f751e170896e70deecf72bddefa21f1dfda5ea5966846dccbbc95544e5e4ecffc0ebeb0d9f429802c8c62a6a3
|
data/.github/workflows/test.yml
CHANGED
@@ -20,7 +20,7 @@ jobs:
|
|
20
20
|
|
21
21
|
steps:
|
22
22
|
- name: Checkout code
|
23
|
-
uses: actions/checkout@
|
23
|
+
uses: actions/checkout@v4
|
24
24
|
|
25
25
|
- name: Set up Ruby
|
26
26
|
uses: ruby/setup-ruby@v1
|
@@ -38,9 +38,6 @@ jobs:
|
|
38
38
|
matrix:
|
39
39
|
os-version: [ 'ubuntu-20.04' ]
|
40
40
|
ruby-version:
|
41
|
-
- '2.0'
|
42
|
-
- '2.1'
|
43
|
-
- '2.2'
|
44
41
|
- '2.3'
|
45
42
|
- '2.4'
|
46
43
|
- '2.5'
|
@@ -49,6 +46,7 @@ jobs:
|
|
49
46
|
- '3.0'
|
50
47
|
- '3.1'
|
51
48
|
- '3.2'
|
49
|
+
- '3.3'
|
52
50
|
- jruby
|
53
51
|
fail-fast: true
|
54
52
|
|
@@ -56,7 +54,7 @@ jobs:
|
|
56
54
|
|
57
55
|
steps:
|
58
56
|
- name: Checkout code
|
59
|
-
uses: actions/checkout@
|
57
|
+
uses: actions/checkout@v4
|
60
58
|
|
61
59
|
- name: Set up Ruby
|
62
60
|
uses: ruby/setup-ruby@v1
|
@@ -75,7 +73,7 @@ jobs:
|
|
75
73
|
DEBIAN_FRONTEND: noninteractive
|
76
74
|
run:
|
77
75
|
# we only need the library
|
78
|
-
sudo apt-get install --fix-missing -qq -o Acquire::Retries=3
|
76
|
+
sudo apt-get install --no-install-recommends --fix-missing -qq -o Acquire::Retries=3
|
79
77
|
libvips
|
80
78
|
|
81
79
|
- name: Run Tests
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,17 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## Version 2.2.2 (2024-07-17)
|
6
|
+
|
7
|
+
* fix compat with unified (semistatic) libvips binaries [kleisauke]
|
8
|
+
|
9
|
+
## Version 2.2.1 (2024-02-21)
|
10
|
+
|
11
|
+
* add `Vips.block_untrusted` method to block all untrusted operations. Only for libvips >= 8.13. [Docs](https://www.libvips.org/API/current/libvips-vips.html#vips-block-untrusted-set). [#382](https://github.com/libvips/ruby-vips/pull/382) [aglushkov](https://github.com/aglushkov)
|
12
|
+
* add `Vips.block` method to block specific operation. Only for libvips >= 8.13. [Docs](https://www.libvips.org/API/current/VipsOperation.html#vips-operation-block-set). [#382](https://github.com/libvips/ruby-vips/pull/382) [aglushkov](https://github.com/aglushkov)
|
13
|
+
* `new_from_source` keeps a ref to the source object [taylorthurlow]
|
14
|
+
* some fixes to object references system
|
15
|
+
|
5
16
|
## Version 2.2.0 (2023-10-18)
|
6
17
|
|
7
18
|
* add `draw_point!` [jcupitt]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.
|
1
|
+
2.2.2
|
data/lib/vips/image.rb
CHANGED
@@ -458,7 +458,14 @@ module Vips
|
|
458
458
|
loader = Vips.vips_foreign_find_load_source source
|
459
459
|
raise Vips::Error if loader.nil?
|
460
460
|
|
461
|
-
Vips::Operation.call loader, [source], opts, option_string
|
461
|
+
result = Vips::Operation.call loader, [source], opts, option_string
|
462
|
+
|
463
|
+
# keep a secret ref to the source object ... the libvips loader will
|
464
|
+
# keep a ref to the C source object, but we need the ruby wrapper object
|
465
|
+
# to stay alive too
|
466
|
+
result.references << source
|
467
|
+
|
468
|
+
result
|
462
469
|
end
|
463
470
|
|
464
471
|
def self.matrix_from_array width, height, array
|
data/lib/vips/interpolate.rb
CHANGED
@@ -49,10 +49,10 @@ module Vips
|
|
49
49
|
|
50
50
|
def initialize name
|
51
51
|
name = name.to_s if name.is_a? Symbol
|
52
|
-
|
53
|
-
raise Vips::Error if
|
52
|
+
pointer = Vips.vips_interpolate_new name
|
53
|
+
raise Vips::Error if pointer.nil?
|
54
54
|
|
55
|
-
super
|
55
|
+
super(pointer)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
data/lib/vips/mutableimage.rb
CHANGED
data/lib/vips/object.rb
CHANGED
@@ -9,9 +9,6 @@ require "ffi"
|
|
9
9
|
module Vips
|
10
10
|
private
|
11
11
|
|
12
|
-
# debugging support
|
13
|
-
attach_function :vips_object_print_all, [], :void
|
14
|
-
|
15
12
|
# we must init these by hand, since they are usually made on first image
|
16
13
|
# create
|
17
14
|
attach_function :vips_band_format_get_type, [], :GType
|
@@ -337,6 +334,7 @@ module Vips
|
|
337
334
|
ArgumentClassPtr.ptr, ArgumentInstancePtr.ptr],
|
338
335
|
:int
|
339
336
|
|
337
|
+
# debugging support
|
340
338
|
attach_function :vips_object_print_all, [], :void
|
341
339
|
|
342
340
|
attach_function :vips_object_set_from_string, [:pointer, :string], :int
|
data/lib/vips/operation.rb
CHANGED
@@ -218,7 +218,7 @@ module Vips
|
|
218
218
|
raise Vips::Error if value.null?
|
219
219
|
end
|
220
220
|
|
221
|
-
super
|
221
|
+
super(value)
|
222
222
|
end
|
223
223
|
|
224
224
|
def build
|
@@ -283,7 +283,7 @@ module Vips
|
|
283
283
|
value = value.map { |x| Operation.imageize match_image, x }
|
284
284
|
end
|
285
285
|
|
286
|
-
super
|
286
|
+
super(name, value)
|
287
287
|
end
|
288
288
|
|
289
289
|
public
|
@@ -440,14 +440,12 @@ module Vips
|
|
440
440
|
end
|
441
441
|
end
|
442
442
|
|
443
|
-
#
|
444
|
-
|
443
|
+
# dedupe all input references here
|
444
|
+
deduped_references = Set.new
|
445
445
|
|
446
446
|
add_reference = lambda do |x|
|
447
447
|
if x.is_a?(Vips::Image)
|
448
|
-
x.references
|
449
|
-
references << i
|
450
|
-
end
|
448
|
+
deduped_references.merge x.references
|
451
449
|
end
|
452
450
|
false
|
453
451
|
end
|
@@ -482,20 +480,27 @@ module Vips
|
|
482
480
|
|
483
481
|
op = op.build
|
484
482
|
|
483
|
+
# we need an array of references for output objects
|
484
|
+
references = deduped_references.to_a
|
485
|
+
|
485
486
|
# attach all input refs to output x
|
486
487
|
set_reference = lambda do |x|
|
488
|
+
# stop early if there are no refs to attach
|
489
|
+
return true if references == []
|
490
|
+
|
487
491
|
if x.is_a? Vips::Image
|
488
|
-
x.references
|
492
|
+
references.each { |i| x.references << i }
|
489
493
|
end
|
494
|
+
|
490
495
|
false
|
491
496
|
end
|
492
497
|
|
493
498
|
# get all required results
|
494
499
|
result = []
|
495
500
|
required_output.each do |details|
|
496
|
-
value = details[:arg_name]
|
501
|
+
value = op.get(details[:arg_name])
|
497
502
|
flat_find value, &set_reference
|
498
|
-
result <<
|
503
|
+
result << value
|
499
504
|
end
|
500
505
|
|
501
506
|
# fetch all optional ones
|
data/lib/vips/region.rb
CHANGED
@@ -44,10 +44,10 @@ module Vips
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def initialize(name)
|
47
|
-
|
48
|
-
raise Vips::Error if
|
47
|
+
pointer = Vips.vips_region_new name
|
48
|
+
raise Vips::Error if pointer.null?
|
49
49
|
|
50
|
-
super
|
50
|
+
super(pointer)
|
51
51
|
end
|
52
52
|
|
53
53
|
def width
|
data/lib/vips/sourcecustom.rb
CHANGED
data/lib/vips/targetcustom.rb
CHANGED
data/lib/vips/version.rb
CHANGED
data/lib/vips.rb
CHANGED
@@ -33,6 +33,30 @@ def library_name(name, abi_number)
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
# we can sometimes get dependent libraries from libvips -- either the platform
|
37
|
+
# will open dependencies for us automatically, or the libvips binary has been
|
38
|
+
# built to includes all main dependencies (common on windows, can happen
|
39
|
+
# elsewhere)
|
40
|
+
#
|
41
|
+
# we must get glib functions from libvips if we can, since it will be the
|
42
|
+
# one that libvips itself is using, and they will share runtime types
|
43
|
+
module Vips
|
44
|
+
extend FFI::Library
|
45
|
+
|
46
|
+
ffi_lib library_name("vips", 42)
|
47
|
+
|
48
|
+
begin
|
49
|
+
attach_function :g_malloc, [:size_t], :pointer
|
50
|
+
@@is_unified = true
|
51
|
+
rescue FFI::NotFoundError
|
52
|
+
@@is_unified = false
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.unified?
|
56
|
+
@@is_unified
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
36
60
|
module GLib
|
37
61
|
class << self
|
38
62
|
attr_accessor :logger
|
@@ -42,7 +66,11 @@ module GLib
|
|
42
66
|
|
43
67
|
extend FFI::Library
|
44
68
|
|
45
|
-
|
69
|
+
if Vips.unified?
|
70
|
+
ffi_lib library_name("vips", 42)
|
71
|
+
else
|
72
|
+
ffi_lib library_name("glib-2.0", 0)
|
73
|
+
end
|
46
74
|
|
47
75
|
attach_function :g_malloc, [:size_t], :pointer
|
48
76
|
|
@@ -134,7 +162,11 @@ end
|
|
134
162
|
module GObject
|
135
163
|
extend FFI::Library
|
136
164
|
|
137
|
-
|
165
|
+
if Vips.unified?
|
166
|
+
ffi_lib library_name("vips", 42)
|
167
|
+
else
|
168
|
+
ffi_lib library_name("gobject-2.0", 0)
|
169
|
+
end
|
138
170
|
|
139
171
|
# we can't just use ulong, windows has different int sizing rules
|
140
172
|
if FFI::Platform::ADDRESS_SIZE == 64
|
@@ -568,9 +600,7 @@ require "vips/gvalue"
|
|
568
600
|
# {Image#median}.
|
569
601
|
|
570
602
|
module Vips
|
571
|
-
|
572
|
-
|
573
|
-
ffi_lib library_name("vips", 42)
|
603
|
+
# we've already opened the libvips library
|
574
604
|
|
575
605
|
LOG_DOMAIN = "VIPS"
|
576
606
|
GLib.set_log_domain LOG_DOMAIN
|
@@ -779,6 +809,31 @@ module Vips
|
|
779
809
|
major > x || (major == x && minor >= y)
|
780
810
|
end
|
781
811
|
|
812
|
+
if at_least_libvips?(8, 13)
|
813
|
+
attach_function :vips_block_untrusted_set, [:bool], :void
|
814
|
+
attach_function :vips_operation_block_set, %i[string bool], :void
|
815
|
+
|
816
|
+
# Block/unblock all untrusted operations from running.
|
817
|
+
# Use `vips -l` at the command-line to see the class hierarchy and which operations are marked as untrusted.
|
818
|
+
def self.block_untrusted(enabled)
|
819
|
+
vips_block_untrusted_set(enabled)
|
820
|
+
end
|
821
|
+
|
822
|
+
# Block/unblock all operations in the libvips class hierarchy at specified *operation_name* and below.
|
823
|
+
#
|
824
|
+
# For example this will block all loaders except JPEG
|
825
|
+
#
|
826
|
+
# Vips.block("VipsForeignLoad", true);
|
827
|
+
# Vips.block("VipsForeignLoadJpeg", false)
|
828
|
+
#
|
829
|
+
# Use `vips -l` at the command-line to see the class hierarchy.
|
830
|
+
# This call does nothing if the named operation is not found.
|
831
|
+
#
|
832
|
+
def self.block(operation_name, enabled)
|
833
|
+
vips_operation_block_set(operation_name, enabled)
|
834
|
+
end
|
835
|
+
end
|
836
|
+
|
782
837
|
# Get a list of all supported file suffixes.
|
783
838
|
#
|
784
839
|
# @return [[String]] array of supported suffixes
|
data/ruby-vips.gemspec
CHANGED
@@ -36,6 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.required_ruby_version = ">= 2.0.0"
|
37
37
|
|
38
38
|
spec.add_runtime_dependency "ffi", ["~> 1.12"]
|
39
|
+
spec.add_runtime_dependency "logger"
|
39
40
|
|
40
41
|
spec.add_development_dependency "rake", ["~> 12.0"]
|
41
42
|
spec.add_development_dependency "rspec", ["~> 3.3"]
|
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.2.
|
4
|
+
version: 2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Cupitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: logger
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -113,6 +127,7 @@ extra_rdoc_files:
|
|
113
127
|
- TODO
|
114
128
|
files:
|
115
129
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
130
|
+
- ".github/dependabot.yml"
|
116
131
|
- ".github/workflows/test.yml"
|
117
132
|
- ".gitignore"
|
118
133
|
- ".standard.yml"
|
@@ -205,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
220
|
- !ruby/object:Gem::Version
|
206
221
|
version: '0'
|
207
222
|
requirements: []
|
208
|
-
rubygems_version: 3.
|
223
|
+
rubygems_version: 3.4.20
|
209
224
|
signing_key:
|
210
225
|
specification_version: 4
|
211
226
|
summary: A fast image processing library with low memory needs
|