Class: Wx::Bitmap

Inherits:
Object
  • Object
show all
Defined in:
lib/wx/classes/bitmap.rb

Overview

A platform-dependent image that can be drawn on the screen

Constant Summary collapse

BITMAP_TYPE_GUESS =

Allow wxRuby to guess the type of an image file from its extension.

{ 
  'bmp'  => Wx::BITMAP_TYPE_BMP,
  'gif'  => Wx::BITMAP_TYPE_GIF,
  'ico'  => Wx::BITMAP_TYPE_ICO,
  'jpeg' => Wx::BITMAP_TYPE_JPEG,
  'jpg'  => Wx::BITMAP_TYPE_JPEG,
  'pbm'  => Wx::BITMAP_TYPE_PNM,
  'pcx'  => Wx::BITMAP_TYPE_PCX,
  'pgm'  => Wx::BITMAP_TYPE_PNM,
  'png'  => Wx::BITMAP_TYPE_PNG,
  'pnm'  => Wx::BITMAP_TYPE_PNM,
  'ppm'  => Wx::BITMAP_TYPE_PNM,
  'tga'  => Wx::BITMAP_TYPE_TGA,
  'tif'  => Wx::BITMAP_TYPE_TIF,
  'tiff' => Wx::BITMAP_TYPE_TIF,
  'xbm'  => Wx::BITMAP_TYPE_XBM,
  'xpm'  => Wx::BITMAP_TYPE_XPM
}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_image(img, depth = -1)) ⇒ Object

Constructor copying data from an image



24
25
26
# File 'lib/wx/classes/bitmap.rb', line 24

def self.from_image(img, depth = -1)
  new(img, depth)
end

Instance Method Details

#draw {|dc| ... } ⇒ Object

Accepts a block, which will be passed a device context which can be used to draw upon the Bitmap

Yields:

  • (dc)


53
54
55
56
57
58
# File 'lib/wx/classes/bitmap.rb', line 53

def draw
  dc = Wx::MemoryDC.new
  dc.select_object(self)
  yield dc
  dc.select_object( Wx::NULL_BITMAP )
end