ruby-vips 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +7 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +3 -14
- data/Rakefile +1 -17
- data/TODO +50 -2
- data/lib/vips.rb +1 -0
- data/lib/vips/image.rb +15 -0
- data/lib/vips/version.rb +4 -0
- data/ruby-vips.gemspec +42 -0
- metadata +20 -32
- data/.travis.yml +0 -22
- data/Gemfile.lock +0 -83
- data/ruby-vips8.gemspec +0 -112
- data/spec/image_spec.rb +0 -515
- data/spec/samples/balloon.v +0 -0
- data/spec/samples/ghost.ppm +0 -405
- data/spec/samples/huge.jpg +0 -0
- data/spec/samples/icc.jpg +0 -0
- data/spec/samples/lcd.icc +0 -0
- data/spec/samples/lion.svg +0 -154
- data/spec/samples/sample.csv +0 -7
- data/spec/samples/sample.exr +0 -0
- data/spec/samples/wagon.jpg +0 -0
- data/spec/samples/wagon.v +0 -0
- data/spec/spec_helper.rb +0 -49
- data/spec/vips_spec.rb +0 -74
data/spec/samples/sample.csv
DELETED
data/spec/samples/sample.exr
DELETED
Binary file
|
data/spec/samples/wagon.jpg
DELETED
Binary file
|
data/spec/samples/wagon.v
DELETED
Binary file
|
data/spec/spec_helper.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'vips'
|
2
|
-
|
3
|
-
require 'tempfile'
|
4
|
-
|
5
|
-
module Spec
|
6
|
-
|
7
|
-
module Path
|
8
|
-
def root
|
9
|
-
@root ||= Pathname.new(File.expand_path('..', __FILE__))
|
10
|
-
end
|
11
|
-
|
12
|
-
def sample(*path)
|
13
|
-
root.join 'samples', *path
|
14
|
-
end
|
15
|
-
|
16
|
-
def tmp(*path)
|
17
|
-
root.join 'tmp', 'working', *path
|
18
|
-
end
|
19
|
-
|
20
|
-
extend self
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
module Helpers
|
25
|
-
def reset_working!
|
26
|
-
FileUtils.rm Dir[tmp.join('*.*')]
|
27
|
-
FileUtils.mkdir_p(tmp)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
def simg(name)
|
34
|
-
Spec::Path::sample(name).to_s
|
35
|
-
end
|
36
|
-
|
37
|
-
def timg(name)
|
38
|
-
Spec::Path::tmp(name).to_s
|
39
|
-
end
|
40
|
-
|
41
|
-
RSpec.configure do |config|
|
42
|
-
config.include Spec::Path
|
43
|
-
config.include Spec::Helpers
|
44
|
-
|
45
|
-
config.before :each do
|
46
|
-
reset_working!
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
data/spec/vips_spec.rb
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
require 'spec_helper.rb'
|
2
|
-
|
3
|
-
RSpec.describe Vips do
|
4
|
-
describe '#call' do
|
5
|
-
it 'can make a black image' do
|
6
|
-
image = Vips::call "black", 200, 200
|
7
|
-
|
8
|
-
expect(image.width).to eq(200)
|
9
|
-
expect(image.height).to eq(200)
|
10
|
-
expect(image.bands).to eq(1)
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'can take an optional argument' do
|
14
|
-
image = Vips::call "black", 200, 200, :bands => 12
|
15
|
-
|
16
|
-
expect(image.width).to eq(200)
|
17
|
-
expect(image.height).to eq(200)
|
18
|
-
expect(image.bands).to eq(12)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'can take an optional argument' do
|
22
|
-
image = Vips::call "black", 200, 200, :bands => 12
|
23
|
-
|
24
|
-
expect(image.width).to eq(200)
|
25
|
-
expect(image.height).to eq(200)
|
26
|
-
expect(image.bands).to eq(12)
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'can handle enum arguments' do
|
30
|
-
black = Vips::call "black", 200, 200
|
31
|
-
embed = Vips::call "embed", black, 10, 10, 500, 500,
|
32
|
-
:extend => :mirror
|
33
|
-
|
34
|
-
expect(embed.width).to eq(500)
|
35
|
-
expect(embed.height).to eq(500)
|
36
|
-
expect(embed.bands).to eq(1)
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'enum arguments can be strings' do
|
40
|
-
black = Vips::call "black", 200, 200
|
41
|
-
embed = Vips::call "embed", black, 10, 10, 500, 500,
|
42
|
-
:extend => "mirror"
|
43
|
-
|
44
|
-
expect(embed.width).to eq(500)
|
45
|
-
expect(embed.height).to eq(500)
|
46
|
-
expect(embed.bands).to eq(1)
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'can return optional output args' do
|
50
|
-
point = Vips::call "black", 1, 1
|
51
|
-
test = Vips::call "embed", point, 20, 10, 100, 100,
|
52
|
-
:extend => :white
|
53
|
-
value, opts = Vips::call "min", test, :x => true, :y => true
|
54
|
-
|
55
|
-
expect(value).to eq(0)
|
56
|
-
expect(opts['x']).to eq(20)
|
57
|
-
expect(opts['y']).to eq(10)
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'can call draw operations' do
|
61
|
-
black = Vips::call "black", 100, 100
|
62
|
-
test = Vips::call "draw_rect", black, 255, 10, 10, 1, 1
|
63
|
-
|
64
|
-
max_black = Vips::call "max", black
|
65
|
-
max_test = Vips::call "max", test
|
66
|
-
|
67
|
-
expect(max_black).to eq(0)
|
68
|
-
expect(max_test).to eq(255)
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
|