devil 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -1,4 +1,4 @@
1
- Devil version 0.1.0
1
+ Devil version 0.1.1
2
2
 
3
3
  * Original author: Jaroslaw Tworek <dev.jrx@gmail.com>
4
4
  * Current maintainer: John Mair (banisterfiend) http://banisterfiend.wordpress.com
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rake/gempackagetask'
4
4
  require 'rake/testtask'
5
5
  require 'rake/rdoctask'
6
6
 
7
- DEVIL_VERSION = "0.1.0"
7
+ DEVIL_VERSION = "0.1.1"
8
8
 
9
9
  dlext = Config::CONFIG['DLEXT']
10
10
 
@@ -27,7 +27,7 @@ spec = Gem::Specification.new do |s|
27
27
  s.extra_rdoc_files = ["README"]
28
28
  s.rdoc_options << '--main' << 'README'
29
29
  s.files = ["Rakefile", "README", "LICENSE", "lib/devil.rb"] +
30
- FileList["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c"].to_a
30
+ FileList["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c", "test/test*.rb"].to_a
31
31
  end
32
32
 
33
33
  Rake::GemPackageTask.new(spec) do |pkg|
data/ext/devil/extconf.rb CHANGED
@@ -1,7 +1,9 @@
1
1
  require 'mkmf'
2
2
 
3
- have_library("IL", "ilInit");
4
- have_library("ILU", "iluInit");
5
- have_library("ILUT", "ilutInit");
3
+ #$CFLAGS += ' -I/home/john/.rake-compiler/ruby/ruby-1.8.6-p287/include/'
4
+ #$LDFLAGS += ' -L/home/john/.rake-compiler/ruby/ruby-1.8.6-p287/lib/'
5
+ exit unless have_library("IL", "ilInit");
6
+ exit unless have_library("ILU", "iluInit");
7
+ #have_library("ILUT", "ilutInit");
6
8
 
7
9
  create_makefile('devil')
@@ -5,5 +5,7 @@ void
5
5
  Init_devil() {
6
6
  InitializeIL();
7
7
  InitializeILU();
8
- InitializeILUT();
8
+
9
+ /* turning off ILUT layer */
10
+ /* InitializeILUT(); */
9
11
  }
@@ -6,4 +6,6 @@ typedef struct RArray RArray;
6
6
 
7
7
  extern void InitializeIL();
8
8
  extern void InitializeILU();
9
- extern void InitializeILUT();
9
+
10
+ /* turning off ILUT layer */
11
+ /*extern void InitializeILUT(); */
data/lib/devil.rb CHANGED
@@ -14,7 +14,7 @@ end
14
14
 
15
15
  # Provides a high level wrapper for the low-level DevIL Ruby bindings
16
16
  module Devil
17
- VERSION = '0.1.0'
17
+ VERSION = '0.1.1'
18
18
 
19
19
  # loads +file+ and returns a new image
20
20
  # Optionally accepts a block and yields the newly created image to the block.
@@ -0,0 +1,24 @@
1
+ direc = File.dirname(__FILE__)
2
+
3
+ require 'rubygems'
4
+ require "#{direc}/../lib/devil"
5
+
6
+
7
+ Devil.load_image("#{direc}/texture.png") do |img|
8
+ img.negative
9
+ img.save("#{direc}/texture_neg.png")
10
+ end
11
+
12
+ img = Devil.load_image("#{direc}/texture.png")
13
+ bink = Devil.load_image("#{direc}/texture.png")
14
+
15
+ img.gamma_correct(1.6)
16
+ bink.resize(50, 50)
17
+
18
+ img.save("#{direc}/texture_blur.png")
19
+ bink.save("#{direc}/texture_tiny.png")
20
+
21
+
22
+
23
+
24
+
@@ -0,0 +1,20 @@
1
+ require 'rubygems'
2
+ require 'devil'
3
+
4
+ IL.Init
5
+
6
+ name = IL.GenImages(1)[0]
7
+ IL.BindImage(name)
8
+ IL.LoadImage("texture.png")
9
+
10
+ puts "image height/width"
11
+ puts IL.GetInteger(IL::IMAGE_WIDTH)
12
+ puts IL.GetInteger(IL::IMAGE_HEIGHT)
13
+
14
+ ILU.Scale(100, 100, 1)
15
+
16
+ IL.Enable(IL::FILE_OVERWRITE)
17
+
18
+ IL.SaveImage("desert_thumb.png")
19
+
20
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaroslaw Tworek, John Mair (banisterfiend)
@@ -28,10 +28,11 @@ files:
28
28
  - lib/devil.rb
29
29
  - ext/devil/extconf.rb
30
30
  - ext/devil/ruby_devil_ext.h
31
- - ext/devil/ruby_ilut.c
32
31
  - ext/devil/ruby_devil_ext.c
33
32
  - ext/devil/ruby_il.c
34
33
  - ext/devil/ruby_ilu.c
34
+ - test/test_new_api.rb
35
+ - test/test_thumbnail.rb
35
36
  has_rdoc: true
36
37
  homepage: http://banisterfiend.wordpress.com
37
38
  post_install_message:
