Class: Ashton::PixelCache

Inherits:
Object
  • Object
show all
Defined in:
lib/ashton/pixel_cache.rb

Instance Method Summary collapse

Instance Method Details

#to_image(options = {}) ⇒ Object

Convert the current contents of the cache into a Gosu::Image

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :caching (Boolean) — default: true

    TexPlay behaviour.

  • :tileable (Boolean) — default: false

    Standard Gosu behaviour.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ashton/pixel_cache.rb', line 10

def to_image(options = {})
  options = {
      tileable: false,
  }.merge! options

  # Create a new Image from the flipped pixel data.
  stub = ImageStub.new to_blob, width, height
  if defined? TexPlay
    Gosu::Image.new $window, stub, options[:tileable], options
  else
    Gosu::Image.new $window, stub, options[:tileable]
  end
end