ruby-vips 2.0.14 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) 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 +41 -0
  7. data/Gemfile +3 -1
  8. data/README.md +42 -41
  9. data/Rakefile +13 -21
  10. data/TODO +18 -10
  11. data/VERSION +1 -1
  12. data/example/annotate.rb +6 -6
  13. data/example/connection.rb +26 -0
  14. data/example/daltonize8.rb +16 -18
  15. data/example/draw_lines.rb +30 -0
  16. data/example/example1.rb +5 -6
  17. data/example/example2.rb +6 -6
  18. data/example/example3.rb +5 -5
  19. data/example/example4.rb +4 -4
  20. data/example/example5.rb +6 -7
  21. data/example/inheritance_with_refcount.rb +36 -54
  22. data/example/progress.rb +30 -0
  23. data/example/thumb.rb +8 -10
  24. data/example/trim8.rb +5 -5
  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 +199 -93
  29. data/lib/vips/align.rb +0 -1
  30. data/lib/vips/angle.rb +0 -1
  31. data/lib/vips/angle45.rb +0 -1
  32. data/lib/vips/bandformat.rb +0 -2
  33. data/lib/vips/blend_mode.rb +29 -27
  34. data/lib/vips/coding.rb +0 -1
  35. data/lib/vips/compass_direction.rb +0 -1
  36. data/lib/vips/connection.rb +46 -0
  37. data/lib/vips/direction.rb +0 -1
  38. data/lib/vips/extend.rb +0 -1
  39. data/lib/vips/gobject.rb +26 -15
  40. data/lib/vips/gvalue.rb +61 -55
  41. data/lib/vips/image.rb +455 -282
  42. data/lib/vips/interesting.rb +0 -1
  43. data/lib/vips/interpolate.rb +3 -7
  44. data/lib/vips/interpretation.rb +0 -1
  45. data/lib/vips/kernel.rb +0 -1
  46. data/lib/vips/methods.rb +791 -124
  47. data/lib/vips/mutableimage.rb +173 -0
  48. data/lib/vips/object.rb +178 -68
  49. data/lib/vips/operation.rb +277 -130
  50. data/lib/vips/operationboolean.rb +0 -1
  51. data/lib/vips/operationcomplex.rb +0 -1
  52. data/lib/vips/operationcomplex2.rb +0 -1
  53. data/lib/vips/operationcomplexget.rb +0 -1
  54. data/lib/vips/operationmath.rb +0 -1
  55. data/lib/vips/operationmath2.rb +0 -1
  56. data/lib/vips/operationrelational.rb +0 -1
  57. data/lib/vips/operationround.rb +0 -1
  58. data/lib/vips/region.rb +73 -0
  59. data/lib/vips/size.rb +0 -1
  60. data/lib/vips/source.rb +88 -0
  61. data/lib/vips/sourcecustom.rb +89 -0
  62. data/lib/vips/target.rb +86 -0
  63. data/lib/vips/targetcustom.rb +77 -0
  64. data/lib/vips/version.rb +1 -2
  65. data/ruby-vips.gemspec +26 -21
  66. metadata +39 -51
  67. data/.rubocop.yml +0 -10
  68. data/.rubocop_todo.yml +0 -730
  69. data/.travis.yml +0 -62
  70. data/install-vips.sh +0 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74183885f19e7d8d792099eb131da6ae94be9b4d34067fa2a0f82b72f3d02026
4
- data.tar.gz: c3a1f642a7edd260ffeda5b408b7ef46c0f090d0098d208a74847574dfd2f1be
3
+ metadata.gz: c77f69e33910d95f8f678cff9787066e2af91cd889f24ec3834dcfaf78ee5cfc
4
+ data.tar.gz: 140effde4d987fff3e293034b0967245aa4f914ba603d8bce41010d0ec1a63ba
5
5
  SHA512:
