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.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/HISTORY +30 -19
  3. data/LICENSE +20 -20
  4. data/README.rdoc +120 -120
  5. data/Rakefile +51 -47
  6. data/cookbook.rdoc +248 -237
  7. data/free-image.gemspec +30 -29
  8. data/lib/free-image.rb +1 -2
  9. data/lib/free-image/bitmap.rb +2 -2
  10. data/lib/free-image/enums/filters.rb +11 -11
  11. data/lib/free-image/errors.rb +43 -43
  12. data/lib/free-image/modules/conversions.rb +253 -253
  13. data/lib/free-image/modules/helper.rb +41 -41
  14. data/lib/free-image/modules/information.rb +20 -2
  15. data/lib/free-image/modules/modify.rb +299 -299
  16. data/lib/free-image/modules/pixels.rb +134 -134
  17. data/lib/free-image/modules/transforms.rb +90 -90
  18. data/lib/free-image/sources/abstract_source.rb +178 -178
  19. data/lib/free-image/sources/file.rb +114 -114
  20. data/lib/free-image/sources/io.rb +153 -153
  21. data/lib/free-image/sources/memory.rb +188 -188
  22. data/lib/free-image/types/boolean.rb +13 -13
  23. data/lib/free-image/types/ffi.rb +13 -13
  24. data/lib/free-image/types/info_header.rb +36 -0
  25. data/lib/free-image/types/rgb16.rb +31 -0
  26. data/test/cookbook.rb +45 -46
  27. data/test/images/sample_composite.png +0 -0
  28. data/test/images/test16.bmp +0 -0
  29. data/test/images/test16bf555.bmp +0 -0
  30. data/test/images/test16bf565.bmp +0 -0
  31. data/test/test_bitmap.rb +61 -63
  32. data/test/test_conversions.rb +85 -86
  33. data/test/test_file.rb +68 -69
  34. data/test/test_free_image.rb +14 -15
  35. data/test/test_helper.rb +14 -0
  36. data/test/test_information.rb +145 -117
  37. data/test/test_io.rb +73 -74
  38. data/test/test_memory.rb +83 -84
  39. data/test/test_modify.rb +75 -58
  40. data/test/test_palette.rb +44 -45
  41. data/test/test_pixels.rb +61 -62
  42. data/test/test_rgb_quad.rb +24 -25
  43. data/test/test_scanline.rb +64 -65
  44. data/test/test_suite.rb +12 -17
  45. data/test/test_transforms.rb +28 -29
  46. metadata +58 -31
