devil 0.1.6-x86-mswin32-60 → 0.1.7-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 CHANGED
@@ -1,29 +1,52 @@
1
- Devil version 0.1.6
2
-
3
- * Original author: Jaroslaw Tworek <dev.jrx@gmail.com>
4
- * Current maintainer: John Mair (banisterfiend) http://banisterfiend.wordpress.com
5
-
6
- Ruby bindings for the Developer's Image Library
7
- You need DevIL installed to build this extension
8
-
9
- For debian:
10
- * install the libdevil and libdevil-dev packages
11
-
12
- For windows:
13
- * download devil.dll and ilu.dll from here http://openil.sourceforge.net
14
- * and copy devil.dll and ilu.dll to c:\windows\system\
15
-
16
- For other systems:
17
- * install libdevil and lib-devil-dev using your package manager
18
- * OR download and install the libraries from http://openil.sourceforge.net
19
-
20
- If you wish to use the Gosu and TexPlay extensions, it is necessary to also have:
21
- * the Gosu gem (gem install gosu)
22
- * the TexPlay gem (gem install texplay)
23
- * ruby-opengl (gem install ruby-opengl)
24
-
25
- For now, there is support for just a subset of DevIL functions, but it is enough
26
- for 95% things you may want to do.
27
-
28
- For example uses, see test/ directory
29
-
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)
data/Rakefile CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'rake/clean'
2
-
3
- if RUBY_PLATFORM !~ /win/
2
+ if RUBY_PLATFORM !~ /win32/
4
3
  require 'rake/extensiontask'
5
4
  end
6
5
 
@@ -8,7 +7,7 @@ require 'rake/gempackagetask'
8
7
  require 'rake/testtask'
9
8
  require 'rake/rdoctask'
10
9
 
11
- DEVIL_VERSION = "0.1.6"
10
+ DEVIL_VERSION = "0.1.7"
12
11
 
13
12
  dlext = Config::CONFIG['DLEXT']
14
13
 
@@ -26,23 +25,23 @@ spec = Gem::Specification.new do |s|
26
25
  s.require_path = 'lib'
27
26
  s.homepage = "http://banisterfiend.wordpress.com"
28
27
 
29
- if RUBY_PLATFORM =~ /win/
28
+ if RUBY_PLATFORM =~ /win32/
30
29
  s.platform = Gem::Platform::CURRENT
31
30
  else
32
31
  s.platform = Gem::Platform::RUBY
33
32
  end
34
33
 
35
- if RUBY_PLATFORM !~ /win/
34
+ if RUBY_PLATFORM !~ /win32/
36
35
  s.extensions = FileList["ext/**/extconf.rb"]
37
36
  end
38
37
 
39
38
  s.has_rdoc = true
40
- s.extra_rdoc_files = ["README", "lib/devil/gosu.rb"]
39
+ s.extra_rdoc_files = ["README"]
41
40
  s.rdoc_options << '--main' << 'README'
42
41
  s.files = ["Rakefile", "README", "LICENSE", "lib/devil.rb", "lib/devil/gosu.rb"] +
43
- FileList["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c", "test/test*.rb", "test/*.jpg", "test/*.png"].to_a
42
+ FileList["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c", "test/test*.rb", "test/*.png", "test/*.jpg"].to_a
44
43
 
45
- if RUBY_PLATFORM =~ /win/
44
+ if RUBY_PLATFORM =~ /win32/
46
45
  s.files += ["lib/1.8/devil.so", "lib/1.9/devil.so"]
47
46
  end
48
47
 
@@ -55,7 +54,7 @@ end
55
54
 
56
55
  task :compile => :clean
57
56
 
58
- if RUBY_PLATFORM !~ /win/
57
+ if RUBY_PLATFORM !~ /win32/
59
58
  Rake::ExtensionTask.new('devil', spec) do |ext|
60
59
  ext.config_script = 'extconf.rb'
61
60
  ext.cross_compile = true
