Tekvel Magic
Loading...
Searching...
No Matches
Bitmap Class Reference

Bitmap graphics. More...

Public Member Functions

def __init__ (self, data=None)
 
def read_from_file (self, str filePath)
 Read Bitmap from file. More...
 
def read_from_bytes (self, bytes bindata)
 Read Bitmap from bytes. More...
 
def to_file (self, str filePath)
 Save Bitmap to file. More...
 
str get_data (self)
 Get binary representation of Bitmap data. More...
 

Detailed Description

Bitmap graphics.

This class provides a convenient interface for bitmap manipulations. It is used as interface by plotter functions as well as for image display dialogs, etc.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  data = None 
)

Member Function Documentation

◆ get_data()

str get_data (   self)

Get binary representation of Bitmap data.

Returns Base64-encoeded binary representation of an image as string.

◆ read_from_bytes()

def read_from_bytes (   self,
bytes  bindata 
)

Read Bitmap from bytes.

Parameters
bindatabytes-type binary representation of an image.

◆ read_from_file()

def read_from_file (   self,
str  filePath 
)

Read Bitmap from file.

Parameters
filePatha path to *.png or *.bmp file.

Reads data from bitmap file from provided path and stores in in the instance of the Bitmap.

bmp = Bitmap()
path = Dialog.open_file("Select BMP or PNG file", "*.bmp;*.BMP;*.png;*.PNG")
bnp.read_from_file(path)
See also
Dialog.open_file()

◆ to_file()

def to_file (   self,
str  filePath 
)

Save Bitmap to file.

Parameters
filePatha path where the *.png or *.bmp file to be saved.

Writes Bitmap data to bitmap file at provided path.