expyfun.visual.RawImage#
- class expyfun.visual.RawImage(ec, image_buffer, pos=(0, 0), scale=1.0, units='norm')[source]#
Create image from array for on-screen display.
- Parameters:
- ecinstance of ExperimentController
Parent EC.
- image_bufferarray
Array, shape (N, M[, 3/4]). Color values should range between 0 and 1.
- posarray-like
2-element array-like with X, Y (center) arguments.
- scalefloat
The scale factor. 1 is native size (pixel-to-pixel), 2 is twice as large, etc.
- unitsstr
Units to use for the position. See
check_units
for options.
- Attributes:
bounds
Left, Right, Bottom, Top (in pixels) of the image.
- scale
Methods
draw
()Draw the image to the buffer
get_rect
([units])X, Y center, Width, Height of image.
set_image
(image_buffer)Set image buffer data
set_pos
(pos[, units])Set image position.
set_scale
(scale)Create image from array for on-screen display.
- Returns:
- imginstance of RawImage
The image object.
- property bounds#
Left, Right, Bottom, Top (in pixels) of the image.
- get_rect(units='norm')[source]#
X, Y center, Width, Height of image.
- Parameters:
- unitsstr
Units to use for the position. See
check_units
for options.
- Returns:
- rectndarray
The rect.
- set_image(image_buffer)[source]#
Set image buffer data
- Parameters:
- image_bufferarray
N x M x 3 (or 4) array. Can be type
np.float64
ornp.uint8
. Ifnp.float64
, color values must range between 0 and 1.np.uint8
is slightly more efficient.