gd2-ffij 0.0.3 → 0.0.4

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
@@ -2,7 +2,7 @@
2
2
  Ruby/GD2 - Ruby binding for Thomas Boutell's gd 2.x graphics library
3
3
  Copyright (C) 2005-2006 Robert Leslie <rob@mars.org>
4
4
 
5
- FFI modifications copyright (C) 2010 J Smith <dark.panda@gmail.com>
5
+ FFI modifications copyright (C) 2010-2012 J Smith <dark.panda@gmail.com>
6
6
 
7
7
  Robert's Notes:
8
8
 
data/Rakefile CHANGED
@@ -1,32 +1,49 @@
1
1
  # -*- ruby -*-
2
2
 
3
3
  require 'rubygems'
4
- require 'rake/gempackagetask'
4
+ require 'rubygems/package_task'
5
5
  require 'rake/testtask'
6
+ require 'rdoc/task'
7
+
8
+ if RUBY_VERSION >= '1.9'
9
+ begin
10
+ gem 'psych'
11
+ rescue Exception => e
12
+ # it's okay, fall back on the bundled psych
13
+ end
14
+ end
6
15
 
7
16
  $:.push 'lib'
8
17
 
18
+ version = File.read('VERSION') rescue ''
19
+
9
20
  begin
10
- require 'jeweler'
11
- Jeweler::Tasks.new do |gem|
12
- gem.name = "gd2-ffij"
13
- gem.version = "0.0.3"
14
- gem.summary = "gd2-ffij is a refactoring of the Ruby/GD2 library implemented with FFI"
15
- gem.description = "gd2-ffij is a refactoring of the Ruby/GD2 library implemented with FFI"
16
- gem.email = "dark.panda@gmail.com"
17
- gem.homepage = "http://github.com/dark-panda/gd2-ffij"
18
- gem.authors = [ "J Smith" ]
19
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
20
- end
21
- Jeweler::GemcutterTasks.new
21
+ require 'jeweler'
22
+ Jeweler::Tasks.new do |gem|
23
+ gem.name = "gd2-ffij"
24
+ gem.summary = "gd2-ffij is a refactoring of the Ruby/GD2 library implemented with FFI"
25
+ gem.description = gem.summary
26
+ gem.email = "dark.panda@gmail.com"
27
+ gem.homepage = "http://github.com/dark-panda/gd2-ffij"
28
+ gem.authors = [ "J Smith" ]
29
+ gem.add_dependency "ffi", "~> 1.0.0"
30
+ end
31
+ Jeweler::GemcutterTasks.new
22
32
  rescue LoadError
23
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
33
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
24
34
  end
25
35
 
26
36
  desc 'Test GD2 interface'
27
37
  Rake::TestTask.new(:test) do |t|
28
- t.libs << 'lib'
29
- t.pattern = 'test/**/*_test.rb'
30
- t.verbose = false
38
+ t.test_files = FileList['test/**/*_tests.rb']
39
+ t.verbose = !!ENV['VERBOSE_TESTS']
31
40
  end
32
41
 
42
+ desc 'Build docs'
43
+ Rake::RDocTask.new do |t|
44
+ require 'rdoc'
45
+ t.title = "gd2-ffij #{version}"
46
+ t.main = 'README'
47
+ t.rdoc_dir = 'doc'
48
+ t.rdoc_files.include('README', 'COPYING', 'COPYRIGHT', 'lib/**/*.rb')
49
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.4
data/gd2-ffij.gemspec CHANGED
@@ -1,96 +1,92 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{gd2-ffij}
8
- s.version = "0.0.3"
7
+ s.name = "gd2-ffij"
8
+ s.version = "0.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["J Smith"]
12
- s.date = %q{2010-11-11}
13
- s.description = %q{gd2-ffij is a refactoring of the Ruby/GD2 library implemented with FFI}
14
- s.email = %q{dark.panda@gmail.com}
12
+ s.date = "2012-01-03"
13
+ s.description = "gd2-ffij is a refactoring of the Ruby/GD2 library implemented with FFI"
14
+ s.email = "dark.panda@gmail.com"
15
15
  s.extra_rdoc_files = [
16
16
  "README"
17
17
  ]
