.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 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

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>RichTextImageBlock</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.richtext.RichTextImageBlock_inheritance.png" alt="Inheritance diagram of RichTextImageBlock" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.richtext.RichTextImageBlock.html" title="This class stores information about an image, in binary in-memory form." alt="" coords="5,83,243,112"/> <area shape="rect" id="node2" href="wx.Object.html" title="This is the root class of many of the wxWidgets classes." alt="" coords="80,5,168,35"/> </map> 
   </p>
   </div>

|


|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()
       
       RichTextImageBlock(block)
       
   
   This class stores information about an image, in binary in-memory
   form.



   .. method:: __init__(self, *args, **kw)



      |overload| Overloaded Implementations:

      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self)`
      
      Constructor.                   
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, block)`
      
      Copy constructor.                  
      
      
      :param `block`: 
      :type `block`: wx.richtext.RichTextImageBlock
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: Clear(self)

      Clears the block.                   





   .. method:: Copy(self, block)

      Copy from `block`.                  


      :param `block`: 
      :type `block`: wx.richtext.RichTextImageBlock







   .. 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: `string`








   .. method:: GetImageType(self)

      Returns the image type.                  

      :rtype: :ref:`wx.BitmapType`








   .. method:: Init(self)

      Initialises the block.                   





   .. 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:`<hr class="overloadsep" /><br />`

      
      **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:`<hr class="overloadsep" /><br />`

      
      **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:`<hr class="overloadsep" /><br />`






   .. 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:`<hr class="overloadsep" /><br />`

      
      **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:`<hr class="overloadsep" /><br />`

      
      **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:`<hr class="overloadsep" /><br />`






   .. 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







   .. method:: SetDataSize(self, size)

      Sets the data size.                  


      :param `size`: 
      :type `size`: int







   .. method:: SetImageType(self, imageType)

      Sets the image type.                  


      :param `imageType`: 
      :type `imageType`: wx.BitmapType







   .. 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:`<hr class="overloadsep" /><br />`

      
      **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:`<hr class="overloadsep" /><br />`

      
      **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:`<hr class="overloadsep" /><br />`






   .. 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`