image_science 1.2.0 → 1.2.1

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.
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ === 1.2.1 / 2009-08-14
2
+
3
+ * 2 minor enhancements:
4
+
5
+ * Added luis' patches to make it build properly on windows.
6
+ * with_image now raises on missing/bad files.
7
+
1
8
  == 1.2.0 / 2009-06-23
2
9
 
3
10
  * 7 minor enhancements:
data/lib/image_science.rb CHANGED
@@ -11,7 +11,7 @@ require 'inline'
11
11
  # http://seattlerb.rubyforge.org/ImageScience.html
12
12
 
13
13
  class ImageScience
14
- VERSION = '1.2.0'
14
+ VERSION = '1.2.1'
15
15
 
16
16
  ##
17
17
  # The top-level image loader opens +path+ and then yields the image.
@@ -94,15 +94,22 @@ class ImageScience
94
94
  end
95
95
 
96
96
  builder.add_link_flags "-lfreeimage"
97
- builder.add_link_flags "-lstdc++" # only needed on PPC for some reason. lame
97
+ unless RUBY_PLATFORM =~ /mswin/
98
+ builder.add_link_flags "-lfreeimage"
99
+ # TODO: detect PPC
100
+ builder.add_link_flags "-lstdc++" # only needed on PPC for some reason
101
+ else
102
+ builder.add_link_flags "freeimage.lib"
103
+ end
98
104
  builder.include '"FreeImage.h"'
99
105
 
100
106
  builder.prefix <<-"END"
101
- #define GET_BITMAP(name) FIBITMAP *(name); Data_Get_Struct(self, FIBITMAP, (name)); if (!(name)) rb_raise(rb_eTypeError, "Bitmap has already been freed")
107
+ #define GET_BITMAP(name) Data_Get_Struct(self, FIBITMAP, (name)); if (!(name)) rb_raise(rb_eTypeError, "Bitmap has already been freed");
102
108
  END
103
109
 
104
110
  builder.prefix <<-"END"