data/ext/devil/extconf.rb CHANGED
@@ -3,10 +3,14 @@ require 'mkmf'
3
3
  if RUBY_PLATFORM =~ /mingw/
4
4
  $CFLAGS += ' -I/home/john/.rake-compiler/ruby/ruby-1.8.6-p287/include/'
5
5
  $LDFLAGS += ' -L/home/john/.rake-compiler/ruby/ruby-1.8.6-p287/lib/'
6
+ elsif RUBY_PLATFORM =~ /darwin/
7
+
8
+ # this only works if you install devil via macports
9
+ $CFLAGS += ' -I/opt/local/include/'
10
+ $LDFLAGS += ' -L/opt/local/lib/'
6
11
  end
7
12
 
8
- puts "platform is #{RUBY_PLATFORM}"
9
- if RUBY_PLATFORM =~ /win/ || RUBY_PLATFORM =~ /mingw/
13
+ if RUBY_PLATFORM =~ /(win32|mingw)/
10
14
  exit unless have_library("DevIL");
11
15
  else
12
16
  exit unless have_library("IL");
data/lib/1.8/devil.so CHANGED
Binary file
data/lib/1.9/devil.so CHANGED
Binary file
data/lib/devil.rb CHANGED
@@ -1,226 +1,235 @@
1
- require 'rbconfig'
2
-
3
- direc = File.dirname(__FILE__)
4
- dlext = Config::CONFIG['DLEXT']
5
- begin
6
- if RUBY_VERSION && RUBY_VERSION =~ /1.9/
7
- require "#{direc}/1.9/devil.#{dlext}"
8
- else
9
- require "#{direc}/1.8/devil.#{dlext}"
10
- end
11
- rescue LoadError => e
12
- require "#{direc}/devil.#{dlext}"
13
- end
14
-
15
- # Provides a high level wrapper for the low-level DevIL Ruby bindings
16
- module Devil
17
- VERSION = '0.1.6'
18
-
19
- class << self
20
-
21
- # loads +file+ and returns a new image
22
- # Optionally accepts a block and yields the newly created image to the block.
23
- def load_image(file, &block)
24
- name = IL.GenImages(1).first
25
- IL.BindImage(name)
26
- IL.LoadImage(file)
27
-
28
- img = Image.new(name, file)
29
- if block
30
- block.call(img)
31
- end
32
-
33
- img
34
- end
35
-
36
- # convert an image +blob+ with +width+ and +height+
37
- # to a bona fide image
38
- def from_blob(blob, width, height)
39
- Image.new(IL.FromBlob(blob, width, height), nil)
40
- end
41
-
42
- # initializes Devil and sets defaults
43
- # This method should never need to be called directly.
44
- def init
45
- # initialize DevIL
46
- IL.Init
47
-
48
- # default options
49
- IL.Enable(IL::FILE_OVERWRITE)
50
- ILU.ImageParameter(ILU::FILTER, ILU::BILINEAR)
51
- end
52
-
53
- alias_method :with_image, :load_image
54
- alias_method :load, :load_image
55
- end
56
-
57
- class Image
58
- attr_reader :name, :file
59
-
60
- def initialize(name, file)
61
- @name = name
62
- @file = file
63
-
64
- ObjectSpace.define_finalizer( self, proc { IL.DeleteImages(1, [name]) } )
65
- end
66
-
67
- # returns the width of the image
68
- def width
69
- set_binding
70
- IL.GetInteger(IL::IMAGE_WIDTH)
71
- end
72
-
73
- # returns the height of the image
74
- def height
75
- set_binding
76
- IL.GetInteger(IL::IMAGE_HEIGHT)
77
- end
78
-
79
- # saves the image to +file+. If no +file+ is provided default to the opened file.
80
- def save(file = @file)
81
- set_binding
82
- IL.SaveImage(file)
83
- self
84
- end
85
-
86
- # resize the image to +width+ and +height+. Aspect ratios of the image do not have to be the same.
87
- def resize(width, height)
88
- set_binding
89
- ILU.Scale(width, height, 1)
90
- self
91
- end
92
-
93
- # Creates a proportional thumbnail of the image scaled so its longest
94
- # edge is resized to +size+
95
- def thumbnail(size)
96
- # this thumbnail code from image_science.rb
97
-
98
- w, h = width, height
99
- scale = size.to_f / (w > h ? w : h)
100
- resize((w * scale).to_i, (h * scale).to_i)
101
- self
102
- end
103
-
104
- # return a deep copy of the current image
105
- def dup
106
- set_binding
107
- Image.new(IL.CloneCurImage, nil)
108
- end
109
-
110
- # crop the current image
111
- # +xoff+ number of pixels to skip in x direction
112
- # +yoff+ number of pixels to skip in y direction
113
- # +width+ number of pixels to preserve in x direction
114
- # +height+ number of pixels to preserve in y direction
115
- def crop(xoff, yoff, width, height)
116
- set_binding
117
- ILU.Crop(xoff, yoff, width, height)
118
- self
119
- end
120
-
121
- # performs a gaussian blur on the image. The blur is performed +iter+ times.
122
- def blur(iter)
123
- set_binding
124
- ILU.BlurGaussian(iter)
125
- self
126
- end
127
-
128
- # 'pixelize' the image using a pixel size of +pixel_size+
129
- def pixelize(pixel_size)
130
- set_binding
131
- ILU.Pixelize(pixel_size)
132
- self
133
- end
134
-
135
- # add random noise to the image. +factor+ is the tolerance to use.
136
- # accepeted values range from 0.0 - 1.0
137
- def noisify(factor)
138
- set_binding
139
- ILU.Noisify(factor)
140
- self
141
- end
142
-
143
- # The sharpening +factor+ must be in the range of 0.0 - 2.5. A value of 1.0 for the sharpening
144
- # factor will have no effect on the image. Values in the range 1.0 - 2.5 will sharpen the
145
- # image, with 2.5 having the most pronounced sharpening effect. Values from 0.0 to 1.0 do
146
- # a type of reverse sharpening, blurring the image. Values outside of the 0.0 - 2.5 range
147
- # produce undefined results.
148
- #
149
- # The number of +iter+ (iterations) to perform will usually be 1, but to achieve more sharpening,
150
- # increase the number of iterations.
151
- def sharpen(factor, iter)
152
- set_binding
153
- ILU.Sharpen(factor, iter)
154
- self
155
- end
156
-
157
- # applies gamma correction to an image using an exponential curve.
158
- # +factor+ is gamma correction factor to use.
159
- # A value of 1.0 leaves the image unmodified.
160
- # Values in the range 0.0 - 1.0 darken the image
161
- # Values above 1.0 brighten the image.
162
- def gamma_correct(factor)
163
- set_binding
164
- ILU.GammaCorrect(factor)
165
- self
166
- end
167
-
168
- # invert the color of every pixel in the image.
169
- def negative
170
- set_binding
171
- ILU.Negative
172
- self
173
- end
174
-
175
- # +factor+ describes desired contrast to use
176
- # A value of 1.0 has no effect on the image.
177
- # Values between 1.0 and 1.7 increase the amount of contrast (values above 1.7 have no effect)
178
- # Valid range of +factor+ is 0.0 - 1.7
179
- def contrast(factor)
180
- set_binding
181
- ILU.Contrast(factor)
182
- self
183
- end
184
-
185
- # darkens the bright colours and lightens the dark
186
- # colours, reducing the contrast in an image or 'equalizing' it.
187
- def equalize
188
- set_binding
189
- ILU.Equalize
190
- self
191
- end
192
-
193
- # returns the image data in the form of a ruby string
194
- # The image data is formatted to RGBA / UNSIGNED BYTE
195
- def to_blob
196
- set_binding
197
- IL.ToBlob
198
- end
199
-
200
- # flip the image about its x axis
201
- def flip
202
- set_binding
203
- ILU.FlipImage
204
- self
205
- end
206
-
207
- # rotate an image about its central point by +angle+ degrees
208
- def rotate(angle)
209
- set_binding
210
- ILU.Rotate(angle)
211
- self
212
- end
213
-
214
- alias_method :columns, :width
215
- alias_method :rows, :height
216
-
217
- private
218
-
219
- def set_binding
220
- IL.BindImage(@name)
221
- end
222
-
223
- end
224
- end
225
-
226
- Devil.init
1
+ require 'rbconfig'
2
+
3
+ direc = File.dirname(__FILE__)
4
+ dlext = Config::CONFIG['DLEXT']
5
+ begin
6
+ if RUBY_VERSION && RUBY_VERSION =~ /1.9/
7
+ require "#{direc}/1.9/devil.#{dlext}"
8
+ else
9
+ require "#{direc}/1.8/devil.#{dlext}"
10
+ end
11
+ rescue LoadError => e
12
+ require "#{direc}/devil.#{dlext}"
13
+ end
14
+
15
+ # Provides a high level wrapper for the low-level DevIL Ruby bindings
16
+ module Devil
17
+ VERSION = '0.1.7'
18
+
19
+ class << self
20
+
21
+ # loads +file+ and returns a new image
22
+ # Optionally accepts a block and yields the newly created image to the block.
23
+ def load_image(file, &block)
24
+ name = IL.GenImages(1).first
25
+ IL.BindImage(name)
26
+ IL.LoadImage(file)
27
+
28
+ if (error_code = IL.GetError) != IL::NO_ERROR
29
+ raise RuntimeError, "an error occured while trying to "+
30
+ "load the image #{file}. Error code: #{error_code}"
31
+ end
32
+
33
+ img = Image.new(name, file)
34
+ if block
35
+ block.call(img)
36
+ end
37
+
38
+ img
39
+ end
40
+
41
+ alias_method :with_image, :load_image
42
+ alias_method :load, :load_image
43
+
44
+ # convert an image +blob+ with +width+ and +height+
45
+ # to a bona fide image
46
+ def from_blob(blob, width, height)
47
+ Image.new(IL.FromBlob(blob, width, height), nil)
48
+ end
49
+
50
+ # initializes Devil and sets defaults
51
+ # This method should never need to be called directly.
52
+ def init
53
+ # initialize DevIL
54
+ IL.Init
55
+
56
+ # default options
57
+ IL.Enable(IL::FILE_OVERWRITE)
58
+ ILU.ImageParameter(ILU::FILTER, ILU::BILINEAR)
59
+ end
60
+
61
+ end
62
+
63
+ class Image
64
+ attr_reader :name, :file
65
+
66
+ def initialize(name, file)
67
+ @name = name
68
+ @file = file
69
+
70
+ ObjectSpace.define_finalizer( self, proc { IL.DeleteImages(1, [name]) } )
71
+ end
72
+
73
+ # returns the width of the image
74
+ def width
75
+ set_binding
76
+ IL.GetInteger(IL::IMAGE_WIDTH)
77
+ end
78
+
79
+ alias_method :columns, :width
80
+
81
+ # returns the height of the image
82
+ def height
83
+ set_binding
84
+ IL.GetInteger(IL::IMAGE_HEIGHT)
85
+ end
86
+
87
+ alias_method :rows, :height
88
+
89
+ # saves the image to +file+. If no +file+ is provided default to the opened file.
90
+ def save(file = @file)
91
+ set_binding
92
+ IL.SaveImage(file)
93
+ self
94
+ end
95
+
96
+ # resize the image to +width+ and +height+. Aspect ratios of the image do not have to be the same.
97
+ def resize(width, height)
98
+ set_binding
99
+ ILU.Scale(width, height, 1)
100
+ self
101
+ end
102
+
103
+ # Creates a proportional thumbnail of the image scaled so its longest
104
+ # edge is resized to +size+
105
+ def thumbnail(size)
106
+ # this thumbnail code from image_science.rb
107
+
108
+ w, h = width, height
109
+ scale = size.to_f / (w > h ? w : h)
110
+ resize((w * scale).to_i, (h * scale).to_i)
111
+ self
112
+ end
113
+
114
+ # return a deep copy of the current image
115
+ def dup
116
+ set_binding
117
+ Image.new(IL.CloneCurImage, nil)
118
+ end
119
+
120
+ alias_method :clone, :dup
121
+
122
+ # crop the current image
123
+ # +xoff+ number of pixels to skip in x direction
124
+ # +yoff+ number of pixels to skip in y direction
125
+ # +width+ number of pixels to preserve in x direction
126
+ # +height+ number of pixels to preserve in y direction
127
+ def crop(xoff, yoff, width, height)
128
+ set_binding
129
+ ILU.Crop(xoff, yoff, width, height)
130
+ self
131
+ end
132
+
133
+ # performs a gaussian blur on the image. The blur is performed +iter+ times.
134
+ def blur(iter)
135
+ set_binding
136
+ ILU.BlurGaussian(iter)
137
+ self
138
+ end
139
+
140
+ # 'pixelize' the image using a pixel size of +pixel_size+
141
+ def pixelize(pixel_size)
142
+ set_binding
143
+ ILU.Pixelize(pixel_size)
144
+ self
145
+ end
146
+
147
+ # add random noise to the image. +factor+ is the tolerance to use.
148
+ # accepeted values range from 0.0 - 1.0
149
+ def noisify(factor)
150
+ set_binding
151
+ ILU.Noisify(factor)
152
+ self
153
+ end
154
+
155
+ # The sharpening +factor+ must be in the range of 0.0 - 2.5. A value of 1.0 for the sharpening
156
+ # factor will have no effect on the image. Values in the range 1.0 - 2.5 will sharpen the
157
+ # image, with 2.5 having the most pronounced sharpening effect. Values from 0.0 to 1.0 do
158
+ # a type of reverse sharpening, blurring the image. Values outside of the 0.0 - 2.5 range
159
+ # produce undefined results.
160
+ #
161
+ # The number of +iter+ (iterations) to perform will usually be 1, but to achieve more sharpening,
162
+ # increase the number of iterations.
163
+ def sharpen(factor, iter)
164
+ set_binding
165
+ ILU.Sharpen(factor, iter)
166
+ self
167
+ end
168
+
169
+ # applies gamma correction to an image using an exponential curve.
170
+ # +factor+ is gamma correction factor to use.
171
+ # A value of 1.0 leaves the image unmodified.
172
+ # Values in the range 0.0 - 1.0 darken the image
173
+ # Values above 1.0 brighten the image.
174
+ def gamma_correct(factor)
175
+ set_binding
176
+ ILU.GammaCorrect(factor)
177
+ self
178
+ end
179
+
180
+ # invert the color of every pixel in the image.
181
+ def negative
182
+ set_binding
183
+ ILU.Negative
184
+ self
185
+ end
186
+
187
+ # +factor+ describes desired contrast to use
188
+ # A value of 1.0 has no effect on the image.
189
+ # Values between 1.0 and 1.7 increase the amount of contrast (values above 1.7 have no effect)
190
+ # Valid range of +factor+ is 0.0 - 1.7
191
+ def contrast(factor)
192
+ set_binding
193
+ ILU.Contrast(factor)
194
+ self
195
+ end
196
+
197
+ # darkens the bright colours and lightens the dark
198
+ # colours, reducing the contrast in an image or 'equalizing' it.
199
+ def equalize
200
+ set_binding
201
+ ILU.Equalize
202
+ self
203
+ end
204
+
205
+ # returns the image data in the form of a ruby string
206
+ # The image data is formatted to RGBA / UNSIGNED BYTE
207
+ def to_blob
208
+ set_binding
209
+ IL.ToBlob
210
+ end
211
+
212
+ # flip the image about its x axis
213
+ def flip
214
+ set_binding
215
+ ILU.FlipImage
216
+ self
217
+ end
218
+
219
+ # rotate an image about its central point by +angle+ degrees
220
+ def rotate(angle)
221
+ set_binding
222
+ ILU.Rotate(angle)
223
+ self
224
+ end
225
+
226
+ private
227
+
228
+ def set_binding
229
+ IL.BindImage(@name)
230
+ end
231
+
232
+ end
233
+ end
234
+
235
+ Devil.init
data/lib/devil/gosu.rb CHANGED
@@ -1,19 +1,18 @@
1
1
  require 'texplay'
