_eve – Low-level BridgeTek EVE bindings

The _eve module provides a class _EVE which contains methods for constructing EVE command buffers and appending basic graphics commands.

class _eve._EVE
register(self, o: object)
flush(self)

Send any queued drawing commands directly to the hardware.

Parameters:width (int) – The width of the grid in tiles, or 1 for sprites.
cc(self, b: ReadableBuffer)

Append bytes to the command FIFO.

Parameters:b (ReadableBuffer) – The bytes to add
AlphaFunc(self, func: int, ref: int)

Set the alpha test function

Parameters:
  • func (int) – specifies the test function, one of NEVER, LESS, LEQUAL, GREATER, GEQUAL, EQUAL, NOTEQUAL, or ALWAYS. Range 0-7. The initial value is ALWAYS(7)
  • ref (int) – specifies the reference value for the alpha test. Range 0-255. The initial value is 0

These values are part of the graphics context and are saved and restored by SaveContext() and RestoreContext().

Begin(self, prim: int)

Begin drawing a graphics primitive

Parameters:prim (int) – graphics primitive.

Valid primitives are BITMAPS, POINTS, LINES, LINE_STRIP, EDGE_STRIP_R, EDGE_STRIP_L, EDGE_STRIP_A, EDGE_STRIP_B and RECTS.

BitmapExtFormat(self, format: int)

Set the bitmap format

Parameters:format (int) – bitmap pixel format.
BitmapHandle(self, handle: int)

Set the bitmap handle

Parameters:handle (int) – bitmap handle. Range 0-31. The initial value is 0

This value is part of the graphics context and is saved and restored by SaveContext() and RestoreContext().

BitmapLayoutH(self, linestride: int, height: int)

Set the source bitmap memory format and layout for the current handle. high bits for large bitmaps

Parameters:
  • linestride (int) – high part of bitmap line stride, in bytes. Range 0-7
  • height (int) – high part of bitmap height, in lines. Range 0-3
BitmapLayout(self, format: int, linestride: int, height: int)

Set the source bitmap memory format and layout for the current handle

Parameters:
  • format (int) – bitmap pixel format, or GLFORMAT to use BITMAP_EXT_FORMAT instead. Range 0-31
  • linestride (int) – bitmap line stride, in bytes. Range 0-1023
  • height (int) – bitmap height, in lines. Range 0-511
BitmapSizeH(self, width: int, height: int)

Set the screen drawing of bitmaps for the current handle. high bits for large bitmaps

Parameters:
  • width (int) – high part of drawn bitmap width, in pixels. Range 0-3
  • height (int) – high part of drawn bitmap height, in pixels. Range 0-3
BitmapSize(self, filter: int, wrapx: int, wrapy: int, width: int, height: int)

Set the screen drawing of bitmaps for the current handle

Parameters:
  • filter (int) – bitmap filtering mode, one of NEAREST or BILINEAR. Range 0-1
  • wrapx (int) – bitmap \(x\) wrap mode, one of REPEAT or BORDER. Range 0-1
  • wrapy (int) – bitmap \(y\) wrap mode, one of REPEAT or BORDER. Range 0-1
  • width (int) – drawn bitmap width, in pixels. Range 0-511
  • height (int) – drawn bitmap height, in pixels. Range 0-511
BitmapSource(self, addr: int)

Set the source address for bitmap graphics

Parameters:addr (int) – Bitmap start address, pixel-aligned. May be in SRAM or flash. Range 0-16777215
BitmapSwizzle(self, r: int, g: int, b: int, a: int)

Set the source for the r,g,b and a channels of a bitmap

Parameters:
  • r (int) – red component source channel. Range 0-7
  • g (int) – green component source channel. Range 0-7
  • b (int) – blue component source channel. Range 0-7
  • a (int) – alpha component source channel. Range 0-7
BitmapTransformA(self, p: int, v: int)

Set the \(a\) component of the bitmap transform matrix

