devil 0.1.9.5-i386-mingw32
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/CHANGELOG +112 -0
- data/LICENSE +21 -0
- data/README +52 -0
- data/Rakefile +55 -0
- data/ext/devil/extconf.rb +23 -0
- data/ext/devil/ruby_devil_ext.c +9 -0
- data/ext/devil/ruby_devil_ext.h +8 -0
- data/ext/devil/ruby_il.c +546 -0
- data/ext/devil/ruby_ilu.c +228 -0
- data/lib/1.8/devil.so +0 -0
- data/lib/1.9/devil.so +0 -0
- data/lib/devil.rb +547 -0
- data/lib/devil/gosu.rb +122 -0
- data/lib/devil/version.rb +3 -0
- data/test/red.png +0 -0
- data/test/tank.png +0 -0
- data/test/test_blank.rb +21 -0
- data/test/test_blit.rb +21 -0
- data/test/test_clone_and_crop.rb +28 -0
- data/test/test_gosu_load.rb +23 -0
- data/test/test_gosu_roundtrip.rb +29 -0
- data/test/test_gosu_save.rb +26 -0
- data/test/test_gosu_show.rb +10 -0
- data/test/test_group.rb +18 -0
- data/test/test_ilut.rb +95 -0
- data/test/test_new_api.rb +28 -0
- data/test/test_profile.rb +8 -0
- data/test/test_quality.rb +9 -0
- data/test/test_scale_algos.rb +30 -0
- data/test/test_screenshot.rb +33 -0
- data/test/test_thumbnail.rb +13 -0
- data/test/texture.jpg +0 -0
- data/test/texture.png +0 -0
- data/test/texture_out1.jpg +0 -0
- data/test/texture_out2.jpg +0 -0
- data/test/thumb.png +0 -0
- metadata +101 -0
data/CHANGELOG
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
2010-8-10 John Mair (Banisterfiend)
|
2
|
+
* version 0.1.9.5
|
3
|
+
* mingw32 gem
|
4
|
+
|
5
|
+
2010-22-03 John Mair (Banisterfiend)
|
6
|
+
* automatically convert from array to packed string in Devil.from_blob
|
7
|
+
|
8
|
+
2009-6-12 John Mair (Banisterfiend)
|
9
|
+
* version 0.1.9.1
|
10
|
+
* added thumbnail2 and resize2 for anti-aliased image scaling
|
11
|
+
* made Gosu::Window#screenshot 1.9 compatible (now using glReadPixels)
|
12
|
+
* using version.rb to help manage versions
|
13
|
+
|
14
|
+
2009-14-11 John Mair (Banisterfiend)
|
15
|
+
* added to ruby_il.c:
|
16
|
+
* IL::SetInteger, IL::JPG_QUALITY
|
17
|
+
* added to ruby_ilu.c:
|
18
|
+
* ILU::CompareImage
|
19
|
+
* added test_quality.rb to tests
|
20
|
+
* added :jpg_quality option parameter to Devil::Image#save
|
21
|
+
|
22
|
+
2009-11-11 John Mair (Banisterfiend)
|
23
|
+
* version 0.1.9.0 re-release
|
24
|
+
* REMOVED ILUT (OpenGL) support because ILUT is not built with OpenGL support on all platforms (e.g gentoo and some ubuntu distros)
|
25
|
+
|
26
|
+
2009-11-10 John Mair (Banisterfiend)
|
27
|
+
* version 0.1.9.0
|
28
|
+
* added ILUT (OpenGL) support
|
29
|
+
* updated installation info (no longer using c:\windows\system\ for dlls)
|
30
|
+
|
31
|
+
2009-10-29 John Mair (Banisterfiend)
|
32
|
+
* version 0.1.8.8
|
33
|
+
* added Devil.with_group (for loading multiple images into the same block)
|
34
|
+
* all images passed into block are cleaned up at end of block
|
35
|
+
* images at end of block are only free'd if they have not already been freed by user
|
36
|
+
* ruby_il.c: added IMAGE_BITS_PER_PIXEL and IMAGE_BYTES_PER_PIXEL constants
|
37
|
+
* finalizers still not implemented
|
38
|
+
|
39
|
+
2009-10-28 John Mair (Banisterfiend)
|
40
|
+
* removed finalizer and replaced with explicit call to image.free at end of block. If no block is used, user must call image.free at end of use
|
41
|
+
* above fixes memory leak.
|
42
|
+
* changed STR2CSTR() to StringValuePtr() in ruby_il.c
|
43
|
+
|
44
|
+
2009-10-28 John Mair (Banisterfiend)
|
45
|
+
* added IL::ConvertImage(IL::RGBA, IL::UNSIGNED_BYTE) to Devil#load; ensures that all image data is in the same format (image files only support RGB/UB and RGBA/UB so make them all RGBA/UB)
|
46
|
+
* changed compile-time conditional for the IL_LBM constant. now checks if IL_LBM is defined before it tries IL_ILBM
|
47
|
+
|
48
|
+
2009-10-25 John Mair (Banisterfiend)
|
49
|
+
version 0.1.8.5
|
50
|
+
* added hooks: prepare_image_hook, create_image_hook, load_image_hook
|
51
|
+
* e.g Devil.set_options :load_image_hook => proc { IL::ConvertImage(IL::RGBA, IL::UNSIGNED_BYTE) }
|
52
|
+
* added Devil.create_image() method for creating blank images (useful as a blitting canvas?)
|
53
|
+
* added :color parameter to create_image (to set background color of new image)
|
54
|
+
* added :in_profile and :out_profile to Devil.load_image and Devil.create_image
|
55
|
+
* color profiles do not appear to work! so not officially supported or documented.
|
56
|
+
* fixed gosu image flip bug
|
57
|
+
* added more tests and rdoc
|
58
|
+
|
59
|
+
2009-10-22 John Mair (Banisterfiend)
|
60
|
+
* added ESC exit from Devil::Image#show
|
61
|
+
* added optional :filter parameter to Devil::Image#thumbnail and Devil::Image#resize
|
62
|
+
|
63
|
+
2009-10-21 John Mair (Banisterfiend)
|
64
|
+
version 0.1.8
|
65
|
+
* made LANCZOS3 scaling filter the default for highquality thumbnails
|
66
|
+
* changed clear color to DevIL default (mother of pearl and full alpha)
|
67
|
+
* added blit function to HLA (high level API)
|
68
|
+
* added mirror, edge_detect, emboss, enlarge_canvas, etc to HLA
|
69
|
+
* added ILU_CENTER, ILU_LOWER_LEFT, ILU_PLACEMENT etc to LLA
|
70
|
+
* include ILU and IL modules in Devil::Image now
|
71
|
+
* made Devil::Image#show return self
|
72
|
+
* made Devil::Image#show use a dup of the image (so a 'snapshot' is taken of image)
|
73
|
+
* added Devil.set_options method to HLA
|
74
|
+
* refactored HLA to use an 'action' method, saved code duplication of set_binding/error_check etc.
|
75
|
+
|
76
|
+
2009-10-17 John Mair (Banisterfiend)
|
77
|
+
* ruby_il.c added:
|
78
|
+
* constants: IMAGE_DEPTH, ORIGIN_SET, CONV_PAL, CUR_IMAGE, ORIGIN_LOWER_LEFT, ORIGIN_LOWER_RIGHT
|
79
|
+
* methods: Disable, OriginFunc, ClearColour, ClearImage.
|
80
|
+
* Modified FromBlob method to restore old binding after use.
|
81
|
+
* ruby_ilu.c added:
|
82
|
+
* methods: EnlargeCanvas, EdgeDetectP, EdgeDetectS, Emboss, Mirror, SwapColours.
|
83
|
+
* Modified Crop to now take z-axis parameters. (stick to original API as closely as possible)
|
84
|
+
|
85
|
+
2009-10-15 John Mair (Banisterfiend)
|
86
|
+
* hopefully fixed compile errors on SnowLeopard!
|
87
|
+
* added error checking to Devil::load_image()
|
88
|
+
* added monkeypatch to Gosu::Image::new() to transparently load multiple formats
|
89
|
+
* updated some rdoc
|
90
|
+
|
91
|
+
2009-10-13 John Mair (Banisterfiend)
|
92
|
+
* version 0.1.6
|
93
|
+
* added Gosu and TexPlay interoperability
|
94
|
+
* ...bunch of other miscellaneous functionality
|
95
|
+
* released gem
|
96
|
+
|
97
|
+
2009-10-10 John Mair (Banisterfiend)
|
98
|
+
* constants added to ruby_il.c:
|
99
|
+
* IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_FORMAT, FILE_OVERWRITE
|
100
|
+
* functions added to ruby_il.c:
|
101
|
+
* ilEnable, ilGetInteger, ilConvertImage, ToBlob, ilCloneCurImage
|
102
|
+
* conditional compilation added to ruby_il.c for LBM constant
|
103
|
+
* functions added to ruby_ilu.c:
|
104
|
+
* ilFlipImage, ilRotate, ilCrop
|
105
|
+
* added Gosu and TexPlay interoperability
|
106
|
+
* ...bunch of other miscellaneous functionality
|
107
|
+
|
108
|
+
2009-10-06 John Mair (Banisterfiend)
|
109
|
+
* ruby 1.9 compatibility
|
110
|
+
|
111
|
+
2006-09-28 Jaroslaw Tworek <dev.jrx@gmail.com>
|
112
|
+
* Initial release
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (C) 2006 Jaroslaw Tworek
|
2
|
+
Copyright (C) 2009 John Mair
|
3
|
+
|
4
|
+
This software is provided 'as-is', without any express or implied
|
5
|
+
warranty. In no event will the authors be held liable for any damages
|
6
|
+
arising from the use of this software.
|
7
|
+
|
8
|
+
Permission is granted to anyone to use this software for any purpose,
|
9
|
+
including commercial applications, and to alter it and redistribute it
|
10
|
+
freely, subject to the following restrictions:
|
11
|
+
|
12
|
+
1. The origin of this software must not be misrepresented; you must not
|
13
|
+
claim that you wrote the original software. If you use this software
|
14
|
+
in a product, an acknowledgment in the product documentation would be
|
15
|
+
appreciated but is not required.
|
16
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
17
|
+
misrepresented as being the original software.
|
18
|
+
3. This notice may not be removed or altered from any source distribution.
|
19
|
+
|
20
|
+
Jaroslaw Tworek < dev.jrx@gmail.com >
|
21
|
+
John Mair, http://banisterfiend.wordpress.com
|
data/README
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
Ruby Devil version 0.1.9.5
|
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-dlls.zip from [http://github.com/banister/devil/downloads]
|
27
|
+
* and copy the uncompressed files to c:\ruby\bin\
|
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
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'rake/clean'
|
2
|
+
require 'rake/gempackagetask'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'rake/rdoctask'
|
5
|
+
|
6
|
+
# get the devil version
|
7
|
+
require './lib/devil/version'
|
8
|
+
dlext = Config::CONFIG['DLEXT']
|
9
|
+
|
10
|
+
CLEAN.include("ext/**/*.#{dlext}", "ext/**/.log", "ext/**/.o", "ext/**/*~", "ext/**/*#*", "ext/**/.obj", "ext/**/.def", "ext/**/.pdb")
|
11
|
+
CLOBBER.include("**/*.#{dlext}", "**/*~", "**/*#*", "**/*.log", "**/*.o", "doc/**")
|
12
|
+
|
13
|
+
spec = Gem::Specification.new do |s|
|
14
|
+
s.name = "devil"
|
15
|
+
s.summary = "Ruby bindings for DevIL cross platform image loading library"
|
16
|
+
s.description = s.summary
|
17
|
+
s.version = Devil::VERSION
|
18
|
+
s.author = "Jaroslaw Tworek, John Mair (banisterfiend)"
|
19
|
+
s.email = 'jrmair@gmail.com'
|
20
|
+
s.date = Time.now.strftime '%Y-%m-%d'
|
21
|
+
s.homepage = "http://banisterfiend.wordpress.com"
|
22
|
+
|
23
|
+
s.platform = 'i386-mingw32'
|
24
|
+
# s.platform = Gem::Platform::RUBY
|
25
|
+
|
26
|
+
#s.extensions = FileList["ext/**/extconf.rb"]
|
27
|
+
|
28
|
+
s.has_rdoc = 'yard'
|
29
|
+
s.extra_rdoc_files = ["README"]
|
30
|
+
s.rdoc_options << '--main' << 'README'
|
31
|
+
s.files = ["Rakefile", "README", "CHANGELOG", "LICENSE", "lib/devil.rb", "lib/devil/gosu.rb", "lib/devil/version.rb"] +
|
32
|
+
FileList["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c", "test/test*.rb", "test/*.png", "test/*.jpg"].to_a
|
33
|
+
|
34
|
+
s.files += ["lib/1.8/devil.so", "lib/1.9/devil.so"]
|
35
|
+
end
|
36
|
+
|
37
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
38
|
+
pkg.need_zip = false
|
39
|
+
pkg.need_tar = false
|
40
|
+
end
|
41
|
+
|
42
|
+
task :compile => :clean
|
43
|
+
|
44
|
+
|
45
|
+
Rake::TestTask.new do |t|
|
46
|
+
t.libs << "lib"
|
47
|
+
t.test_files = FileList['test/test*.rb']
|
48
|
+
t.verbose = true
|
49
|
+
end
|
50
|
+
|
51
|
+
Rake::RDocTask.new do |rd|
|
52
|
+
rd.main = "README"
|
53
|
+
rd.rdoc_files.include("README", "lib/devil.rb", "lib/devil/gosu.rb", "lib/devil/version.rb")
|
54
|
+
end
|
55
|
+
|
@@ -0,0 +1,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("DevIL")
|
7
|
+
|
8
|
+
elsif RUBY_PLATFORM =~ /darwin/
|
9
|
+
|
10
|
+
# this only works if you install devil via macports
|
11
|
+
$CFLAGS += ' -I/opt/local/include/'
|
12
|
+
$LDFLAGS += ' -L/opt/local/lib/'
|
13
|
+
exit unless have_library("IL")
|
14
|
+
|
15
|
+
elsif RUBY_PLATFORM =~ /linux/
|
16
|
+
exit unless have_library("IL")
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
# all platforms
|
21
|
+
exit unless have_library("ILU")
|
22
|
+
|
23
|
+
create_makefile('devil')
|
data/ext/devil/ruby_il.c
ADDED
@@ -0,0 +1,546 @@
|
|
1
|
+
#include "ruby_devil_ext.h"
|
2
|
+
#include <IL/il.h>
|
3
|
+
|
4
|
+
struct ImageData {
|
5
|
+
ILubyte* data;
|
6
|
+
};
|
7
|
+
|
8
|
+
static VALUE mIL;
|
9
|
+
static VALUE cImageData;
|
10
|
+
static VALUE cNullImageData;
|
11
|
+
|
12
|
+
|
13
|
+
inline ILubyte* ImageData2Arr(VALUE obj) {
|
14
|
+
struct ImageData* arr;
|
15
|
+
Data_Get_Struct(obj, struct ImageData, arr);
|
16
|
+
return arr->data;
|
17
|
+
}
|
18
|
+
|
19
|
+
inline VALUE MakeImageData(ILubyte* image_data) {
|
20
|
+
struct ImageData* c_data;
|
21
|
+
VALUE ret = Data_Make_Struct(cImageData, struct ImageData, 0, NULL, c_data);
|
22
|
+
c_data->data = image_data;
|
23
|
+
return ret;
|
24
|
+
}
|
25
|
+
|
26
|
+
|
27
|
+
static VALUE il_Init(VALUE obj) {
|
28
|
+
ilInit();
|
29
|
+
return Qnil;
|
30
|
+
}
|
31
|
+
|
32
|
+
static VALUE il_GenImages(VALUE obj, VALUE num_names) {
|
33
|
+
ILsizei num = NUM2INT(num_names);
|
34
|
+
ILuint* names = ALLOC_N(ILuint, num);
|
35
|
+
RArray* ret;
|
36
|
+
int i;
|
37
|
+
|
38
|
+
if (!names)
|
39
|
+
rb_raise(rb_eRuntimeError, "IL.GenImages memory allocation");
|
40
|
+
|
41
|
+
ilGenImages(num, names);
|
42
|
+
|
43
|
+
ret = RARRAY( rb_ary_new2(num));
|
44
|
+
for(i = 0; i < num; ++i)
|
45
|
+
rb_ary_push( (VALUE)ret, INT2NUM(names[i]));
|
46
|
+
free(names);
|
47
|
+
|
48
|
+
return (VALUE)ret;
|
49
|
+
}
|
50
|
+
|
51
|
+
static VALUE il_BindImage(VALUE obj, VALUE image) {
|
52
|
+
ILuint u_image = NUM2INT(image);
|
53
|
+
ilBindImage(u_image);
|
54
|
+
return Qnil;
|
55
|
+
}
|
56
|
+
|
57
|
+
static VALUE il_DeleteImages(VALUE obj, VALUE images) {
|
58
|
+
ILsizei num;
|
59
|
+
ILuint* u_images;
|
60
|
+
RArray* ary;
|
61
|
+
VALUE entry;
|
62
|
+
int i = 0;
|
63
|
+
|
64
|
+
if(TYPE(images) != T_ARRAY)
|
65
|
+
rb_raise(rb_eTypeError, "type mismatch:%s", rb_class2name(images));
|
66
|
+
|
67
|
+
ary = RARRAY(images);
|
68
|
+
num = RARRAY_LEN(images);
|
69
|
+
u_images = ALLOC_N(ILuint, num);
|
70
|
+
|
71
|
+
for(i = 0; i < num; ++i) {
|
72
|
+
entry = rb_ary_entry((VALUE)ary, i);
|
73
|
+
u_images[i] = NUM2INT(entry);
|
74
|
+
}
|
75
|
+
|
76
|
+
ilDeleteImages(num, u_images);
|
77
|
+
|
78
|
+
free(u_images);
|
79
|
+
return Qnil;
|
80
|
+
}
|
81
|
+
|
82
|
+
static VALUE il_LoadImage(VALUE obj, VALUE rb_filename) {
|
83
|
+
char* filename = StringValuePtr(rb_filename);
|
84
|
+
ILboolean load = ilLoadImage(filename);
|
85
|
+
return load ? Qtrue : Qfalse;
|
86
|
+
}
|
87
|
+
|
88
|
+
static VALUE il_Load(VALUE obj, VALUE rb_type, VALUE rb_filename) {
|
89
|
+
ILenum type = NUM2INT(rb_type);
|
90
|
+
char* filename = StringValuePtr(rb_filename);
|
91
|
+
|
92
|
+
ILboolean load = ilLoad(type, filename);
|
93
|
+
return load ? Qtrue : Qfalse;
|
94
|
+
}
|
95
|
+
|
96
|
+
static VALUE il_SaveImage(VALUE obj, VALUE rb_filename) {
|
97
|
+
char* filename = StringValuePtr(rb_filename);
|
98
|
+
ILboolean load = ilSaveImage(filename);
|
99
|
+
|
100
|
+
return load ? Qtrue : Qfalse;
|
101
|
+
}
|
102
|
+
|
103
|
+
static VALUE il_Save(VALUE obj, VALUE rb_type, VALUE rb_filename) {
|
104
|
+
ILenum type = NUM2INT(rb_type);
|
105
|
+
char* filename = StringValuePtr(rb_filename);
|
106
|
+
ILboolean load = ilSave(type, filename);
|
107
|
+
|
108
|
+
return load ? Qtrue : Qfalse;
|
109
|
+
}
|
110
|
+
|
111
|
+
static VALUE il_TexImage(VALUE obj, VALUE rb_width, VALUE rb_height,
|
112
|
+
VALUE rb_depth, VALUE rb_bpp, VALUE rb_format, VALUE rb_type,
|
113
|
+
VALUE rb_data) {
|
114
|
+
ILuint width = NUM2INT(rb_width);
|
115
|
+
ILuint height = NUM2INT(rb_height);
|
116
|
+
ILuint depth = NUM2INT(rb_depth);
|
117
|
+
ILubyte bpp = NUM2INT(rb_bpp);
|
118
|
+
ILenum format = NUM2INT(rb_format);
|
119
|
+
ILenum type = NUM2INT(rb_type);
|
120
|
+
ILboolean flag;
|
121
|
+
|
122
|
+
/* from ILvoid */
|
123
|
+
void * data = NULL;
|
124
|
+
|
125
|
+
if(NIL_P(rb_data))
|
126
|
+
data = NULL;
|
127
|
+
else
|
128
|
+
data = ImageData2Arr(rb_data);
|
129
|
+
|
130
|
+
flag = ilTexImage(width, height, depth,
|
131
|
+
bpp, format, type, data);
|
132
|
+
return flag ? Qtrue : Qfalse;
|
133
|
+
}
|
134
|
+
|
135
|
+
static VALUE il_GetData(VALUE obj) {
|
136
|
+
ILubyte* data = ilGetData();
|
137
|
+
return MakeImageData(data);
|
138
|
+
}
|
139
|
+
|
140
|
+
/* ILuint ilCopyPixels(ILuint XOff, ILuint YOff, ILuint ZOff, ILuint Width, */
|
141
|
+
/* /\* changed from ILvoid *\/ */
|
142
|
+
/* ILuint Height, ILuint Depth, ILenum Format, ILenum Type, void */
|
143
|
+
/* *Data); */
|
144
|
+
|
145
|
+
/* static VALUE il_CopyPixels(VALUE obj, VALUE rb_XOff, VALUE rb_YOff, VALUE rb_ZOff, */
|
146
|
+
/* VALUE rb_Width, VALUE rb_Height, VALUE rb_Depth, VALUE rb_Format, */
|
147
|
+
/* VALUE rb_Type, VALUE rb_data) { */
|
148
|
+
/* ILuint XOff = NUM2INT(rb_XOff); */
|
149
|
+
/* ILuint YOff = NUM2INT(rb_YOff); */
|
150
|
+
/* ILuint ZOff = NUM2INT(rb_ZOff); */
|
151
|
+
/* ILuint Width = NUM2INT(rb_Width); */
|
152
|
+
/* ILuint Height = NUM2INT(rb_Height); */
|
153
|
+
/* ILuint Depth = NUM2INT(rb_Depth); */
|
154
|
+
/* ILenum Format = NUM2INT(rb_Format); */
|
155
|
+
/* ILenum Type = NUM2INT(rb_Type); */
|
156
|
+
/* /\* ILvoid *\/ */
|
157
|
+
/* void* data = ImageData2Arr(rb_data); */
|
158
|
+
|
159
|
+
/* ILuint uint = ilCopyPixels(XOff, YOff, ZOff, Width, Height, Depth, Format, Type, data); */
|
160
|
+
/* return INT2FIX(uint); */
|
161
|
+
/* } */
|
162
|
+
|
163
|
+
static VALUE il_SetData(VALUE obj, VALUE rb_Data) {
|
164
|
+
/* ILvoid */
|
165
|
+
void* data = ImageData2Arr(rb_Data);
|
166
|
+
ILboolean flag = ilSetData(data);
|
167
|
+
return flag ? Qtrue : Qfalse;
|
168
|
+
}
|
169
|
+
|
170
|
+
static VALUE il_SetPixels(VALUE obj, VALUE rb_XOff, VALUE rb_YOff, VALUE rb_ZOff,
|
171
|
+
VALUE rb_Width, VALUE rb_Height, VALUE rb_Depth, VALUE rb_Format,
|
172
|
+
VALUE rb_Type, VALUE rb_data) {
|
173
|
+
ILuint XOff = NUM2INT(rb_XOff);
|
174
|
+
ILuint YOff = NUM2INT(rb_YOff);
|
175
|
+
ILuint ZOff = NUM2INT(rb_ZOff);
|
176
|
+
ILuint Width = NUM2INT(rb_Width);
|
177
|
+
ILuint Height = NUM2INT(rb_Height);
|
178
|
+
ILuint Depth = NUM2INT(rb_Depth);
|
179
|
+
ILenum Format = NUM2INT(rb_Format);
|
180
|
+
ILenum Type = NUM2INT(rb_Type);
|
181
|
+
/* ILvoid */
|
182
|
+
void* data = ImageData2Arr(rb_data);
|
183
|
+
|
184
|
+
ilSetPixels(XOff, YOff, ZOff, Width, Height, Depth, Format, Type, data);
|
185
|
+
return Qnil;
|
186
|
+
}
|
187
|
+
|
188
|
+
|
189
|
+
static VALUE il_CopyImage(VALUE obj, VALUE rb_Src){
|
190
|
+
ILuint Src = NUM2INT(rb_Src);
|
191
|
+
ILboolean flag = ilCopyImage(Src);
|
192
|
+
return flag ? Qtrue : Qfalse;
|
193
|
+
}
|
194
|
+
|
195
|
+
static VALUE il_OverlayImage(VALUE obj, VALUE rb_Source, VALUE rb_XCoord,
|
196
|
+
VALUE rb_YCoord, VALUE rb_ZCoord) {
|
197
|
+
ILuint Source = NUM2INT(rb_Source);
|
198
|
+
ILint XCoord = NUM2INT(rb_XCoord);
|
199
|
+
ILint YCoord = NUM2INT(rb_YCoord);
|
200
|
+
ILint ZCoord = NUM2INT(rb_ZCoord);
|
201
|
+
ILboolean flag = ilOverlayImage(Source, XCoord, YCoord,ZCoord);
|
202
|
+
|
203
|
+
return flag ? Qtrue : Qfalse;
|
204
|
+
}
|
205
|
+
|
206
|
+
|
207
|
+
static VALUE il_Blit(VALUE obj, VALUE rb_Source, VALUE rb_DestX, VALUE
|
208
|
+
rb_DestY, VALUE rb_DestZ, VALUE rb_SrcX, VALUE rb_SrcY, VALUE
|
209
|
+
rb_SrcZ, VALUE rb_Width, VALUE rb_Height, VALUE rb_Depth) {
|
210
|
+
ILuint Source = NUM2INT(rb_Source);
|
211
|
+
ILint DestX = NUM2INT(rb_DestX);
|
212
|
+
ILint DestY = NUM2INT(rb_DestY);
|
213
|
+
ILint DestZ = NUM2INT(rb_DestZ);
|
214
|
+
ILint SrcX = NUM2INT(rb_SrcX);
|
215
|
+
ILint SrcY = NUM2INT(rb_SrcY);
|
216
|
+
ILint SrcZ = NUM2INT(rb_SrcZ);
|
217
|
+
ILuint Width = NUM2INT(rb_Width);
|
218
|
+
ILuint Height = NUM2INT(rb_Height);
|
219
|
+
ILuint Depth = NUM2INT(rb_Depth);
|
220
|
+
|
221
|
+
ILboolean flag = ilBlit(Source, DestX,DestY, DestZ,SrcX, SrcY, SrcZ,
|
222
|
+
Width,Height,Depth);
|
223
|
+
return flag ? Qtrue : Qfalse;
|
224
|
+
}
|
225
|
+
|
226
|
+
static VALUE il_GetError(VALUE obj) {
|
227
|
+
ILenum num = ilGetError();
|
228
|
+
return INT2FIX(num);
|
229
|
+
}
|
230
|
+
|
231
|
+
static VALUE il_ActiveMipmap(VALUE obj, VALUE rb_Number) {
|
232
|
+
ILuint Number = NUM2INT(rb_Number);
|
233
|
+
ILboolean flag = ilActiveMipmap(Number);
|
234
|
+
return flag ? Qtrue : Qfalse;
|
235
|
+
}
|
236
|
+
|
237
|
+
static VALUE il_ActiveImage(VALUE obj, VALUE rb_Number){
|
238
|
+
ILuint Number = NUM2INT(rb_Number);
|
239
|
+
ILboolean flag = ilActiveImage(Number);
|
240
|
+
return flag ? Qtrue : Qfalse;
|
241
|
+
}
|
242
|
+
|
243
|
+
/* methods below added by banisterfiend */
|
244
|
+
static VALUE il_Enable(VALUE obj, VALUE rb_mode) {
|
245
|
+
ILenum mode = NUM2INT(rb_mode);
|
246
|
+
|
247
|
+
ILboolean flag = ilEnable(mode);
|
248
|
+
return flag ? Qtrue : Qfalse;
|
249
|
+
}
|
250
|
+
|
251
|
+
static VALUE il_Disable(VALUE obj, VALUE rb_mode) {
|
252
|
+
ILenum mode = NUM2INT(rb_mode);
|
253
|
+
|
254
|
+
ILboolean flag = ilDisable(mode);
|
255
|
+
return flag ? Qtrue : Qfalse;
|
256
|
+
}
|
257
|
+
|
258
|
+
static VALUE il_ApplyProfile(VALUE obj, VALUE rb_inprofile, VALUE rb_outprofile)
|
259
|
+
{
|
260
|
+
char * inprofile = NULL;
|
261
|
+
char * outprofile = StringValuePtr(rb_outprofile);
|
262
|
+
ILboolean flag;
|
263
|
+
|
264
|
+
if(NIL_P(rb_inprofile))
|
265
|
+
inprofile = NULL;
|
266
|
+
else
|
267
|
+
inprofile = StringValuePtr(rb_inprofile);
|
268
|
+
|
269
|
+
flag = ilApplyProfile(inprofile, outprofile);
|
270
|
+
|
271
|
+
return flag ? Qtrue : Qfalse;
|
272
|
+
}
|
273
|
+
|
274
|
+
static VALUE il_GetInteger(VALUE obj, VALUE rb_mode) {
|
275
|
+
ILenum mode = NUM2INT(rb_mode);
|
276
|
+
|
277
|
+
ILint result = ilGetInteger(mode);
|
278
|
+
return INT2NUM(result);
|
279
|
+
}
|
280
|
+
|
281
|
+
static VALUE il_ConvertImage(VALUE obj, VALUE rb_destformat, VALUE rb_desttype)
|
282
|
+
{
|
283
|
+
ILenum destformat = NUM2INT(rb_destformat);
|
284
|
+
ILenum desttype = NUM2INT(rb_desttype);
|
285
|
+
|
286
|
+
ILboolean flag = ilConvertImage(destformat, desttype);
|
287
|
+
return flag ? Qtrue : Qfalse;
|
288
|
+
}
|
289
|
+
|
290
|
+
/* TODO: MAKE SURE NO MEMORY LEAKS! */
|
291
|
+
/* this function is not actually in the DevIL API, but im adding it here for convenience */
|
292
|
+
static VALUE bf_ToBlob(VALUE obj)
|
293
|
+
{
|
294
|
+
ILuint width, height, saved_image, copy_image;
|
295
|
+
char * img_ptr;
|
296
|
+
VALUE blob;
|
297
|
+
|
298
|
+
saved_image = ilGetInteger(IL_CUR_IMAGE);
|
299
|
+
|
300
|
+
/* make a copy of the current image */
|
301
|
+
copy_image = ilCloneCurImage();
|
302
|
+
|
303
|
+
ilBindImage(copy_image);
|
304
|
+
|
305
|
+
/* ensure the image is int RGBA UNSIGNED_BYTE format for blob */
|
306
|
+
ilConvertImage(IL_RGBA, IL_UNSIGNED_BYTE);
|
307
|
+
|
308
|
+
width = ilGetInteger(IL_IMAGE_WIDTH);
|
309
|
+
height = ilGetInteger(IL_IMAGE_HEIGHT);
|
310
|
+
|
311
|
+
img_ptr = (char *)ilGetData();
|
312
|
+
|
313
|
+
blob = rb_str_new(img_ptr, 4 * width * height);
|
314
|
+
|
315
|
+
/* restore saved binding */
|
316
|
+
ilBindImage(saved_image);
|
317
|
+
|
318
|
+
ilDeleteImages(1, ©_image);
|
319
|
+
|
320
|
+
return blob;
|
321
|
+
}
|
322
|
+
|
323
|
+
static VALUE bf_FromBlob(VALUE obj, VALUE blob, VALUE rb_width, VALUE rb_height)
|
324
|
+
{
|
325
|
+
ILubyte * data;
|
326
|
+
ILuint width, height;
|
327
|
+
ILuint image;
|
328
|
+
ILuint saved_image;
|
329
|
+
|
330
|
+
width = NUM2INT(rb_width);
|
331
|
+
height = NUM2INT(rb_height);
|
332
|
+
|
333
|
+
data = (ILubyte *) RSTRING_PTR(blob);
|
334
|
+
|
335
|
+
saved_image = ilGetInteger(IL_CUR_IMAGE);
|
336
|
+
|
337
|
+
ilGenImages(1, &image);
|
338
|
+
ilBindImage(image);
|
339
|
+
|
340
|
+
ilTexImage(width, height, 1, 4, IL_RGBA, IL_UNSIGNED_BYTE, data);
|
341
|
+
|
342
|
+
ilBindImage(saved_image);
|
343
|
+
|
344
|
+
return INT2NUM(image);
|
345
|
+
}
|
346
|
+
|
347
|
+
static VALUE il_CloneCurImage(VALUE obj)
|
348
|
+
{
|
349
|
+
ILuint clone = ilCloneCurImage();
|
350
|
+
|
351
|
+
return INT2NUM(clone);
|
352
|
+
}
|
353
|
+
|
354
|
+
static VALUE il_OriginFunc(VALUE obj, VALUE rb_mode)
|
355
|
+
{
|
356
|
+
ILenum mode = NUM2INT(rb_mode);
|
357
|
+
|
358
|
+
ILboolean flag = ilOriginFunc(mode);
|
359
|
+
return flag ? Qtrue : Qfalse;
|
360
|
+
}
|
361
|
+
|
362
|
+
static VALUE il_ClearColour(VALUE obj, VALUE rb_red, VALUE rb_green, VALUE rb_blue, VALUE rb_alpha)
|
363
|
+
{
|
364
|
+
ILubyte red = NUM2INT(rb_red);
|
365
|
+
ILubyte green = NUM2INT(rb_green);
|
366
|
+
ILubyte blue = NUM2INT(rb_blue);
|
367
|
+
ILubyte alpha = NUM2INT(rb_alpha);
|
368
|
+
|
369
|
+
ilClearColour(red, green, blue, alpha);
|
370
|
+
|
371
|
+
return Qnil;
|
372
|
+
}
|
373
|
+
|
374
|
+
static VALUE il_ClearImage(VALUE obj)
|
375
|
+
{
|
376
|
+
ILboolean flag = ilClearImage();
|
377
|
+
return flag ? Qtrue : Qfalse;
|
378
|
+
}
|
379
|
+
|
380
|
+
static VALUE il_SetInteger(VALUE obj, VALUE rb_mode, VALUE rb_param)
|
381
|
+
{
|
382
|
+
ILenum mode = NUM2INT(rb_mode);
|
383
|
+
ILint param = NUM2INT(rb_param);
|
384
|
+
|
385
|
+
ilSetInteger(mode, param);
|
386
|
+
|
387
|
+
return Qnil;
|
388
|
+
}
|
389
|
+
|
390
|
+
/* end of banisterfiend additions */
|
391
|
+
|
392
|
+
void
|
393
|
+
InitializeIL() {
|
394
|
+
mIL = rb_define_module("IL");
|
395
|
+
//////////////////////////////////
|
396
|
+
//CLASSES
|
397
|
+
//////////////////////////////////
|
398
|
+
cImageData = rb_define_class_under(mIL, "ImageData", rb_cObject);
|
399
|
+
cNullImageData = MakeImageData(NULL);
|
400
|
+
rb_define_const(cImageData, "NullData", cNullImageData);
|
401
|
+
//////////////////////////////////
|
402
|
+
//METHODS
|
403
|
+
//////////////////////////////////
|
404
|
+
rb_define_module_function(mIL, "Init", il_Init, 0);
|
405
|
+
rb_define_module_function(mIL, "GenImages", il_GenImages, 1);
|
406
|
+
rb_define_module_function(mIL, "BindImage", il_BindImage, 1);
|
407
|
+
rb_define_module_function(mIL, "DeleteImages", il_DeleteImages, 1);
|
408
|
+
rb_define_module_function(mIL, "LoadImage", il_LoadImage, 1);
|
409
|
+
rb_define_module_function(mIL, "Load", il_Load, 2);
|
410
|
+
rb_define_module_function(mIL, "SaveImage", il_SaveImage, 1);
|
411
|
+
rb_define_module_function(mIL, "Save", il_Save, 2);
|
412
|
+
rb_define_module_function(mIL, "TexImage", il_TexImage, 7);
|
413
|
+
rb_define_module_function(mIL, "GetData", il_GetData, 0);
|
414
|
+
/* rb_define_module_function(mIL, "CopyPixels", il_CopyPixels, 9); */
|
415
|
+
rb_define_module_function(mIL, "SetData", il_SetData, 1);
|
416
|
+
rb_define_module_function(mIL, "SetPixels", il_SetPixels, 9);
|
417
|
+
rb_define_module_function(mIL, "CopyImage", il_CopyImage, 1);
|
418
|
+
rb_define_module_function(mIL, "OverlayImage", il_OverlayImage, 4);
|
419
|
+
rb_define_module_function(mIL, "Blit", il_Blit, 10);
|
420
|
+
rb_define_module_function(mIL, "GetError", il_GetError, 0);
|
421
|
+
rb_define_module_function(mIL, "ActiveMipmap", il_ActiveMipmap, 1);
|
422
|
+
rb_define_module_function(mIL, "ActiveImage", il_ActiveImage, 1);
|
423
|
+
|
424
|
+
/* methods added by baniterfiend */
|
425
|
+
rb_define_module_function(mIL, "Enable", il_Enable, 1);
|
426
|
+
rb_define_module_function(mIL, "Disable", il_Disable, 1);
|
427
|
+
rb_define_module_function(mIL, "GetInteger", il_GetInteger, 1);
|
428
|
+
rb_define_module_function(mIL, "ConvertImage", il_ConvertImage, 2);
|
429
|
+
rb_define_module_function(mIL, "ToBlob", bf_ToBlob, 0);
|
430
|
+
rb_define_module_function(mIL, "FromBlob", bf_FromBlob, 3);
|
431
|
+
rb_define_module_function(mIL, "CloneCurImage", il_CloneCurImage, 0);
|
432
|
+
rb_define_module_function(mIL, "OriginFunc", il_OriginFunc, 1);
|
433
|
+
rb_define_module_function(mIL, "ClearColour", il_ClearColour, 4);
|
434
|
+
rb_define_module_function(mIL, "ClearImage", il_ClearImage, 0);
|
435
|
+
rb_define_module_function(mIL, "ApplyProfile", il_ApplyProfile, 2);
|
436
|
+
rb_define_module_function(mIL, "SetInteger", il_SetInteger, 2);
|
437
|
+
/* end of methods added by banisterfiend */
|
438
|
+
|
439
|
+
//////////////////////////////////
|
440
|
+
//CONSTANTS
|
441
|
+
//////////////////////////////////
|
442
|
+
rb_define_const(mIL, "TYPE_UNKNOWN", INT2NUM(IL_TYPE_UNKNOWN));
|
443
|
+
rb_define_const(mIL, "BMP", INT2NUM(IL_BMP));
|
444
|
+
rb_define_const(mIL, "CUT", INT2NUM(IL_CUT));
|
445
|
+
rb_define_const(mIL, "DOOM", INT2NUM(IL_DOOM));
|
446
|
+
rb_define_const(mIL, "DOOM_FLAT", INT2NUM(IL_DOOM_FLAT));
|
447
|
+
rb_define_const(mIL, "ICO", INT2NUM(IL_ICO));
|
448
|
+
rb_define_const(mIL, "JPG", INT2NUM(IL_JPG));
|
449
|
+
rb_define_const(mIL, "JFIF", INT2NUM(IL_JFIF));
|
450
|
+
|
451
|
+
#ifndef IL_LBM
|
452
|
+
rb_define_const(mIL, "LBM", INT2NUM(IL_ILBM));
|
453
|
+
#else
|
454
|
+
rb_define_const(mIL, "LBM", INT2NUM(IL_LBM));
|
455
|
+
#endif
|
456
|
+
|
457
|
+
rb_define_const(mIL, "PCD", INT2NUM(IL_PCD));
|
458
|
+
rb_define_const(mIL, "PCX", INT2NUM(IL_PCX));
|
459
|
+
rb_define_const(mIL, "PIC", INT2NUM(IL_PIC));
|
460
|
+
rb_define_const(mIL, "PNG", INT2NUM(IL_PNG));
|
461
|
+
rb_define_const(mIL, "PNM", INT2NUM(IL_PNM));
|
462
|
+
rb_define_const(mIL, "SGI", INT2NUM(IL_SGI));
|
463
|
+
rb_define_const(mIL, "TGA", INT2NUM(IL_TGA));
|
464
|
+
rb_define_const(mIL, "TIF", INT2NUM(IL_TIF));
|
465
|
+
rb_define_const(mIL, "CHEAD", INT2NUM(IL_CHEAD));
|
466
|
+
rb_define_const(mIL, "RAW", INT2NUM(IL_RAW));
|
467
|
+
rb_define_const(mIL, "MDL", INT2NUM(IL_MDL));
|
468
|
+
rb_define_const(mIL, "WAL", INT2NUM(IL_WAL));
|
469
|
+
rb_define_const(mIL, "LIF", INT2NUM(IL_LIF));
|
470
|
+
rb_define_const(mIL, "MNG", INT2NUM(IL_MNG));
|
471
|
+
rb_define_const(mIL, "JNG", INT2NUM(IL_JNG));
|
472
|
+
rb_define_const(mIL, "GIF", INT2NUM(IL_GIF));
|
473
|
+
rb_define_const(mIL, "DDS", INT2NUM(IL_DDS));
|
474
|
+
rb_define_const(mIL, "DCX", INT2NUM(IL_DCX));
|
475
|
+
rb_define_const(mIL, "PSD", INT2NUM(IL_PSD));
|
476
|
+
rb_define_const(mIL, "EXIF", INT2NUM(IL_EXIF));
|
477
|
+
rb_define_const(mIL, "PSP", INT2NUM(IL_PSP));
|
478
|
+
rb_define_const(mIL, "PIX", INT2NUM(IL_PIX));
|
479
|
+
rb_define_const(mIL, "PXR", INT2NUM(IL_PXR));
|
480
|
+
rb_define_const(mIL, "XPM", INT2NUM(IL_XPM));
|
481
|
+
rb_define_const(mIL, "HDR", INT2NUM(IL_HDR));
|
482
|
+
rb_define_const(mIL, "JASC_PAL", INT2NUM(IL_JASC_PAL));
|
483
|
+
|
484
|
+
rb_define_const(mIL, "COLOUR_INDEX", INT2NUM(IL_COLOUR_INDEX));
|
485
|
+
rb_define_const(mIL, "COLOR_INDEX", INT2NUM(IL_COLOR_INDEX));
|
486
|
+
rb_define_const(mIL, "RGB", INT2NUM(IL_RGB));
|
487
|
+
rb_define_const(mIL, "RGBA", INT2NUM(IL_RGBA));
|
488
|
+
rb_define_const(mIL, "BGR", INT2NUM(IL_BGR));
|
489
|
+
rb_define_const(mIL, "BGRA", INT2NUM(IL_BGRA));
|
490
|
+
rb_define_const(mIL, "LUMINANCE", INT2NUM(IL_LUMINANCE));
|
491
|
+
rb_define_const(mIL, "LUMINANCE_ALPHA", INT2NUM(IL_LUMINANCE_ALPHA));
|
492
|
+
|
493
|
+
rb_define_const(mIL, "UNSIGNED_BYTE", INT2NUM(IL_UNSIGNED_BYTE));
|
494
|
+
rb_define_const(mIL, "SHORT", INT2NUM(IL_SHORT));
|
495
|
+
rb_define_const(mIL, "UNSIGNED_SHORT", INT2NUM(IL_UNSIGNED_SHORT));
|
496
|
+
rb_define_const(mIL, "INT", INT2NUM(IL_INT));
|
497
|
+
rb_define_const(mIL, "UNSIGNED_INT", INT2NUM(IL_UNSIGNED_INT));
|
498
|
+
rb_define_const(mIL, "FLOAT", INT2NUM(IL_FLOAT));
|
499
|
+
rb_define_const(mIL, "DOUBLE", INT2NUM(IL_DOUBLE));
|
500
|
+
|
501
|
+
rb_define_const(mIL, "NO_ERROR", INT2NUM(IL_NO_ERROR));
|
502
|
+
rb_define_const(mIL, "INVALID_ENUM", INT2NUM(IL_INVALID_ENUM));
|
503
|
+
rb_define_const(mIL, "OUT_OF_MEMORY", INT2NUM(IL_OUT_OF_MEMORY));
|
504
|
+
rb_define_const(mIL, "FORMAT_NOT_SUPPORTED", INT2NUM(IL_FORMAT_NOT_SUPPORTED));
|
505
|
+
rb_define_const(mIL, "INTERNAL_ERROR", INT2NUM(IL_INTERNAL_ERROR));
|
506
|
+
rb_define_const(mIL, "INVALID_VALUE", INT2NUM(IL_INVALID_VALUE));
|
507
|
+
rb_define_const(mIL, "ILLEGAL_OPERATION", INT2NUM(IL_ILLEGAL_OPERATION));
|
508
|
+
rb_define_const(mIL, "ILLEGAL_FILE_VALUE", INT2NUM(IL_ILLEGAL_FILE_VALUE));
|
509
|
+
rb_define_const(mIL, "INVALID_FILE_HEADER", INT2NUM(IL_INVALID_FILE_HEADER));
|
510
|
+
rb_define_const(mIL, "INVALID_PARAM", INT2NUM(IL_INVALID_PARAM));
|
511
|
+
rb_define_const(mIL, "COULD_NOT_OPEN_FILE", INT2NUM(IL_COULD_NOT_OPEN_FILE));
|
512
|
+
rb_define_const(mIL, "INVALID_EXTENSION", INT2NUM(IL_INVALID_EXTENSION));
|
513
|
+
rb_define_const(mIL, "FILE_ALREADY_EXISTS", INT2NUM(IL_FILE_ALREADY_EXISTS));
|
514
|
+
rb_define_const(mIL, "OUT_FORMAT_SAME", INT2NUM(IL_OUT_FORMAT_SAME));
|
515
|
+
rb_define_const(mIL, "STACK_OVERFLOW", INT2NUM(IL_STACK_OVERFLOW));
|
516
|
+
rb_define_const(mIL, "STACK_UNDERFLOW", INT2NUM(IL_STACK_UNDERFLOW));
|
517
|
+
rb_define_const(mIL, "INVALID_CONVERSION", INT2NUM(IL_INVALID_CONVERSION));
|
518
|
+
rb_define_const(mIL, "BAD_DIMENSIONS", INT2NUM(IL_BAD_DIMENSIONS));
|
519
|
+
rb_define_const(mIL, "FILE_READ_ERROR", INT2NUM(IL_FILE_READ_ERROR));
|
520
|
+
rb_define_const(mIL, "FILE_WRITE_ERROR", INT2NUM(IL_FILE_WRITE_ERROR));
|
521
|
+
rb_define_const(mIL, "LIB_GIF_ERROR", INT2NUM(IL_LIB_GIF_ERROR));
|
522
|
+
rb_define_const(mIL, "LIB_JPEG_ERROR", INT2NUM(IL_LIB_JPEG_ERROR));
|
523
|
+
rb_define_const(mIL, "LIB_PNG_ERROR", INT2NUM(IL_LIB_PNG_ERROR));
|
524
|
+
rb_define_const(mIL, "LIB_TIFF_ERROR", INT2NUM(IL_LIB_TIFF_ERROR));
|
525
|
+
rb_define_const(mIL, "LIB_MNG_ERROR", INT2NUM(IL_LIB_MNG_ERROR));
|
526
|
+
rb_define_const(mIL, "UNKNOWN_ERROR", INT2NUM(IL_UNKNOWN_ERROR));
|
527
|
+
|
528
|
+
/* CONSTANTS BELOW ADDED BY BANISTERFIEND */
|
529
|
+
rb_define_const(mIL, "IMAGE_DEPTH", INT2NUM(IL_IMAGE_DEPTH));
|
530
|
+
rb_define_const(mIL, "IMAGE_WIDTH", INT2NUM(IL_IMAGE_WIDTH));
|
531
|
+
rb_define_const(mIL, "IMAGE_HEIGHT", INT2NUM(IL_IMAGE_HEIGHT));
|
532
|
+
rb_define_const(mIL, "IMAGE_FORMAT", INT2NUM(IL_IMAGE_FORMAT));
|
533
|
+
rb_define_const(mIL, "IMAGE_BITS_PER_PIXEL", INT2NUM(IL_IMAGE_BITS_PER_PIXEL));
|
534
|
+
rb_define_const(mIL, "IMAGE_BYTES_PER_PIXEL", INT2NUM(IL_IMAGE_BYTES_PER_PIXEL));
|
535
|
+
rb_define_const(mIL, "FILE_OVERWRITE", INT2NUM(IL_FILE_OVERWRITE));
|
536
|
+
rb_define_const(mIL, "ORIGIN_SET", INT2NUM(IL_ORIGIN_SET));
|
537
|
+
rb_define_const(mIL, "CONV_PAL", INT2NUM(IL_CONV_PAL));
|
538
|
+
rb_define_const(mIL, "CUR_IMAGE", INT2NUM(IL_CUR_IMAGE));
|
539
|
+
rb_define_const(mIL, "ORIGIN_LOWER_LEFT", INT2NUM(IL_ORIGIN_LOWER_LEFT));
|
540
|
+
rb_define_const(mIL, "ORIGIN_UPPER_LEFT", INT2NUM(IL_ORIGIN_UPPER_LEFT));
|
541
|
+
rb_define_const(mIL, "JPG_QUALITY", INT2NUM(IL_JPG_QUALITY));
|
542
|
+
}
|
543
|
+
//////////////////////////////////////////
|
544
|
+
|
545
|
+
//////////////////////////////////////////
|
546
|
+
|