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 +50 -0
- data/README +52 -52
- data/Rakefile +76 -75
- data/ext/devil/ruby_il.c +65 -3
- data/ext/devil/ruby_ilu.c +68 -3
- data/lib/1.8/devil.so +0 -0
- data/lib/1.9/devil.so +0 -0
- data/lib/devil.rb +371 -235
- data/lib/devil/gosu.rb +10 -4
- data/test/red.png +0 -0
- data/test/test_blit.rb +22 -0
- data/test/test_new_api.rb +8 -8
- data/test/test_scale_algos.rb +30 -0
- data/test/test_thumbnail.rb +1 -2
- metadata +6 -2
data/lib/devil/gosu.rb
CHANGED
@@ -10,6 +10,7 @@ module TexPlay
|
|
10
10
|
capture {
|
11
11
|
to_devil.save(file)
|
12
12
|
}
|
13
|
+
self
|
13
14
|
end
|
14
15
|
|
15
16
|
# convert a Gosu::Image to a Devil::Image.
|
@@ -83,13 +84,15 @@ class Devil::Image
|
|
83
84
|
# if +x+ and +y+ are specified then show the image centered at this location, otherwise
|
84
85
|
# draw the image at the center of the screen
|
85
86
|
# This method is only available if require 'devil/gosu' is used
|
86
|
-
def show(x =
|
87
|
+
def show(x = Devil.get_options[:window_size][0] / 2,
|
88
|
+
y = Devil.get_options[:window_size][1] / 2)
|
89
|
+
|
87
90
|
if !Devil.const_defined?(:Window)
|
88
91
|
c = Class.new(Gosu::Window) do
|
89
92
|
attr_accessor :show_list
|
90
93
|
|
91
94
|
def initialize
|
92
|
-
super(
|
95
|
+
super(Devil.get_options[:window_size][0], Devil.get_options[:window_size][1], false)
|
93
96
|
@show_list = []
|
94
97
|
end
|
95
98
|
|
@@ -106,7 +109,10 @@ class Devil::Image
|
|
106
109
|
|
107
110
|
at_exit { @@window.show }
|
108
111
|
end
|
109
|
-
|
110
|
-
|
112
|
+
|
113
|
+
# note we dup the image so the displayed image is a snapshot taken at the time #show is invoked
|
114
|
+
@@window.show_list.push :image => Gosu::Image.new(@@window, self.dup), :x => x, :y => y
|
115
|
+
|
116
|
+
self
|
111
117
|
end
|
112
118
|
end
|
data/test/red.png
ADDED
Binary file
|
data/test/test_blit.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
$direc = File.dirname(__FILE__)
|
2
|
+
|
3
|
+
$LOAD_PATH.push("#{$direc}/../lib/")
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
require 'devil/gosu'
|
7
|
+
|
8
|
+
Devil.with_image("#{$direc}/texture.png") do |img|
|
9
|
+
img2 = Devil.load("#{$direc}/red.png")
|
10
|
+
|
11
|
+
img.show(200,200)
|
12
|
+
|
13
|
+
img.blit img2, 100, 100, :crop => [0, 0, img2.width / 2, img2.height / 2]
|
14
|
+
|
15
|
+
img.show
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
data/test/test_new_api.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
direc = File.dirname(__FILE__)
|
1
|
+
$direc = File.dirname(__FILE__)
|
2
2
|
|
3
|
-
$LOAD_PATH.push("#{direc}/../lib/")
|
3
|
+
$LOAD_PATH.push("#{$direc}/../lib/")
|
4
4
|
|
5
5
|
require 'rubygems'
|
6
6
|
require "devil"
|
7
7
|
|
8
|
-
Devil.
|
8
|
+
Devil.with_image("#{$direc}/texture.png") do |img|
|
9
9
|
img.negative
|
10
|
-
img.save("#{direc}/texture_neg.png")
|
10
|
+
img.save("#{$direc}/texture_neg.png")
|
11
11
|
end
|
12
12
|
|
13
|
-
img = Devil.load_image("#{direc}/texture.png")
|
14
|
-
bink = Devil.load_image("#{direc}/texture.png")
|
13
|
+
img = Devil.load_image("#{$direc}/texture.png")
|
14
|
+
bink = Devil.load_image("#{$direc}/texture.png")
|
15
15
|
|
16
16
|
img.gamma_correct(1.6)
|
17
17
|
bink.resize(50, 50)
|
18
18
|
|
19
|
-
img.save("#{direc}/texture_gamma.png")
|
20
|
-
bink.save("#{direc}/texture_tiny.png")
|
19
|
+
img.save("#{$direc}/texture_gamma.png")
|
20
|
+
bink.save("#{$direc}/texture_tiny.png")
|
21
21
|
|
22
22
|
|
23
23
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'devil'
|
3
|
+
|
4
|
+
algorithms = {
|
5
|
+
ILU::NEAREST => :nearest,
|
6
|
+
ILU::LINEAR => :linear,
|
7
|
+
ILU::BILINEAR => :bilinear,
|
8
|
+
ILU::SCALE_BOX => :scale_box,
|
9
|
+
ILU::SCALE_TRIANGLE => :scale_triangle,
|
10
|
+
ILU::SCALE_BELL => :scale_bell,
|
11
|
+
ILU::SCALE_BSPLINE => :scale_bspline,
|
12
|
+
ILU::SCALE_LANCZOS3 => :scale_lanczos3,
|
13
|
+
ILU::SCALE_MITCHELL => :scale_mitchell
|
14
|
+
}
|
15
|
+
|
16
|
+
|
17
|
+
algorithms.each do |key, value|
|
18
|
+
puts "Generating image using filter: #{value}"
|
19
|
+
IL.Init
|
20
|
+
|
21
|
+
name = IL.GenImages(1)[0]
|
22
|
+
IL.BindImage(name)
|
23
|
+
IL.LoadImage("texture.jpg")
|
24
|
+
ILU.ImageParameter(ILU::FILTER, key)
|
25
|
+
|
26
|
+
ILU.Scale(100, 100, 1)
|
27
|
+
IL.Enable(IL::FILE_OVERWRITE)
|
28
|
+
IL.SaveImage("scaling_test_#{value}.jpg")
|
29
|
+
|
30
|
+
end
|
data/test/test_thumbnail.rb
CHANGED
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.8
|
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-10-21 00:00:00 +13:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -24,6 +24,7 @@ extra_rdoc_files:
|
|
24
24
|
files:
|
25
25
|
- Rakefile
|
26
26
|
- README
|
27
|
+
- CHANGELOG
|
27
28
|
- LICENSE
|
28
29
|
- lib/devil.rb
|
29
30
|
- lib/devil/gosu.rb
|
@@ -32,13 +33,16 @@ files:
|
|
32
33
|
- ext/devil/ruby_devil_ext.c
|
33
34
|
- ext/devil/ruby_il.c
|
34
35
|
- ext/devil/ruby_ilu.c
|
36
|
+
- test/test_blit.rb
|
35
37
|
- test/test_clone_and_crop.rb
|
36
38
|
- test/test_gosu_load.rb
|
37
39
|
- test/test_gosu_save.rb
|
38
40
|
- test/test_gosu_show.rb
|
39
41
|
- test/test_new_api.rb
|
42
|
+
- test/test_scale_algos.rb
|
40
43
|
- test/test_screenshot.rb
|
41
44
|
- test/test_thumbnail.rb
|
45
|
+
- test/red.png
|
42
46
|
- test/tank.png
|
43
47
|
- test/texture.png
|
44
48
|
- test/texture.jpg
|