texplay 0.2.721-i386-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/CHANGELOG +119 -0
  2. data/README.markdown +41 -0
  3. data/Rakefile +66 -0
  4. data/examples/common.rb +8 -0
  5. data/examples/example_alpha_blend.rb +31 -0
  6. data/examples/example_bezier.rb +42 -0
  7. data/examples/example_color_control.rb +69 -0
  8. data/examples/example_color_transform.rb +68 -0
  9. data/examples/example_dup.rb +75 -0
  10. data/examples/example_each.rb +42 -0
  11. data/examples/example_effect.rb +35 -0
  12. data/examples/example_fill.rb +44 -0
  13. data/examples/example_fill_old.rb +49 -0
  14. data/examples/example_fluent.rb +31 -0
  15. data/examples/example_gen_eval.rb +34 -0
  16. data/examples/example_hash_arguments.rb +47 -0
  17. data/examples/example_lsystem.rb +61 -0
  18. data/examples/example_melt.rb +27 -0
  19. data/examples/example_polyline.rb +43 -0
  20. data/examples/example_scale.rb +29 -0
  21. data/examples/example_simple.rb +38 -0
  22. data/examples/example_splice.rb +27 -0
  23. data/examples/example_sync.rb +60 -0
  24. data/examples/example_turtle.rb +40 -0
  25. data/examples/example_weird.rb +29 -0
  26. data/examples/media/bird.png +0 -0
  27. data/examples/media/empty2.png +0 -0
  28. data/examples/media/gob.png +0 -0
  29. data/examples/media/gosu.png +0 -0
  30. data/examples/media/green.png +0 -0
  31. data/examples/media/logo.png +0 -0
  32. data/examples/media/maria.png +0 -0
  33. data/examples/media/rose.bmp +0 -0
  34. data/examples/media/sand1.png +0 -0
  35. data/examples/media/sunset.png +0 -0
  36. data/examples/media/texplay.png +0 -0
  37. data/lib/1.8/texplay.so +0 -0
  38. data/lib/1.9/texplay.so +0 -0
  39. data/lib/texplay/version.rb +3 -0
  40. data/lib/texplay-contrib.rb +171 -0
  41. data/lib/texplay.rb +137 -0
  42. metadata +115 -0
