wxRuby Documentation Home

# Wx::BitmapHandler

Overviewwxbitmapoverview

This is the base class for implementing bitmap file loading/saving, and bitmap creation from data.
It is used within Bitmap and is not normally seen by the application.

If you wish to extend the capabilities of Bitmap, derive a class from BitmapHandler
and add the handler using Bitmap#add_handler in your
application initialisation.

## Derived from

Object

## See also

Bitmap, Icon, Cursor

## Methods

- BitmapHandler.new
- BitmapHandler#create
- BitmapHandler#get_name
- BitmapHandler#get_extension
- BitmapHandler#get_type
- BitmapHandler#load_file
- BitmapHandler#save_file
- BitmapHandler#set_name
- BitmapHandler#set_extension
- BitmapHandler#set_type

### BitmapHandler.new

destructor()

Destroys the BitmapHandler object.

### BitmapHandler#create

Boolean create(%(arg-type)Bitmap% bitmap, (arg-type) data, Integer type, Integer width, Integer height, Integer depth = -1)

Creates a bitmap from the given data, which can be of arbitrary type. The Bitmap object bitmap is
manipulated by this function.

#### Parameters

- bitmap The Bitmap object.
- width The width of the bitmap in pixels.
- height The height of the bitmap in pixels.
- depth The depth of the bitmap in pixels. If this is -1, the screen depth is used.
- data Data whose type depends on the value of type.
- type A bitmap type identifier – see BitmapHandler.new for a list
  of possible values.

#### Return value

true if the call succeeded, false otherwise (the default).

### BitmapHandler#get_name

String get_name()

Gets the name of this handler.

### BitmapHandler#get_extension

String get_extension()

Gets the file extension associated with this handler.

### BitmapHandler#get_type

Integer get_type()

Gets the bitmap type associated with this handler.

### BitmapHandler#load_file

Boolean load_file(%(arg-type)Bitmap% bitmap, String name, Integer type)

Loads a bitmap from a file or resource, putting the resulting data into bitmap.

#### Parameters

- bitmap The bitmap object which is to be affected by this operation.
- name Either a filename or a Windows resource name.
  The meaning of name is determined by the type parameter.
- type See Bitmap.new for values this can take.

#### Return value

true if the operation succeeded, false otherwise.

#### See also

Bitmap#load_file

Bitmap#save_file

BitmapHandler#save_file

### BitmapHandler#save_file

Boolean save_file(%(arg-type)Bitmap% bitmap, String name, Integer type, Palette palette = nil)

Saves a bitmap in the named file.

#### Parameters

- bitmap The bitmap object which is to be affected by this operation.
- name A filename. The meaning of name is determined by the type parameter.
- type See Bitmap.new for values this can take.
- palette An optional palette used for saving the bitmap.

#### Return value

true if the operation succeeded, false otherwise.

#### See also

Bitmap#load_file

Bitmap#save_file

BitmapHandler#load_file

### BitmapHandler#set_name

set_name(%(arg-type)String% name)

Sets the handler name.

#### Parameters

- name Handler name.

### BitmapHandler#set_extension

set_extension(%(arg-type)String% extension)

Sets the handler extension.

#### Parameters

- extension Handler extension.

### BitmapHandler#set_type

set_type(%(arg-type)Integer% type)

Sets the handler type.

#### Parameters

- name Handler type.

[This page automatically generated from the Textile source at 2023-06-09 00:45:25 +0000]