wx.richtext.RichTextImageBlock¶This class stores information about an image, in binary in-memory form.
See also
wx.richtext.RichTextBuffer, wx.richtext.RichTextCtrl
Class Hierarchy¶
Inheritance diagram for class RichTextImageBlock:
Methods Summary¶Constructor. |
|
Clears the block. |
|
Copy from block. |
|
Makes the image block. |
|
Returns the raw data. |
|
Returns the data size in bytes. |
|
Gets the extension for the block’s type. |
|
Returns the image type. |
|
Initialises the block. |
|
Returns |
|
Load the original image into a memory block. |
|
Uses a wx.Image for efficiency, but can’t set quality (only relevant for |
|
Implementation. |
|
Reads the data in hex from a stream. |
|
Sets the data size. |
|
Sets the image type. |
|
Writes the block to a file. |
|
Writes a memory block to stream. |
|
Writes the data in hex to a stream. |
Properties Summary¶See |
|
See |
|
See |
Class API¶wx.richtext.RichTextImageBlock(Object)¶Possible constructors:
RichTextImageBlock() -> None
RichTextImageBlock(block : RichTextImageBlock) -> None
This class stores information about an image, in binary in-memory form.
__init__(self, *args, **kw)¶__init__ (self)
Constructor.
None
__init__ (self, block : RichTextImageBlock)
Copy constructor.
block (wx.richtext.RichTextImageBlock) –
None
Clear(self)¶Clears the block.
None
Copy(self, block : RichTextImageBlock)¶Copy from block.
block (wx.richtext.RichTextImageBlock) –
None
DoMakeImageBlock(self, image : Image, imageType : BitmapType)¶Makes the image block.
image (wx.Image) –
imageType (BitmapType) –
bool
GetData(self)¶Returns the raw data.
int
GetDataSize(self)¶Returns the data size in bytes.
int
GetExtension(self)¶Gets the extension for the block’s type.
str
GetImageType(self)¶Returns the image type.
BitmapType
Init(self)¶Initialises the block.
None
IsOk(self)¶Returns True if the data is not None.
bool
MakeImageBlock(self, *args, **kw)¶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.
filename (string) –
imageType (BitmapType) –
image (wx.Image) –
convertToJPEG (bool) –
bool
MakeImageBlock (self, image : Image, imageType : BitmapType, quality: int=80)
Make an image block from the wx.Image in the given format.
image (wx.Image) –
imageType (BitmapType) –
quality (int) –
bool
MakeImageBlockDefaultQuality(self, image : Image, imageType : BitmapType)¶Uses a wx.Image for efficiency, but can’t set quality (only relevant for JPEG)
image (wx.Image) –
imageType (BitmapType) –
bool
Ok(self)¶bool
ReadBlock(*args, **kw)¶ReadBlock (stream : InputStream, size : int)
Implementation.
Allocates and reads from a stream as a block of memory.
stream (wx.InputStream) –
size (int) –
int
ReadBlock (filename : str, size : int)
Allocates and reads from a file as a block of memory.
filename (string) –
size (int) –
int
ReadHex(self, stream : InputStream, length : int, imageType : BitmapType)¶Reads the data in hex from a stream.
stream (wx.InputStream) –
length (int) –
imageType (BitmapType) –
bool
SetData(self, image : int)¶image (int) –
None
SetDataSize(self, size : int)¶Sets the data size.
size (int) –
None
SetImageType(self, imageType : BitmapType)¶Sets the image type.
imageType (BitmapType) –
None
Write(self, filename : str)¶Writes the block to a file.
filename (string) –
bool
WriteBlock(*args, **kw)¶WriteBlock (stream : OutputStream, block : int, size : int)
Writes a memory block to stream.
stream (wx.OutputStream) –
block (int) –
size (int) –
bool
WriteBlock (filename : str, block : int, size : int)
Writes a memory block to a file.
filename (string) –
block (int) –
size (int) –
bool
WriteHex(self, stream : OutputStream)¶Writes the data in hex to a stream.
stream (wx.OutputStream) –
bool
DataSize¶See GetDataSize and SetDataSize
Extension¶See GetExtension
ImageType¶See GetImageType and SetImageType