2
2
  require 'devil'
3
3
 
4
+ # monkey patches for TexPlay module (and by proxy the Gosu::Image class)
4
5
  module TexPlay
5
6
 
6
7
  # save a Gosu::Image to +file+
7
8
  # This method is only available if require 'devil/gosu' is used
8
9
  def save(file)
9
10
  capture {
10
- save_image = Devil.from_blob(self.to_blob, self.width, self.height)
11
- save_image.flip
12
- save_image.save(file)
11
+ to_devil.save(file)
13
12
  }
14
13
  end
15
14
 
16
- # convert a Gosu::Image to a Devil::Image
15
+ # convert a Gosu::Image to a Devil::Image.
17
16
  # This method is only available if require 'devil/gosu' is used
18
17
  def to_devil
19
18
  devil_img = nil
@@ -25,9 +24,10 @@ module TexPlay
25
24
  end
26
25
  end
27
26
 
27
+ # monkey patches for Gosu::Window class
28
28
  class Gosu::Window
29
29
 
30
- # return a screenshot of the framebuffer as a Devil::Image
30
+ # return a screenshot of the framebuffer as a Devil::Image.
31
31
  # This method is only available if require 'devil/gosu' is used
32
32
  def screenshot
33
33
  require 'opengl'
@@ -54,10 +54,27 @@ class Gosu::Window
54
54
  end