Parameters:
  • p (int) – precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
  • v (int) – The \(a\) component of the bitmap transform matrix, in signed 8.8 or 1.15 bit fixed-point form. Range 0-131071. The initial value is 256

The initial value is p = 0, v = 256. This represents the value 1.0.

These values are part of the graphics context and are saved and restored by SaveContext() and RestoreContext().

BitmapTransformB(self, p: int, v: int)

Set the \(b\) component of the bitmap transform matrix

Parameters:
  • p (int) – precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
  • v (int) – The \(b\) component of the bitmap transform matrix, in signed 8.8 or 1.15 bit fixed-point form. Range 0-131071. The initial value is 0

The initial value is p = 0, v = 0. This represents the value 0.0.

These values are part of the graphics context and are saved and restored by SaveContext() and RestoreContext().

BitmapTransformC(self, v: int)

Set the \(c\) component of the bitmap transform matrix

Parameters:v (int) – The \(c\) component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0

This value is part of the graphics context and is saved and restored by SaveContext() and RestoreContext().

BitmapTransformD(self, p: int, v: int)

Set the \(d\) component of the bitmap transform matrix

Parameters:
  • p (int) – precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
  • v (int) – The \(d\) component of the bitmap transform matrix, in signed 8.8 or 1.15 bit fixed-point form. Range 0-131071. The initial value is 0

The initial value is p = 0, v = 0. This represents the value 0.0.

These values are part of the graphics context and are saved and restored by SaveContext() and RestoreContext().

BitmapTransformE(self, p: int, v: int)

Set the \(e\) component of the bitmap transform matrix

Parameters:
  • p (int) – precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
  • v (int) – The \(e\) component of the bitmap transform matrix, in signed 8.8 or 1.15 bit fixed-point form. Range 0-131071. The initial value is 256

The initial value is p = 0, v = 256. This represents the value 1.0.

These values are part of the graphics context and are saved and restored by SaveContext() and RestoreContext().

BitmapTransformF(self, v: int)

Set the \(f\) component of the bitmap transform matrix

Parameters:v (int) – The \(f\) component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0

This value is part of the graphics context and is saved and restored by SaveContext() and RestoreContext().

BlendFunc(self, src: int, dst: int)

Set pixel arithmetic

Parameters:
  • src (int) – specifies how the source blending factor is computed. One of ZERO, ONE, SRC_ALPHA, DST_ALPHA, ONE_MINUS_SRC_ALPHA or ONE_MINUS_DST_ALPHA. Range 0-7. The initial value is SRC_ALPHA(2)
  • dst (int) – specifies how the destination blending factor is computed, one of the same constants as src. Range 0-7. The initial value is ONE_MINUS_SRC_ALPHA(4)

These values are part of the graphics context and are saved and restored by SaveContext() and RestoreContext().

Call(self, dest: int)

Execute a sequence of commands at another location in the display list

Parameters:dest (int) – display list address. Range 0-65535
Cell(self, cell: int)

Set the bitmap cell number for the vertex2f command

Parameters:cell (int) – bitmap cell number. Range 0-127. The initial value is 0

This value is part of the graphics context and is saved and restored by SaveContext() and RestoreContext().

ClearColorA(self, alpha: int)

Set clear value for the alpha channel

Parameters:alpha (int) – alpha value used when the color buffer is cleared. Range 0-255. The initial value is 0

This value is part of the graphics context and is saved and restored by SaveContext() and RestoreContext().

ClearColorRGB(self, red: int, green: int, blue: int)

Set clear values for red, green and blue channels

Parameters:
  • red (int) – red value used when the color buffer is cleared. Range 0-255. The initial value is 0
  • green (int) – green value used when the color buffer is cleared. Range 0-255. The initial value is 0
  • blue (int) – blue value used when the color buffer is cleared. Range 0-255. The initial value is 0

These values are part of the graphics context and are saved and restored by SaveContext() and RestoreContext().

Clear(self, c: int, s: int, t: int)

