Class: Wx::Image

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

Overview

A platform-independent image; can be manipulated more extensively than Bitmap, but must be converted to a Bitmap for drawing.

Constant Summary collapse

BITMAP_TYPE_GUESS =
Wx::Bitmap::BITMAP_TYPE_GUESS

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_bitmap(bmp) ⇒ Object

Create a new image from Wx::Bitmap, preserving mask information



21
22
23
# File 'lib/wx/classes/image.rb', line 21

def self.from_bitmap(bmp)
  bmp.convert_to_image
end

.read(an_io, type_or_mime, index = -1)) ⇒ Object

Load a new image from an IO-like object that supports “read”



14
15
16
17
18
# File 'lib/wx/classes/image.rb', line 14

def self.read(an_io, type_or_mime, index = -1)
  img = new
  img.load_stream(an_io, type_or_mime, index)
  img
end

Instance Method Details

#convert_to_bitmapObject

Convert to bitmap



50
51
52
# File 'lib/wx/classes/image.rb', line 50

def convert_to_bitmap
  Wx::Bitmap.from_image(self)
end

#to_bitmapObject

Ruby methods that switch class are conventionally named to_foo



26
27
28
# File 'lib/wx/classes/image.rb', line 26

def to_bitmap
  Wx::Bitmap.from_image(self)
end