@@ -1,26 +1,25 @@
1
- # encoding: UTF-8
2
-
3
- require './test_helper'
4
- require 'test/unit'
5
-
6
- class RGBQuadTest < Test::Unit::TestCase
7
- def test_create
8
- color = FreeImage::RGBQuad.create(1,2,3,4)
9
- assert_equal(color[:red], 1)
10
- assert_equal(color[:green], 2)
11
- assert_equal(color[:blue], 3)
12
- assert_equal(color[:reserved], 4)
13
- end
14
-
15
- def test_=
16
- color1 = FreeImage::RGBQuad.create(1,2,3,4)
17
- color2 = FreeImage::RGBQuad.create(1,2,3,4)
18
- assert_equal(color1, color2)
19
- end
20
-
21
- def test_eql
22
- color1 = FreeImage::RGBQuad.create(1,2,3,4)
23
- color2 = FreeImage::RGBQuad.create(1,2,3,4)
24
- assert(color1.eql?(color2))
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
@@ -1,65 +1,64 @@
1
- # encoding: UTF-8
2
-
3
- require './test_helper'
4
- require 'test/unit'
5
-
6
- class ScanlineTest < Test::Unit::TestCase
7
- def scanline(index = 0)
8
- image = lena_image
9
- image.scanline(index)
10
- end
11
-
12
- def test_class
13
- assert_kind_of(FreeImage::Scanline, scanline)
14
- end
15
-
16
- def test_bytesize
17
- assert_equal(lena_image.pitch, scanline.bytesize)
18
- end
19
-
20
- def test_pixelsize
21
- assert_equal(lena_image.width, scanline.pixelsize)
22
- end
23
-
24
- def test_color_type
25
- assert_equal(FreeImage::RGBTriple, scanline.send(:color_type))
26
- end
27
-
28
- def test_color_size
29
- assert_equal(3, scanline.send(:color_type).size)
30
- end
31
-
32
- def test_color
33
- expected = lena_image.pixel_color(0, 0)
34
- actual = scanline[0]
35
-
36
- assert_equal(expected[:red], actual[:red])
37
- assert_equal(expected[:green], actual[:green])
38
- assert_equal(expected[:blue], actual[:blue])
39
- assert_equal(expected[:reserved], 0)
40
- end
41
-
42
- def test_invalid_y
43
- error = assert_raise(RangeError) do
44
- lena_image.scanline(-1)
45
- end
46
- assert_equal("Index must be between 0 and 511", error.to_s)
47
-
48
- error = assert_raise(RangeError) do
49
- lena_image.scanline(1000)
50
- end
51
- assert_equal("Index must be between 0 and 511", error.to_s)
52
- end
53
-
54
- def test_invalid_x
55
- error = assert_raise(RangeError) do
56
- scanline[-1]
57
- end
58
- assert_equal("Index must be between 0 and 511", error.to_s)
59
-
60
- error = assert_raise(RangeError) do
61
- scanline[1000]
62
- end
63
- assert_equal("Index must be between 0 and 511", error.to_s)
64
- end
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
@@ -1,19 +1,14 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Change to current directory so relative
4
- # requires work.
5
- dir = File.dirname(__FILE__)
6
- Dir.chdir(dir)
7
-
8
- require './test_bitmap'
9
- require './test_conversions'
10
- require './test_file'
11
- require './test_free_image'
12
- require './test_information'
13
- require './test_io'
14
- require './test_memory'
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'
@@ -1,30 +1,29 @@
1
- # encoding: UTF-8
2
-
3
- require './test_helper'
4
- require 'test/unit'
5
-
6
- class TrasformsTest < Test::Unit::TestCase
7
- def test_rotate
8
- bitmap1 = FreeImage::Bitmap.open(image_path('sample.png'))
9
- bitmap2 = bitmap1.rotate(45)
10
- assert_kind_of(FreeImage::Bitmap, bitmap2)
11
- end
12
-
13
- def test_rotate_ex
14
- bitmap1 = FreeImage::Bitmap.open(image_path('sample.png'))
15
- bitmap2 = bitmap1.rotate_ex(45, 0, 0, 0, 0)
16
- assert_kind_of(FreeImage::Bitmap, bitmap2)
17
- end
18
-
19
- def test_flip_horizontal
20
- bitmap1 = FreeImage::Bitmap.open(image_path('sample.png'))
21
- result = bitmap1.flip_horizontal!
22
- assert_kind_of(TrueClass, result)
23
- end
24
-
25
- def test_flip_vertical
26
- bitmap1 = FreeImage::Bitmap.open(image_path('sample.png'))
27
- result = bitmap1.flip_vertical!
28
- assert_kind_of(TrueClass, result)
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.6.2
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: 2011-09-06 00:00:00.000000000 Z
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: &23576770 !ruby/object:Gem::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: *23576770
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: &23576430 !ruby/object:Gem::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: *23576430
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: &23575760 !ruby/object:Gem::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: *23575760
47
- description: ! " FreeImage is an Open Source library project for developers who
48
- would like to support\n popular graphics image formats like PNG, BMP, JPEG, TIFF
49
- and others as needed by\n today's multimedia applications. FreeImage is easy
50
- to use, fast, multithreading\n safe, compatible with all 32-bit or 64-bit versions
51
- of Windows, and\n cross-platform (works both with Linux and Mac OS X).\n"
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
- - free-image.gemspec
82
+ - README.rdoc
60
83
  - Rakefile
61
84
  - cookbook.rdoc
62
- - README.rdoc
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: 1.8.10
178
+ rubygems_version: 2.4.5
152
179
  signing_key:
153
- specification_version: 3
180
+ specification_version: 4
154
181
  summary: Ruby Bindings for the Free Image Library
155
182
  test_files:
156
183
  - test/test_bitmap.rb