A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://wxpython.org/Phoenix/docs/html/wx.ImageHandler.html below:

wx.ImageHandler — wxPython Phoenix 4.2.4a1 documentation

wx.ImageHandler¶

This is the base class for implementing image file loading/saving, and image creation from data.

It is used within wx.Image and is not normally seen by the application.

If you wish to extend the capabilities of wx.Image, derive a class from wx.ImageHandler and add the handler using wx.Image.AddHandler in your application initialization.

Note that all ImageHandlers provided by wxWidgets are part of the Core library. For details about the default handlers, please see the section Available image handlers in the wx.Image class documentation.

Note (Legal Issue)¶

This software is based in part on the work of the Independent JPEG Group. (Applies when wxWidgets is linked with JPEG support. wx.JPEGHandler uses libjpeg created by IJG.)

Class Hierarchy¶

Inheritance diagram for class

ImageHandler

:

Known Subclasses¶

wx.GIFHandler, wx.IFFHandler, wx.JPEGHandler, wx.PCXHandler, wx.PNGHandler, wx.PNMHandler, wx.TGAHandler, wx.TIFFHandler, wx.XPMHandler

Methods Summary¶

__init__

Default constructor.

CanRead

Returns True if this handler supports the image format contained in the given stream.

DoCanRead

Called to test if this handler can read an image from the given stream.

DoGetImageCount

Called to get the number of images available in a multi-image file type, if supported.

GetAltExtensions

Returns the other file extensions associated with this handler.

GetExtension

Gets the preferred file extension associated with this handler.

GetImageCount

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.

GetMimeType

Gets the MIME type associated with this handler.

GetName

Gets the name of this handler.

GetType

Gets the image type associated with this handler.

LoadFile

Loads an image from a stream, putting the resulting data into image.

SaveFile

Saves an image in the output stream.

SetAltExtensions

Sets the alternative file extensions associated with this handler.

SetExtension

Sets the preferred file extension associated with this handler.

SetMimeType

Sets the handler MIME type.

SetName

Sets the handler name.

SetType

Sets the bitmap type for the handler.

Properties Summary¶ Class API¶
class wx.ImageHandler(Object)¶

Possible constructors:

This is the base class for implementing image file loading/saving, and image creation from data.


Methods¶
__init__(self)¶

Default constructor.

In your own default constructor, initialise the members m_name, m_extension and m_type.

Return type:

None


CanRead(self, *args, **kw)¶

Overloaded Implementations:

CanRead (self, stream)

Returns True if this handler supports the image format contained in the given stream.

This function doesn’t modify the current stream position (because it restores the original position before returning; this however requires the stream to be seekable; see wx.StreamBase.IsSeekable ).

Parameters:

stream (wx.InputStream)

Return type:

bool

CanRead (self, filename)

Returns True if this handler supports the image format contained in the file with the given name.

This function doesn’t modify the current stream position (because it restores the original position before returning; this however requires the stream to be seekable; see wx.StreamBase.IsSeekable ).

Parameters:

filename (string)

Return type:

bool



DoCanRead(self, stream)¶

Called to test if this handler can read an image from the given stream.

NOTE: this function is allowed to change the current stream position since CallDoCanRead() will take care of restoring it later

Parameters:

stream (wx.InputStream)

Return type:

bool


DoGetImageCount(self, stream)¶

Called to get the number of images available in a multi-image file type, if supported.

NOTE: this function is allowed to change the current stream position since GetImageCount will take care of restoring it later

Parameters:

stream (wx.InputStream)

Return type:

int


GetAltExtensions(self)¶

Returns the other file extensions associated with this handler.

The preferred extension for this handler is returned by GetExtension .

Return type:

List[str]

Added in version 2.9.0.


GetExtension(self)¶

Gets the preferred file extension associated with this handler.

Return type:

str


GetImageCount(self, 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.

Parameters:

stream (wx.InputStream) – Opened input stream for reading image data. This function doesn’t modify the current stream position (because it restores the original position before returning; this however requires the stream to be seekable; see wx.StreamBase.IsSeekable ).

Return type:

int

Returns:

Number of available images. For most image handlers, this is 1 (exceptions are TIFF and ICO formats as well as animated GIFs for which this function returns the number of frames in the animation).


GetMimeType(self)¶

Gets the MIME type associated with this handler.

Return type:

str


GetName(self)¶

Gets the name of this handler.

Return type:

str


GetType(self)¶

Gets the image type associated with this handler.

Return type:

wx.BitmapType


LoadFile(self, image, stream, verbose=True, index=-1)¶

Loads an 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 (wx.Image) – The image object which is to be affected by this operation.

  • stream (wx.InputStream) – Opened input stream for reading image data.

  • verbose (bool) – If set to True, errors reported by the image handler will produce LogMessages.

  • index (int) – The index of the image in the file (starting from zero).

Return type:

bool

Returns:

True if the operation succeeded, False otherwise.


SaveFile(self, image, stream, verbose=True)¶

Saves an image in the output stream.

Parameters:
  • image (wx.Image) – The image object which is to be affected by this operation.

  • stream (wx.OutputStream) – Opened output stream for writing the data.

  • verbose (bool) – If set to True, errors reported by the image handler will produce LogMessages.

Return type:

bool

Returns:

True if the operation succeeded, False otherwise.


SetAltExtensions(self, extensions)¶

Sets the alternative file extensions associated with this handler.

Parameters:

extensions (list of strings) – Array of file extensions.

Return type:

None

Added in version 2.9.0.


SetExtension(self, extension)¶

Sets the preferred file extension associated with this handler.

Parameters:

extension (string) – File extension without leading dot.

Return type:

None


SetMimeType(self, mimetype)¶

Sets the handler MIME type.

Parameters:

mimetype (string) – Handler MIME type.

Return type:

None


SetName(self, name)¶

Sets the handler name.

Parameters:

name (string) – Handler name.

Return type:

None


SetType(self, type)¶

Sets the bitmap type for the handler.

Parameters:

type (BitmapType) – The bitmap type.

Return type:

None


Properties¶
AltExtensions¶

See GetAltExtensions and SetAltExtensions


Extension¶

See GetExtension and SetExtension


MimeType¶

See GetMimeType and SetMimeType


Name¶

See GetName and SetName


Type¶

See GetType and SetType


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4