This class stores information about an image, in binary in-memory form.
See also
wx.richtext.RichTextBuffer, wx.richtext.RichTextCtrl
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. |
See |
|
See |
|
See |
wx.richtext.
RichTextImageBlock
(Object)¶Possible constructors:
RichTextImageBlock()
RichTextImageBlock(block)
This class stores information about an image, in binary in-memory form.
__init__
(self, *args, **kw)¶__init__ (self)
Constructor.
__init__ (self, block)
Copy constructor.
block (wx.richtext.RichTextImageBlock) –
Clear
(self)¶Clears the block.
Copy
(self, block)¶Copy from block.
block (wx.richtext.RichTextImageBlock) –
DoMakeImageBlock
(self, image, imageType)¶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.
string
GetImageType
(self)¶Returns the image type.
Init
(self)¶Initialises the block.
IsOk
(self)¶Returns True
if the data is not None
.
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 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, imageType, quality=80)
Make an image block from the wx.Image in the given format.
image (wx.Image) –
imageType (BitmapType) –
quality (int) –
bool
MakeImageBlockDefaultQuality
(self, image, imageType)¶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, size)
Implementation.
Allocates and reads from a stream as a block of memory.
stream (wx.InputStream) –
size (int) –
int
ReadBlock (filename, size)
Allocates and reads from a file as a block of memory.
filename (string) –
size (int) –
int
ReadHex
(self, stream, length, imageType)¶Reads the data in hex from a stream.
stream (wx.InputStream) –
length (int) –
imageType (BitmapType) –
bool
SetData
(self, image)¶image (int) –
SetDataSize
(self, size)¶Sets the data size.
size (int) –
SetImageType
(self, imageType)¶Sets the image type.
imageType (BitmapType) –
Write
(self, filename)¶Writes the block to a file.
filename (string) –
bool
WriteBlock
(*args, **kw)¶WriteBlock (stream, block, size)
Writes a memory block to stream.
stream (wx.OutputStream) –
block (int) –
size (int) –
bool
WriteBlock (filename, block, size)
Writes a memory block to a file.
filename (string) –
block (int) –
size (int) –
bool
WriteHex
(self, stream)¶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