Clear buffers to preset values

Parameters:
  • c (int) – clear color buffer. Range 0-1
  • s (int) – clear stencil buffer. Range 0-1
  • t (int) – clear tag buffer. Range 0-1
ClearStencil(self, s: int)

Set clear value for the stencil buffer

Parameters:s (int) – value used when the stencil buffer is cleared. Range 0-255. The initial value is 0

This value is part of the graphics context and is saved and restored by SaveContext() and RestoreContext().

ClearTag(self, s: int)

Set clear value for the tag buffer

Parameters:s (int) – value used when the tag buffer is cleared. Range 0-255. The initial value is 0

This value is part of the graphics context and is saved and restored by SaveContext() and RestoreContext().

ColorA(self, alpha: int)

Set the current color alpha

Parameters:alpha (int) – alpha for the current color. Range 0-255. The initial value is 255

This value is part of the graphics context and is saved and restored by SaveContext() and RestoreContext().

ColorMask(self, r: int, g: int, b: int, a: int)

Enable and disable writing of frame buffer color components

Parameters:
  • r (int) – allow updates to the frame buffer red component. Range 0-1. The initial value is 1
  • g (int) – allow updates to the frame buffer green component. Range 0-1. The initial value is 1
  • b (int) – allow updates to the frame buffer blue component. Range 0-1. The initial value is 1
  • a (int) – allow updates to the frame buffer alpha component. Range 0-1. The initial value is 1

These values are part of the graphics context and are saved and restored by SaveContext() and RestoreContext().

ColorRGB(self, red: int, green: int, blue: int)

Set the drawing color

Parameters:
  • red (int) – red value for the current color. Range 0-255. The initial value is 255
  • green (int) – green for the current color. Range 0-255. The initial value is 255
  • blue (int) – blue for the current color. Range 0-255. The initial value is 255

These values are part of the graphics context and are saved and restored by SaveContext() and RestoreContext().

Display(self)

End the display list

End(self)

End drawing a graphics primitive

Vertex2ii() and Vertex2f() calls are ignored until the next Begin().

Jump(self, dest: int)

Execute commands at another location in the display list

Parameters:dest (int) – display list address. Range 0-65535
LineWidth(self, width: int)

Set the width of rasterized lines

Parameters:width (int) – line width in \(1/16\) pixel. Range 0-4095. The initial value is 16

This value is part of the graphics context and is saved and restored by SaveContext() and RestoreContext().

Macro(self, m: int)

Execute a single command from a macro register

Parameters:m (int) – macro register to read. Range 0-1
Nop(self)

No operation

PaletteSource(self, addr: int)

Set the base address of the palette

Parameters:addr (int) – Address in graphics SRAM, 2-byte aligned. Range 0-4194303. The initial value is 0

This value is part of the graphics context and is saved and restored by SaveContext() and RestoreContext().

PointSize(self, size: int)

Set the radius of rasterized points

Parameters:size (int) – point radius in \(1/16\) pixel. Range 0-8191. The initial value is 16

This value is part of the graphics context and is saved and restored by SaveContext() and RestoreContext().

RestoreContext(self)

Restore the current graphics context from the context stack

Return(self)

Return from a previous call command

SaveContext(self)

Push the current graphics context on the context stack

ScissorSize(self, width: int, height: int)

Set the size of the scissor clip rectangle

Parameters:
  • width (int) – The width of the scissor clip rectangle, in pixels. Range 0-4095. The initial value is hsize
  • height (int) – The height of the scissor clip rectangle, in pixels. Range 0-4095. The initial value is 2048

These values are part of the graphics context and are saved and restored by SaveContext() and RestoreContext().

ScissorXY(self, x: int, y: int)

Set the top left corner of the scissor clip rectangle

Parameters:
  • x (int) – The \(x\) coordinate of the scissor clip rectangle, in pixels. Range 0-2047. The initial value is 0
  • y (int) – The \(y\) coordinate of the scissor clip rectangle, in pixels. Range 0-2047. The initial value is 0

