devil 0.1.7-x86-mswin32-60 → 0.1.8-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG ADDED
@@ -0,0 +1,50 @@
1
+ 2009-10-21
2
+ version 0.1.8
3
+ * made LANCZOS3 scaling filter the default for highquality thumbnails
4
+ * changed clear color to DevIL default (mother of pearl and full alpha)
5
+ * added blit function to HLA (high level API)
6
+ * added mirror, edge_detect, emboss, enlarge_canvas, etc to HLA
7
+ * added ILU_CENTER, ILU_LOWER_LEFT, ILU_PLACEMENT etc to LLA
8
+ * include ILU and IL modules in Devil::Image now
9
+ * made Devil::Image#show return self
10
+ * made Devil::Image#show use a dup of the image (so a 'snapshot' is taken of image)
11
+ * added Devil.set_options method to HLA
12
+ * refactored HLA to use an 'action' method, saved code duplication of set_binding/error_check etc.
13
+
14
+ 2009-10-17 John Mair (Banisterfiend)
15
+ * ruby_il.c added:
16
+ * constants: IMAGE_DEPTH, ORIGIN_SET, CONV_PAL, CUR_IMAGE, ORIGIN_LOWER_LEFT, ORIGIN_LOWER_RIGHT
17
+ * methods: Disable, OriginFunc, ClearColour, ClearImage.
18
+ * Modified FromBlob method to restore old binding after use.
19
+ * ruby_ilu.c added:
20
+ * methods: EnlargeCanvas, EdgeDetectP, EdgeDetectS, Emboss, Mirror, SwapColours.
21
+ * Modified Crop to now take z-axis parameters. (stick to original API as closely as possible)
22
+
23
+ 2009-10-15 John Mair (Banisterfiend)
24
+ * hopefully fixed compile errors on SnowLeopard!
25
+ * added error checking to Devil::load_image()
26
+ * added monkeypatch to Gosu::Image::new() to transparently load multiple formats
27
+ * updated some rdoc
28
+
29
+ 2009-10-13 John Mair (Banisterfiend)
30
+ * version 0.1.6
31
+ * added Gosu and TexPlay interoperability
32
+ * ...bunch of other miscellaneous functionality
33
+ * released gem
34
+
35
+ 2009-10-10 John Mair (Banisterfiend)
36
+ * constants added to ruby_il.c:
37
+ * IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_FORMAT, FILE_OVERWRITE
38
+ * functions added to ruby_il.c:
39
+ * ilEnable, ilGetInteger, ilConvertImage, ToBlob, ilCloneCurImage
40
+ * conditional compilation added to ruby_il.c for LBM constant
41
+ * functions added to ruby_ilu.c:
42
+ * ilFlipImage, ilRotate, ilCrop
43
+ * added Gosu and TexPlay interoperability
44
+ * ...bunch of other miscellaneous functionality
45
+
46
+ 2009-10-06 John Mair (Banisterfiend)
47
+ * ruby 1.9 compatibility
48
+
49
+ 2006-09-28 Jaroslaw Tworek <dev.jrx@gmail.com>
50
+ * Initial release
data/README CHANGED
@@ -1,52 +1,52 @@
1
- Ruby Devil version 0.1.7
2
- ========================
3
-
4
- * Original author: Jaroslaw Tworek <dev.jrx@gmail.com>
5
- * Current maintainer: John Mair (banisterfiend) [http://banisterfiend.wordpress.com]
6
-
7
- Ruby bindings for the Developer's Image Library
8
- You need DevIL installed to use this extension
9
-
10
- The Ruby Devil Project page is here: [http://github.com/banister/devil]
11
-
12
-
13
- Installation Instructions:
14
- ==========================
15
-
16
- For debian:
17
-
18
- * install the libdevil and libdevil-dev packages
19
-
20
- For Gentoo:
21
-
22
- * emerge "media-libs/devil"
23
-
24
- For windows:
25
-
26
- * download devil.dll and ilu.dll from [http://github.com/banister/devil/downloads]
27
- * and copy these files to c:\windows\system\
28
-
29
- For macosx:
30
-
31
- * sudo port install libdevil
32
-
33
- For other systems:
34
-
35
- * install libdevil and lib-devil-dev using your package manager
36
- * OR download and install the libraries from [http://openil.sourceforge.net]
37
-
38
- After you've installed the DevIL libraries you install the gem by going:
39
-
40
- * gem install devil
41
-
42
- If you wish to use the Gosu and TexPlay extensions, it is necessary to also have:
43
-
44
- * the Gosu gem (gem install gosu)
45
- * the TexPlay gem (gem install texplay)
46
- * ruby-opengl (gem install ruby-opengl)
47
-
48
- For now, there is support for just a subset of DevIL functions, but it is enough
49
- for 95% things you may want to do.
50
-
51
- For example uses, see test/ directory
52
- (note: that many of the examples use the Gosu library...this is often just for visualization purposes. Alot of the functionality does not depend on Gosu being present)
1
+ Ruby Devil version 0.1.8
2
+ ========================
3
+
4
+ * Original author: Jaroslaw Tworek <dev.jrx@gmail.com>
5
+ * Current maintainer: John Mair (banisterfiend) [http://banisterfiend.wordpress.com]
6
+
7
+ Ruby bindings for the Developer's Image Library
8
+ You need DevIL installed to use this extension
9
+
10
+ The Ruby Devil Project page is here: [http://github.com/banister/devil]
11
+
12
+
13
+ Installation Instructions:
14
+ ==========================
15
+
16
+ For debian:
17
+
18
+ * install the libdevil and libdevil-dev packages
19
+
20
+ For Gentoo:
21
+
22
+ * emerge "media-libs/devil"
23
+
24
+ For windows:
25
+
26
+ * download devil.dll and ilu.dll from [http://github.com/banister/devil/downloads]
27
+ * and copy these files to c:\windows\system\
28
+
29
+ For macosx:
30
+
31
+ * sudo port install libdevil
32
+
33
+ For other systems:
34
+
35
+ * install libdevil and lib-devil-dev using your package manager
36
+ * OR download and install the libraries from [http://openil.sourceforge.net]
37
+
38
+ After you've installed the DevIL libraries you install the gem by going:
39
+
40
+ * gem install devil
41
+
42
+ If you wish to use the Gosu and TexPlay extensions, it is necessary to also have:
43
+
44
+ * the Gosu gem (gem install gosu)
45
+ * the TexPlay gem (gem install texplay)
46
+ * ruby-opengl (gem install ruby-opengl)
47
+
48
+ For now, there is support for just a subset of DevIL functions, but it is enough
49
+ for 95% things you may want to do.
50
+
51
+ For example uses, see test/ directory
52
+ (note: that many of the examples use the Gosu library...this is often just for visualization purposes. Alot of the functionality does not depend on Gosu being present)
data/Rakefile CHANGED
@@ -1,75 +1,76 @@
1
- require 'rake/clean'
2
- if RUBY_PLATFORM !~ /win32/
3
- require 'rake/extensiontask'
4
- end
5
-
6
- require 'rake/gempackagetask'
7
- require 'rake/testtask'
8
- require 'rake/rdoctask'
9
-
10
- DEVIL_VERSION = "0.1.7"
11
-
12
- dlext = Config::CONFIG['DLEXT']
13
-
14
- CLEAN.include("ext/**/*.#{dlext}", "ext/**/.log", "ext/**/.o", "ext/**/*~", "ext/**/*#*", "ext/**/.obj", "ext/**/.def", "ext/**/.pdb")
15
- CLOBBER.include("**/*.#{dlext}", "**/*~", "**/*#*", "**/*.log", "**/*.o", "doc/**")
16
-
17
- spec = Gem::Specification.new do |s|
18
- s.name = "devil"
19
- s.summary = "ruby bindings for devil cross platform image loading library"
20
- s.description = s.summary
21
- s.version = DEVIL_VERSION
22
- s.author = "Jaroslaw Tworek, John Mair (banisterfiend)"
23
- s.email = 'jrmair@gmail.com'
24
- s.date = Time.now.strftime '%Y-%m-%d'
25
- s.require_path = 'lib'
26
- s.homepage = "http://banisterfiend.wordpress.com"
27
-
28
- if RUBY_PLATFORM =~ /win32/
29
- s.platform = Gem::Platform::CURRENT
30
- else
31
- s.platform = Gem::Platform::RUBY
32
- end
33
-
34
- if RUBY_PLATFORM !~ /win32/
35
- s.extensions = FileList["ext/**/extconf.rb"]
36
- end
37
-
38
- s.has_rdoc = true
39
- s.extra_rdoc_files = ["README"]
40
- s.rdoc_options << '--main' << 'README'
41
- s.files = ["Rakefile", "README", "LICENSE", "lib/devil.rb", "lib/devil/gosu.rb"] +
42
- FileList["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c", "test/test*.rb", "test/*.png", "test/*.jpg"].to_a
43
-
44
- if RUBY_PLATFORM =~ /win32/
45
- s.files += ["lib/1.8/devil.so", "lib/1.9/devil.so"]
46
- end
47
-
48
- end
49
-
50
- Rake::GemPackageTask.new(spec) do |pkg|
51
- pkg.need_zip = false
52
- pkg.need_tar = false
53
- end
54
-
55
- task :compile => :clean
56
-
57
- if RUBY_PLATFORM !~ /win32/
58
- Rake::ExtensionTask.new('devil', spec) do |ext|
59
- ext.config_script = 'extconf.rb'
60
- ext.cross_compile = true
61
- ext.cross_platform = 'i386-mswin32'
62
- end
63
- end
64
-
65
- Rake::TestTask.new do |t|
66
- t.libs << "lib"
67
- t.test_files = FileList['test/test*.rb']
68
- t.verbose = true
69
- end
70
-
71
- Rake::RDocTask.new do |rd|
72
- rd.main = "README"
73
- rd.rdoc_files.include("README", "lib/devil.rb", "lib/devil/gosu.rb")
74
- end
75
-
1
+ require 'rake/clean'
2
+
3
+ if RUBY_PLATFORM !~ /win32/
4
+ require 'rake/extensiontask'
5
+ end
6
+
7
+ require 'rake/gempackagetask'
8
+ require 'rake/testtask'
9
+ require 'rake/rdoctask'
10
+
11
+ DEVIL_VERSION = "0.1.8"
12
+
13
+ dlext = Config::CONFIG['DLEXT']
14
+
15
+ CLEAN.include("ext/**/*.#{dlext}", "ext/**/.log", "ext/**/.o", "ext/**/*~", "ext/**/*#*", "ext/**/.obj", "ext/**/.def", "ext/**/.pdb")
16
+ CLOBBER.include("**/*.#{dlext}", "**/*~", "**/*#*", "**/*.log", "**/*.o", "doc/**")
17
+
18
+ spec = Gem::Specification.new do |s|
19
+ s.name = "devil"
20
+ s.summary = "ruby bindings for devil cross platform image loading library"
21
+ s.description = s.summary
22
+ s.version = DEVIL_VERSION
23
+ s.author = "Jaroslaw Tworek, John Mair (banisterfiend)"
24
+ s.email = 'jrmair@gmail.com'
25
+ s.date = Time.now.strftime '%Y-%m-%d'
26
+ s.require_path = 'lib'
27
+ s.homepage = "http://banisterfiend.wordpress.com"
28
+
29
+ if RUBY_PLATFORM =~ /win32/
30
+ s.platform = Gem::Platform::CURRENT
31
+ else
32
+ s.platform = Gem::Platform::RUBY
33
+ end
34
+
35
+ if RUBY_PLATFORM !~ /win32/
36
+ s.extensions = FileList["ext/**/extconf.rb"]
37
+ end
38
+
39
+ s.has_rdoc = true
40
+ s.extra_rdoc_files = ["README"]
41
+ s.rdoc_options << '--main' << 'README'
42
+ s.files = ["Rakefile", "README", "CHANGELOG", "LICENSE", "lib/devil.rb", "lib/devil/gosu.rb"] +
43
+ FileList["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c", "test/test*.rb", "test/*.png", "test/*.jpg"].to_a
44
+
45
+ if RUBY_PLATFORM =~ /win32/
46
+ s.files += ["lib/1.8/devil.so", "lib/1.9/devil.so"]
47
+ end
48
+
49
+ end
50
+
51
+ Rake::GemPackageTask.new(spec) do |pkg|
52
+ pkg.need_zip = false
53
+ pkg.need_tar = false
54
+ end
55
+
56
+ task :compile => :clean
57
+
58
+ if RUBY_PLATFORM !~ /win32/
59
+ Rake::ExtensionTask.new('devil', spec) do |ext|
60
+ ext.config_script = 'extconf.rb'
61
+ ext.cross_compile = true
62
+ ext.cross_platform = 'i386-mswin32'
63
+ end
64
+ end
65
+
66
+ Rake::TestTask.new do |t|
67
+ t.libs << "lib"
68
+ t.test_files = FileList['test/test*.rb']
69
+ t.verbose = true
70
+ end
71
+
72
+ Rake::RDocTask.new do |rd|
73
+ rd.main = "README"
74
+ rd.rdoc_files.include("README", "lib/devil.rb", "lib/devil/gosu.rb")
75
+ end
76
+
data/ext/devil/ruby_il.c CHANGED
@@ -151,7 +151,7 @@ static VALUE il_GetData(VALUE obj) {
151
151
  /* void* data = ImageData2Arr(rb_data); */
152
152
 
153
153
  /* ILuint uint = ilCopyPixels(XOff, YOff, ZOff, Width, Height, Depth, Format, Type, data); */
154
- /* return INT2FIX(uint); */
154
+ /* return INT2FIX(uint); */
155
155
  /* } */
156
156
 
157
157
  static VALUE il_SetData(VALUE obj, VALUE rb_Data) {
@@ -242,6 +242,13 @@ static VALUE il_Enable(VALUE obj, VALUE rb_mode) {
242
242
  return flag ? Qtrue : Qfalse;
243
243
  }
244
244
 
245
+ static VALUE il_Disable(VALUE obj, VALUE rb_mode) {
246
+ ILenum mode = NUM2INT(rb_mode);
247
+
248
+ ILboolean flag = ilDisable(mode);
249
+ return flag ? Qtrue : Qfalse;
250
+ }
251
+
245
252
  static VALUE il_GetInteger(VALUE obj, VALUE rb_mode) {
246
253
  ILenum mode = NUM2INT(rb_mode);
247
254
 
@@ -258,13 +265,22 @@ static VALUE il_ConvertImage(VALUE obj, VALUE rb_destformat, VALUE rb_desttype)
258
265
  return flag ? Qtrue : Qfalse;
259
266
  }
260
267
 
268
+ /* TODO: MAKE SURE NO MEMORY LEAKS! */
261
269
  /* this function is not actualy in the DevIL API, but im adding it here for convenience */
262
270
  static VALUE bf_ToBlob(VALUE obj)
263
271
  {
264
- ILuint width, height;
272
+ ILuint width, height, saved_image, copy_image;
265
273
  char * img_ptr;
266
274
  VALUE blob;
275
+
276
+ saved_image = ilGetInteger(IL_CUR_IMAGE);
277
+
278
+ /* make a copy of the current image */
279
+ copy_image = ilCloneCurImage();
280
+
281
+ ilBindImage(copy_image);
267
282
 
283
+ /* ensure the image is int RGBA UNSIGNED_BYTE format for blob */
268
284
  ilConvertImage(IL_RGBA, IL_UNSIGNED_BYTE);
269
285
 
270
286
  width = ilGetInteger(IL_IMAGE_WIDTH);
@@ -274,6 +290,11 @@ static VALUE bf_ToBlob(VALUE obj)
274
290
 
275
291
  blob = rb_str_new(img_ptr, 4 * width * height);
276
292
 
293
+ /* restore saved binding */
294
+ ilBindImage(saved_image);
295
+
296
+ ilDeleteImages(1, &copy_image);
297
+
277
298
  return blob;
278
299
  }
279
300
 
@@ -282,17 +303,22 @@ static VALUE bf_FromBlob(VALUE obj, VALUE blob, VALUE rb_width, VALUE rb_height)
282
303
  ILubyte * data;
283
304
  ILuint width, height;
284
305
  ILuint image;
306
+ ILuint saved_image;
285
307
 
286
308
  width = NUM2INT(rb_width);
287
309
  height = NUM2INT(rb_height);
288
310
 
289
311
  data = (ILubyte *) RSTRING_PTR(blob);
290
312
 
313
+ saved_image = ilGetInteger(IL_CUR_IMAGE);
314
+
291
315
  ilGenImages(1, &image);
292
316
  ilBindImage(image);
293
317
 
294
318
  ilTexImage(width, height, 1, 4, IL_RGBA, IL_UNSIGNED_BYTE, data);
295
319
 
320
+ ilBindImage(saved_image);
321
+
296
322
  return INT2NUM(image);
297
323
  }
298
324
 
@@ -302,6 +328,32 @@ static VALUE il_CloneCurImage(VALUE obj)
302
328
 
303
329
  return INT2NUM(clone);
304
330
  }
331
+
332
+ static VALUE il_OriginFunc(VALUE obj, VALUE rb_mode)
333
+ {
334
+ ILenum mode = NUM2INT(rb_mode);
335
+
336
+ ILboolean flag = ilOriginFunc(mode);
337
+ return flag ? Qtrue : Qfalse;
338
+ }
339
+
340
+ static VALUE il_ClearColour(VALUE obj, VALUE rb_red, VALUE rb_green, VALUE rb_blue, VALUE rb_alpha)
341
+ {
342
+ ILubyte red = NUM2INT(rb_red);
343
+ ILubyte green = NUM2INT(rb_green);
344
+ ILubyte blue = NUM2INT(rb_blue);
345
+ ILubyte alpha = NUM2INT(rb_alpha);
346
+
347
+ ilClearColour(red, green, blue, alpha);
348
+
349
+ return Qnil;
350
+ }
351
+
352
+ static VALUE il_ClearImage(VALUE obj)
353
+ {
354
+ ILboolean flag = ilClearImage();
355
+ return flag ? Qtrue : Qfalse;
356
+ }
305
357
  /* end of banisterfiend additions */
306
358
 
307
359
  void
@@ -338,11 +390,15 @@ InitializeIL() {
338
390
 
339
391
  /* methods added by baniterfiend */
340
392
  rb_define_module_function(mIL, "Enable", il_Enable, 1);
393
+ rb_define_module_function(mIL, "Disable", il_Disable, 1);
341
394
  rb_define_module_function(mIL, "GetInteger", il_GetInteger, 1);
342
395
  rb_define_module_function(mIL, "ConvertImage", il_ConvertImage, 2);
343
396
  rb_define_module_function(mIL, "ToBlob", bf_ToBlob, 0);
344
397
  rb_define_module_function(mIL, "FromBlob", bf_FromBlob, 3);
345
398
  rb_define_module_function(mIL, "CloneCurImage", il_CloneCurImage, 0);
399
+ rb_define_module_function(mIL, "OriginFunc", il_OriginFunc, 1);
400
+ rb_define_module_function(mIL, "ClearColour", il_ClearColour, 4);
401
+ rb_define_module_function(mIL, "ClearImage", il_ClearImage, 0);
346
402
  /* end of methods added by banisterfiend */
347
403
 
348
404
  //////////////////////////////////
@@ -434,11 +490,17 @@ InitializeIL() {
434
490
  rb_define_const(mIL, "LIB_MNG_ERROR", INT2NUM(IL_LIB_MNG_ERROR));
435
491
  rb_define_const(mIL, "UNKNOWN_ERROR", INT2NUM(IL_UNKNOWN_ERROR));
436
492
 
437
- // CONSTANTS BELOW ADDED BY BANISTERFIEND
493
+ /* CONSTANTS BELOW ADDED BY BANISTERFIEND */
494
+ rb_define_const(mIL, "IMAGE_DEPTH", INT2NUM(IL_IMAGE_DEPTH));
438
495
  rb_define_const(mIL, "IMAGE_WIDTH", INT2NUM(IL_IMAGE_WIDTH));
439
496
  rb_define_const(mIL, "IMAGE_HEIGHT", INT2NUM(IL_IMAGE_HEIGHT));
440
497
  rb_define_const(mIL, "IMAGE_FORMAT", INT2NUM(IL_IMAGE_FORMAT));
441
498
  rb_define_const(mIL, "FILE_OVERWRITE", INT2NUM(IL_FILE_OVERWRITE));
499
+ rb_define_const(mIL, "ORIGIN_SET", INT2NUM(IL_ORIGIN_SET));
500
+ rb_define_const(mIL, "CONV_PAL", INT2NUM(IL_CONV_PAL));
501
+ rb_define_const(mIL, "CUR_IMAGE", INT2NUM(IL_CUR_IMAGE));
502
+ rb_define_const(mIL, "ORIGIN_LOWER_LEFT", INT2NUM(IL_ORIGIN_LOWER_LEFT));
503
+ rb_define_const(mIL, "ORIGIN_UPPER_LEFT", INT2NUM(IL_ORIGIN_UPPER_LEFT));
442
504
  }
443
505
  //////////////////////////////////////////
444
506