Skip to content

Commit 4d1f91d

Browse files
committed
release 0.5a1
1 parent 55b3baf commit 4d1f91d

File tree

17 files changed

+2297
-1715
lines changed

17 files changed

+2297
-1715
lines changed

py5/__init__.py

Lines changed: 1726 additions & 1584 deletions
Large diffs are not rendered by default.

py5/graphics.py

Lines changed: 138 additions & 17 deletions
Large diffs are not rendered by default.

py5/image.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,14 @@ def blend(self, sx: int, sy: int, sw: int, sh: int, dx: int,
259259
* DARKEST: only the darkest colour succeeds: ``C = min(A*factor, B)``
260260
* LIGHTEST: only the lightest colour succeeds: ``C = max(A*factor, B)``
261261
* DIFFERENCE: subtract colors from underlying image.
262-
* EXCLUSION: similar to ``DIFFERENCE``, but less extreme.
262+
* EXCLUSION: similar to DIFFERENCE, but less extreme.
263263
* MULTIPLY: Multiply the colors, result will always be darker.
264264
* SCREEN: Opposite multiply, uses inverse values of the colors.
265-
* OVERLAY: A mix of ``MULTIPLY`` and ``SCREEN``. Multiplies dark values, and
266-
screens light values.
267-
* HARD_LIGHT: ``SCREEN`` when greater than 50% gray, ``MULTIPLY`` when lower.
268-
* SOFT_LIGHT: Mix of ``DARKEST`` and ``LIGHTEST``. Works like ``OVERLAY``, but
269-
not as harsh.
265+
* OVERLAY: A mix of MULTIPLY and SCREEN. Multiplies dark values, and screens
266+
light values.
267+
* HARD_LIGHT: SCREEN when greater than 50% gray, MULTIPLY when lower.
268+
* SOFT_LIGHT: Mix of DARKEST and LIGHTEST. Works like OVERLAY, but not as
269+
harsh.
270270
* DODGE: Lightens light tones and increases contrast, ignores darks. Called
271271
"Color Dodge" in Illustrator and Photoshop.
272272
* BURN: Darker areas are applied, increasing contrast, ignores lights. Called
@@ -343,14 +343,14 @@ def blend(self, src: Py5Image, sx: int, sy: int, sw: int, sh: int,
343343
* DARKEST: only the darkest colour succeeds: ``C = min(A*factor, B)``
344344
* LIGHTEST: only the lightest colour succeeds: ``C = max(A*factor, B)``
345345
* DIFFERENCE: subtract colors from underlying image.
346-
* EXCLUSION: similar to ``DIFFERENCE``, but less extreme.
346+
* EXCLUSION: similar to DIFFERENCE, but less extreme.
347347
* MULTIPLY: Multiply the colors, result will always be darker.
348348
* SCREEN: Opposite multiply, uses inverse values of the colors.
349-
* OVERLAY: A mix of ``MULTIPLY`` and ``SCREEN``. Multiplies dark values, and
350-
screens light values.
351-
* HARD_LIGHT: ``SCREEN`` when greater than 50% gray, ``MULTIPLY`` when lower.
352-
* SOFT_LIGHT: Mix of ``DARKEST`` and ``LIGHTEST``. Works like ``OVERLAY``, but
353-
not as harsh.
349+
* OVERLAY: A mix of MULTIPLY and SCREEN. Multiplies dark values, and screens
350+
light values.
351+
* HARD_LIGHT: SCREEN when greater than 50% gray, MULTIPLY when lower.
352+
* SOFT_LIGHT: Mix of DARKEST and LIGHTEST. Works like OVERLAY, but not as
353+
harsh.
354354
* DODGE: Lightens light tones and increases contrast, ignores darks. Called
355355
"Color Dodge" in Illustrator and Photoshop.
356356
* BURN: Darker areas are applied, increasing contrast, ignores lights. Called
@@ -425,14 +425,14 @@ def blend(self, *args):
425425
* DARKEST: only the darkest colour succeeds: ``C = min(A*factor, B)``
426426
* LIGHTEST: only the lightest colour succeeds: ``C = max(A*factor, B)``
427427
* DIFFERENCE: subtract colors from underlying image.
428-
* EXCLUSION: similar to ``DIFFERENCE``, but less extreme.
428+
* EXCLUSION: similar to DIFFERENCE, but less extreme.
429429
* MULTIPLY: Multiply the colors, result will always be darker.
430430
* SCREEN: Opposite multiply, uses inverse values of the colors.
431-
* OVERLAY: A mix of ``MULTIPLY`` and ``SCREEN``. Multiplies dark values, and
432-
screens light values.
433-
* HARD_LIGHT: ``SCREEN`` when greater than 50% gray, ``MULTIPLY`` when lower.
434-
* SOFT_LIGHT: Mix of ``DARKEST`` and ``LIGHTEST``. Works like ``OVERLAY``, but
435-
not as harsh.
431+
* OVERLAY: A mix of MULTIPLY and SCREEN. Multiplies dark values, and screens
432+
light values.
433+
* HARD_LIGHT: SCREEN when greater than 50% gray, MULTIPLY when lower.
434+
* SOFT_LIGHT: Mix of DARKEST and LIGHTEST. Works like OVERLAY, but not as
435+
harsh.
436436
* DODGE: Lightens light tones and increases contrast, ignores darks. Called
437437
"Color Dodge" in Illustrator and Photoshop.
438438
* BURN: Darker areas are applied, increasing contrast, ignores lights. Called

py5/jars/py5.jar

0 Bytes
Binary file not shown.

py5/mixins/math.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -909,13 +909,13 @@ def random(self, *args: float) -> float:
909909
return self._rng.uniform()
910910
elif len(args) == 1:
911911
high = args[0]
912-
if isinstance(high, (int, float)):
912+
if isinstance(high, (int, np.integer, float)):
913913
return self._rng.uniform(0, high)
914914
elif len(args) == 2:
915915
low, high = args
916916
if isinstance(
917-
low, (int, float)) and isinstance(
918-
high, (int, float)):
917+
low, (int, np.integer, float)) and isinstance(
918+
high, (int, np.integer, float)):
919919
return self._rng.uniform(low, high)
920920

921921
types = ','.join([type(a).__name__ for a in args])
@@ -1127,11 +1127,13 @@ def random_int(self, *args: int) -> int:
11271127
return self._rng.integers(0, 1, endpoint=True)
11281128
elif len(args) == 1:
11291129
high = args[0]
1130-
if isinstance(high, int):
1130+
if isinstance(high, (int, np.integer)):
11311131
return self._rng.integers(0, high, endpoint=True)
11321132
elif len(args) == 2:
11331133
low, high = args
1134-
if isinstance(low, int) and isinstance(high, int):
1134+
if isinstance(
1135+
low, (int, np.integer)) and isinstance(
1136+
high, (int, np.integer)):
11351137
return self._rng.integers(low, high, endpoint=True)
11361138

11371139
types = ','.join([type(a).__name__ for a in args])
@@ -1333,13 +1335,13 @@ def random_gaussian(self, *args: float) -> float:
13331335
return self._rng.normal()
13341336
elif len(args) == 1:
13351337
loc = args[0]
1336-
if isinstance(loc, int):
1338+
if isinstance(loc, (int, np.integer)):
13371339
return self._rng.normal(loc)
13381340
elif len(args) == 2:
13391341
loc, scale = args
13401342
if isinstance(
1341-
loc, (int, float)) and isinstance(
1342-
scale, (int, float)):
1343+
loc, (int, np.integer, float)) and isinstance(
1344+
scale, (int, np.integer, float)):
13431345
return self._rng.normal(loc, scale)
13441346

