.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.richtext.RichTextImageBlock:
==========================================================================================================================================
|phoenix_title| **wx.richtext.RichTextImageBlock**
==========================================================================================================================================
This class stores information about an image, in binary in-memory form.
.. seealso:: :ref:`wx.richtext.RichTextBuffer`, :ref:`wx.richtext.RichTextCtrl`
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
RichTextImageBlock:
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.richtext.RichTextImageBlock.__init__` Constructor.
:meth:`~wx.richtext.RichTextImageBlock.Clear` Clears the block.
:meth:`~wx.richtext.RichTextImageBlock.Copy` Copy from `block`.
:meth:`~wx.richtext.RichTextImageBlock.DoMakeImageBlock` Makes the image block.
:meth:`~wx.richtext.RichTextImageBlock.GetData` Returns the raw data.
:meth:`~wx.richtext.RichTextImageBlock.GetDataSize` Returns the data size in bytes.
:meth:`~wx.richtext.RichTextImageBlock.GetExtension` Gets the extension for the block's type.
:meth:`~wx.richtext.RichTextImageBlock.GetImageType` Returns the image type.
:meth:`~wx.richtext.RichTextImageBlock.Init` Initialises the block.
:meth:`~wx.richtext.RichTextImageBlock.IsOk` Returns ``True`` if the data is not ``None``.
:meth:`~wx.richtext.RichTextImageBlock.Load`
:meth:`~wx.richtext.RichTextImageBlock.MakeImageBlock` Load the original image into a memory block.
:meth:`~wx.richtext.RichTextImageBlock.MakeImageBlockDefaultQuality` Uses a :ref:`wx.Image` for efficiency, but can't set quality (only relevant for ``JPEG``)
:meth:`~wx.richtext.RichTextImageBlock.Ok`
:meth:`~wx.richtext.RichTextImageBlock.ReadBlock` Implementation.
:meth:`~wx.richtext.RichTextImageBlock.ReadHex` Reads the data in hex from a stream.
:meth:`~wx.richtext.RichTextImageBlock.SetData`
:meth:`~wx.richtext.RichTextImageBlock.SetDataSize` Sets the data size.
:meth:`~wx.richtext.RichTextImageBlock.SetImageType` Sets the image type.
:meth:`~wx.richtext.RichTextImageBlock.Write` Writes the block to a file.
:meth:`~wx.richtext.RichTextImageBlock.WriteBlock` Writes a memory block to stream.
:meth:`~wx.richtext.RichTextImageBlock.WriteHex` Writes the data in hex to a stream.
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.richtext.RichTextImageBlock.Data` See :meth:`~wx.richtext.RichTextImageBlock.GetData` and :meth:`~wx.richtext.RichTextImageBlock.SetData`
:attr:`~wx.richtext.RichTextImageBlock.DataSize` See :meth:`~wx.richtext.RichTextImageBlock.GetDataSize` and :meth:`~wx.richtext.RichTextImageBlock.SetDataSize`
:attr:`~wx.richtext.RichTextImageBlock.Extension` See :meth:`~wx.richtext.RichTextImageBlock.GetExtension`
:attr:`~wx.richtext.RichTextImageBlock.ImageType` See :meth:`~wx.richtext.RichTextImageBlock.GetImageType` and :meth:`~wx.richtext.RichTextImageBlock.SetImageType`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.richtext.RichTextImageBlock(Object)
**Possible constructors**::
RichTextImageBlock() -> None
RichTextImageBlock(block : RichTextImageBlock) -> None
This class stores information about an image, in binary in-memory
form.
.. method:: __init__(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**__init__** `(self)`
Constructor.
:rtype: `None`
:html:`
`
**__init__** `(self, block : RichTextImageBlock)`
Copy constructor.
:param `block`:
:type `block`: wx.richtext.RichTextImageBlock
:rtype: `None`
:html:`
`
.. method:: Clear(self)
Clears the block.
:rtype: `None`
.. method:: Copy(self, block : RichTextImageBlock)
Copy from `block`.
:param `block`:
:type `block`: wx.richtext.RichTextImageBlock
:rtype: `None`
.. method:: DoMakeImageBlock(self, image : Image, imageType : BitmapType)
Makes the image block.
:param `image`:
:type `image`: wx.Image
:param `imageType`:
:type `imageType`: wx.BitmapType
:rtype: `bool`
.. method:: GetData(self)
Returns the raw data.
:rtype: `int`
.. method:: GetDataSize(self)
Returns the data size in bytes.
:rtype: `int`
.. method:: GetExtension(self)
Gets the extension for the block's type.
:rtype: `str`
.. method:: GetImageType(self)
Returns the image type.
:rtype: `BitmapType`
.. method:: Init(self)
Initialises the block.
:rtype: `None`
.. method:: IsOk(self)
Returns ``True`` if the data is not ``None``.
:rtype: `bool`
.. method:: Load(self, image : Image)
:param `image`:
:type `image`: wx.Image
:rtype: `bool`
.. method:: MakeImageBlock(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**MakeImageBlock** `(self, filename : str, imageType : BitmapType, image : Image, convertToJPEG: bool=True)`
Load the original image into a memory block.
If the image is not a ``JPEG``, we must convert it into a ``JPEG`` to conserve space. If it's not a ``JPEG`` we can make use of `image`, already scaled, so we don't have to load the image a second time.
:param `filename`:
:type `filename`: string
:param `imageType`:
:type `imageType`: wx.BitmapType
:param `image`:
:type `image`: wx.Image
:param `convertToJPEG`:
:type `convertToJPEG`: bool
:rtype: `bool`
:html:`
`
**MakeImageBlock** `(self, image : Image, imageType : BitmapType, quality: int=80)`
Make an image block from the :ref:`wx.Image` in the given format.
:param `image`:
:type `image`: wx.Image
:param `imageType`:
:type `imageType`: wx.BitmapType
:param `quality`:
:type `quality`: int
:rtype: `bool`
:html:`
`
.. method:: MakeImageBlockDefaultQuality(self, image : Image, imageType : BitmapType)
Uses a :ref:`wx.Image` for efficiency, but can't set quality (only relevant for ``JPEG``)
:param `image`:
:type `image`: wx.Image
:param `imageType`:
:type `imageType`: wx.BitmapType
:rtype: `bool`
.. method:: Ok(self)
:rtype: `bool`
.. staticmethod:: ReadBlock(*args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**ReadBlock** `(stream : InputStream, size : int)`
Implementation.
Allocates and reads from a stream as a block of memory.
:param `stream`:
:type `stream`: wx.InputStream
:param `size`:
:type `size`: int
:rtype: `int`
:html:`
`
**ReadBlock** `(filename : str, size : int)`
Allocates and reads from a file as a block of memory.
:param `filename`:
:type `filename`: string
:param `size`:
:type `size`: int
:rtype: `int`
:html:`
`
.. method:: ReadHex(self, stream : InputStream, length : int, imageType : BitmapType)
Reads the data in hex from a stream.
:param `stream`:
:type `stream`: wx.InputStream
:param `length`:
:type `length`: int
:param `imageType`:
:type `imageType`: wx.BitmapType
:rtype: `bool`
.. method:: SetData(self, image : int)
:param `image`:
:type `image`: int
:rtype: `None`
.. method:: SetDataSize(self, size : int)
Sets the data size.
:param `size`:
:type `size`: int
:rtype: `None`
.. method:: SetImageType(self, imageType : BitmapType)
Sets the image type.
:param `imageType`:
:type `imageType`: wx.BitmapType
:rtype: `None`
.. method:: Write(self, filename : str)
Writes the block to a file.
:param `filename`:
:type `filename`: string
:rtype: `bool`
.. staticmethod:: WriteBlock(*args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**WriteBlock** `(stream : OutputStream, block : int, size : int)`
Writes a memory block to stream.
:param `stream`:
:type `stream`: wx.OutputStream
:param `block`:
:type `block`: int
:param `size`:
:type `size`: int
:rtype: `bool`
:html:`
`
**WriteBlock** `(filename : str, block : int, size : int)`
Writes a memory block to a file.
:param `filename`:
:type `filename`: string
:param `block`:
:type `block`: int
:param `size`:
:type `size`: int
:rtype: `bool`
:html:`
`
.. method:: WriteHex(self, stream : OutputStream)
Writes the data in hex to a stream.
:param `stream`:
:type `stream`: wx.OutputStream
:rtype: `bool`
.. attribute:: Data
See :meth:`~wx.richtext.RichTextImageBlock.GetData` and :meth:`~wx.richtext.RichTextImageBlock.SetData`
.. attribute:: DataSize
See :meth:`~wx.richtext.RichTextImageBlock.GetDataSize` and :meth:`~wx.richtext.RichTextImageBlock.SetDataSize`
.. attribute:: Extension
See :meth:`~wx.richtext.RichTextImageBlock.GetExtension`
.. attribute:: ImageType
See :meth:`~wx.richtext.RichTextImageBlock.GetImageType` and :meth:`~wx.richtext.RichTextImageBlock.SetImageType`