55
55
  end
56
56
 
57
+ class Gosu::Image
58
+ class << self
59
+ alias_method :original_new_redux, :new
60
+
61
+ # monkey patching to support multiple image formats.
62
+ # This method is only available if require 'devil/gosu' is used
63
+ def new(window, file, *args, &block)
64
+ if file.respond_to?(:to_blob) || file =~ /\.(bmp|png)$/
65
+ original_new_redux(window, file, *args, &block)
66
+ else
67
+ original_new_redux(window, Devil.load(file), *args, &block)
68
+ end
69
+ end
70
+ end
71
+ end
72
+
57
73
  class Devil::Image
58
74
 
59
75
  # convert a Devil::Image to a Gosu::Image.
60
76
  # Must provide a +window+ parameter, as per Gosu::Image#new()
77
+ # This method is only available if require 'devil/gosu' is used
61
78
  def to_gosu(window)
62
79
  Gosu::Image.new(window, self)
63
80
  end
@@ -92,5 +109,4 @@ class Devil::Image
92
109
 
93
110
  @@window.show_list.push :image => Gosu::Image.new(@@window, self), :x => x, :y => y
94
111
  end
95
-
96
112
  end
@@ -5,7 +5,7 @@ $LOAD_PATH.push("#{direc}/../lib/")
5
5
  require 'rubygems'