13451347
types = ','.join([type(a).__name__ for a in args])

py5/reference.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,22 @@
209209
(('Sketch', 'vertex'), ['(x: float, y: float, /) -> None', '(x: float, y: float, z: float, /) -> None', '(x: float, y: float, u: float, v: float, /) -> None', '(x: float, y: float, z: float, u: float, v: float, /) -> None', '(v: NDArray[(Any,), Float], /) -> None']),
210210
(('Sketch', 'vertices'), ['(coordinates: NDArray[(Any, Any), Float], /) -> None']),
211211
(('Sketch', 'year'), ['() -> int']),
212+
(('Sketch', 'load_json'), ['(json_path: Union[str, Path], **kwargs: Dict[str, Any]) -> Any']),
213+
(('Sketch', 'save_json'), ['(json_data: Any, filename: Union[str, Path], **kwargs: Dict[str, Any]) -> None']),
214+
(('Sketch', 'parse_json'), ['(serialized_json: Any, **kwargs: Dict[str, Any]) -> Any']),
215+
(('Sketch', 'set_println_stream'), ['(println_stream: Any) -> None']),
216+
(('Sketch', 'println'), ["(*args, sep: str = ' ', end: str = '\\n', stderr: bool = False) -> None"]),
217+
(('Sketch', 'load_np_pixels'), ['() -> None']),
218+
(('Sketch', 'update_np_pixels'), ['() -> None']),
219+
(('Sketch', 'set_np_pixels'), ["(array: np.ndarray, bands: str = 'ARGB') -> None"]),
220+
(('Sketch', 'save'), ['(filename: Union[str, Path], *, format: str = None, drop_alpha: bool = True, use_thread: bool = False, **params) -> None']),
221+
(('Sketch', 'launch_thread'), ['(f: Callable, name: str = None, *, daemon: bool = True, args: Tuple = None, kwargs: Dict = None) -> str']),
222+
(('Sketch', 'launch_promise_thread'), ['(f: Callable, name: str = None, *, daemon: bool = True, args: Tuple = None, kwargs: Dict = None) -> Py5Promise']),
223+
(('Sketch', 'launch_repeating_thread'), ['(f: Callable, name: str = None, *, time_delay: float = 0, daemon: bool = True, args: Tuple = None, kwargs: Dict = None) -> str']),
224+
(('Sketch', 'has_thread'), ['(name: str) -> None']),
225+
(('Sketch', 'stop_thread'), ['(name: str, wait: bool = False) -> None']),
226+
(('Sketch', 'stop_all_threads'), ['(wait: bool = False) -> None']),
227+
(('Sketch', 'list_threads'), ['() -> None']),
212228
(('Sketch', 'sin'), ['(angle: float) -> float']),
213229
(('Sketch', 'cos'), ['(angle: float) -> float']),
214230
(('Sketch', 'tan'), ['(angle: float) -> float']),
@@ -239,22 +255,6 @@
239255
(('Sketch', 'noise_mode'), ['(mode: int) -> None']),
240256
(('Sketch', 'noise_detail'), ['(octaves: float = None, persistence: float = None, lacunarity: float = None) -> None']),
241257
(('Sketch', 'noise_seed'), ['(seed: int) -> None']),
242-
(('Sketch', 'load_json'), ['(json_path: Union[str, Path], **kwargs: Dict[str, Any]) -> Any']),
243-
(('Sketch', 'save_json'), ['(json_data: Any, filename: Union[str, Path], **kwargs: Dict[str, Any]) -> None']),
244-
(('Sketch', 'parse_json'), ['(serialized_json: Any, **kwargs: Dict[str, Any]) -> Any']),
245-
(('Sketch', 'set_println_stream'), ['(println_stream: Any) -> None']),
246-
(('Sketch', 'println'), ["(*args, sep: str = ' ', end: str = '\\n', stderr: bool = False) -> None"]),
247-
(('Sketch', 'load_np_pixels'), ['() -> None']),
248-
(('Sketch', 'update_np_pixels'), ['() -> None']),
249-
(('Sketch', 'set_np_pixels'), ["(array: np.ndarray, bands: str = 'ARGB') -> None"]),
250-
(('Sketch', 'save'), ['(filename: Union[str, Path], *, format: str = None, drop_alpha: bool = True, use_thread: bool = False, **params) -> None']),
251-
(('Sketch', 'launch_thread'), ['(f: Callable, name: str = None, *, daemon: bool = True, args: Tuple = None, kwargs: Dict = None) -> str']),
252-
(('Sketch', 'launch_promise_thread'), ['(f: Callable, name: str = None, *, daemon: bool = True, args: Tuple = None, kwargs: Dict = None) -> Py5Promise']),
253-
(('Sketch', 'launch_repeating_thread'), ['(f: Callable, name: str = None, *, time_delay: float = 0, daemon: bool = True, args: Tuple = None, kwargs: Dict = None) -> str']),
254-
(('Sketch', 'has_thread'), ['(name: str) -> None']),
255-
(('Sketch', 'stop_thread'), ['(name: str, wait: bool = False) -> None']),
256-
(('Sketch', 'stop_all_threads'), ['(wait: bool = False) -> None']),
257-
(('Sketch', 'list_threads'), ['() -> None']),
258258
(('Sketch', 'sketch_path'), ['() -> Path', '(where: str, /) -> Path']),
259259
(('Sketch', 'hot_reload_draw'), ['(draw: Callable) -> None']),
260260
(('Sketch', 'profile_functions'), ['(function_names: List[str]) -> None']),
@@ -542,9 +542,10 @@
542542
(('Py5Tools', 'get_classpath'), ['() -> str']),
543543
(('Py5Tools', 'add_classpath'), ['(classpath: Union[Path, str]) -> None']),
544544
(('Py5Tools', 'add_jars'), ['(path: Union[Path, str]) -> None']),
545+
(('Py5Tools', 'get_jvm_debug_info'), ['() -> Dict[str, Any]']),
545546
(('Py5Tools', 'screenshot'), ['(*, sketch: Sketch = None, hook_post_draw: bool = False) -> PIL.Image']),
546547
(('Py5Tools', 'save_frames'), ["(dirname: str, *, filename: str = 'frame_####.png', period: float = 0.0, start: int = None, limit: int = 0, sketch: Sketch = None, hook_post_draw: bool = False) -> List[str]"]),
547548
(('Py5Tools', 'animated_gif'), ['(filename: str, count: int, period: float, duration: float, *, loop: int = 0, optimize: bool = True, sketch: Sketch = None, hook_post_draw: bool = False) -> str']),
548549
(('Py5Tools', 'capture_frames'), ['(count: float, *, period: float = 0.0, sketch: Sketch = None, hook_post_draw: bool = False) -> List[PIL.Image]']),
549-
(('Py5Tools', 'sketch_portal'), ['(*, time_limit: float = 0.0, throttle_frame_rate: float = None, scale: float = 1.0, quality: int = 75, portal_widget: Py5SketchPortal = None, sketch: Sketch = None, hook_post_draw: bool = False) -> None']),
550+
(('Py5Tools', 'sketch_portal'), ['(*, time_limit: float = 0.0, throttle_frame_rate: float = 30, scale: float = 1.0, quality: int = 75, portal_widget: Py5SketchPortal = None, sketch: Sketch = None, hook_post_draw: bool = False) -> None']),
550551
])

0 commit comments

Comments
 (0)