18
18
  s.files = [
19
- ".gitignore",
20
- "COPYING",
21
- "COPYRIGHT",
22
- "README",
23
- "Rakefile",
24
- "gd2-ffij.gemspec",
25
- "lib/gd2-ffij.rb",
26
- "lib/gd2/canvas.rb",
27
- "lib/gd2/color.rb",
28
- "lib/gd2/ffi_struct.rb",
29
- "lib/gd2/font.rb",
30
- "lib/gd2/image.rb",
31
- "lib/gd2/palette.rb",
32
- "test/canvas_test.rb",
33
- "test/image_test.rb",
34
- "test/images/test.bmp",
35
- "test/images/test.gd",
36
- "test/images/test.gd2",
37
- "test/images/test.gif",
38
- "test/images/test.jpg",
39
- "test/images/test.png",
40
- "test/images/test.wbmp",
41
- "test/images/test.xbm",
42
- "test/images/test.xcf",
43
- "test/images/test.xpm",
44
- "test/images/test_arc.gd2",
45
- "test/images/test_canvas_filled_polygon.gd2",
46
- "test/images/test_canvas_filled_rectangle.gd2",
47
- "test/images/test_canvas_line.gd2",
48
- "test/images/test_canvas_move_to_and_line_to.gd2",
49
- "test/images/test_canvas_polygon.gd2",
50
- "test/images/test_canvas_rectangle.gd2",
51
- "test/images/test_circle.gd2",
52
- "test/images/test_color.gd2",
53
- "test/images/test_color.png",
54
- "test/images/test_color.xcf",
55
- "test/images/test_color_indexed.gd2",
56
- "test/images/test_color_sharpened.gd2",
57
- "test/images/test_cropped.gd2",
58
- "test/images/test_ellipse.gd2",
59
- "test/images/test_fill.gd2",
60
- "test/images/test_fill_to.gd2",
61
- "test/images/test_filled_circle.gd2",
62
- "test/images/test_filled_ellipse.gd2",
63
- "test/images/test_filled_wedge.gd2",
64
- "test/images/test_polar_transform.gd2",
65
- "test/images/test_resampled.gd2",
66
- "test/images/test_resized.gd2",
67
- "test/images/test_rotated_180.gd2",
68
- "test/images/test_text.gd2",
69
- "test/images/test_text_circle.gd2",
70
- "test/images/test_wedge.gd2",
71
- "test/test_helper.rb",
72
- "vendor/fonts/ttf/DejaVuSans.ttf",
73
- "vendor/fonts/ttf/LICENSE"
19
+ "COPYING",
20
+ "COPYRIGHT",
21
+ "README",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "gd2-ffij.gemspec",
25
+ "lib/gd2-ffij.rb",
26
+ "lib/gd2/canvas.rb",
27
+ "lib/gd2/color.rb",
28
+ "lib/gd2/ffi_struct.rb",
29
+ "lib/gd2/font.rb",
30
+ "lib/gd2/image.rb",
31
+ "lib/gd2/palette.rb",
32
+ "test/canvas_tests.rb",
33
+ "test/image_tests.rb",
34
+ "test/images/test.bmp",
35
+ "test/images/test.gd",
36
+ "test/images/test.gd2",
37
+ "test/images/test.gif",
38
+ "test/images/test.jpg",
39
+ "test/images/test.png",
40
+ "test/images/test.wbmp",
41
+ "test/images/test.xbm",
42
+ "test/images/test.xcf",
43
+ "test/images/test.xpm",
44
+ "test/images/test_arc.gd2",
45
+ "test/images/test_canvas_filled_polygon.gd2",
46
+ "test/images/test_canvas_filled_rectangle.gd2",
47
+ "test/images/test_canvas_line.gd2",
48
+ "test/images/test_canvas_move_to_and_line_to.gd2",
49
+ "test/images/test_canvas_polygon.gd2",
50
+ "test/images/test_canvas_rectangle.gd2",
51
+ "test/images/test_circle.gd2",
52
+ "test/images/test_color.gd2",
53
+ "test/images/test_color.png",
54
+ "test/images/test_color.xcf",
55
+ "test/images/test_color_indexed.gd2",
56
+ "test/images/test_color_sharpened.gd2",
57
+ "test/images/test_cropped.gd2",
58
+ "test/images/test_ellipse.gd2",
59
+ "test/images/test_fill.gd2",
60
+ "test/images/test_fill_to.gd2",
61
+ "test/images/test_filled_circle.gd2",
62
+ "test/images/test_filled_ellipse.gd2",
63
+ "test/images/test_filled_wedge.gd2",
64
+ "test/images/test_polar_transform.gd2",
65
+ "test/images/test_resampled.gd2",
66
+ "test/images/test_resized.gd2",
67
+ "test/images/test_rotated_180.gd2",
68
+ "test/images/test_text.gd2",
69
+ "test/images/test_text_circle.gd2",
70
+ "test/images/test_wedge.gd2",
71
+ "test/test_helper.rb",
72
+ "vendor/fonts/ttf/DejaVuSans.ttf",
73
+ "vendor/fonts/ttf/LICENSE"
74
74
  ]