6
- metadata.gz: b87c9ed538391c1f8ca65fb16fb0ab9fa9b685cfddb8b8c016beed93c3d3ccabb5f6024487a191528595bac256e4dc8b3cae4d1aaee0506d1c24fef55aa65b41
7
- data.tar.gz: f4686c49a18ad1bcf8cf95f70146815d17e3497edef62a525663b2046bcc6753eb075f379cd38e25e0c129b9afdc8e8e67e52116019a0a90b3c53a595c3d295e
6
+ metadata.gz: 28b7309c3a0744b29c5d100b898aab3521cc07a17667d4041db3d5194db537336bdda578e25fddb79be929c0ac32a246fb47f08862c5273fc94c2e390cc5874c
7
+ data.tar.gz: d428e645d302329a9544819a188b7b010f1e265086a064cd2480dc5213d61a9ef78b0da5381a6f8bd85754ac5c8f2ce6f253701afb27e3180e157d1e807294d3
@@ -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,47 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## Version 2.1.1 (2021-5-3)
6
+
7
+ * fix "mutate" with libvips 8.9 [jcupitt]
8
+ * update autodocs for libvips 8.11 [jcupitt]
9
+
10
+ ## Version 2.1.0 (2021-3-8)
11
+
12
+ * add "mutate" system [jcupitt]
13
+ * better behaviour with some nil parameters [jcupitt]
14
+ * revise gemspec [jcupitt]
15
+ * allow symbols for Interpolate.new [noraj]
16
+ * update docs for 8.10, fix minor doc formatting issues [jcupitt]
17
+ * `new_from_array` checks array argument more carefully [dkam]
18
+ * add `new_from_memory` and `new_from_memory_copy` [ankane]
19
+ * jruby added to CI testing [pftg]
20
+ * switch to github actions for CI [pftg]
21
+ * remove rubocop, revise formatting for standardrb [pftg]
22
+
23
+ ## Version 2.0.17 (2019-10-29)
24
+
25
+ * install msys2 libvips on Windows [larskanis]
26
+ * better `-` to `_` conversion [Nakilon]
27
+ * fix `GValue#set` for stricter metadata rules in 8.9 [jcupitt]
28
+ * fix a ref leak on operation build error [jcupitt]
29
+ * faster operation call [jcupitt]
30
+ * add support for VipsConnection [jcupitt]
31
+ * add `signal_connect` [jcupitt]
32
+ * add `Image#set_kill` for progress termination [jcupitt]
33
+
34
+ ## Version 2.0.16 (2019-9-21)
35
+
36
+ * better library name generation [renchap]
37
+ * allow `_` as a separator in enum names [D-W-L]
38
+ * add `Vips::Region` and `Region#fetch` [jcupitt]
39
+
40
+ ## Version 2.0.15 (2019-6-12)
41
+
42
+ * better error messages from `write_to_memory` [linkyndy]
43
+ * fix doc generation typo for array return [jcupitt]
44
+ * update tests for libvips 8.8 [jcupitt]
45
+
5
46
  ## Version 2.0.14 (2018-10-3)
6
47
 
7
48
  * update links for new home [jcupitt]
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,36 +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
- - version bump
10
+ - Lint.
11
11
 
12
- edit lib/vips/version.rb
13
- edit VERSION
12
+ bundle exec standardrb
14
13
 
15
- - reinstall local copy of gem after a change
14
+ - Reinstall local copy of gem after a change.
16
15
 
17
16
  bundle exec rake install
18
17
 
19
- - run test suite
18
+ - Run test suite.
20
19
 
21
20
  bundle exec rake
22
21
 
23
- - regenerate autodocs
22
+ - Version bump.
23
+
24
+ edit lib/vips/version.rb
25
+ edit VERSION
26
+
27
+ - Regenerate autodocs.
24
28
 
25
29
  cd lib/vips
26
30
  ruby > methods.rb
27
- require 'vips'; Vips::generate_yard
31
+ require "vips"; Vips::Yard.generate
28
32
  ^D
29
33
 
30
- - regenerate docs
34
+ - Regenerate docs.
31
35
 
32
36
  bundle exec rake yard
33
37
 
34
- - push new gem to rubygems, tag repository with version
38
+ - Push new gem to rubygems, tag repository with version.
35
39
 
40
+ gem signin --otp 111111
36
41
  bundle exec rake release
42
+
43
+ The otp is from authy / google authenticator / etc.
44
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.14
1
+ 2.1.1