These values are part of the graphics context and are saved and restored by SaveContext() and RestoreContext().

StencilFunc(self, func: int, ref: int, mask: int)

Set function and reference value for stencil testing

Parameters:
  • func (int) – specifies the test function, one of NEVER, LESS, LEQUAL, GREATER, GEQUAL, EQUAL, NOTEQUAL, or ALWAYS. Range 0-7. The initial value is ALWAYS(7)
  • ref (int) – specifies the reference value for the stencil test. Range 0-255. The initial value is 0
  • mask (int) – specifies a mask that is ANDed with the reference value and the stored stencil value. Range 0-255. The initial value is 255

These values are part of the graphics context and are saved and restored by SaveContext() and RestoreContext().

StencilMask(self, mask: int)

Control the writing of individual bits in the stencil planes

Parameters:mask (int) – the mask used to enable writing stencil bits. Range 0-255. The initial value is 255

This value is part of the graphics context and is saved and restored by SaveContext() and RestoreContext().

StencilOp(self, sfail: int, spass: int)

Set stencil test actions

Parameters:
  • sfail (int) – specifies the action to take when the stencil test fails, one of KEEP, ZERO, REPLACE, INCR, INCR_WRAP, DECR, DECR_WRAP, and INVERT. Range 0-7. The initial value is KEEP(1)
  • spass (int) – specifies the action to take when the stencil test passes, one of the same constants as sfail. Range 0-7. The initial value is KEEP(1)

These values are part of the graphics context and are saved and restored by SaveContext() and RestoreContext().

TagMask(self, mask: int)

Control the writing of the tag buffer

Parameters:mask (int) – allow updates to the tag buffer. Range 0-1. The initial value is 1

This value is part of the graphics context and is saved and restored by SaveContext() and RestoreContext().

Tag(self, s: int)

Set the current tag value

Parameters:s (int) – tag value. Range 0-255. The initial value is 255

This value is part of the graphics context and is saved and restored by SaveContext() and RestoreContext().

VertexTranslateX(self, x: int)

Set the vertex transformation’s x translation component

Parameters:x (int) – signed x-coordinate in \(1/16\) pixel. Range 0-131071. The initial value is 0

This value is part of the graphics context and is saved and restored by SaveContext() and RestoreContext().

VertexTranslateY(self, y: int)

Set the vertex transformation’s y translation component

Parameters:y (int) – signed y-coordinate in \(1/16\) pixel. Range 0-131071. The initial value is 0

This value is part of the graphics context and is saved and restored by SaveContext() and RestoreContext().

VertexFormat(self, frac: int)

Set the precision of vertex2f coordinates

Parameters:frac (int) – Number of fractional bits in X,Y coordinates, 0-4. Range 0-7. The initial value is 4

This value is part of the graphics context and is saved and restored by SaveContext() and RestoreContext().

Vertex2ii(self, x: int, y: int, handle: int, cell: int)
Parameters:
  • x (int) – x-coordinate in pixels. Range 0-511
  • y (int) – y-coordinate in pixels. Range 0-511
  • handle (int) – bitmap handle. Range 0-31
  • cell (int) – cell number. Range 0-127

This method is an alternative to Vertex2f().

Vertex2f(self, b: float)

Draw a point.

Parameters:
  • x (float) – pixel x-coordinate
  • y (float) – pixel y-coordinate
cmd0(self, n: int)

Append the command word n to the FIFO

Parameters:n (int) – The command code

This method is used by the eve module to efficiently add commands to the FIFO.

cmd(self, n: int, fmt: str, args: Tuple[str, ...])

Append a command packet to the FIFO.

Parameters:
  • n (int) – The command code
  • fmt (str) – The command format struct layout
  • args (tuple(str, ..)) – The command’s arguments

Supported format codes: h, H, i, I.

This method is used by the eve module to efficiently add commands to the FIFO.