6
6
  require "devil/gosu"
7
7
 
8
- img = Devil.load_image("#{direc}/texture.png")
8
+ img = Devil.load_image("#{direc}/texture.jpg")
9
9
 
10
10
  img.crop(100,100, 200, 200)
11
11
  img_dup = img.dup
@@ -3,16 +3,13 @@ $direc = File.dirname(__FILE__)
3
3
  $LOAD_PATH.push("#{$direc}/../lib/")
4
4
 
5
5
  require 'rubygems'
6
- require 'gosu'
7
- require 'devil'
6
+ require 'devil/gosu'
8
7
 
9
8
  class W < Gosu::Window
10
9
  def initialize
11
10
  super(1024, 768, false, 20)
12
11
 
13
- img = Devil.load_image("#{$direc}/texture.jpg")
14
-
15
- @img = Gosu::Image.new(self, img)
12
+ @img = Gosu::Image.new(self, "#{$direc}/texture.jpg")
16
13
  end
17
14
 
18
15
  def draw
data/test/test_new_api.rb CHANGED
@@ -16,7 +16,7 @@ bink = Devil.load_image("#{direc}/texture.png")
16
16
  img.gamma_correct(1.6)
17
17
  bink.resize(50, 50)
18
18
 
19
- img.save("#{direc}/texture_blur.png")
19
+ img.save("#{direc}/texture_gamma.png")
20
20
  bink.save("#{direc}/texture_tiny.png")
