qgym.utils.visualisation.typing module

This module contains types and type aliases used during visualisation.

class qgym.utils.visualisation.typing.Font(file_path=None, size=12)
class qgym.utils.visualisation.typing.Font(file_path, size) Font
class qgym.utils.visualisation.typing.Font(pathlib.Path, size) Font
class qgym.utils.visualisation.typing.Font(object, size) Font

Bases: object

create a new Font object from a file

bold

bold -> bool Gets or sets whether the font should be rendered in (faked) bold.

get_ascent() int

get the ascent of the font

get_bold() bool

check if text will be rendered bold

get_descent() int

get the descent of the font

get_height() int

get the height of the font

get_italic() bool

check if the text will be rendered italic

get_linesize() int

get the line space of the font text

get_strikethrough() bool

check if text will be rendered with a strikethrough

get_underline() bool

check if text will be rendered with an underline

italic

italic -> bool Gets or sets whether the font should be rendered in (faked) italics.

metrics(text) list

gets the metrics for each character in the passed string

render(text, antialias, color, background=None) Surface

draw text on a new Surface

set_bold(bool) None

enable fake rendering of bold text

set_italic(bool) None

enable fake rendering of italic text

set_script(str) None

set the script code for text shaping

set_strikethrough(bool) None

control if text is rendered with a strikethrough

set_underline(bool) None

control if text is rendered with an underline

size(text)

determine the amount of space needed to render text

strikethrough

strikethrough -> bool Gets or sets whether the font should be rendered with a strikethrough.

underline

underline -> bool Gets or sets whether the font should be rendered with an underline.

class qgym.utils.visualisation.typing.Surface((width, height), flags=0, depth=0, masks=None)
class qgym.utils.visualisation.typing.Surface((width, height), flags=0, Surface) Surface

Bases: object

pygame object for representing images

blit(source, dest, area=None, special_flags=0) Rect

draw one image onto another

blits(blit_sequence=((source, dest), ...), doreturn=1) [Rect, ...] or None
blits(((source, dest, area), ...)) [Rect, ...]
blits(((source, dest, area, special_flags), ...)) [Rect, ...]

draw many images onto another

convert(Surface=None) Surface
convert(depth, flags=0) Surface
convert(masks, flags=0) Surface

change the pixel format of an image

convert_alpha(Surface) Surface
convert_alpha() Surface

change the pixel format of an image including per pixel alphas

copy() Surface

create a new copy of a Surface

fill(color, rect=None, special_flags=0) Rect

fill Surface with a solid color

get_abs_offset()

find the absolute position of a child subsurface inside its top level parent

get_abs_parent() Surface

find the top level parent of a subsurface

get_alpha() int_value

get the current Surface transparency value

get_at((x, y)) Color

get the color value at a single pixel

get_at_mapped((x, y)) Color

get the mapped color value at a single pixel

get_bitsize() int

get the bit depth of the Surface pixel format

get_blendmode()

Return the surface’s SDL 2 blend mode

get_bounding_rect(min_alpha=1) Rect

find the smallest rect containing data

get_buffer() BufferProxy

acquires a buffer object for the pixels of the Surface.

get_bytesize() int

get the bytes used per Surface pixel

get_clip() Rect

get the current clipping area of the Surface

get_colorkey() RGB or None

Get the current transparent colorkey

get_flags() int

get the additional flags used for the Surface

get_height() height

get the height of the Surface

get_locked() bool

test if the Surface is current locked

get_locks() tuple

Gets the locks for the Surface

get_losses()

the significant bits used to convert between a color and a mapped integer

get_masks()

the bitmasks needed to convert between a color and a mapped integer

get_offset()

find the position of a child subsurface inside a parent

get_palette() [RGB, RGB, RGB, ...]

get the color index palette for an 8-bit Surface

get_palette_at(index) RGB

get the color for a single entry in a palette

get_parent() Surface

find the parent of a subsurface

get_pitch() int

get the number of bytes used per Surface row

get_rect(**kwargs) Rect

get the rectangular area of the Surface

get_shifts()

the bit shifts needed to convert between a color and a mapped integer

get_size()

get the dimensions of the Surface

get_view(<kind>='2') BufferProxy

return a buffer view of the Surface’s pixels.

get_width() width

get the width of the Surface

lock() None

lock the Surface memory for pixel access

map_rgb(Color) mapped_int

convert a color into a mapped color value

mustlock() bool

test if the Surface requires locking

premul_alpha() Surface

returns a copy of the surface with the RGB channels pre-multiplied by the alpha channel.

scroll(dx=0, dy=0) None

Shift the surface image in place

set_alpha(value, flags=0) None
set_alpha(None) None

set the alpha value for the full Surface image

set_at((x, y), Color) None

set the color value for a single pixel

set_clip(rect) None
set_clip(None) None

set the current clipping area of the Surface

set_colorkey(Color, flags=0) None
set_colorkey(None) None

Set the transparent colorkey

set_masks((r, g, b, a)) None

set the bitmasks needed to convert between a color and a mapped integer

set_palette([RGB, RGB, RGB, ...]) None

set the color palette for an 8-bit Surface

set_palette_at(index, RGB) None

set the color for a single index in an 8-bit Surface palette

set_shifts((r, g, b, a)) None

sets the bit shifts needed to convert between a color and a mapped integer

subsurface(Rect) Surface

create a new surface that references its parent

unlock() None

unlock the Surface memory from pixel access

unmap_rgb(mapped_int) Color

convert a mapped integer color value into a Color