ruby-vips 2.0.15 → 2.1.2

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +42 -0
  3. data/.github/workflows/test.yml +80 -0
  4. data/.standard.yml +17 -0
  5. data/.yardopts +0 -1
  6. data/CHANGELOG.md +39 -0
  7. data/Gemfile +3 -1
  8. data/README.md +42 -41
  9. data/Rakefile +13 -21
  10. data/TODO +14 -14
  11. data/VERSION +1 -1
  12. data/example/annotate.rb +6 -6
  13. data/example/connection.rb +26 -0
  14. data/example/daltonize8.rb +6 -6
  15. data/example/draw_lines.rb +30 -0
  16. data/example/example1.rb +4 -4
  17. data/example/example2.rb +6 -6
  18. data/example/example3.rb +5 -5
  19. data/example/example4.rb +2 -2
  20. data/example/example5.rb +4 -4
  21. data/example/inheritance_with_refcount.rb +35 -36
  22. data/example/progress.rb +30 -0
  23. data/example/thumb.rb +6 -6
  24. data/example/trim8.rb +1 -1
  25. data/example/watermark.rb +2 -2
  26. data/example/wobble.rb +1 -1
  27. data/lib/ruby-vips.rb +1 -1
  28. data/lib/vips.rb +191 -79
  29. data/lib/vips/blend_mode.rb +29 -25
  30. data/lib/vips/connection.rb +46 -0
  31. data/lib/vips/gobject.rb +27 -12
  32. data/lib/vips/gvalue.rb +62 -50
  33. data/lib/vips/image.rb +475 -256
  34. data/lib/vips/interpolate.rb +3 -2
  35. data/lib/vips/methods.rb +788 -121
  36. data/lib/vips/mutableimage.rb +173 -0
  37. data/lib/vips/object.rb +171 -54
  38. data/lib/vips/operation.rb +272 -117
  39. data/lib/vips/region.rb +73 -0
  40. data/lib/vips/source.rb +88 -0
  41. data/lib/vips/sourcecustom.rb +89 -0
  42. data/lib/vips/target.rb +86 -0
  43. data/lib/vips/targetcustom.rb +77 -0
  44. data/lib/vips/version.rb +1 -1
  45. data/ruby-vips.gemspec +26 -20
  46. metadata +39 -50
  47. data/.rubocop.yml +0 -22
  48. data/.rubocop_todo.yml +0 -515
  49. data/.travis.yml +0 -62
  50. data/install-vips.sh +0 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f840e3348f61c24e35a7edaf8110e04c80d554ca0941e1a2657e42a5e7d9c585
4
- data.tar.gz: 914ae65523b71d0703e0dadcb0a864d89dbf15c4177fd98b3d440e84023b31ec
3
+ metadata.gz: 267111867f885404762f693512589879bf5f1a47ef0711e368aa6bf57acdb78d
4
+ data.tar.gz: 80b65db37293a9054f508a786f841fbce6f5638cd9e237cba68074cdf3455420
5
5
  SHA512:
