IDS peak ICV v1.3.0
Loading...
Searching...
No Matches
opacity.py
Go to the documentation of this file.
1from __future__ import annotations
2
3from ids_peak_icv.exceptions import OutOfRangeException
4
5
6class Opacity:
7 """!
8 @brief
9 Class representing opacity for painting operations. Opacity indicates how much the underlying layer is hidden.
10
11 A value of 100 means that the underlying layer is completely hidden. On the other hand, 0 means that the layer is
12 completely visible.
13
14 @ingroup ids_peak_icv_python_painting
15 @since ids_peak_icv 1.1
16 """
17 MINIMUM = 0
18 MAXIMUM = 100
19
20 def __init__(self, value: int = MAXIMUM) -> None:
21 """!
22 @brief
23 Creates an Opacity object with a default value of 100.
24
25 @param value: (int, optional) Value of the Opacity. Defaults to maximum.
26
27 @exception OutOfRangeException: If the opacity value is not within the valid range.
28
29 @since ids_peak_icv 1.1
30 """
31 if not self.MINIMUM <= value <= self.MAXIMUM:
32 raise OutOfRangeException(f"Opacity value must be between {self.MINIMUM} and {self.MAXIMUM}")
33 self._value = value
34
35 @property
36 def value(self) -> int:
37 """!
38 @brief
39 Retrieve the current opacity.
40
41 @return The current opacity value.
42
43 @since ids_peak_icv 1.1
44 """
45 return self._value
46
47 def __eq__(self, other: object) -> bool:
48 """!
49 @brief
50 Check if the Opacity object is equal to a given value.
51
52 @param other: Value to compare with.
53
54 @return True if equal, False otherwise.
55
56 @since ids_peak_icv 1.1
57 """
58 if not isinstance(other, Opacity):
59 return False
60
61 return self._value == other
Occurs when a provided value falls outside the allowed valid range.
Definition exceptions.py:87
Class representing opacity for painting operations.
Definition opacity.py:6
bool __eq__(self, object other)
Check if the Opacity object is equal to a given value.
Definition opacity.py:47
None __init__(self, int value=MAXIMUM)
Creates an Opacity object with a default value of 100.
Definition opacity.py:20
int value(self)
Retrieve the current opacity.
Definition opacity.py:36