@@ -1,98 +0,0 @@
1
- #include <ruby.h>
2
- #include <IL/ilut.h>
3
- #include "ruby_devil_ext.h"
4
-
5
- static VALUE mILUT;
6
-
7
- static VALUE ilut_Renderer(VALUE obj, VALUE ilut_enum) {
8
- ILenum renderer = NUM2INT(ilut_enum);
9
- ilutRenderer(renderer);
10
- return Qnil;
11
- }
12
-
13
- static VALUE ilut_Enable(VALUE obj, VALUE rb_Mode) {
14
- ILenum Mode = NUM2INT(rb_Mode);
15
- ILboolean flag = ilutEnable(Mode);
16
- return flag ? Qtrue : Qfalse;
17
- }
18
-
19
- static VALUE ilut_GLTexImage(VALUE obj, VALUE rb_Level) {
20
- ILuint Level = NUM2INT(rb_Level);
21
- ILboolean flag = ilutGLTexImage(Level);
22
- return flag ? Qtrue : Qfalse;
23
- }
24
-
25
- static VALUE ilut_GLBindTexImage(VALUE obj) {
26
- GLuint ret = ilutGLBindTexImage();
27
- return INT2FIX(ret);
28
- }
29
-
30
- static VALUE ilut_GLBuildMipmaps(VALUE obj) {
31
- ILboolean flag = ilutGLBuildMipmaps();
32
- return flag ? Qtrue : Qfalse;
33
- }
34
-
35
- static VALUE ilut_GLBindMipmaps(VALUE obj) {
36
- ILuint ret = ilutGLBindMipmaps();
37
- return INT2FIX(ret);
38
- }
39
-
40
- static VALUE ilut_GLLoadImage(VALUE obj, VALUE rb_FileName) {
41
- const ILstring FileName = STR2CSTR(rb_FileName);
42
- GLuint ret = ilutGLLoadImage(FileName);
43
- return INT2FIX(ret);
44
- }
45
-
46
- static VALUE ilut_GLScreen(VALUE obj) {
47
- ILboolean flag = ilutGLScreen();
48
- return flag ? Qtrue : Qfalse;
49
- }
50
-
51
- static VALUE ilut_GLScreenie(VALUE obj) {
52
- ILboolean flag = ilutGLScreenie();
53
- return flag ? Qtrue : Qfalse;
54
- }
55
-
56
-
57
-
58
- void
59
- InitializeILUT() {
60
- mILUT = rb_define_module("ILUT");
61
- //////////////////////////////////
62
- //METHODS
63
- //////////////////////////////////
64
- rb_define_module_function(mILUT, "Renderer", ilut_Renderer, 1);
65
- rb_define_module_function(mILUT, "Enable", ilut_Enable , 1);
66
- rb_define_module_function(mILUT, "GLTexImage", ilut_GLTexImage, 1);
67
- rb_define_module_function(mILUT, "GLBindTexImage", ilut_GLBindTexImage, 0);
68
- rb_define_module_function(mILUT, "GLBuildMipmaps", ilut_GLBuildMipmaps , 0);
69
- rb_define_module_function(mILUT, "GLBindMipmaps", ilut_GLBindMipmaps , 0);
70
- rb_define_module_function(mILUT, "GLLoadImage", ilut_GLLoadImage, 1);
71
- rb_define_module_function(mILUT, "GLScreen", ilut_GLScreen , 1);
72
- rb_define_module_function(mILUT, "GLScreenie", ilut_GLScreenie , 1);
73
-
74
- //////////////////////////////////
75
- //CONSTANTS
76
- //////////////////////////////////
77
- rb_define_const(mILUT, "OPENGL", INT2NUM(ILUT_OPENGL));
78
- rb_define_const(mILUT, "ALLEGRO", INT2NUM(ILUT_ALLEGRO));
79
- rb_define_const(mILUT, "WIN32", INT2NUM(ILUT_WIN32));
80
- rb_define_const(mILUT, "DIRECT3D8", INT2NUM(ILUT_DIRECT3D8));
81
- rb_define_const(mILUT, "DIRECT3D9", INT2NUM(ILUT_DIRECT3D9));
82
-
83
- rb_define_const(mILUT, "PALETTE_MODE", INT2NUM(ILUT_PALETTE_MODE));
84
- rb_define_const(mILUT, "OPENGL_CONV", INT2NUM(ILUT_OPENGL_CONV));
85
- rb_define_const(mILUT, "D3D_MIPLEVELS", INT2NUM(ILUT_D3D_MIPLEVELS));
86
- rb_define_const(mILUT, "MAXTEX_WIDTH", INT2NUM(ILUT_MAXTEX_WIDTH));
87
- rb_define_const(mILUT, "MAXTEX_HEIGHT", INT2NUM(ILUT_MAXTEX_HEIGHT));
88
- rb_define_const(mILUT, "MAXTEX_DEPTH", INT2NUM(ILUT_MAXTEX_DEPTH));
89
- rb_define_const(mILUT, "GL_USE_S3TC", INT2NUM(ILUT_GL_USE_S3TC));
90
- rb_define_const(mILUT, "D3D_USE_DXTC", INT2NUM(ILUT_D3D_USE_DXTC));
91
- rb_define_const(mILUT, "GL_GEN_S3TC", INT2NUM(ILUT_GL_GEN_S3TC));
92
- rb_define_const(mILUT, "D3D_GEN_DXTC", INT2NUM(ILUT_D3D_GEN_DXTC));
93
- rb_define_const(mILUT, "S3TC_FORMAT", INT2NUM(ILUT_S3TC_FORMAT));
94
- rb_define_const(mILUT, "DXTC_FORMAT", INT2NUM(ILUT_DXTC_FORMAT));
95
- rb_define_const(mILUT, "D3D_POOL", INT2NUM(ILUT_D3D_POOL));
96
- rb_define_const(mILUT, "D3D_ALPHA_KEY_COLOR", INT2NUM(ILUT_D3D_ALPHA_KEY_COLOR));
97
- rb_define_const(mILUT, "D3D_ALPHA_KEY_COLOUR", INT2NUM(ILUT_D3D_ALPHA_KEY_COLOUR));
98
- }