free-image 0.6.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/HISTORY +30 -19
- data/LICENSE +20 -20
- data/README.rdoc +120 -120
- data/Rakefile +51 -47
- data/cookbook.rdoc +248 -237
- data/free-image.gemspec +30 -29
- data/lib/free-image.rb +1 -2
- data/lib/free-image/bitmap.rb +2 -2
- data/lib/free-image/enums/filters.rb +11 -11
- data/lib/free-image/errors.rb +43 -43
- data/lib/free-image/modules/conversions.rb +253 -253
- data/lib/free-image/modules/helper.rb +41 -41
- data/lib/free-image/modules/information.rb +20 -2
- data/lib/free-image/modules/modify.rb +299 -299
- data/lib/free-image/modules/pixels.rb +134 -134
- data/lib/free-image/modules/transforms.rb +90 -90
- data/lib/free-image/sources/abstract_source.rb +178 -178
- data/lib/free-image/sources/file.rb +114 -114
- data/lib/free-image/sources/io.rb +153 -153
- data/lib/free-image/sources/memory.rb +188 -188
- data/lib/free-image/types/boolean.rb +13 -13
- data/lib/free-image/types/ffi.rb +13 -13
- data/lib/free-image/types/info_header.rb +36 -0
- data/lib/free-image/types/rgb16.rb +31 -0
- data/test/cookbook.rb +45 -46
- data/test/images/sample_composite.png +0 -0
- data/test/images/test16.bmp +0 -0
- data/test/images/test16bf555.bmp +0 -0
- data/test/images/test16bf565.bmp +0 -0
- data/test/test_bitmap.rb +61 -63
- data/test/test_conversions.rb +85 -86
- data/test/test_file.rb +68 -69
- data/test/test_free_image.rb +14 -15
- data/test/test_helper.rb +14 -0
- data/test/test_information.rb +145 -117
- data/test/test_io.rb +73 -74
- data/test/test_memory.rb +83 -84
- data/test/test_modify.rb +75 -58
- data/test/test_palette.rb +44 -45
- data/test/test_pixels.rb +61 -62
- data/test/test_rgb_quad.rb +24 -25
- data/test/test_scanline.rb +64 -65
- data/test/test_suite.rb +12 -17
- data/test/test_transforms.rb +28 -29
- metadata +58 -31
data/test/test_rgb_quad.rb
CHANGED
@@ -1,26 +1,25 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require '
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
color
|
9
|
-
assert_equal(color[:
|
10
|
-
assert_equal(color[:
|
11
|
-
assert_equal(color[:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
1
|
+
# encoding: UTF-8
|
2
|
+
require File.join(File.dirname(__FILE__),'test_helper')
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
class RGBQuadTest < Test::Unit::TestCase
|
6
|
+
def test_create
|
7
|
+
color = FreeImage::RGBQuad.create(1,2,3,4)
|
8
|
+
assert_equal(color[:red], 1)
|
9
|
+
assert_equal(color[:green], 2)
|
10
|
+
assert_equal(color[:blue], 3)
|
11
|
+
assert_equal(color[:reserved], 4)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_=
|
15
|
+
color1 = FreeImage::RGBQuad.create(1,2,3,4)
|
16
|
+
color2 = FreeImage::RGBQuad.create(1,2,3,4)
|
17
|
+
assert_equal(color1, color2)
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_eql
|
21
|
+
color1 = FreeImage::RGBQuad.create(1,2,3,4)
|
22
|
+
color2 = FreeImage::RGBQuad.create(1,2,3,4)
|
23
|
+
assert(color1.eql?(color2))
|
24
|
+
end
|
26
25
|
end
|
data/test/test_scanline.rb
CHANGED
@@ -1,65 +1,64 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require '
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
image
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
assert_equal(expected[:
|
37
|
-
assert_equal(expected[:
|
38
|
-
assert_equal(expected[:
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
end
|
1
|
+
# encoding: UTF-8
|
2
|
+
require File.join(File.dirname(__FILE__),'test_helper')
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
class ScanlineTest < Test::Unit::TestCase
|
6
|
+
def scanline(index = 0)
|
7
|
+
image = lena_image
|
8
|
+
image.scanline(index)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_class
|
12
|
+
assert_kind_of(FreeImage::Scanline, scanline)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_bytesize
|
16
|
+
assert_equal(lena_image.pitch, scanline.bytesize)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_pixelsize
|
20
|
+
assert_equal(lena_image.width, scanline.pixelsize)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_color_type
|
24
|
+
assert_equal(FreeImage::RGBTriple, scanline.send(:color_type))
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_color_size
|
28
|
+
assert_equal(3, scanline.send(:color_type).size)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_color
|
32
|
+
expected = lena_image.pixel_color(0, 0)
|
33
|
+
actual = scanline[0]
|
34
|
+
|
35
|
+
assert_equal(expected[:red], actual[:red])
|
36
|
+
assert_equal(expected[:green], actual[:green])
|
37
|
+
assert_equal(expected[:blue], actual[:blue])
|
38
|
+
assert_equal(expected[:reserved], 0)
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_invalid_y
|
42
|
+
error = assert_raise(RangeError) do
|
43
|
+
lena_image.scanline(-1)
|
44
|
+
end
|
45
|
+
assert_equal("Index must be between 0 and 511", error.to_s)
|
46
|
+
|
47
|
+
error = assert_raise(RangeError) do
|
48
|
+
lena_image.scanline(1000)
|
49
|
+
end
|
50
|
+
assert_equal("Index must be between 0 and 511", error.to_s)
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_invalid_x
|
54
|
+
error = assert_raise(RangeError) do
|
55
|
+
scanline[-1]
|
56
|
+
end
|
57
|
+
assert_equal("Index must be between 0 and 511", error.to_s)
|
58
|
+
|
59
|
+
error = assert_raise(RangeError) do
|
60
|
+
scanline[1000]
|
61
|
+
end
|
62
|
+
assert_equal("Index must be between 0 and 511", error.to_s)
|
63
|
+
end
|
64
|
+
end
|
data/test/test_suite.rb
CHANGED
@@ -1,19 +1,14 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
require './
|
9
|
-
require './
|
10
|
-
require './
|
11
|
-
require './
|
12
|
-
require './
|
13
|
-
require './
|
14
|
-
require './
|
15
|
-
require './test_modify'
|
16
|
-
require './test_palette'
|
17
|
-
require './test_pixels'
|
18
|
-
require './test_rgb_quad'
|
19
|
-
require './test_transforms'
|
3
|
+
require './test/test_bitmap'
|
4
|
+
require './test/test_conversions'
|
5
|
+
require './test/test_file'
|
6
|
+
require './test/test_free_image'
|
7
|
+
require './test/test_information'
|
8
|
+
require './test/test_io'
|
9
|
+
require './test/test_memory'
|
10
|
+
require './test/test_modify'
|
11
|
+
require './test/test_palette'
|
12
|
+
require './test/test_pixels'
|
13
|
+
require './test/test_rgb_quad'
|
14
|
+
require './test/test_transforms'
|
data/test/test_transforms.rb
CHANGED
@@ -1,30 +1,29 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require '
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
bitmap2
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
result
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
result
|
28
|
-
|
29
|
-
end
|
1
|
+
# encoding: UTF-8
|
2
|
+
require File.join(File.dirname(__FILE__),'test_helper')
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
class TrasformsTest < Test::Unit::TestCase
|
6
|
+
def test_rotate
|
7
|
+
bitmap1 = FreeImage::Bitmap.open(image_path('sample.png'))
|
8
|
+
bitmap2 = bitmap1.rotate(45)
|
9
|
+
assert_kind_of(FreeImage::Bitmap, bitmap2)
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_rotate_ex
|
13
|
+
bitmap1 = FreeImage::Bitmap.open(image_path('sample.png'))
|
14
|
+
bitmap2 = bitmap1.rotate_ex(45, 0, 0, 0, 0)
|
15
|
+
assert_kind_of(FreeImage::Bitmap, bitmap2)
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_flip_horizontal
|
19
|
+
bitmap1 = FreeImage::Bitmap.open(image_path('sample.png'))
|
20
|
+
result = bitmap1.flip_horizontal!
|
21
|
+
assert_kind_of(TrueClass, result)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_flip_vertical
|
25
|
+
bitmap1 = FreeImage::Bitmap.open(image_path('sample.png'))
|
26
|
+
result = bitmap1.flip_vertical!
|
27
|
+
assert_kind_of(TrueClass, result)
|
28
|
+
end
|
30
29
|
end
|
metadata
CHANGED
@@ -1,54 +1,77 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: free-image
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.7.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Charlie Savage
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-10-10 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: ffi
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 1.0.10
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.10
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
25
41
|
- !ruby/object:Gem::Dependency
|
26
42
|
name: hanna-nouveau
|
27
|
-
requirement:
|
28
|
-
none: false
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
29
44
|
requirements:
|
30
|
-
- -
|
45
|
+
- - ">="
|
31
46
|
- !ruby/object:Gem::Version
|
32
47
|
version: '0'
|
33
48
|
type: :development
|
34
49
|
prerelease: false
|
35
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
36
55
|
- !ruby/object:Gem::Dependency
|
37
56
|
name: open4
|
38
|
-
requirement:
|
39
|
-
none: false
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
40
58
|
requirements:
|
41
|
-
- -
|
59
|
+
- - ">="
|
42
60
|
- !ruby/object:Gem::Version
|
43
61
|
version: '0'
|
44
62
|
type: :development
|
45
63
|
prerelease: false
|
46
|
-
version_requirements:
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: |2
|
70
|
+
FreeImage is an Open Source library project for developers who would like to support
|
71
|
+
popular graphics image formats like PNG, BMP, JPEG, TIFF and others as needed by
|
72
|
+
today's multimedia applications. FreeImage is easy to use, fast, multithreading
|
73
|
+
safe, compatible with all 32-bit or 64-bit versions of Windows, and
|
74
|
+
cross-platform (works both with Linux and Mac OS X).
|
52
75
|
email:
|
53
76
|
executables: []
|
54
77
|
extensions: []
|
@@ -56,10 +79,11 @@ extra_rdoc_files: []
|
|
56
79
|
files:
|
57
80
|
- HISTORY
|
58
81
|
- LICENSE
|
59
|
-
-
|
82
|
+
- README.rdoc
|
60
83
|
- Rakefile
|
61
84
|
- cookbook.rdoc
|
62
|
-
-
|
85
|
+
- free-image.gemspec
|
86
|
+
- lib/free-image.rb
|
63
87
|
- lib/free-image/bitmap.rb
|
64
88
|
- lib/free-image/enums/color_types.rb
|
65
89
|
- lib/free-image/enums/dithers.rb
|
@@ -83,13 +107,13 @@ files:
|
|
83
107
|
- lib/free-image/types/boolean.rb
|
84
108
|
- lib/free-image/types/complex.rb
|
85
109
|
- lib/free-image/types/ffi.rb
|
110
|
+
- lib/free-image/types/info_header.rb
|
86
111
|
- lib/free-image/types/rgb16.rb
|
112
|
+
- lib/free-image/types/rgb_quad.rb
|
113
|
+
- lib/free-image/types/rgb_triple.rb
|
87
114
|
- lib/free-image/types/rgba16.rb
|
88
115
|
- lib/free-image/types/rgbaf.rb
|
89
116
|
- lib/free-image/types/rgbf.rb
|
90
|
-
- lib/free-image/types/rgb_quad.rb
|
91
|
-
- lib/free-image/types/rgb_triple.rb
|
92
|
-
- lib/free-image.rb
|
93
117
|
- test/cookbook.rb
|
94
118
|
- test/images/corrupt.jpg
|
95
119
|
- test/images/gradient.png
|
@@ -112,7 +136,11 @@ files:
|
|
112
136
|
- test/images/lena_thumbnail_border_scanline.png
|
113
137
|
- test/images/not_an_image.txt
|
114
138
|
- test/images/sample.png
|
139
|
+
- test/images/sample_composite.png
|
115
140
|
- test/images/sample_composite_color.png
|
141
|
+
- test/images/test16.bmp
|
142
|
+
- test/images/test16bf555.bmp
|
143
|
+
- test/images/test16bf565.bmp
|
116
144
|
- test/test_bitmap.rb
|
117
145
|
- test/test_conversions.rb
|
118
146
|
- test/test_file.rb
|
@@ -130,27 +158,26 @@ files:
|
|
130
158
|
- test/test_transforms.rb
|
131
159
|
homepage:
|
132
160
|
licenses: []
|
161
|
+
metadata: {}
|
133
162
|
post_install_message:
|
134
163
|
rdoc_options: []
|
135
164
|
require_paths:
|
136
165
|
- lib
|
137
166
|
required_ruby_version: !ruby/object:Gem::Requirement
|
138
|
-
none: false
|
139
167
|
requirements:
|
140
|
-
- -
|
168
|
+
- - ">="
|
141
169
|
- !ruby/object:Gem::Version
|
142
170
|
version: 1.8.7
|
143
171
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
|
-
none: false
|
145
172
|
requirements:
|
146
|
-
- -
|
173
|
+
- - ">="
|
147
174
|
- !ruby/object:Gem::Version
|
148
175
|
version: '0'
|
149
176
|
requirements: []
|
150
177
|
rubyforge_project:
|
151
|
-
rubygems_version:
|
178
|
+
rubygems_version: 2.4.5
|
152
179
|
signing_key:
|
153
|
-
specification_version:
|
180
|
+
specification_version: 4
|
154
181
|
summary: Ruby Bindings for the Free Image Library
|
155
182
|
test_files:
|
156
183
|
- test/test_bitmap.rb
|