anim.plane.image¶
- class anim.plane.image(file=None, array=None, flip=[False, False], colormap=<anim.colormap.colormap object>, Lx=None, Ly=None, dimension=None, center=[True, True], group=None, x=0, y=0, position=None, center_of_rotation=[0, 0], orientation=0, zvalue=0, draggable=False, clickable=False)¶
An image item is defined by its:
source image (numpy array or file)
colormap
dimensions (width and height)
position of the point of reference
- horizontal and vertical centering, with respect to the point of
reference. The defaut centering is (True,True), while (False,False) defines the reference as the bottom-left corner. One can also use a single value to set both at the same time.
flipping (vertical and horizontal)
Parameters ══════════
- name
str The image item’s name
- group
anim.plane.group default: None The image’s group. If None, the position of the reference point and center of rotation are in absolute coordinates. Otherwise, the position is relative to the group’s reference point.
─── image ───────────────────────────────────
- file
path The image file. The user should define either a file or an array.
- array
numpy array The image array. If 2D then it is assumed to be greyscale. If 3D, the 3 channels are RGB.
- flip
[boolean, boolean], (boolean, boolean) default: [False, False] Horizontal and vertical flipping of the image.
- colormap
Colormap object default: Colormap(‘grey’, ncolors=256) / RGB Image colormap.
─── dimensions ──────────────────────────────
- Lx
float The image width, i.e. length along the x axis when orientation is 0.
- Ly
float The image height, i.e.length along the y axis when orientation is 0.
- dimension
(float, float), [float, float], complex default: [0,0] Dimensions along the x and y axes when orientation is 0. The user must define either Lx, Ly or the dimension array. In case of conflicting definitions, the dimension attribute wins.
─── position ────────────────────────────────
- x
float default: 0 x-position of the reference point.
- y
float default: 0 y-position of the reference point.
- position
(float, float), [float, float], complex default: [0,0] Position of the reference point. The user can define either x, y or the position. In case of conflict, the position attribute wins.
- center
(bool, bool), [bool, bool], bool default: [True,True] Boolean Defining the centering around the reference point. For tuple and list the first element is for the x-axis and the second is for the y-axis.
─── transformations ─────────────────────────
- orientation
float default: 0, unit: radians Orientation of the image, with respect to the positive part of the x-axis.
- center_of_rotation
(float, float), [float, float], complex default: None Center point for the rotation.
- draggable
bool default: False Boolean specifying if the item can be dragged. If True, the dragging callback is defined in the ‘itemChange’ method of the event class, which is transfered to the canva’s ‘event’ method (recommended).
─── stack ───────────────────────────────────
- zvalue
float default: 0 Z-value (stack order) of the image.
- __init__(file=None, array=None, flip=[False, False], colormap=<anim.colormap.colormap object>, Lx=None, Ly=None, dimension=None, center=[True, True], group=None, x=0, y=0, position=None, center_of_rotation=[0, 0], orientation=0, zvalue=0, draggable=False, clickable=False)¶
Image constructor
Methods
__init__([file, array, flip, colormap, Lx, ...])Image constructor
initialize()Initialize the image
rotate(angle)Relative rotation
setGeometry()Set the image geometry
setOrientation()Set the qitem orientation
setPixmap()Set the pixmap
setPosition()Override
translate(dx[, dy])Relative translation
Attributes
LxLyarraycentercenter_of_rotationclickablecolormapdimensiondraggablefileflipgrouporientationpositionxyzvalue