Class: Quartz::BitmapContext

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyquartz/bitmap_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width, height, options = {}) ⇒ BitmapContext

Returns a new instance of BitmapContext.



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rubyquartz/bitmap_context.rb', line 30

def initialize(width, height, options={})
  raise "Width must be an integer" if width.to_i != width
  raise "Height must be an integer" if height.to_i != height

  super()
  
  colorspace = options[:colorspace] || ColorSpace.new(:name => ColorSpace::GENERIC_RGB)
  
  # Record the bitmap as an ivar so it is retained.  _initialize grabs a pointer, so losing this ivar can cause crashes.
  @bitmap = Quartz::Bitmap.new(width, height, colorspace, options)
  _initialize(@bitmap, colorspace)
end

Instance Attribute Details

#bitmapObject (readonly)

Returns the value of attribute bitmap.



28
29
30
# File 'lib/rubyquartz/bitmap_context.rb', line 28

def bitmap
  @bitmap
end

Instance Method Details

#copy_imageObject



45
46
47
# File 'lib/rubyquartz/bitmap_context.rb', line 45

def copy_image
  Image.new(:bitmap_context => self)
end