|
2 | 2 | """ |
3 | 3 | from __future__ import annotations |
4 | 4 |
|
5 | | -import warnings |
6 | | - |
7 | | -from deprecation import deprecated |
8 | 5 | from PIL import Image |
9 | 6 |
|
10 | 7 |
|
11 | | -@deprecated(deprecated_in="2021.1", removed_in="", details="use renderWAlphaOffset") |
12 | | -def rasterImageOA( # pylint:disable=missing-function-docstring |
13 | | - image: Image.Image, size: tuple[int, int], alpha: float = 1.0, offsets: tuple[int, int] = (0, 0) |
14 | | -) -> Image.Image: |
15 | | - warnings.warn( |
16 | | - "Call to deprecated function rasterImageOA.", category=DeprecationWarning, stacklevel=2 |
17 | | - ) |
18 | | - return renderWAlphaOffset(image, size, alpha, offsets) |
19 | | - |
20 | | - |
21 | | -@deprecated(deprecated_in="2021.1", removed_in="", details="use renderWAlphaOffset") |
22 | | -def rasterImageOffset( # pylint:disable=missing-function-docstring |
23 | | - image: Image.Image, size: tuple[int, int], offsets: tuple[int, int] = (0, 0) |
24 | | -) -> Image.Image: |
25 | | - warnings.warn( |
26 | | - "Call to deprecated function rasterImageOffset.", category=DeprecationWarning, stacklevel=2 |
27 | | - ) |
28 | | - return renderWAlphaOffset(image, size, 1, offsets) |
29 | | - |
30 | | - |
31 | 8 | def renderWAlphaOffset( |
32 | 9 | image: Image.Image, size: tuple[int, int], alpha: float = 1.0, offsets: tuple[int, int] = (0, 0) |
33 | 10 | ) -> Image.Image: |
34 | 11 | """Render an image with offset and alpha to a given size. |
35 | 12 |
|
36 | 13 | Args: |
| 14 | + ---- |
37 | 15 | image (Image.Image): pil image to draw |
38 | 16 | size (tuple[int, int]): width, height as a tuple |
39 | 17 | alpha (float, optional): alpha transparency. Defaults to 1.0. |
40 | 18 | offsets (tuple[int, int], optional): x, y offsets as a tuple. |
41 | 19 | Defaults to (0, 0). |
42 | 20 |
|
43 | 21 | Returns: |
| 22 | + ------- |
44 | 23 | Image.Image: new image |
45 | 24 | """ |
46 | 25 | imageOffset = Image.new("RGBA", size) |
|
0 commit comments