wx.richtext.RichTextImageBlock¶
This class stores information about an image, in binary in-memory form.
Class Hierarchy¶
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¶
- class wx.richtext.RichTextImageBlock(Object)¶
Possible constructors:
RichTextImageBlock() -> None RichTextImageBlock(block) -> None
This class stores information about an image, in binary in-memory form.
Methods¶
- __init__(self, *args, **kw)¶
-
__init__ (self)
Constructor.
- Return type:
None
__init__ (self, block)
Copy constructor.
- Parameters:
block (wx.richtext.RichTextImageBlock)
- Return type:
None
- Clear(self)¶
Clears the block.
- Return type:
None
- Copy(self, block)¶
Copy from block.
- Parameters:
block (wx.richtext.RichTextImageBlock)
- Return type:
None
- DoMakeImageBlock(self, image, imageType)¶
Makes the image block.
- Parameters:
image (wx.Image)
imageType (BitmapType)
- Return type:
bool
- GetData(self)¶
Returns the raw data.
- Return type:
int
- GetDataSize(self)¶
Returns the data size in bytes.
- Return type:
int
- GetExtension(self)¶
Gets the extension for the block’s type.
- Return type:
str
- GetImageType(self)¶
Returns the image type.
- Return type:
BitmapType
- Init(self)¶
Initialises the block.
- Return type:
None
- IsOk(self)¶
Returns
True
if the data is notNone
.- Return type:
bool
- MakeImageBlock(self, *args, **kw)¶
-
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 aJPEG
to conserve space. If it’s not aJPEG
we can make use of image, already scaled, so we don’t have to load the image a second time.- Parameters:
filename (string)
imageType (BitmapType)
image (wx.Image)
convertToJPEG (bool)
- Return type:
bool
MakeImageBlock (self, image, imageType, quality=80)
Make an image block from the wx.Image in the given format.
- Parameters:
image (wx.Image)
imageType (BitmapType)
quality (int)
- Return type:
bool
- MakeImageBlockDefaultQuality(self, image, imageType)¶
Uses a wx.Image for efficiency, but can’t set quality (only relevant for
JPEG
)- Parameters:
image (wx.Image)
imageType (BitmapType)
- Return type:
bool
- Ok(self)¶
- Return type:
bool
- static ReadBlock(*args, **kw)¶
-
ReadBlock (stream, size)
Implementation.
Allocates and reads from a stream as a block of memory.
- Parameters:
stream (wx.InputStream)
size (int)
- Return type:
int
ReadBlock (filename, size)
Allocates and reads from a file as a block of memory.
- Parameters:
filename (string)
size (int)
- Return type:
int
- ReadHex(self, stream, length, imageType)¶
Reads the data in hex from a stream.
- Parameters:
stream (wx.InputStream)
length (int)
imageType (BitmapType)
- Return type:
bool
- SetData(self, image)¶
- Parameters:
image (int)
- Return type:
None
- SetDataSize(self, size)¶
Sets the data size.
- Parameters:
size (int)
- Return type:
None
- SetImageType(self, imageType)¶
Sets the image type.
- Parameters:
imageType (BitmapType)
- Return type:
None
- Write(self, filename)¶
Writes the block to a file.
- Parameters:
filename (string)
- Return type:
bool
- static WriteBlock(*args, **kw)¶
-
WriteBlock (stream, block, size)
Writes a memory block to stream.
- Parameters:
stream (wx.OutputStream)
block (int)
size (int)
- Return type:
bool
WriteBlock (filename, block, size)
Writes a memory block to a file.
- Parameters:
filename (string)
block (int)
size (int)
- Return type:
bool
- WriteHex(self, stream)¶
Writes the data in hex to a stream.
- Parameters:
stream (wx.OutputStream)
- Return type:
bool
Properties¶
- DataSize¶
See
GetDataSize
andSetDataSize
- Extension¶
See
GetExtension
- ImageType¶
See
GetImageType
andSetImageType