Class: Gosu::Image
- Inherits:
-
Object
- Object
- Gosu::Image
- Includes:
- TexPlay
- Defined in:
- lib/texplay.rb,
lib/texplay/live.rb
Constant Summary
Constants included from TexPlay
TexPlay::RENDER_CLEAR_COLOR, TexPlay::TP_MAX_QUAD_SIZE, TexPlay::VERSION, TexPlay::Win
Constants included from TexPlay::Colors
TexPlay::Colors::Alpha, TexPlay::Colors::Black, TexPlay::Colors::Blue, TexPlay::Colors::Brown, TexPlay::Colors::Cyan, TexPlay::Colors::Green, TexPlay::Colors::Grey, TexPlay::Colors::Orange, TexPlay::Colors::Purple, TexPlay::Colors::Red, TexPlay::Colors::Turquoise, TexPlay::Colors::Tyrian, TexPlay::Colors::White, TexPlay::Colors::Yellow
Instance Attribute Summary collapse
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Class Method Summary collapse
- .from_text(*args, &block) ⇒ Object
- .new(*args, &block) ⇒ Object
- .original_from_text ⇒ Object
- .original_new ⇒ Object
- .prepare_image(obj, window, options = {}) ⇒ Object
Instance Method Summary collapse
-
#initialize(*args) ⇒ Image
constructor
A new instance of Image.
- #orig_init ⇒ Object
Methods included from TexPlay
#[], #bezier, #cache, #circle, #clear, #clone, #color, #colour, create_blank_image, create_image, create_macro, #delete_options, #dup, #each, #fill, #force_sync, from_blob, get_options, #get_options, #get_pixel, init, #line, load, #method_missing, #ngon, #offset, on_setup, original_create_image, #paint, #polyline, #quad_cached?, #rect, #refresh_cache, refresh_cache_all, remove_macro, set_defaults, set_options, #set_options, #set_pixel, setup, #splice, #to_blob
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class TexPlay
Instance Attribute Details
#x ⇒ Object
Returns the value of attribute x.
10 11 12 |
# File 'lib/texplay/live.rb', line 10 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
10 11 12 |
# File 'lib/texplay/live.rb', line 10 def y @y end |
Class Method Details
.from_text(*args, &block) ⇒ Object
189 190 191 192 193 194 195 196 |
# File 'lib/texplay.rb', line 189 def from_text(*args, &block) = args.last.is_a?(Hash) ? args.pop : {} # invoke old behaviour obj = original_from_text(*args, &block) prepare_image(obj, args.first, ) end |
.new(*args, &block) ⇒ Object
178 179 180 181 182 183 184 185 |
# File 'lib/texplay.rb', line 178 def new(*args, &block) = args.last.is_a?(Hash) ? args.pop : {} # invoke old behaviour obj = original_new(*args, &block) prepare_image(obj, args.first, ) end |
.original_from_text ⇒ Object
187 |
# File 'lib/texplay.rb', line 187 alias_method :original_from_text, :from_text |
.original_new ⇒ Object
176 |
# File 'lib/texplay.rb', line 176 alias_method :original_new, :new |
.prepare_image(obj, window, options = {}) ⇒ Object
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/texplay.rb', line 198 def prepare_image(obj, window, ={}) = { :caching => TexPlay.[:caching] }.merge!() caching_mode = [:caching] # we can't manipulate large images, so skip them. if obj.width <= (TexPlay::TP_MAX_QUAD_SIZE) && obj.height <= (TexPlay::TP_MAX_QUAD_SIZE) if caching_mode if caching_mode == :lazy # only cache if quad already cached (to refresh old data) # otherwise cache lazily at point of first TexPlay call obj.refresh_cache if obj.quad_cached? else # force a cache - this obviates the need for a # potentialy expensive runtime cache of the image by # moving the cache to load-time obj.refresh_cache end end end # run custom setup TexPlay.setup(obj) obj.instance_variable_set(:@__window__, window) obj end |
Instance Method Details
#orig_init ⇒ Object
12 |
# File 'lib/texplay/live.rb', line 12 alias_method :orig_init, :initialize |