devil 0.1.8.8-x86-mswin32-60 → 0.1.9.0-x86-mswin32-60
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/README +1 -1
- data/Rakefile +1 -1
- data/ext/devil/extconf.rb +27 -23
- data/ext/devil/ruby_devil_ext.c +1 -3
- data/ext/devil/ruby_ilut.c +98 -0
- data/lib/1.8/devil.so +0 -0
- data/lib/1.9/devil.so +0 -0
- data/lib/devil.rb +16 -31
- data/test/test_ilut.rb +95 -0
- data/test/test_thumbnail.rb +2 -2
- metadata +4 -2
data/README
CHANGED
data/Rakefile
CHANGED
data/ext/devil/extconf.rb
CHANGED
@@ -1,23 +1,27 @@
|
|
1
|
-
require 'mkmf'
|
2
|
-
|
3
|
-
if RUBY_PLATFORM =~ /mingw/
|
4
|
-
$CFLAGS += ' -I/home/john/.rake-compiler/ruby/ruby-1.8.6-p287/include/'
|
5
|
-
$LDFLAGS += ' -L/home/john/.rake-compiler/ruby/ruby-1.8.6-p287/lib/'
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
exit unless have_library("
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
exit unless have_library("
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
1
|
+
require 'mkmf'
|
2
|
+
|
3
|
+
if RUBY_PLATFORM =~ /mingw|win32/
|
4
|
+
$CFLAGS += ' -I/home/john/.rake-compiler/ruby/ruby-1.8.6-p287/include/'
|
5
|
+
$LDFLAGS += ' -L/home/john/.rake-compiler/ruby/ruby-1.8.6-p287/lib/'
|
6
|
+
exit unless have_library("glut32")
|
7
|
+
exit unless have_library("DevIL")
|
8
|
+
|
9
|
+
elsif RUBY_PLATFORM =~ /darwin/
|
10
|
+
|
11
|
+
# this only works if you install devil via macports
|
12
|
+
$CFLAGS += ' -I/opt/local/include/ -I/System/Library/Frameworks/GLUT.framework/Headers'
|
13
|
+
$LDFLAGS += ' -L/opt/local/lib/ -framework GLUT'
|
14
|
+
exit unless have_library("IL")
|
15
|
+
|
16
|
+
elsif RUBY_PLATFORM =~ /linux/
|
17
|
+
exit unless have_library("IL")
|
18
|
+
|
19
|
+
exit unless have_library("glut")
|
20
|
+
exit unless have_library("GL")
|
21
|
+
end
|
22
|
+
|
23
|
+
# all platforms
|
24
|
+
exit unless have_library("ILU")
|
25
|
+
exit unless have_library("ILUT")
|
26
|
+
|
27
|
+
create_makefile('devil')
|
data/ext/devil/ruby_devil_ext.c
CHANGED
@@ -0,0 +1,98 @@
|
|
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
|
+
GLuint 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 = StringValuePtr(rb_FileName);
|
42
|
+
ILuint 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
|
+
}
|
data/lib/1.8/devil.so
CHANGED
Binary file
|
data/lib/1.9/devil.so
CHANGED
Binary file
|
data/lib/devil.rb
CHANGED
@@ -19,7 +19,7 @@ module Devil
|
|
19
19
|
include IL
|
20
20
|
include ILU
|
21
21
|
|
22
|
-
VERSION = '0.1.
|
22
|
+
VERSION = '0.1.9.0'
|
23
23
|
|
24
24
|
class << self
|
25
25
|
|
@@ -35,23 +35,9 @@ module Devil
|
|
35
35
|
# apply a color profile if one is provided
|
36
36
|
IL.ApplyProfile(in_profile, out_profile) if out_profile
|
37
37
|
|
38
|
-
# run the load image hook (if it exists)
|
39
38
|
check_and_run_hook(:load_image_hook)
|
40
|
-
|
41
39
|
error_check
|
42
|
-
|
43
|
-
img = Image.new(name, file)
|
44
|
-
if block
|
45
|
-
begin
|
46
|
-
block.call(img)
|
47
|
-
ensure
|
48
|
-
# don't bother freeing it if it's already free
|
49
|
-
img.free if img.name
|
50
|
-
end
|
51
|
-
else
|
52
|
-
# ObjectSpace.define_finalizer(img, proc { IL.DeleteImages([img.name]) if img.name })
|
53
|
-
img
|
54
|
-
end
|
40
|
+
wrap_and_yield(name, file, block)
|
55
41
|
end
|
56
42
|
|
57
43
|
alias_method :with_image, :load_image
|
@@ -78,22 +64,9 @@ module Devil
|
|
78
64
|
IL.ClearImage
|
79
65
|
IL.ClearColour(*Devil.get_options[:clear_color]) if clear_color
|
80
66
|
|
81
|
-
# run the create image hook (if it exists)
|
82
67
|
check_and_run_hook(:create_image_hook)
|
83
|
-
|
84
68
|
error_check
|
85
|
-
|
86
|
-
img = Image.new(name, nil)
|
87
|
-
if block
|
88
|
-
begin
|
89
|
-
block.call(img)
|
90
|
-
ensure
|
91
|
-
img.free if img.name
|
92
|
-
end
|
93
|
-
else
|
94
|
-
# ObjectSpace.define_finalizer(img, proc { IL.DeleteImages([img.name]) if img.name })
|
95
|
-
img
|
96
|
-
end
|
69
|
+
wrap_and_yield(name, nil, block)
|
97
70
|
end
|
98
71
|
|
99
72
|
alias_method :create_blank_image, :create_image
|
@@ -219,7 +192,6 @@ module Devil
|
|
219
192
|
name = IL.GenImages(1).first
|
220
193
|
IL.BindImage(name)
|
221
194
|
|
222
|
-
# run the prepare image hook (if it exists)
|
223
195
|
check_and_run_hook(:prepare_image_hook)
|
224
196
|
|
225
197
|
name
|
@@ -232,6 +204,19 @@ module Devil
|
|
232
204
|
IL.ConvertImage(IL::RGBA, IL::UNSIGNED_BYTE)
|
233
205
|
end
|
234
206
|
|
207
|
+
def wrap_and_yield(name, file, block)
|
208
|
+
img = Image.new(name, file)
|
209
|
+
if block
|
210
|
+
begin
|
211
|
+
block.call(img)
|
212
|
+
ensure
|
213
|
+
img.free if img.name
|
214
|
+
end
|
215
|
+
else
|
216
|
+
img
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
235
220
|
def check_and_run_hook(hook_name)
|
236
221
|
Devil.get_options[hook_name].call if Devil.get_options[hook_name]
|
237
222
|
end
|
data/test/test_ilut.rb
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
# this test is a hold over from the original ruby-devil bindings (by Jaroslaw Tworek)
|
2
|
+
|
3
|
+
$direc = File.dirname(__FILE__)
|
4
|
+
|
5
|
+
$LOAD_PATH.push("#{$direc}/../lib/")
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
require 'glut'
|
9
|
+
require 'opengl'
|
10
|
+
require 'devil'
|
11
|
+
require 'thread'
|
12
|
+
|
13
|
+
$tex_id = 0
|
14
|
+
|
15
|
+
$idle = proc {
|
16
|
+
GLUT.PostRedisplay
|
17
|
+
}
|
18
|
+
|
19
|
+
$display = proc {
|
20
|
+
GL.Clear(GL::COLOR_BUFFER_BIT | GL::DEPTH_BUFFER_BIT)
|
21
|
+
GL.LoadIdentity
|
22
|
+
GLU.LookAt(0,0,-5,0,0,0,0,1,0)
|
23
|
+
|
24
|
+
GL.Begin GL::QUADS
|
25
|
+
|
26
|
+
|
27
|
+
GL.TexCoord(1,0)
|
28
|
+
GL.Vertex(1, 1,0)
|
29
|
+
GL.TexCoord(1,1)
|
30
|
+
GL.Vertex(1, -1,0)
|
31
|
+
GL.TexCoord(0,1)
|
32
|
+
GL.Vertex(-1, -1,0)
|
33
|
+
GL.TexCoord(0,0)
|
34
|
+
GL.Vertex(-1, 1,0)
|
35
|
+
|
36
|
+
GL.End
|
37
|
+
|
38
|
+
GLUT.SwapBuffers
|
39
|
+
}
|
40
|
+
|
41
|
+
$reshape = proc { |w,h|
|
42
|
+
GL.Viewport(0,0,w,h)
|
43
|
+
GL.MatrixMode(GL::PROJECTION)
|
44
|
+
GL.LoadIdentity
|
45
|
+
GLU.Perspective(45.0, Float(w)/h, 0.01, 100)
|
46
|
+
GL.MatrixMode(GL::MODELVIEW)
|
47
|
+
GL.LoadIdentity
|
48
|
+
}
|
49
|
+
|
50
|
+
def setup_gl
|
51
|
+
GL.ClearColor( 0,0,0,1)
|
52
|
+
IL.Init
|
53
|
+
ILUT.Renderer(ILUT::OPENGL)
|
54
|
+
GL.Enable(GL::DEPTH_TEST)
|
55
|
+
GL.DrawBuffer(GL::BACK)
|
56
|
+
GL.Disable(GL::CULL_FACE)
|
57
|
+
GL.ShadeModel(GL::FLAT)
|
58
|
+
GL.Enable(GL::TEXTURE_2D)
|
59
|
+
|
60
|
+
name = IL.GenImages(1)[0]
|
61
|
+
IL.BindImage(name)
|
62
|
+
|
63
|
+
if File.directory?("test") then
|
64
|
+
if !File.exist?("test/texture.png") then
|
65
|
+
raise RuntimeError, "File test/texture.png doesn't exist"
|
66
|
+
end
|
67
|
+
IL.LoadImage("test/texture.png")
|
68
|
+
else
|
69
|
+
if !File.exist?("texture.png") then
|
70
|
+
raise RuntimeError, "File texture.png doesn't exist"
|
71
|
+
end
|
72
|
+
IL.LoadImage("texture.png")
|
73
|
+
end
|
74
|
+
|
75
|
+
$tex_id = ILUT.GLBindMipmaps()
|
76
|
+
IL.DeleteImages([name])
|
77
|
+
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
def main
|
82
|
+
GLUT.Init
|
83
|
+
GLUT.InitDisplayMode(GLUT::DOUBLE | GLUT::RGB | GLUT::DEPTH)
|
84
|
+
GLUT.InitWindowSize(800,600)
|
85
|
+
GLUT.CreateWindow("Ruby-DevIL test")
|
86
|
+
setup_gl
|
87
|
+
GLUT.DisplayFunc($display)
|
88
|
+
GLUT.ReshapeFunc($reshape)
|
89
|
+
GLUT.IdleFunc($idle)
|
90
|
+
GLUT.MainLoop
|
91
|
+
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
main
|
data/test/test_thumbnail.rb
CHANGED
@@ -6,7 +6,7 @@ require 'rubygems'
|
|
6
6
|
require 'devil/gosu'
|
7
7
|
|
8
8
|
Devil.load("texture.png") do |img|
|
9
|
-
img.dup.thumbnail(
|
10
|
-
img.dup.thumbnail(
|
9
|
+
img.dup.thumbnail(100, :filter => Devil::NEAREST).show(200, 300).free
|
10
|
+
img.dup.thumbnail(100).show(200, 500).free
|
11
11
|
end
|
12
12
|
|
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.
|
4
|
+
version: 0.1.9.0
|
5
5
|
platform: x86-mswin32-60
|
6
6
|
authors:
|
7
7
|
- Jaroslaw Tworek, John Mair (banisterfiend)
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10
|
12
|
+
date: 2009-11-10 00:00:00 +13:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -33,6 +33,7 @@ files:
|
|
33
33
|
- ext/devil/ruby_devil_ext.c
|
34
34
|
- ext/devil/ruby_il.c
|
35
35
|
- ext/devil/ruby_ilu.c
|
36
|
+
- ext/devil/ruby_ilut.c
|
36
37
|
- test/test_blank.rb
|
37
38
|
- test/test_blit.rb
|
38
39
|
- test/test_clone_and_crop.rb
|
@@ -41,6 +42,7 @@ files:
|
|
41
42
|
- test/test_gosu_save.rb
|
42
43
|
- test/test_gosu_show.rb
|
43
44
|
- test/test_group.rb
|
45
|
+
- test/test_ilut.rb
|
44
46
|
- test/test_new_api.rb
|
45
47
|
- test/test_profile.rb
|
46
48
|
- test/test_scale_algos.rb
|