data/lib/texplay.rb ADDED
@@ -0,0 +1,137 @@
1
+ # (C) John Mair 2009, under the MIT licence
2
+
3
+ begin
4
+ require 'rubygems'
5
+ rescue LoadError
6
+ end
7
+
8
+ direc = File.dirname(__FILE__)
9
+
10
+ # include gosu first
11
+ require 'rbconfig'
12
+ require 'gosu'
13
+ require "#{direc}/texplay/version"
14
+
15
+ module TexPlay
16
+ class << self
17
+ def on_setup(&block)
18
+ raise "need a block" if !block
19
+
20
+ @__init_procs__ ||= []
21
+ @__init_procs__.push(block)
22
+ end
23
+
24
+ def setup(receiver)
25
+ if @__init_procs__ then
26
+ @__init_procs__.each do |init_proc|
27
+ receiver.instance_eval(&init_proc)
28
+ end
29
+ end
30
+ end
31
+
32
+ def create_blank_image(window, width, height)
33
+ Gosu::Image.new(window, EmptyImageStub.new(width, height))
34
+ end
35
+
36
+ alias_method :create_image, :create_blank_image
37
+ end
38
+
39
+ module Colors
40
+ Red = [1, 0, 0, 1]
41
+ Green = [0, 1, 0, 1]
42
+ Blue = [0, 0, 1, 1]
43
+ Black = [0, 0, 0, 1]
44
+ White = [1, 1, 1, 1]
45
+ Grey = [0.5, 0.5, 0.5, 1]
46
+ Alpha = [0, 0, 0, 0]
47
+ Purple = [1, 0, 1, 1]
48
+ Yellow = [1, 1, 0, 1]
49
+ Cyan = [0, 1, 1, 1]
50
+ Orange = [1, 0.5, 0, 1]
51
+ Brown = [0.39, 0.26, 0.13, 1]
52
+ Turquoise = [1, 0.6, 0.8, 1]
53
+ Tyrian = [0.4, 0.007, 0.235, 1]
54
+ end
55
+ include Colors
56
+ end
57
+
58
+ # credit to philomory for this class
59
+ class EmptyImageStub
60
+ def initialize(w, h)
61
+ @w, @h = w, h
62
+ end
63
+
64
+ def to_blob
65
+ "\0" * @w * @h * 4
66
+ end
67
+
68
+ def rows
69
+ @h
70
+ end
71
+
72
+ def columns
73
+ @w
74
+ end
75
+ end
76
+
77
+ # bring in user-defined extensions to TexPlay
78
+ direc = File.dirname(__FILE__)
79
+ dlext = Config::CONFIG['DLEXT']
80
+ begin
81
+ if RUBY_VERSION && RUBY_VERSION =~ /1.9/
82
+ require "#{direc}/1.9/texplay.#{dlext}"
83
+ else
84
+ require "#{direc}/1.8/texplay.#{dlext}"
85
+ end
86
+ rescue LoadError => e
87
+ require "#{direc}/texplay.#{dlext}"
88
+ end
89
+
90
+ require "#{direc}/texplay-contrib"
91
+
92
+ # monkey patching the Gosu::Image class to add image manipulation functionality
93
+ module Gosu
94
+ class Image
95
+
96
+ # bring in the TexPlay image manipulation methods
97
+ include TexPlay
98
+
99
+ attr_reader :__window__
100
+
101
+ class << self
102
+ alias_method :original_new, :new
103
+
104
+ def new(*args, &block)
105
+
106
+ # invoke old behaviour
107
+ obj = original_new(*args, &block)
108
+
109
+ # refresh the TexPlay image cache
110
+ if obj.width <= (TexPlay::TP_MAX_QUAD_SIZE) &&
111
+ obj.height <= (TexPlay::TP_MAX_QUAD_SIZE) && obj.quad_cached? then
112
+
113
+ obj.refresh_cache
114
+ end
115
+
116
+ # run custom setup
117
+ TexPlay::setup(obj)
118
+
119
+ obj.instance_variable_set(:@__window__, args.first)
120
+
121
+ # return the new image
122
+ obj
123
+ end
124
+ end
125
+ end
126
+ end
127
+
128
+ # a bug in ruby 1.8.6 rb_eval_string() means i must define this here (rather than in texplay.c)
129
+ class Proc
130
+ def __context__
131
+ eval('self', self.binding)
132
+ end
133
+ end
134
+
135
+
136
+
137
+
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: texplay
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 721
9
+ version: 0.2.721
10
+ platform: i386-mingw32
11
+ authors:
12
+ - John Mair (banisterfiend)
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-03-13 00:00:00 +13:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: gosu
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 7
30
+ - 14
31
+ version: 0.7.14
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ description: TexPlay is a light-weight image manipulation framework for Ruby and Gosu
35
+ email: jrmair@gmail.com
36
+ executables: []
37
+
38
+ extensions: []
39
+
40
+ extra_rdoc_files: []
41
+
42
+ files:
43
+ - Rakefile
44
+ - README.markdown
45
+ - CHANGELOG
46
+ - lib/texplay.rb
47
+ - lib/texplay-contrib.rb
48
+ - lib/texplay/version.rb
49
+ - lib/1.8/texplay.so
50
+ - lib/1.9/texplay.so
51
+ - examples/common.rb
52
+ - examples/example_alpha_blend.rb
53
+ - examples/example_bezier.rb
54
+ - examples/example_color_control.rb
55
+ - examples/example_color_transform.rb
56
+ - examples/example_dup.rb
57
+ - examples/example_each.rb
58
+ - examples/example_effect.rb
59
+ - examples/example_fill.rb
60
+ - examples/example_fill_old.rb
61
+ - examples/example_fluent.rb
62
+ - examples/example_gen_eval.rb
63
+ - examples/example_hash_arguments.rb
64
+ - examples/example_lsystem.rb
65
+ - examples/example_melt.rb
66
+ - examples/example_polyline.rb
67
+ - examples/example_scale.rb
68
+ - examples/example_simple.rb
69
+ - examples/example_splice.rb
70
+ - examples/example_sync.rb
71
+ - examples/example_turtle.rb
72
+ - examples/example_weird.rb
73
+ - examples/media/bird.png
74
+ - examples/media/empty2.png
75
+ - examples/media/gob.png
76
+ - examples/media/gosu.png
77
+ - examples/media/green.png
78
+ - examples/media/logo.png
79
+ - examples/media/maria.png
80
+ - examples/media/rose.bmp
81
+ - examples/media/sand1.png
82
+ - examples/media/sunset.png
83
+ - examples/media/texplay.png
84
+ has_rdoc: true
85
+ homepage: http://banisterfiend.wordpress.com/2008/08/23/texplay-an-image-manipulation-tool-for-ruby-and-gosu/
86
+ licenses: []
87
+
88
+ post_install_message:
89
+ rdoc_options: []
90
+
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ segments:
98
+ - 0
99
+ version: "0"
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ segments:
105
+ - 0
106
+ version: "0"
107
+ requirements: []
108
+
109
+ rubyforge_project:
110
+ rubygems_version: 1.3.6
111
+ signing_key:
112
+ specification_version: 3
113
+ summary: TexPlay is a light-weight image manipulation framework for Ruby and Gosu
114
+ test_files: []
115
+