wxRuby Documentation Home

# Wx::ImageHandler

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

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

## Note (Legal Issue)

This software is based in part on the work of the Independent JPEG Group.

(Applies when Widgets is linked with JPEG support. JPEGHandler uses libjpeg
created by IJG.)

## Derived from

Object

## See also

Image,
InitAllImageHandlers

## Methods

- ImageHandler.new
- ImageHandler#get_name
- ImageHandler#get_extension
- ImageHandler#get_image_count
- ImageHandler#get_type
- ImageHandler#get_mime_type
- ImageHandler#load_file
- ImageHandler#save_file
- ImageHandler#set_name
- ImageHandler#set_extension
- ImageHandler#set_mime_type
- ImageHandler#set_type

### ImageHandler.new

destructor()

Destroys the ImageHandler object.

### ImageHandler#get_name

String get_name()

Gets the name of this handler.

### ImageHandler#get_extension

String get_extension()

Gets the file extension associated with this handler.

### ImageHandler#get_image_count

Integer get_image_count(%(arg-type)InputStream% stream)

If the image file contains more than one image and the image handler is capable
of retrieving these individually, this function will return the number of
available images.

- stream Opened input stream for reading image data. Currently, the stream must support seeking.

#### Return value

Number of available images. For most image handlers, this is 1 (exceptions
are TIFF and ICO formats).

### ImageHandler#get_type

Integer get_type()

Gets the image type associated with this handler.

### ImageHandler#get_mime_type

String get_mime_type()

Gets the MIME type associated with this handler.

### ImageHandler#load_file

Boolean load_file(%(arg-type)Image% image, InputStream stream, Boolean verbose=true, Integer index=0)

Loads a image from a stream, putting the resulting data into image. If the image file contains
more than one image and the image handler is capable of retrieving these individually, index
indicates which image to read from the stream.

#### Parameters

- image The image object which is to be affected by this operation.
- stream Opened input stream for reading image data.
- verbose If set to true, errors reported by the image handler will produce LogMessages.
- index The index of the image in the file (starting from zero).

#### Return value

true if the operation succeeded, false otherwise.

#### See also

Image#load_file,
Image#save_file,
ImageHandler#save_file

### ImageHandler#save_file

Boolean save_file(%(arg-type)Image% image, OutputStream stream)

Saves a image in the output stream.

#### Parameters

- image The image object which is to be affected by this operation.
- stream Opened output stream for writing the data.

#### Return value

true if the operation succeeded, false otherwise.

#### See also

Image#load_file,
Image#save_file,
ImageHandler#load_file

### ImageHandler#set_name

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

Sets the handler name.

#### Parameters

- name Handler name.

### ImageHandler#set_extension

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

Sets the handler extension.

#### Parameters

- extension Handler extension.

### ImageHandler#set_mime_type

set_mime_type(%(arg-type)String% mimetype)

Sets the handler MIME type.

#### Parameters

- mimename Handler MIME type.

### ImageHandler#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]