Skip to content

Commit 1e9f27d

Browse files
authored
Merge pull request #1 from hx2A/release0821
release 0.8.2a1
2 parents 0dbe0ca + 095c3be commit 1e9f27d

File tree

21 files changed

+1642
-1476
lines changed

21 files changed

+1642
-1476
lines changed

py5/__init__.py

Lines changed: 1328 additions & 1249 deletions
Large diffs are not rendered by default.

py5/graphics.py

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -894,52 +894,52 @@ def apply_matrix(self, n00: float, n01: float, n02: float,
894894
----------
895895

896896
n00: float
897-
numbers which define the 4x4 matrix to be multiplied
897+
numeric value in row 0 and column 0 of the matrix
898898

899899
n01: float
900-
numbers which define the 4x4 matrix to be multiplied
900+
numeric value in row 0 and column 1 of the matrix
901901

902902
n02: float
903-
numbers which define the 4x4 matrix to be multiplied
903+
numeric value in row 0 and column 2 of the matrix
904904

905905
n03: float
906-
numbers which define the 4x4 matrix to be multiplied
906+
numeric value in row 0 and column 3 of the matrix
907907

908908
n10: float
909-
numbers which define the 4x4 matrix to be multiplied
909+
numeric value in row 1 and column 0 of the matrix
910910

911911
n11: float
912-
numbers which define the 4x4 matrix to be multiplied
912+
numeric value in row 1 and column 1 of the matrix
913913

914914
n12: float
915-
numbers which define the 4x4 matrix to be multiplied
915+
numeric value in row 1 and column 2 of the matrix
916916

917917
n13: float
918-
numbers which define the 4x4 matrix to be multiplied
918+
numeric value in row 1 and column 3 of the matrix
919919

920920
n20: float
921-
numbers which define the 4x4 matrix to be multiplied
921+
numeric value in row 2 and column 0 of the matrix
922922

923923
n21: float
924-
numbers which define the 4x4 matrix to be multiplied
924+
numeric value in row 2 and column 1 of the matrix
925925

926926
n22: float
927-
numbers which define the 4x4 matrix to be multiplied
927+
numeric value in row 2 and column 2 of the matrix
928928

929929
n23: float
930-
numbers which define the 4x4 matrix to be multiplied
930+
numeric value in row 2 and column 3 of the matrix
931931

932932
n30: float
933-
numbers which define the 4x4 matrix to be multiplied
933+
numeric value in row 3 and column 0 of the matrix
934934

935935
n31: float
936-
numbers which define the 4x4 matrix to be multiplied
936+
numeric value in row 3 and column 1 of the matrix
937937

938938
n32: float
939-
numbers which define the 4x4 matrix to be multiplied
939+
numeric value in row 3 and column 2 of the matrix
940940

941941
n33: float
942-
numbers which define the 4x4 matrix to be multiplied
942+
numeric value in row 3 and column 3 of the matrix
943943

944944
source: npt.NDArray[np.floating]
945945
transformation matrix with a shape of 2x3 for 2D transforms or 4x4 for 3D transforms
@@ -994,52 +994,52 @@ def apply_matrix(
994994
----------
995995

996996
n00: float
997-
numbers which define the 4x4 matrix to be multiplied
997+
numeric value in row 0 and column 0 of the matrix
998998

999999
n01: float
1000-
numbers which define the 4x4 matrix to be multiplied
1000+
numeric value in row 0 and column 1 of the matrix
10011001

10021002
n02: float
1003-
numbers which define the 4x4 matrix to be multiplied
1003+
numeric value in row 0 and column 2 of the matrix
10041004

10051005
n03: float
1006-
numbers which define the 4x4 matrix to be multiplied
1006+
numeric value in row 0 and column 3 of the matrix
10071007

10081008
n10: float
1009-
numbers which define the 4x4 matrix to be multiplied
1009+
numeric value in row 1 and column 0 of the matrix
10101010

10111011
n11: float
1012-
numbers which define the 4x4 matrix to be multiplied
1012+
numeric value in row 1 and column 1 of the matrix
10131013

10141014
n12: float
1015-
numbers which define the 4x4 matrix to be multiplied
1015+
numeric value in row 1 and column 2 of the matrix
10161016

10171017
n13: float
1018-
numbers which define the 4x4 matrix to be multiplied
1018+
numeric value in row 1 and column 3 of the matrix
10191019

10201020
n20: float
1021-
numbers which define the 4x4 matrix to be multiplied
1021+
numeric value in row 2 and column 0 of the matrix
10221022

10231023
n21: float
1024-
numbers which define the 4x4 matrix to be multiplied
1024+
numeric value in row 2 and column 1 of the matrix
10251025

10261026
n22: float
1027-
numbers which define the 4x4 matrix to be multiplied
1027+
numeric value in row 2 and column 2 of the matrix
10281028

10291029
n23: float
1030-
numbers which define the 4x4 matrix to be multiplied
1030+
numeric value in row 2 and column 3 of the matrix
10311031

10321032
n30: float
1033-
numbers which define the 4x4 matrix to be multiplied
1033+
numeric value in row 3 and column 0 of the matrix
10341034

10351035
n31: float
1036-
numbers which define the 4x4 matrix to be multiplied
1036+
numeric value in row 3 and column 1 of the matrix
10371037

10381038
n32: float
1039-
numbers which define the 4x4 matrix to be multiplied
1039+
numeric value in row 3 and column 2 of the matrix
10401040

10411041
n33: float
1042-
numbers which define the 4x4 matrix to be multiplied
1042+
numeric value in row 3 and column 3 of the matrix
10431043

10441044
source: npt.NDArray[np.floating]
10451045
transformation matrix with a shape of 2x3 for 2D transforms or 4x4 for 3D transforms
@@ -1076,52 +1076,52 @@ def apply_matrix(self, source: npt.NDArray[np.floating], /) -> None:
10761076
----------
10771077

10781078
n00: float
1079-
numbers which define the 4x4 matrix to be multiplied
1079+
numeric value in row 0 and column 0 of the matrix
10801080

10811081
n01: float
1082-
numbers which define the 4x4 matrix to be multiplied
1082+
numeric value in row 0 and column 1 of the matrix
10831083

10841084
n02: float
1085-
numbers which define the 4x4 matrix to be multiplied
1085+
numeric value in row 0 and column 2 of the matrix
10861086

10871087
n03: float
1088-
numbers which define the 4x4 matrix to be multiplied
1088+
numeric value in row 0 and column 3 of the matrix
10891089

10901090
n10: float
1091-
numbers which define the 4x4 matrix to be multiplied
1091+
numeric value in row 1 and column 0 of the matrix
10921092

10931093
n11: float
1094-
numbers which define the 4x4 matrix to be multiplied
1094+
numeric value in row 1 and column 1 of the matrix
10951095

10961096
n12: float
1097-
numbers which define the 4x4 matrix to be multiplied
1097+
numeric value in row 1 and column 2 of the matrix
10981098

10991099
n13: float
1100-
numbers which define the 4x4 matrix to be multiplied
1100+
numeric value in row 1 and column 3 of the matrix
11011101

11021102
n20: float
1103-
numbers which define the 4x4 matrix to be multiplied
1103+
numeric value in row 2 and column 0 of the matrix
11041104

11051105
n21: float
1106-
numbers which define the 4x4 matrix to be multiplied
1106+
numeric value in row 2 and column 1 of the matrix
11071107

11081108
n22: float
1109-
numbers which define the 4x4 matrix to be multiplied
1109+
numeric value in row 2 and column 2 of the matrix
11101110

11111111
n23: float
1112-
numbers which define the 4x4 matrix to be multiplied
1112+
numeric value in row 2 and column 3 of the matrix
11131113

11141114
n30: float
1115-
numbers which define the 4x4 matrix to be multiplied
1115+
numeric value in row 3 and column 0 of the matrix
11161116

11171117
n31: float
1118-
numbers which define the 4x4 matrix to be multiplied
1118+
numeric value in row 3 and column 1 of the matrix
11191119

11201120
n32: float
1121-
numbers which define the 4x4 matrix to be multiplied
1121+
numeric value in row 3 and column 2 of the matrix
11221122

11231123
n33: float
1124-
numbers which define the 4x4 matrix to be multiplied
1124+
numeric value in row 3 and column 3 of the matrix
11251125

11261126
source: npt.NDArray[np.floating]
11271127
transformation matrix with a shape of 2x3 for 2D transforms or 4x4 for 3D transforms
@@ -1157,52 +1157,52 @@ def apply_matrix(self, *args):
11571157
----------
11581158

11591159
n00: float
1160-
numbers which define the 4x4 matrix to be multiplied
1160+
numeric value in row 0 and column 0 of the matrix
11611161

11621162
n01: float
1163-
numbers which define the 4x4 matrix to be multiplied
1163+
numeric value in row 0 and column 1 of the matrix
11641164

11651165
n02: float
1166-
numbers which define the 4x4 matrix to be multiplied
1166+
numeric value in row 0 and column 2 of the matrix
11671167

11681168
n03: float
1169-
numbers which define the 4x4 matrix to be multiplied
1169+
numeric value in row 0 and column 3 of the matrix
11701170

11711171
n10: float
1172-
numbers which define the 4x4 matrix to be multiplied
1172+
numeric value in row 1 and column 0 of the matrix
11731173

11741174
n11: float
1175-
numbers which define the 4x4 matrix to be multiplied
1175+
numeric value in row 1 and column 1 of the matrix
11761176

11771177
n12: float
1178-
numbers which define the 4x4 matrix to be multiplied
1178+
numeric value in row 1 and column 2 of the matrix
11791179

11801180
n13: float
1181-
numbers which define the 4x4 matrix to be multiplied
1181+
numeric value in row 1 and column 3 of the matrix
11821182

11831183
n20: float
1184-
numbers which define the 4x4 matrix to be multiplied
1184+
numeric value in row 2 and column 0 of the matrix
11851185

11861186
n21: float
1187-
numbers which define the 4x4 matrix to be multiplied
1187+
numeric value in row 2 and column 1 of the matrix
11881188

11891189
n22: float
1190-
numbers which define the 4x4 matrix to be multiplied
1190+
numeric value in row 2 and column 2 of the matrix
11911191

11921192
n23: float
1193-
numbers which define the 4x4 matrix to be multiplied
1193+
numeric value in row 2 and column 3 of the matrix
11941194

11951195
n30: float
1196-
numbers which define the 4x4 matrix to be multiplied
1196+
numeric value in row 3 and column 0 of the matrix
11971197

11981198
n31: float
1199-
numbers which define the 4x4 matrix to be multiplied
1199+
numeric value in row 3 and column 1 of the matrix
12001200

12011201
n32: float
1202-
numbers which define the 4x4 matrix to be multiplied
1202+
numeric value in row 3 and column 2 of the matrix
12031203

12041204
n33: float
1205-
numbers which define the 4x4 matrix to be multiplied
1205+
numeric value in row 3 and column 3 of the matrix
12061206

12071207
source: npt.NDArray[np.floating]
12081208
transformation matrix with a shape of 2x3 for 2D transforms or 4x4 for 3D transforms

py5/jars/core.jar

-175 Bytes
Binary file not shown.

py5/jars/dxf/dxf.jar

-7 Bytes
Binary file not shown.

py5/jars/pdf/pdf.jar

-7 Bytes
Binary file not shown.

py5/jars/py5.jar

3 Bytes
Binary file not shown.

py5/jars/svg/svg.jar

-7 Bytes
Binary file not shown.

py5/mixins/math.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ def hex_color(cls, color: int) -> str:
7070
provides an alternative approach, converting the 32 bit integer into a string
7171
such as ``'#0F3FF0FF'``. The hex string has 8 hexadecimal values following a
7272
``#`` character. The first two values represent the red value, the next two
73-
green, the next two blue, and the last two alpha. This is similar to web colors
74-
except for the addition of the alpha channel.
73+
green, the next two blue, and the last two alpha. This is consistent with CSS 8
74+
digit hex colors.
7575
7676
Conveniently, the hex color string returned by this method can also be used as
7777
parameter for other methods that accept color values. Observe how this is done

py5/mixins/print_tools.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
# along with this library. If not, see <https://www.gnu.org/licenses/>.
1818
#
1919
# *****************************************************************************
20+
import sys
21+
2022
from typing import Any
2123

2224

@@ -96,5 +98,8 @@ def println(
9698
having to cope with output moving from one cell to the next.
9799
98100
Use ``set_println_stream()`` to customize the behavior of ``println()``."""
99-
self._println_stream.print(sep.join(str(x)
100-
for x in args), end=end, stderr=stderr)
101+
msg = sep.join(str(x) for x in args)
102+
if self._println_stream is None:
103+
print(msg, end=end, file=sys.stderr if stderr else sys.stdout)
104+
else:
105+
self._println_stream.print(msg, end=end, stderr=stderr)

py5/reference.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -235,22 +235,9 @@
235235
(('Sketch', 'window_resize'), ['(new_width: int, new_height: int, /) -> None']),
236236
(('Sketch', 'window_title'), ['(title: str, /) -> None']),
237237
(('Sketch', 'year'), ['() -> int']),
238-
(('Sketch', 'set_println_stream'), ['(println_stream: Any) -> None']),
239-
(('Sketch', 'println'), ["(*args, sep: str = ' ', end: str = '\\n', stderr: bool = False) -> None"]),
240238
(('Sketch', 'load_json'), ['(json_path: Union[str, Path], **kwargs: dict[str, Any]) -> Any']),
241239
(('Sketch', 'save_json'), ['(json_data: Any, filename: Union[str, Path], **kwargs: dict[str, Any]) -> None']),
242240
(('Sketch', 'parse_json'), ['(serialized_json: Any, **kwargs: dict[str, Any]) -> Any']),
243-
(('Sketch', 'load_np_pixels'), ['() -> None']),
244-
(('Sketch', 'update_np_pixels'), ['() -> None']),
245-
(('Sketch', 'set_np_pixels'), ["(array: npt.NDArray[np.uint8], bands: str = 'ARGB') -> None"]),
246-
(('Sketch', 'save'), ['(filename: Union[str, Path, BytesIO], *, format: str = None, drop_alpha: bool = True, use_thread: bool = False, **params) -> None']),
247-
(('Sketch', 'launch_thread'), ['(f: Callable, name: str = None, *, daemon: bool = True, args: tuple = None, kwargs: dict = None) -> str']),
248-
(('Sketch', 'launch_promise_thread'), ['(f: Callable, name: str = None, *, daemon: bool = True, args: tuple = None, kwargs: dict = None) -> Py5Promise']),
249-
(('Sketch', 'launch_repeating_thread'), ['(f: Callable, name: str = None, *, time_delay: float = 0, daemon: bool = True, args: tuple = None, kwargs: dict = None) -> str']),
250-
(('Sketch', 'has_thread'), ['(name: str) -> None']),
251-
(('Sketch', 'stop_thread'), ['(name: str, wait: bool = False) -> None']),
252-
(('Sketch', 'stop_all_threads'), ['(wait: bool = False) -> None']),
253-
(('Sketch', 'list_threads'), ['() -> None']),
254241
(('Sketch', 'hex_color'), ['(color: int) -> str']),
255242
(('Sketch', 'sin'), ['(angle: Union[float, npt.ArrayLike]) -> Union[float, npt.NDArray]']),
256243
(('Sketch', 'cos'), ['(angle: Union[float, npt.ArrayLike]) -> Union[float, npt.NDArray]']),
@@ -280,6 +267,19 @@
280267
(('Sketch', 'random_gaussian'), ['() -> float', '(loc: float, /) -> float', '(loc: float, scale: float, /) -> float']),
281268
(('Sketch', 'noise'), ['(x: Union[float, npt.NDArray], /) -> Union[float, npt.NDArray]', '(x: Union[float, npt.NDArray], y: Union[float, npt.NDArray], /) -> Union[float, npt.NDArray]', '(x: Union[float, npt.NDArray], y: Union[float, npt.NDArray], z: Union[float, npt.NDArray], /) -> Union[float, npt.NDArray]']),
282269
(('Sketch', 'os_noise'), ['(x: Union[float, npt.NDArray], y: Union[float, npt.NDArray], /) -> Union[float, npt.NDArray]', '(x: Union[float, npt.NDArray], y: Union[float, npt.NDArray], z: Union[float, npt.NDArray], /) -> Union[float, npt.NDArray]', '(x: Union[float, npt.NDArray], y: Union[float, npt.NDArray], z: Union[float, npt.NDArray], w: Union[float, npt.NDArray], /) -> Union[float, npt.NDArray]']),
270+
(('Sketch', 'load_np_pixels'), ['() -> None']),
271+
(('Sketch', 'update_np_pixels'), ['() -> None']),
272+
(('Sketch', 'set_np_pixels'), ["(array: npt.NDArray[np.uint8], bands: str = 'ARGB') -> None"]),
273+
(('Sketch', 'save'), ['(filename: Union[str, Path, BytesIO], *, format: str = None, drop_alpha: bool = True, use_thread: bool = False, **params) -> None']),
274+
(('Sketch', 'set_println_stream'), ['(println_stream: Any) -> None']),
275+
(('Sketch', 'println'), ["(*args, sep: str = ' ', end: str = '\\n', stderr: bool = False) -> None"]),
276+
(('Sketch', 'launch_thread'), ['(f: Callable, name: str = None, *, daemon: bool = True, args: tuple = None, kwargs: dict = None) -> str']),
277+
(('Sketch', 'launch_promise_thread'), ['(f: Callable, name: str = None, *, daemon: bool = True, args: tuple = None, kwargs: dict = None) -> Py5Promise']),
278+
(('Sketch', 'launch_repeating_thread'), ['(f: Callable, name: str = None, *, time_delay: float = 0, daemon: bool = True, args: tuple = None, kwargs: dict = None) -> str']),
279+
(('Sketch', 'has_thread'), ['(name: str) -> None']),
280+
(('Sketch', 'stop_thread'), ['(name: str, wait: bool = False) -> None']),
281+
(('Sketch', 'stop_all_threads'), ['(wait: bool = False) -> None']),
282+
(('Sketch', 'list_threads'), ['() -> None']),
283283
(('Sketch', 'sketch_path'), ['() -> Path', '(where: str, /) -> Path']),
284284
(('Sketch', 'hot_reload_draw'), ['(draw: Callable) -> None']),
285285
(('Sketch', 'profile_functions'), ['(function_names: list[str]) -> None']),
@@ -289,6 +289,7 @@
289289
(('Sketch', 'select_folder'), ['(prompt: str, callback: Callable, default_folder: str = None) -> None']),
290290
(('Sketch', 'select_input'), ['(prompt: str, callback: Callable, default_file: str = None) -> None']),
291291
(('Sketch', 'select_output'), ['(prompt: str, callback: Callable, default_file: str = None) -> None']),
292+
(('Sketch', 'create_image_from_numpy'), ["(array: npt.NDArray[np.uint8], bands: str = 'ARGB', *, dst: Py5Image = None) -> Py5Image"]),
292293
(('Sketch', 'convert_image'), ['(obj: Any, *, dst: Py5Image = None) -> Py5Image']),
293294
(('Sketch', 'load_image'), ['(image_path: Union[str, Path], *, dst: Py5Image = None) -> Py5Image']),
294295
(('Sketch', 'request_image'), ['(image_path: Union[str, Path]) -> Py5Promise']),

0 commit comments

Comments
 (0)