Phoenix Logo

phoenix_title wx.richtext.RichTextImageBlock

This class stores information about an image, in binary in-memory form.


class_hierarchy Class Hierarchy

Inheritance diagram for class RichTextImageBlock:

method_summary Methods Summary

__init__ Constructor.
Clear Clears the block.
Copy Copy from block.
DoMakeImageBlock Makes the image block.
GetData Returns the raw data.
GetDataSize Returns the data size in bytes.
GetExtension Gets the extension for the block’s type.
GetImageType Returns the image type.
Init Initialises the block.
IsOk Returns True if the data is not None.
Load  
MakeImageBlock Load the original image into a memory block.
MakeImageBlockDefaultQuality Uses a wx.Image for efficiency, but can’t set quality (only relevant for JPEG)
Ok  
ReadBlock Implementation.
ReadHex Reads the data in hex from a stream.
SetData  
SetDataSize Sets the data size.
SetImageType Sets the image type.
Write Writes the block to a file.
WriteBlock Writes a memory block to stream.
WriteHex Writes the data in hex to a stream.

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.


Methods



__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self)

Constructor.



__init__ (self, block)

Copy constructor.

Parameters:block (wx.richtext.RichTextImageBlock) –





Clear(self)

Clears the block.



Copy(self, block)

Copy from block.

Parameters:block (wx.richtext.RichTextImageBlock) –


DoMakeImageBlock(self, image, imageType)

Makes the image block.

Parameters:
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:string


GetImageType(self)

Returns the image type.

Return type: wx.BitmapType


Init(self)

Initialises the block.



IsOk(self)

Returns True if the data is not None.

Return type:bool


Load(self, image)
Parameters:image (wx.Image) –
Return type:bool


MakeImageBlock(self, *args, **kw)

overload Overloaded Implementations:



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.

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:
Return type:

bool





MakeImageBlockDefaultQuality(self, image, imageType)

Uses a wx.Image for efficiency, but can’t set quality (only relevant for JPEG)

Parameters:
Return type:

bool



Ok(self)
Return type:bool


static ReadBlock(*args, **kw)

overload Overloaded Implementations:



ReadBlock (stream, size)

Implementation.

Allocates and reads from a stream as a block of memory.

Parameters:
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:
Return type:

bool



SetData(self, image)
Parameters:image (int) –


SetDataSize(self, size)

Sets the data size.

Parameters:size (int) –


SetImageType(self, imageType)

Sets the image type.

Parameters:imageType (BitmapType) –


Write(self, filename)

Writes the block to a file.

Parameters:filename (string) –
Return type:bool


static WriteBlock(*args, **kw)

overload Overloaded Implementations:



WriteBlock (stream, block, size)

Writes a memory block to stream.

Parameters:
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



Data

See GetData and SetData



DataSize

See GetDataSize and SetDataSize



Extension

See GetExtension



ImageType

See GetImageType and SetImageType