75
- s.homepage = %q{http://github.com/dark-panda/gd2-ffij}
76
- s.rdoc_options = ["--charset=UTF-8"]
75
+ s.homepage = "http://github.com/dark-panda/gd2-ffij"
77
76
  s.require_paths = ["lib"]
78
- s.rubygems_version = %q{1.3.7}
79
- s.summary = %q{gd2-ffij is a refactoring of the Ruby/GD2 library implemented with FFI}
80
- s.test_files = [
81
- "test/canvas_test.rb",
82
- "test/image_test.rb",
83
- "test/test_helper.rb"
84
- ]
77
+ s.rubygems_version = "1.8.10"
78
+ s.summary = "gd2-ffij is a refactoring of the Ruby/GD2 library implemented with FFI"
85
79
 
86
80
  if s.respond_to? :specification_version then
87
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
88
81
  s.specification_version = 3
89
82
 
90
83
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
84
+ s.add_runtime_dependency(%q<ffi>, ["~> 1.0.0"])
91
85
  else
86
+ s.add_dependency(%q<ffi>, ["~> 1.0.0"])
92
87
  end
93
88
  else
89
+ s.add_dependency(%q<ffi>, ["~> 1.0.0"])
94
90
  end
95
91
  end
96
92
 
data/lib/gd2-ffij.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Ruby/GD2 -- Ruby binding for gd 2 graphics library
3
3
  #
4
- # Copyright © 2005-2006 Robert Leslie, 2010 J Smith
4
+ # Copyright 2005-2006 Robert Leslie, 2010 J Smith
5
5
  #
6
6
  # This file is part of Ruby/GD2.
7
7
  #
@@ -24,23 +24,33 @@ require 'ffi'
24
24
  require 'rbconfig'
25
25
 
26
26
  module GD2
27
- VERSION = '0.0.3'.freeze
27
+ VERSION = File.read(File.join(File.dirname(__FILE__), %w{ .. VERSION })).strip
28
28
 
29
29
  module GD2FFI
30
30
  def self.gd_library_name
31
- if ENV['GD2_LIBRARY_PATH']
32
- ENV['GD2_LIBRARY_PATH']
31
+ return @gd_library_name if @gd_library_name
32
+
33
+ @gd_library_name = if RbConfig::CONFIG['host_os'] == 'cygwin'
34
+ 'cyggd-2.dll'
33
35
  else
34
- lib = case Config::CONFIG['arch']
35
- when /darwin/
36
- [ '/usr/lib', '/usr/local/lib', '/opt/local/lib' ].detect { |path|
37
- File.exists?("#{path}/libgd.2.dylib")
38
- }.to_s + '/libgd.2.dylib'
39
- when /mswin32/, /cygwin/
40
- 'bgd.dll'
36
+ paths = if ENV['GD2_LIBRARY_PATH']
37
+ ENV['GD2_LIBRARY_PATH']
38
+ else
39
+ [ '/usr/local/{lib64,lib}', '/opt/local/{lib64,lib}', '/usr/{lib64,lib}' ]
40
+ end
41
+
42
+ lib = if [
43
+ RbConfig::CONFIG['arch'],
44
+ RbConfig::CONFIG['host_os']
45
+ ].detect { |c| c =~ /darwin/ }
46
+ 'libgd.2.dylib'
41
47
  else
42
48
  'libgd.so.2'
43
49
  end
50
+
51
+ Dir.glob(paths.collect { |path|
52
+ "#{path}/#{lib}"
53
+ }).first
44
54
  end
45
55
  end
46
56
 
data/lib/gd2/canvas.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Ruby/GD2 -- Ruby binding for gd 2 graphics library
3
3
  #
4
- # Copyright © 2005 Robert Leslie, 2010 J Smith
4
+ # Copyright 2005 Robert Leslie, 2010 J Smith
5
5
  #
6
6
  # This file is part of Ruby/GD2.
7
7
  #
@@ -281,22 +281,30 @@ module GD2
281
281
  end
282
282
  end
283
283
 
284
- def translate(tx, ty, &block)
285
- affine_transform(1, 0, 0, 1, tx, ty, &block)
284
+ def translate(tx, ty)
285
+ affine_transform(1, 0, 0, 1, tx, ty) { |*block_args|
286
+ yield(*block_args)
287
+ }
286
288
  end
287
289
 
288
- def scale(sx, sy = sx, &block)
289
- affine_transform(sx, 0, 0, sy, 0, 0, &block)
290
+ def scale(sx, sy = sx)
291
+ affine_transform(sx, 0, 0, sy, 0, 0) { |*block_args|
292
+ yield(*block_args)
293
+ }
290
294
  end
291
295
 
292
- def rotate(angle, &block)
296
+ def rotate(angle)
293
297
  cos = Math.cos(angle)
294
298
  sin = Math.sin(angle)
295
- affine_transform(cos, sin, -sin, cos, 0, 0, &block)
299
+ affine_transform(cos, sin, -sin, cos, 0, 0) { |*block_args|
300
+ yield(*block_args)
301
+ }
296
302
  end
297
303
 
298
- def cartesian(&block)
299
- affine_transform(1, 0, 0, -1, 0, @image.height - 1, &block)
304
+ def cartesian
305
+ affine_transform(1, 0, 0, -1, 0, @image.height - 1) { |*block_args|
306
+ yield(*block_args)
307
+ }
300
308
  end
301
309
 
302
310
  def point(x, y)
data/lib/gd2/color.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Ruby/GD2 -- Ruby binding for gd 2 graphics library
3
3
  #
4
- # Copyright © 2005 Robert Leslie, 2010 J Smith
4
+ # Copyright 2005 Robert Leslie, 2010 J Smith
5
5
  #
6
6
  # This file is part of Ruby/GD2.
7
7
  #
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Ruby/GD2 -- Ruby binding for gd 2 graphics library
3
3
  #
4
- # Copyright 2010 J Smith
4
+ # Copyright 2010 J Smith
5
5
  #
6
6
  # This file is part of Ruby/GD2.
7
7
  #
data/lib/gd2/font.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Ruby/GD2 -- Ruby binding for gd 2 graphics library
3
3
  #
4
- # Copyright © 2005 Robert Leslie, 2010 J Smith
4
+ # Copyright 2005 Robert Leslie, 2010 J Smith
5
5
  #
6
6
  # This file is part of Ruby/GD2.
7
7
  #
data/lib/gd2/image.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Ruby/GD2 -- Ruby binding for gd 2 graphics library
3
3
  #
4
- # Copyright © 2005-2006 Robert Leslie, 2010 J Smith
4
+ # Copyright 2005-2006 Robert Leslie, 2010 J Smith
5
5
  #
6
6
  # This file is part of Ruby/GD2.
7
7
  #
data/lib/gd2/palette.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Ruby/GD2 -- Ruby binding for gd 2 graphics library
3
3
  #
4
- # Copyright © 2005 Robert Leslie, 2010 J Smith
4
+ # Copyright 2005 Robert Leslie, 2010 J Smith
5
5
  #
6
6
  # This file is part of Ruby/GD2.
7
7
  #
File without changes
File without changes
metadata CHANGED
@@ -1,38 +1,39 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gd2-ffij
3
- version: !ruby/object:Gem::Version
4
- hash: 25
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 0
9
- - 3
10
- version: 0.0.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - J Smith
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2010-11-11 00:00:00 -05:00
19
- default_executable:
20
- dependencies: []
21
-
12
+ date: 2012-01-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: ffi
16
+ requirement: &70147998478480 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.0.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70147998478480
22
25
  description: gd2-ffij is a refactoring of the Ruby/GD2 library implemented with FFI
23
26
  email: dark.panda@gmail.com
24
27
  executables: []
25
-
26
28
  extensions: []
27
-
28
- extra_rdoc_files:
29
+ extra_rdoc_files:
29
30
  - README
30
- files:
31
- - .gitignore
31
+ files:
32
32
  - COPYING
33
33
  - COPYRIGHT
34
34
  - README
35
35
  - Rakefile
36
+ - VERSION
36
37
  - gd2-ffij.gemspec
37
38
  - lib/gd2-ffij.rb
38
39
  - lib/gd2/canvas.rb
@@ -41,8 +42,8 @@ files:
41
42
  - lib/gd2/font.rb
42
43
  - lib/gd2/image.rb
43
44
  - lib/gd2/palette.rb
44
- - test/canvas_test.rb
45
- - test/image_test.rb
45
+ - test/canvas_tests.rb
46
+ - test/image_tests.rb
46
47
  - test/images/test.bmp
47
48
  - test/images/test.gd
48
49
  - test/images/test.gd2
@@ -83,41 +84,28 @@ files:
83
84
  - test/test_helper.rb
84
85
  - vendor/fonts/ttf/DejaVuSans.ttf
85
86
  - vendor/fonts/ttf/LICENSE
86
- has_rdoc: true
87
87
  homepage: http://github.com/dark-panda/gd2-ffij
88
88
  licenses: []
89
-
90
89
  post_install_message:
91
- rdoc_options:
92
- - --charset=UTF-8
93
- require_paths:
90
+ rdoc_options: []
91
+ require_paths:
94
92
  - lib
95
- required_ruby_version: !ruby/object:Gem::Requirement
93
+ required_ruby_version: !ruby/object:Gem::Requirement
96
94
  none: false
97
- requirements:
98
- - - ">="
99
- - !ruby/object:Gem::Version
100
- hash: 3
101
- segments:
102
- - 0
103
- version: "0"
104
- required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
100
  none: false
106
- requirements:
107
- - - ">="
108
- - !ruby/object:Gem::Version
109
- hash: 3
110
- segments:
111
- - 0
112
- version: "0"
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
113
105
  requirements: []
114
-
115
106
  rubyforge_project:
116
- rubygems_version: 1.3.7
107
+ rubygems_version: 1.8.10
117
108
  signing_key:
118
109
  specification_version: 3
119
110
  summary: gd2-ffij is a refactoring of the Ruby/GD2 library implemented with FFI
120
- test_files:
121
- - test/canvas_test.rb
122
- - test/image_test.rb
123
- - test/test_helper.rb
111
+ test_files: []
data/.gitignore DELETED
@@ -1,5 +0,0 @@
1
- *.kpf
2
- *~
3
- .DS_Store
4
- *tmp*
5
- pkg/