Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,577 changes: 1,328 additions & 1,249 deletions py5/__init__.py

Large diffs are not rendered by default.

128 changes: 64 additions & 64 deletions py5/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,52 +894,52 @@ def apply_matrix(self, n00: float, n01: float, n02: float,
----------

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

source: npt.NDArray[np.floating]
transformation matrix with a shape of 2x3 for 2D transforms or 4x4 for 3D transforms
Expand Down
Binary file modified py5/jars/core.jar
Binary file not shown.
Binary file modified py5/jars/dxf/dxf.jar
Binary file not shown.
Binary file modified py5/jars/pdf/pdf.jar
Binary file not shown.
Binary file modified py5/jars/py5.jar
Binary file not shown.
Binary file modified py5/jars/svg/svg.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions py5/mixins/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ def hex_color(cls, color: int) -> str:
provides an alternative approach, converting the 32 bit integer into a string
such as ``'#0F3FF0FF'``. The hex string has 8 hexadecimal values following a
``#`` character. The first two values represent the red value, the next two
green, the next two blue, and the last two alpha. This is similar to web colors
except for the addition of the alpha channel.
green, the next two blue, and the last two alpha. This is consistent with CSS 8
digit hex colors.

Conveniently, the hex color string returned by this method can also be used as
parameter for other methods that accept color values. Observe how this is done
Expand Down
9 changes: 7 additions & 2 deletions py5/mixins/print_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# along with this library. If not, see <https://www.gnu.org/licenses/>.
#
# *****************************************************************************
import sys

from typing import Any


Expand Down Expand Up @@ -96,5 +98,8 @@ def println(
having to cope with output moving from one cell to the next.

Use ``set_println_stream()`` to customize the behavior of ``println()``."""
self._println_stream.print(sep.join(str(x)
for x in args), end=end, stderr=stderr)
msg = sep.join(str(x) for x in args)
if self._println_stream is None:
print(msg, end=end, file=sys.stderr if stderr else sys.stdout)
else:
self._println_stream.print(msg, end=end, stderr=stderr)
27 changes: 14 additions & 13 deletions py5/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,22 +235,9 @@
(('Sketch', 'window_resize'), ['(new_width: int, new_height: int, /) -> None']),
(('Sketch', 'window_title'), ['(title: str, /) -> None']),
(('Sketch', 'year'), ['() -> int']),
(('Sketch', 'set_println_stream'), ['(println_stream: Any) -> None']),
(('Sketch', 'println'), ["(*args, sep: str = ' ', end: str = '\\n', stderr: bool = False) -> None"]),
(('Sketch', 'load_json'), ['(json_path: Union[str, Path], **kwargs: dict[str, Any]) -> Any']),
(('Sketch', 'save_json'), ['(json_data: Any, filename: Union[str, Path], **kwargs: dict[str, Any]) -> None']),
(('Sketch', 'parse_json'), ['(serialized_json: Any, **kwargs: dict[str, Any]) -> Any']),
(('Sketch', 'load_np_pixels'), ['() -> None']),
(('Sketch', 'update_np_pixels'), ['() -> None']),
(('Sketch', 'set_np_pixels'), ["(array: npt.NDArray[np.uint8], bands: str = 'ARGB') -> None"]),
(('Sketch', 'save'), ['(filename: Union[str, Path, BytesIO], *, format: str = None, drop_alpha: bool = True, use_thread: bool = False, **params) -> None']),
(('Sketch', 'launch_thread'), ['(f: Callable, name: str = None, *, daemon: bool = True, args: tuple = None, kwargs: dict = None) -> str']),
(('Sketch', 'launch_promise_thread'), ['(f: Callable, name: str = None, *, daemon: bool = True, args: tuple = None, kwargs: dict = None) -> Py5Promise']),
(('Sketch', 'launch_repeating_thread'), ['(f: Callable, name: str = None, *, time_delay: float = 0, daemon: bool = True, args: tuple = None, kwargs: dict = None) -> str']),
(('Sketch', 'has_thread'), ['(name: str) -> None']),
(('Sketch', 'stop_thread'), ['(name: str, wait: bool = False) -> None']),
(('Sketch', 'stop_all_threads'), ['(wait: bool = False) -> None']),
(('Sketch', 'list_threads'), ['() -> None']),
(('Sketch', 'hex_color'), ['(color: int) -> str']),
(('Sketch', 'sin'), ['(angle: Union[float, npt.ArrayLike]) -> Union[float, npt.NDArray]']),
(('Sketch', 'cos'), ['(angle: Union[float, npt.ArrayLike]) -> Union[float, npt.NDArray]']),
Expand Down Expand Up @@ -280,6 +267,19 @@
(('Sketch', 'random_gaussian'), ['() -> float', '(loc: float, /) -> float', '(loc: float, scale: float, /) -> float']),
(('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]']),
(('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]']),
(('Sketch', 'load_np_pixels'), ['() -> None']),
(('Sketch', 'update_np_pixels'), ['() -> None']),
(('Sketch', 'set_np_pixels'), ["(array: npt.NDArray[np.uint8], bands: str = 'ARGB') -> None"]),
(('Sketch', 'save'), ['(filename: Union[str, Path, BytesIO], *, format: str = None, drop_alpha: bool = True, use_thread: bool = False, **params) -> None']),
(('Sketch', 'set_println_stream'), ['(println_stream: Any) -> None']),
(('Sketch', 'println'), ["(*args, sep: str = ' ', end: str = '\\n', stderr: bool = False) -> None"]),
(('Sketch', 'launch_thread'), ['(f: Callable, name: str = None, *, daemon: bool = True, args: tuple = None, kwargs: dict = None) -> str']),
(('Sketch', 'launch_promise_thread'), ['(f: Callable, name: str = None, *, daemon: bool = True, args: tuple = None, kwargs: dict = None) -> Py5Promise']),
(('Sketch', 'launch_repeating_thread'), ['(f: Callable, name: str = None, *, time_delay: float = 0, daemon: bool = True, args: tuple = None, kwargs: dict = None) -> str']),
(('Sketch', 'has_thread'), ['(name: str) -> None']),
(('Sketch', 'stop_thread'), ['(name: str, wait: bool = False) -> None']),
(('Sketch', 'stop_all_threads'), ['(wait: bool = False) -> None']),
(('Sketch', 'list_threads'), ['() -> None']),
(('Sketch', 'sketch_path'), ['() -> Path', '(where: str, /) -> Path']),
(('Sketch', 'hot_reload_draw'), ['(draw: Callable) -> None']),
(('Sketch', 'profile_functions'), ['(function_names: list[str]) -> None']),
Expand All @@ -289,6 +289,7 @@
(('Sketch', 'select_folder'), ['(prompt: str, callback: Callable, default_folder: str = None) -> None']),
(('Sketch', 'select_input'), ['(prompt: str, callback: Callable, default_file: str = None) -> None']),
(('Sketch', 'select_output'), ['(prompt: str, callback: Callable, default_file: str = None) -> None']),
(('Sketch', 'create_image_from_numpy'), ["(array: npt.NDArray[np.uint8], bands: str = 'ARGB', *, dst: Py5Image = None) -> Py5Image"]),
(('Sketch', 'convert_image'), ['(obj: Any, *, dst: Py5Image = None) -> Py5Image']),
(('Sketch', 'load_image'), ['(image_path: Union[str, Path], *, dst: Py5Image = None) -> Py5Image']),
(('Sketch', 'request_image'), ['(image_path: Union[str, Path]) -> Py5Promise']),
Expand Down
Loading