scistag.imagestag.anchor2d.Anchor2D¶
- class Anchor2D(value)[source]¶
Bases:
IntEnumDefines how an origin (such as a position) is interpreted when a shape such as a rectangle, a circle or a multi-line text is painted just given a position and a size is painted.
Methods
Gets the anchor caused position shifting at given object size
Adjusts the position by the amount of pixels this anchor will shift the painting origin of the position caused through this anchor.
Attributes
The origin is the shape's top left edge - everything is painted to the right and bottom of it.
The origin is the shape's top center edge - everything is painted equally to the left and right of it and to the bottom.
The origin is the shape's top right edge - everything is painted to the left and the bottom of it.
The origin is the shape's center left edge - everything is painted equally to the top and bottom of it and to the right.
The origin is the shape's center - everything is painted equally to the left, right, top and bottom of it.
The origin is the shape's center right - everything is painted equally to the top and bottom of it to the right.
The origin is the shape's bottom left - everything is painted to the right and to the top of it.
The origin is the shape's bottom center - everything is painted equally to the left and right of it to the top.
The origin is the shape's bottom right - everything is painted to the left and top of it.
__doc____members____module__- classmethod _missing_(value)[source]¶
Initializes an anchor using a string
- Parameters
value (Anchor2D | str) – The integer enum value or an alternative string shortcode representation. Valid values are: - “tl” / “topLeft” - TOP_LEFT - “t” /”top” - TOP (center) - “tr” / “topRight” - TOP_RIGHT - “cl” / “centerLeft” - CENTER_LEFT - “c” / “center” - CENTER (horizontally and vertically) - “cr” / “centerRight” - CENTER_RIGHT - “bl” / “bottomLeft” - BOTTOM_LEFT - “b” / “bottom” - BOTTOM (center) - “br” / “bottomRight” - BOTTOM_RIGHT
- Returns
The Anchor2D enum value
- get_position_shift(size)[source]¶
Gets the anchor caused position shifting at given object size
E.g. a LEFT_TOP anchor will never modify the position at all, a CENTER anchor will be the position by half of size.width to the left and half of size.height to the right etc. so the painted object will be centered around the (original) pos effectively when being painted at the now (modified) pos.
- shift_position(pos, size, round_shift=False)[source]¶
Adjusts the position by the amount of pixels this anchor will shift the painting origin of the position caused through this anchor.
E.g. a LEFT_TOP anchor will never modify the position at all, a CENTER anchor will be the position by half of size.width to the left and half of size.height to the right etc. so the painted object will be centered around the (original) pos effectively when being painted at the now (modified) pos.
- BOTTOM = 7¶
The origin is the shape’s bottom center - everything is painted equally to the left and right of it to the top.
- BOTTOM_LEFT = 6¶
The origin is the shape’s bottom left - everything is painted to the right and to the top of it.
- BOTTOM_RIGHT = 8¶
The origin is the shape’s bottom right - everything is painted to the left and top of it.
- CENTER = 4¶
The origin is the shape’s center - everything is painted equally to the left, right, top and bottom of it.
- CENTER_LEFT = 3¶
The origin is the shape’s center left edge - everything is painted equally to the top and bottom of it and to the right.
- CENTER_RIGHT = 5¶
The origin is the shape’s center right - everything is painted equally to the top and bottom of it to the right.
- TOP = 1¶
The origin is the shape’s top center edge - everything is painted equally to the left and right of it and to the bottom.
- TOP_LEFT = 0¶
The origin is the shape’s top left edge - everything is painted to the right and bottom of it.
- TOP_RIGHT = 2¶
The origin is the shape’s top right edge - everything is painted to the left and the bottom of it.