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



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

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”



9
10
11
12
13
# File 'lib/wx/classes/image.rb', line 9

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



45
46
47
# File 'lib/wx/classes/image.rb', line 45

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

#to_bitmapObject

Ruby methods that switch class are conventionally named to_foo



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

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