105
111
  VALUE unload(VALUE self) {
112
+ FIBITMAP *bitmap;
106
113
  GET_BITMAP(bitmap);
107
114
 
108
115
  FreeImage_Unload(bitmap);
@@ -148,13 +155,14 @@ class ImageScience
148
155
  builder.c_singleton <<-"END"
149
156
  VALUE with_image(char * input) {
150
157
  FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;
158
+ int flags;
151
159
 
152
160
  fif = FreeImage_GetFileType(input, 0);
153
161
  if (fif == FIF_UNKNOWN) fif = FreeImage_GetFIFFromFilename(input);
154
162
  if ((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) {
155
163
  FIBITMAP *bitmap;
156
164
  VALUE result = Qnil;
157
- int flags = fif == FIF_JPEG ? JPEG_ACCURATE : 0;
165
+ flags = fif == FIF_JPEG ? JPEG_ACCURATE : 0;
158
166
  if (bitmap = FreeImage_Load(fif, input, flags)) {
159
167
  FITAG *tagValue = NULL;
160
168
  FreeImage_GetMetadata(FIMD_EXIF_MAIN, bitmap, "Orientation", &tagValue);
@@ -212,7 +220,7 @@ class ImageScience
212
220
 
213
221
  builder.c <<-"END"
214
222
  VALUE with_crop(int l, int t, int r, int b) {
215
- FIBITMAP *copy;
223
+ FIBITMAP *copy, *bitmap;
216
224
  VALUE result = Qnil;
217
225
  GET_BITMAP(bitmap);
218
226
 
@@ -226,6 +234,7 @@ class ImageScience
226
234
 
227
235
  builder.c <<-"END"
228
236
  int height() {
237
+ FIBITMAP *bitmap;
229
238
  GET_BITMAP(bitmap);
230
239
 
231
240
  return FreeImage_GetHeight(bitmap);
@@ -234,6 +243,7 @@ class ImageScience
234
243
 
235
244
  builder.c <<-"END"
236
245
  int width() {
246
+ FIBITMAP *bitmap;
237
247
  GET_BITMAP(bitmap);
238
248
 
239
249
  return FreeImage_GetWidth(bitmap);
@@ -242,10 +252,11 @@ class ImageScience
242
252
 
243
253
  builder.c <<-"END"
244
254
  VALUE resize(long w, long h) {
255
+ FIBITMAP *bitmap, *image;
245
256
  if (w <= 0) rb_raise(rb_eArgError, "Width <= 0");
246
257
  if (h <= 0) rb_raise(rb_eArgError, "Height <= 0");
247
258
  GET_BITMAP(bitmap);
248
- FIBITMAP *image = FreeImage_Rescale(bitmap, w, h, FILTER_CATMULLROM);
259
+ image = FreeImage_Rescale(bitmap, w, h, FILTER_CATMULLROM);
249
260
  if (image) {
250
261
  copy_icc_profile(self, bitmap, image);
251
262
  return wrap_and_yield(image, self, 0);
@@ -256,11 +267,13 @@ class ImageScience
256
267
 
257
268
  builder.c <<-"END"
258
269
  VALUE save(char * output) {
270
+ int flags;
271
+ FIBITMAP *bitmap;
259
272
  FREE_IMAGE_FORMAT fif = FreeImage_GetFIFFromFilename(output);
260
273
  if (fif == FIF_UNKNOWN) fif = FIX2INT(rb_iv_get(self, "@file_type"));
261
274
  if ((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsWriting(fif)) {
262
275
  GET_BITMAP(bitmap);
263
- int flags = fif == FIF_JPEG ? JPEG_QUALITYSUPERB : 0;
276
+ flags = fif == FIF_JPEG ? JPEG_QUALITYSUPERB : 0;
264
277
  BOOL result = 0, unload = 0;
265
278
 
266
279
  if (fif == FIF_PNG) FreeImage_DestroyICCProfile(bitmap);
@@ -48,8 +48,10 @@ class TestImageScience < MiniTest::Unit::TestCase
48
48
  end
49
49
 
50
50
  def test_class_with_image_missing_with_img_extension
51
- assert_nil ImageScience.with_image("nope#{@path}") do |img|
52
- flunk
51
+ assert_raises RuntimeError do
52
+ assert_nil ImageScience.with_image("nope#{@path}") do |img|
53
+ flunk
54
+ end
53
55
  end
54
56
  end
55
57
 
metadata CHANGED
@@ -1,36 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_science
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDPjCCAiagAwIBAgIBADANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
14
- ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTA5MDMwNjE4NTMxNVoXDTEwMDMwNjE4NTMxNVowRTETMBEGA1UE
16
- AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
- JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
18
- b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
19
- taCPaLmfYIaFcHHCSY4hYDJijRQkLxPeB3xbOfzfLoBDbjvx5JxgJxUjmGa7xhcT
20
- oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
21
- GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
22
- qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
23
- gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
24
- HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
25
- AQAY59gYvDxqSqgC92nAP9P8dnGgfZgLxP237xS6XxFGJSghdz/nI6pusfCWKM8m
26
- vzjjH2wUMSSf3tNudQ3rCGLf2epkcU13/rguI88wO6MrE0wi4ZqLQX+eZQFskJb/
27
- w6x9W1ur8eR01s397LSMexySDBrJOh34cm2AlfKr/jokKCTwcM0OvVZnAutaovC0
28
- l1SVZ0ecg88bsWHA0Yhh7NFxK1utWoIhtB6AFC/+trM0FQEB/jZkIS8SaNzn96Rl
29
- n0sZEf77FLf5peR8TP/PtmIg7Cyqz23sLM4mCOoTGIy5OcZ8TdyiyINUHtb5ej/T
30
- FBHgymkyj/AOSqKRIpXPhjC6
31
- -----END CERTIFICATE-----
10
+ cert_chain: []
32
11
 
33
- date: 2009-06-23 00:00:00 -07:00
12
+ date: 2009-08-14 00:00:00 -07:00
34
13
  default_executable:
35
14
  dependencies:
36
15
  - !ruby/object:Gem::Dependency
@@ -41,7 +20,7 @@ dependencies:
41
20
  requirements:
42
21
  - - ">="
43
22
  - !ruby/object:Gem::Version
44
- version: 2.3.0
23
+ version: 2.3.3
45
24
  version:
46
25
  description: |-
47
26
  ImageScience is a clean and happy Ruby library that generates
@@ -94,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
73
  requirements: []
95
74
 
96
75
  rubyforge_project: seattlerb
97
- rubygems_version: 1.3.4
76
+ rubygems_version: 1.3.5
98
77
  signing_key:
99
78
  specification_version: 3
100
79
  summary: ImageScience is a clean and happy Ruby library that generates thumbnails -- and kicks the living crap out of RMagick
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
@@ -1,4 +0,0 @@
1
- #
2
- ���
3
- �'��6�@�[ߺk~�V;t �� 7�����hG��I�q�j_�#�IH��� ����%���T'���0O������
4
- (r%��$