21
21
 
22
22
 
@@ -1,33 +1,33 @@
1
- $direc = File.dirname(__FILE__)
2
-
3
- $LOAD_PATH.push("#{$direc}/../lib/")
4
-
5
- require 'rubygems'
6
- require 'devil/gosu'
7
-
8
- class W < Gosu::Window
9
- def initialize
10
- super(1024, 768, false, 20)
11
-
12
- @img = Gosu::Image.new(self, "tank.png")
13
- @img2 = @img.dup
14
- @img.circle 100, 100, 50, :color => :purple, :filled => true
15
- end
16
-
17
- def draw
18
- @img.draw 100, 50,1
19
- @img.draw 300, 50, 1
20
- @img2.draw 300, 400, 1
21
- end
22
-
23
- def update
24
- if button_down?(Gosu::KbEscape)
25
- screenshot.rotate(45).save("screenshot.png")
26
- exit
27
- end
28
- end
29
- end
30
-
31
- w = W.new
32
- w.show
33
-
1
+ $direc = File.dirname(__FILE__)
2
+
3
+ $LOAD_PATH.push("#{$direc}/../lib/")
4
+
5
+ require 'rubygems'
6
+ require 'devil/gosu'
7
+
8
+ class W < Gosu::Window
9
+ def initialize
10
+ super(1024, 768, false, 20)
11
+
12
+ @img = Gosu::Image.new(self, "tank.png")
13
+ @img2 = @img.dup
14
+ @img.circle 100, 100, 50, :color => :purple, :filled => true
15
+ end
16
+
17
+ def draw
18
+ @img.draw 100, 50,1
19
+ @img.draw 300, 50, 1
20
+ @img2.draw 300, 400, 1
21
+ end
22
+
23
+ def update
24
+ if button_down?(Gosu::KbEscape)
25
+ screenshot.rotate(45).save("screenshot.png")
26
+ exit
27
+ end
28
+ end
29
+ end
30
+
31
+ w = W.new
32
+ w.show
33
+
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.6
4
+ version: 0.1.7
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-13 00:00:00 +13:00
12
+ date: 2009-10-16 00:00:00 +13:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -21,7 +21,6 @@ extensions: []
21
21
 
22
22
  extra_rdoc_files:
23
23
  - README
24
- - lib/devil/gosu.rb
25
24
  files:
26
25
  - Rakefile
27
26
  - README
@@ -40,11 +39,9 @@ files:
40
39
  - test/test_new_api.rb
41
40
  - test/test_screenshot.rb
42
41
  - test/test_thumbnail.rb
43
- - test/texture.jpg
44
- - test/screenshot.png
45
- - test/tank-modified.png
46
42
  - test/tank.png
47
43
  - test/texture.png
44
+ - test/texture.jpg
48
45
  - lib/1.8/devil.so
49
46
  - lib/1.9/devil.so
50
47
  has_rdoc: true
data/test/screenshot.png DELETED
Binary file
Binary file