6
- metadata.gz: 173ff890370fb1a4fdc70f5ab6ecb4622995a855494c5b46ff3aa2b1ef74415e1c39d9b20773e42b2e01dd520cdb6d59a00abc2a54d34a670b503d811cee8aa8
7
- data.tar.gz: fdc9235e39d693067d4e2ac3f327bce3b71d98ed170a8946ec12626599f274485d4ebd71fdacf837122d34b6da08cabe1b0f31e530a36e3cf548e7b498179880
6
+ metadata.gz: 62c7552e7372e35005cc2212d05471c30194511a06065c658aca6b63b5a1bdfe7b3fecece9231b533d274956981bc65e61c7fc5d4d3bc64268e723f10425c80c
7
+ data.tar.gz: a908583f08ed891280aaf94aa57275b04038b831027954298f7a8cb98e85c90bc3f61fb276e89f159bb874404022b015b3144e899f6c41170ed9ae082bc97903
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: bug
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Questions or suggestions**
11
+
12
+ We are using [Discussions](https://github.com/libvips/ruby-vips/discussions) for questions and suggestions for new features. Issues are only for bug reports.
13
+
14
+ **Describe the bug**
15
+ A clear and concise description of what the bug is.
16
+
17
+ **To Reproduce**
18
+ Steps to reproduce the behavior:
19
+ 1. Go to '...'
20
+ 2. Click on '....'
21
+ 3. Scroll down to '....'
22
+ 4. See error
23
+
24
+ **Expected behavior**
25
+ A clear and concise description of what you expected to happen.
26
+
27
+ **Screenshots**
28
+ If applicable, add screenshots to help explain your problem.
29
+
30
+ **Desktop (please complete the following information):**
31
+ - OS: [e.g. iOS]
32
+ - Browser [e.g. chrome, safari]
33
+ - Version [e.g. 22]
34
+
35
+ **Smartphone (please complete the following information):**
36
+ - Device: [e.g. iPhone6]
37
+ - OS: [e.g. iOS8.1]
38
+ - Browser [e.g. stock browser, safari]
39
+ - Version [e.g. 22]
40
+
41
+ **Additional context**
42
+ Add any other context about the problem here.
@@ -0,0 +1,80 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ pull_request_target:
9
+ branches:
10
+ - master
11
+
12
+ env:
13
+ NOKOGIRI_USE_SYSTEM_LIBRARIES: true
14
+ SPEC_OPTS: '--backtrace'
15
+
16
+ jobs:
17
+ lint:
18
+ name: Lint
19
+ runs-on: ubuntu-latest
20
+
21
+ steps:
22
+ - name: Checkout code
23
+ uses: actions/checkout@v2
24
+
25
+ - name: Set up Ruby
26
+ uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: '2.7'
29
+ bundler-cache: true
30
+
31
+ - name: Run standard Ruby linter
32
+ run: bundle exec standardrb --no-fix --fail-fast
33
+
34
+ test:
35
+ name: Functional testing
36
+
37
+ strategy:
38
+ matrix:
39
+ os-version: [ 'ubuntu-20.04' ]
40
+ ruby-version:
41
+ - 2.0
42
+ - 2.1
43
+ - 2.2
44
+ - 2.3
45
+ - 2.4
46
+ - 2.5
47
+ - 2.6
48
+ - 2.7
49
+ - 3.0
50
+ - jruby
51
+ fail-fast: true
52
+
53
+ runs-on: ${{ matrix.os-version }}
54
+
55
+ steps:
56
+ - name: Checkout code
57
+ uses: actions/checkout@v2
58
+
59
+ - name: Set up Ruby
60
+ uses: ruby/setup-ruby@v1
61
+ with:
62
+ ruby-version: ${{ matrix.ruby-version }}
63
+ bundler-cache: true
64
+
65
+ - name: Update apt
66
+ env:
67
+ DEBIAN_FRONTEND: noninteractive
68
+ run:
69
+ sudo apt-get update -qq -o Acquire::Retries=3
70
+
71
+ - name: Install libvips
72
+ env:
73
+ DEBIAN_FRONTEND: noninteractive
74
+ run:
75
+ # we only need the library
76
+ sudo apt-get install --fix-missing -qq -o Acquire::Retries=3
77
+ libvips
78
+
79
+ - name: Run Tests
80
+ run: bundle exec rake spec
data/.standard.yml ADDED
@@ -0,0 +1,17 @@
1
+ fix: false # default: false
2
+ parallel: true # default: false
3
+ format: progress # default: Standard::Formatter
4
+ ruby_version: 2.0 # default: RUBY_VERSION
5
+ default_ignores: false # default: true
6
+
7
+ ignore: # default: []
8
+ - '**/*':
9
+ - Standard/SemanticBlocks
10
+ - 'lib/vips/methods.rb'
11
+ - '{lib,example}/**/*':
12
+ - Lint/IneffectiveAccessModifier
13
+ - Lint/RescueException
14
+ - Style/GlobalVars
15
+ - 'spec/**/*':
16
+ - Lint/BinaryOperatorWithIdenticalOperands
17
+ - 'vendor/**/*'
data/.yardopts CHANGED
@@ -1,2 +1 @@
1
- --markup-provider=redcarpet
2
1
  --markup=markdown
data/CHANGELOG.md CHANGED
@@ -2,6 +2,45 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## Version 2.1.2 (2021-5-3)
6
+
7
+ * allow `FFI::Pointer` as an argument to `new_from_memory` etc. [sled]
8
+
9
+ ## Version 2.1.1 (2021-5-3)
10
+
11
+ * fix "mutate" with libvips 8.9 [jcupitt]
12
+ * update autodocs for libvips 8.11 [jcupitt]
13
+
14
+ ## Version 2.1.0 (2021-3-8)
15
+
16
+ * add "mutate" system [jcupitt]
17
+ * better behaviour with some nil parameters [jcupitt]
18
+ * revise gemspec [jcupitt]
19
+ * allow symbols for Interpolate.new [noraj]
20
+ * update docs for 8.10, fix minor doc formatting issues [jcupitt]
21
+ * `new_from_array` checks array argument more carefully [dkam]
22
+ * add `new_from_memory` and `new_from_memory_copy` [ankane]
23
+ * jruby added to CI testing [pftg]
24
+ * switch to github actions for CI [pftg]
25
+ * remove rubocop, revise formatting for standardrb [pftg]
26
+
27
+ ## Version 2.0.17 (2019-10-29)
28
+
29
+ * install msys2 libvips on Windows [larskanis]
30
+ * better `-` to `_` conversion [Nakilon]
31
+ * fix `GValue#set` for stricter metadata rules in 8.9 [jcupitt]
32
+ * fix a ref leak on operation build error [jcupitt]
33
+ * faster operation call [jcupitt]
34
+ * add support for VipsConnection [jcupitt]
35
+ * add `signal_connect` [jcupitt]
36
+ * add `Image#set_kill` for progress termination [jcupitt]
37
+
38
+ ## Version 2.0.16 (2019-9-21)
39
+
40
+ * better library name generation [renchap]
41
+ * allow `_` as a separator in enum names [D-W-L]
42
+ * add `Vips::Region` and `Region#fetch` [jcupitt]
43
+
5
44
  ## Version 2.0.15 (2019-6-12)
6
45
 
7
46
  * better error messages from `write_to_memory` [linkyndy]
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # all gems are handled by .gemspec (since this repo is for a gem)
4
4
  gemspec
5
+
6
+ gem "github-markup"
data/README.md CHANGED
@@ -1,37 +1,17 @@
1
1
  # ruby-vips
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/ruby-vips.svg)](https://badge.fury.io/rb/ruby-vips)
4
- [![Build Status](https://travis-ci.org/libvips/ruby-vips.svg?branch=master)](https://travis-ci.org/libvips/ruby-vips)
4
+ [![Test](https://github.com/libvips/ruby-vips/workflows/Test/badge.svg)](https://github.com/libvips/ruby-vips/actions?query=workflow%3ATest)
5
5
 
6
- This gem provides a Ruby binding for the [libvips image processing
6
+ This gem is a Ruby binding for the [libvips image processing
7
7
  library](https://libvips.github.io/libvips).
8
8
 
9
- Programs that use `ruby-vips` don't
10
- manipulate images directly, instead they create pipelines of image processing
11
- operations building on a source image. When the end of the pipe is connected
12
- to a destination, the whole pipeline executes at once, streaming the image
13
- in parallel from source to destination a section at a time.
14
-
15
- Because `ruby-vips` is parallel, it's quick, and because it doesn't need to
16
- keep entire images in memory, it's light. For example, the benchmark at
17
- [vips-benchmarks](https://github.com/jcupitt/vips-benchmarks) loads a
18
- large image, crops, shrinks, sharpens and saves again, and repeats 10 times.
19
-
20
- ```text
21
- real time in seconds, fastest of five runs
22
- benchmark tiff jpeg
23
- ruby-vips.rb 0.85 0.78
24
- image-magick 2.03 2.44
25
- rmagick.rb 3.87 3.89
26
-
27
- peak memory use in kb
28
- benchmark peak RES
29
- ruby-vips.rb 43864
30
- rmagick.rb 788768
31
- ```
32
-
33
- See also [benchmarks at the official libvips
34
- website](https://github.com/libvips/libvips/wiki/Speed-and-memory-use).
9
+ Programs that use `ruby-vips` don't manipulate images directly, instead
10
+ they create pipelines of image processing operations building on a source
11
+ image. When the end of the pipe is connected to a destination, the whole
12
+ pipeline executes at once, streaming the image in parallel from source to
13
+ destination a section at a time. Because `ruby-vips` is parallel, it's quick,
14
+ and because it doesn't need to keep entire images in memory, it's light.
35
15
 
36
16
  ## Requirements
37
17
 
@@ -41,7 +21,7 @@ website](https://github.com/libvips/libvips/wiki/Speed-and-memory-use).
41
21
 
42
22
  * [ruby-ffi](https://github.com/ffi/ffi) 1.9 or later
43
23
 
44
- * Ruby 2.0+, JRuby should work
24
+ * Ruby 2.0+, JRuby
45
25
 
46
26
  ## Install
47
27
 
@@ -54,19 +34,16 @@ $ gem install ruby-vips
54
34
  or include it in `Gemfile`:
55
35
 
56
36
  ```ruby
57
- gem 'ruby-vips'
37
+ gem "ruby-vips"
58
38
  ```
59
39
 
60
40
  On Windows, you'll need to set the `RUBY_DLL_PATH` environment variable to
61
41
  point to the libvips bin directory.
62
42
 
63
- Take a look in `examples/`. There is [full API
64
- documentation](http://www.rubydoc.info/gems/ruby-vips).
65
-
66
43
  # Example
67
44
 
68
45
  ```ruby
69
- require 'vips'
46
+ require "vips"
70
47
 
71
48
  im = Vips::Image.new_from_file filename
72
49
 
@@ -90,13 +67,37 @@ im = im.conv mask, precision: :integer
90
67
  im.write_to_file output_filename
91
68
  ```
92
69
 
93
- # Older versions
70
+ The `Vips` section in the API docs has a [tutorial introduction with
71
+ examples](https://www.rubydoc.info/gems/ruby-vips/Vips).
94
72
 
95
- There are two older versions of this gem.
73
+ ruby-vips has [API
74
+ documentation](http://www.rubydoc.info/gems/ruby-vips). The [libvips
75
+ reference manual](https://libvips.github.io/libvips/API/current/) has a
76
+ complete explanation of every method.
96
77
 
97
- The `0.3-stable` branch is written in C and supports a different API. It still
98
- works, but is only maintained for compatibility.
78
+ The
79
+ [`example/`](https://github.com/libvips/ruby-vips/tree/master/example)
80
+ directory has some simple example programs.
81
+
82
+ # Benchmarks
83
+
84
+ The benchmark at [vips-benchmarks](https://github.com/jcupitt/vips-benchmarks)
85
+ loads a large image, crops, shrinks, sharpens and saves again, and repeats
86
+ 10 times.
87
+
88
+ ```text
89
+ real time in seconds, fastest of five runs
90
+ benchmark tiff jpeg
91
+ ruby-vips.rb 0.85 0.78
92
+ image-magick 2.03 2.44
93
+ rmagick.rb 3.87 3.89
94
+
95
+ peak memory use in kb
96
+ benchmark peak RES
97
+ ruby-vips.rb 43864
98
+ rmagick.rb 788768
99
+ ```
100
+
101
+ See also [benchmarks at the official libvips
102
+ website](https://github.com/libvips/libvips/wiki/Speed-and-memory-use).
99
103
 
100
- The `1.0-stable` branch is based on `gobject-introspection` rather than
101
- `ffi`. It supports the same API as the current version, but is harder to
102
- install, less portable, slower, and less stable.
data/Rakefile CHANGED
@@ -1,35 +1,27 @@
1
- # encoding: utf-8
2
-
3
- require 'bundler/gem_tasks'
1
+ require "bundler/gem_tasks"
4
2
 
5
3
  begin
6
4
  Bundler.setup(:default, :development)
7
5
  rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
6
+ warn e.message
7
+ warn "Run `bundle install` to install missing gems"
10
8
  exit e.status_code
11
9
  end
12
10
 
13
- require 'rake'
11
+ require "rake"
14
12
 
15
- require 'rspec/core'
16
- require 'rspec/core/rake_task'
13
+ require "rspec/core"
14
+ require "rspec/core/rake_task"
17
15
  RSpec::Core::RakeTask.new(:spec) do |spec|
18
- spec.pattern = FileList['spec/**/*_spec.rb']
16
+ spec.pattern = FileList["spec/**/*_spec.rb"]
19
17
  end
20
18
 
21
- task :default => :spec
22
-
23
- require "github/markup"
24
- require "redcarpet"
25
- require "yard"
26
- require "yard/rake/yardoc_task"
19
+ task default: :spec
27
20
 
28
- YARD::Rake::YardocTask.new do |yard|
29
- end
21
+ unless RUBY_PLATFORM.include?("java")
22
+ require "github/markup"
23
+ require "yard"
24
+ require "yard/rake/yardoc_task"
30
25
 
31
- # RuboCop requires Ruby >= 2.2
32
- if Gem.ruby_version >= Gem::Version.new("2.2.0")
33
- require 'rubocop/rake_task'
34
- RuboCop::RakeTask.new
26
+ YARD::Rake::YardocTask.new
35
27
  end
data/TODO CHANGED
@@ -1,44 +1,44 @@
1
1
  # Notes
2
2
 
3
- - support complex constants, eg.
3
+ - We should support complex constants, eg:
4
4
 
5
5
  Complex(1, 2)
6
6
  => (1+2i)
7
7
 
8
8
  # Common operations
9
9
 
10
- - lint
10
+ - Lint.
11
11
 
12
- bundle exec rake rubocop
12
+ bundle exec standardrb
13
13
 
14
- - reinstall local copy of gem after a change
14
+ - Reinstall local copy of gem after a change.
15
15
 
16
16
  bundle exec rake install
17
17
 
18
- - run test suite
18
+ - Run test suite.
19
19
 
20
20
  bundle exec rake
21
21
 
22
- - version bump
22
+ - Version bump.
23
23
 
24
24
  edit lib/vips/version.rb
25
25
  edit VERSION
26
26
 
27
- - regenerate autodocs
27
+ - Regenerate autodocs.
28
28
 
29
29
  cd lib/vips
30
30
  ruby > methods.rb
31
- require 'vips'; Vips::generate_yard
31
+ require "vips"; Vips::Yard.generate
32
32
  ^D
33
33
 
34
- - regenerate .rubocop_todo.yml
35
-
36
- bundle exec rubocop --auto-gen-config
37
-
38
- - regenerate docs
34
+ - Regenerate docs.
39
35
 
40
36
  bundle exec rake yard
41
37
 
42
- - push new gem to rubygems, tag repository with version
38
+ - Push new gem to rubygems, tag repository with version.
43
39
 
40
+ gem signin --otp 111111
44
41
  bundle exec rake release
42
+
43
+ The otp is from authy / google authenticator / etc.
44
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.15
1
+ 2.1.2