Skip to content

Commit 24aeb9d

Browse files
authored
Merge pull request #14 from hx2A/v0107a0
release 0.10.7a0
2 parents 1da412a + e882cf2 commit 24aeb9d

File tree

17 files changed

+258
-143
lines changed

17 files changed

+258
-143
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
[![mybinder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/py5coding/py5examples/HEAD?urlpath=lab)
88

9-
py5 is a new version of [Processing][processing] for Python 3.9+. The goal of py5 is to create a version of Processing that is [integrated into the Python ecosystem](https://py5coding.org/integrations/python_ecosystem_integrations.html). Built into the library are thoughtful choices about how to best get py5 to work with other popular Python libraries and tools such as [Jupyter](https://jupyter.org/), [numpy](https://numpy.org/), [shapely](https://shapely.readthedocs.io/en/stable/), [trimesh](https://trimesh.org/), [matplotlib](https://matplotlib.org/), and [Pillow](https://python-pillow.org/).
9+
py5 is a new version of [Processing][processing] for Python. The goal of py5 is to create a version of Processing that is [integrated into the Python ecosystem](https://py5coding.org/integrations/python_ecosystem_integrations.html). Built into the library are thoughtful choices about how to best get py5 to work with other popular Python libraries and tools such as [Jupyter](https://jupyter.org/), [numpy](https://numpy.org/), [shapely](https://shapely.readthedocs.io/en/stable/), [trimesh](https://trimesh.org/), [matplotlib](https://matplotlib.org/), and [Pillow](https://python-pillow.org/).
1010

1111
py5 is an excellent choice for educators looking to teach Python in the context of creative coding and is currently used in classrooms all around the world. The documentation website includes [introductory tutorials](https://py5coding.org/tutorials/intro_to_py5_and_python.html) as well as extensive [reference documentation](https://py5coding.org/reference/summary.html), complete with example code.
1212

py5/__init__.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# *****************************************************************************
2020
# -*- coding: utf-8 -*-
2121
"""
22-
py5 is a version of Processing for Python 3.9+. It makes the Processing Java libraries available to the CPython interpreter using JPype.
22+
py5 is a version of Processing for Python. It makes the Processing Java libraries available to the CPython interpreter using JPype.
2323
"""
2424
from __future__ import annotations
2525

@@ -208,6 +208,8 @@
208208
BASELINE = 0
209209
BEVEL = 32
210210
BEZIER_VERTEX = 1
211+
BICUBIC = 2
212+
BILINEAR = 1
211213
BLEND = 1
212214
BLUR = 11
213215
BOTTOM = 102
@@ -289,6 +291,7 @@
289291
MODEL = 4
290292
MOVE = 13
291293
MULTIPLY = 128
294+
NEAREST_NEIGHBOR = 0
292295
NORMAL = 1
293296
OPAQUE = 14
294297
OPEN = 1
@@ -3792,6 +3795,10 @@ def copy() -> Py5Image:
37923795
the source image has an alpha channel set, it will be copied as well.
37933796

37943797
This function ignores `image_mode()`.
3798+
3799+
If you want to create a new image with the contents of a rectangular region of
3800+
the sketch, check out `get_pixels()` where x, y, w, h, are the position and
3801+
dimensions of the area to be copied. It will return a `Py5Image` object.
37953802
"""
37963803
pass
37973804

@@ -3856,6 +3863,10 @@ def copy(
38563863
the source image has an alpha channel set, it will be copied as well.
38573864

38583865
This function ignores `image_mode()`.
3866+
3867+
If you want to create a new image with the contents of a rectangular region of
3868+
the sketch, check out `get_pixels()` where x, y, w, h, are the position and
3869+
dimensions of the area to be copied. It will return a `Py5Image` object.
38593870
"""
38603871
pass
38613872

@@ -3929,6 +3940,10 @@ def copy(
39293940
the source image has an alpha channel set, it will be copied as well.
39303941

39313942
This function ignores `image_mode()`.
3943+
3944+
If you want to create a new image with the contents of a rectangular region of
3945+
the sketch, check out `get_pixels()` where x, y, w, h, are the position and
3946+
dimensions of the area to be copied. It will return a `Py5Image` object.
39323947
"""
39333948
pass
39343949

@@ -3990,6 +4005,10 @@ def copy(*args):
39904005
the source image has an alpha channel set, it will be copied as well.
39914006

39924007
This function ignores `image_mode()`.
4008+
4009+
If you want to create a new image with the contents of a rectangular region of
4010+
the sketch, check out `get_pixels()` where x, y, w, h, are the position and
4011+
dimensions of the area to be copied. It will return a `Py5Image` object.
39934012
"""
39944013
return _py5sketch.copy(*args)
39954014

py5/graphics.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,6 +1651,8 @@ def color(self, *args) -> int:
16511651
BASELINE = 0
16521652
BEVEL = 32
16531653
BEZIER_VERTEX = 1
1654+
BICUBIC = 2
1655+
BILINEAR = 1
16541656
BLEND = 1
16551657
BLUE_MASK = 255
16561658
BLUR = 11
@@ -1731,6 +1733,7 @@ def color(self, *args) -> int:
17311733
MODEL = 4
17321734
MOVE = 13
17331735
MULTIPLY = 128
1736+
NEAREST_NEIGHBOR = 0
17341737
NORMAL = 1
17351738
OPAQUE = 14
17361739
OPEN = 1
@@ -5581,6 +5584,11 @@ def copy(self) -> Py5Image:
55815584

55825585
This method is the same as `copy()` but linked to a `Py5Graphics` object. To see
55835586
example code for how it can be used, see `copy()`.
5587+
5588+
If you want to create a new image with the contents of a rectangular region of a
5589+
`Py5Graphics` object, check out the `Py5Graphics.get_pixels()` method, where x,
5590+
y, w, h, are the position and dimensions of the area to be copied. It will
5591+
return a `Py5Image` object.
55845592
"""
55855593
pass
55865594

@@ -5647,6 +5655,11 @@ def copy(
56475655

56485656
This method is the same as `copy()` but linked to a `Py5Graphics` object. To see
56495657
example code for how it can be used, see `copy()`.
5658+
5659+
If you want to create a new image with the contents of a rectangular region of a
5660+
`Py5Graphics` object, check out the `Py5Graphics.get_pixels()` method, where x,
5661+
y, w, h, are the position and dimensions of the area to be copied. It will
5662+
return a `Py5Image` object.
56505663
"""
56515664
pass
56525665

@@ -5723,6 +5736,11 @@ def copy(
57235736

57245737
This method is the same as `copy()` but linked to a `Py5Graphics` object. To see
57255738
example code for how it can be used, see `copy()`.
5739+
5740+
If you want to create a new image with the contents of a rectangular region of a
5741+
`Py5Graphics` object, check out the `Py5Graphics.get_pixels()` method, where x,
5742+
y, w, h, are the position and dimensions of the area to be copied. It will
5743+
return a `Py5Image` object.
57265744
"""
57275745
pass
57285746

@@ -5787,6 +5805,11 @@ def copy(self, *args):
57875805

57885806
This method is the same as `copy()` but linked to a `Py5Graphics` object. To see
57895807
example code for how it can be used, see `copy()`.
5808+
5809+
If you want to create a new image with the contents of a rectangular region of a
5810+
`Py5Graphics` object, check out the `Py5Graphics.get_pixels()` method, where x,
5811+
y, w, h, are the position and dimensions of the area to be copied. It will
5812+
return a `Py5Image` object.
57905813
"""
57915814
return self._instance.copy(*args)
57925815

py5/image.py

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ def __getattr__(self, name):
103103
ALPHA = 4
104104
ALPHA_MASK = -16777216
105105
ARGB = 2
106+
BICUBIC = 2
107+
BILINEAR = 1
106108
BLEND = 1
107109
BLUE_MASK = 255
108110
BLUR = 11
@@ -120,6 +122,7 @@ def __getattr__(self, name):
120122
INVERT = 13
121123
LIGHTEST = 8
122124
MULTIPLY = 128
125+
NEAREST_NEIGHBOR = 0
123126
OPAQUE = 14
124127
OVERLAY = 512
125128
POSTERIZE = 15
@@ -591,6 +594,11 @@ def copy(self) -> Py5Image:
591594
as well.
592595
593596
This function ignores `image_mode()`.
597+
598+
If you want to create a new image with the contents of a rectangular region of a
599+
`Py5Image` object, check out the `Py5Image.get_pixels()` method, where x, y, w,
600+
h, are the position and dimensions of the area to be copied. It will return a
601+
`Py5Image` object.
594602
"""
595603
pass
596604

@@ -651,6 +659,11 @@ def copy(
651659
as well.
652660
653661
This function ignores `image_mode()`.
662+
663+
If you want to create a new image with the contents of a rectangular region of a
664+
`Py5Image` object, check out the `Py5Image.get_pixels()` method, where x, y, w,
665+
h, are the position and dimensions of the area to be copied. It will return a
666+
`Py5Image` object.
654667
"""
655668
pass
656669

@@ -721,6 +734,11 @@ def copy(
721734
as well.
722735
723736
This function ignores `image_mode()`.
737+
738+
If you want to create a new image with the contents of a rectangular region of a
739+
`Py5Image` object, check out the `Py5Image.get_pixels()` method, where x, y, w,
740+
h, are the position and dimensions of the area to be copied. It will return a
741+
`Py5Image` object.
724742
"""
725743
pass
726744

@@ -779,6 +797,11 @@ def copy(self, *args):
779797
as well.
780798
781799
This function ignores `image_mode()`.
800+
801+
If you want to create a new image with the contents of a rectangular region of a
802+
`Py5Image` object, check out the `Py5Image.get_pixels()` method, where x, y, w,
803+
h, are the position and dimensions of the area to be copied. It will return a
804+
`Py5Image` object.
782805
"""
783806
return self._instance.copy(*args)
784807

@@ -1270,6 +1293,140 @@ def mask(self, *args):
12701293
"""
12711294
return self._instance.mask(*args)
12721295

1296+
@overload
1297+
def resize(self, w: int, h: int, /) -> None:
1298+
"""Resize the Py5Image object to a new height and width.
1299+
1300+
Underlying Processing method: PImage.resize
1301+
1302+
Methods
1303+
-------
1304+
1305+
You can use any of the following signatures:
1306+
1307+
* resize(w: int, h: int, /) -> None
1308+
* resize(w: int, h: int, interpolation_mode: int, /) -> None
1309+
1310+
Parameters
1311+
----------
1312+
1313+
h: int
1314+
height to size image to
1315+
1316+
interpolation_mode: int
1317+
interpolation method for resize operation
1318+
1319+
w: int
1320+
width to size image to
1321+
1322+
Notes
1323+
-----
1324+
1325+
Resize the Py5Image object to a new height and width. This will modify the
1326+
Py5Image object in place, meaning that rather than returning a resized copy, it
1327+
will modify your existing Py5Image object. If this isn't what you want, pair
1328+
this method with `Py5Image.copy()`, as shown in the example.
1329+
1330+
To make the image scale proportionally, use 0 as the value for either the `w` or
1331+
`h` parameter.
1332+
1333+
The default resize interpolation mode is `BILINEAR`. Alternatively you can use
1334+
the `interpolation_mode` parameter to interpolate using the `NEAREST_NEIGHBOR`
1335+
method, which is faster but yields lower quality results. You can also use
1336+
`BICUBIC` interpolation, which is the most computationally intensive but looks
1337+
the best, particularly for up-scaling operations.
1338+
"""
1339+
pass
1340+
1341+
@overload
1342+
def resize(self, w: int, h: int, interpolation_mode: int, /) -> None:
1343+
"""Resize the Py5Image object to a new height and width.
1344+
1345+
Underlying Processing method: PImage.resize
1346+
1347+
Methods
1348+
-------
1349+
1350+
You can use any of the following signatures:
1351+
1352+
* resize(w: int, h: int, /) -> None
1353+
* resize(w: int, h: int, interpolation_mode: int, /) -> None
1354+
1355+
Parameters
1356+
----------
1357+
1358+
h: int
1359+
height to size image to
1360+
1361+
interpolation_mode: int
1362+
interpolation method for resize operation
1363+
1364+
w: int
1365+
width to size image to
1366+
1367+
Notes
1368+
-----
1369+
1370+
Resize the Py5Image object to a new height and width. This will modify the
1371+
Py5Image object in place, meaning that rather than returning a resized copy, it
1372+
will modify your existing Py5Image object. If this isn't what you want, pair
1373+
this method with `Py5Image.copy()`, as shown in the example.
1374+
1375+
To make the image scale proportionally, use 0 as the value for either the `w` or
1376+
`h` parameter.
1377+
1378+
The default resize interpolation mode is `BILINEAR`. Alternatively you can use
1379+
the `interpolation_mode` parameter to interpolate using the `NEAREST_NEIGHBOR`
1380+
method, which is faster but yields lower quality results. You can also use
1381+
`BICUBIC` interpolation, which is the most computationally intensive but looks
1382+
the best, particularly for up-scaling operations.
1383+
"""
1384+
pass
1385+
1386+
def resize(self, *args):
1387+
"""Resize the Py5Image object to a new height and width.
1388+
1389+
Underlying Processing method: PImage.resize
1390+
1391+
Methods
1392+
-------
1393+
1394+
You can use any of the following signatures:
1395+
1396+
* resize(w: int, h: int, /) -> None
1397+
* resize(w: int, h: int, interpolation_mode: int, /) -> None
1398+
1399+
Parameters
1400+
----------
1401+
1402+
h: int
1403+
height to size image to
1404+
1405+
interpolation_mode: int
1406+
interpolation method for resize operation
1407+
1408+
w: int
1409+
width to size image to
1410+
1411+
Notes
1412+
-----
1413+
1414+
Resize the Py5Image object to a new height and width. This will modify the
1415+
Py5Image object in place, meaning that rather than returning a resized copy, it
1416+
will modify your existing Py5Image object. If this isn't what you want, pair
1417+
this method with `Py5Image.copy()`, as shown in the example.
1418+
1419+
To make the image scale proportionally, use 0 as the value for either the `w` or
1420+
`h` parameter.
1421+
1422+
The default resize interpolation mode is `BILINEAR`. Alternatively you can use
1423+
the `interpolation_mode` parameter to interpolate using the `NEAREST_NEIGHBOR`
1424+
method, which is faster but yields lower quality results. You can also use
1425+
`BICUBIC` interpolation, which is the most computationally intensive but looks
1426+
the best, particularly for up-scaling operations.
1427+
"""
1428+
return self._instance.resize(*args)
1429+
12731430
@overload
12741431
def set_pixels(self, x: int, y: int, c: int, /) -> None:
12751432
"""Changes the color of any pixel or writes an image directly into the Py5Image

py5/jars/core.jar

432 Bytes
Binary file not shown.

py5/jars/dxf/dxf.jar

0 Bytes
Binary file not shown.

py5/jars/pdf/pdf.jar

0 Bytes
Binary file not shown.

py5/jars/py5.jar

-11 Bytes
Binary file not shown.

py5/jars/svg/svg.jar

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)