.. 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) -> 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)`
      
      Copy constructor. 
                       
      
      
      :param `block`: 
      :type `block`: wx.richtext.RichTextImageBlock
      
      
      
      
      :rtype: `None`     
      
      
      
      
      
      
      
      :html:`
`
   .. method:: Clear(self)
      Clears the block. 
                 
      :rtype: `None`     
   .. method:: Copy(self, block)
      Copy from `block`. 
                 
      :param `block`: 
      :type `block`: wx.richtext.RichTextImageBlock
      :rtype: `None`     
   .. method:: DoMakeImageBlock(self, image, imageType)
      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)
      :param `image`: 
      :type `image`: wx.Image
      :rtype: `bool`
   .. method:: MakeImageBlock(self, *args, **kw)
      |overload| **Overloaded Implementations:**
      :html:`
`
      
      **MakeImageBlock** `(self, filename, imageType, image, convertToJPEG=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, imageType, quality=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, imageType)
      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, size)`
      
      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, size)`
      
      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, length, imageType)
      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)
      :param `image`: 
      :type `image`: int
      :rtype: `None`     
   .. method:: SetDataSize(self, size)
      Sets the data size. 
                 
      :param `size`: 
      :type `size`: int
      :rtype: `None`     
   .. method:: SetImageType(self, imageType)
      Sets the image type. 
                 
      :param `imageType`: 
      :type `imageType`: wx.BitmapType
      :rtype: `None`     
   .. method:: Write(self, filename)
      Writes the block to a file. 
                 
      :param `filename`: 
      :type `filename`: string
      :rtype: `bool`
   .. staticmethod:: WriteBlock(*args, **kw)
      |overload| **Overloaded Implementations:**
      :html:`
`
      
      **WriteBlock** `(stream, block, size)`
      
      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, block, size)`
      
      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)
      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`