Skip to content

Commit 7a6020e

Browse files
authored
Merge pull request #406 from keko24/keko24/convert-image-shape-405
Issue #405: Implemented corresponding changes to convert_image and convert_shape.
2 parents 3ed83ce + d1174e3 commit 7a6020e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

py5_resources/py5_module/py5/sketch.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,8 @@ def convert_image(
747747
self, obj: Any, *, dst: Py5Image = None, **kwargs: dict[str, Any]
748748
) -> Py5Image:
749749
"""$class_Sketch_convert_image"""
750+
if isinstance(obj, (Py5Image, Py5Graphics)):
751+
return obj
750752
result = image_conversion._convert(self, obj, **kwargs)
751753
if isinstance(result, (Path, str)):
752754
return self.load_image(result, dst=dst)
@@ -758,6 +760,8 @@ def convert_image(
758760

759761
def convert_shape(self, obj: Any, **kwargs: dict[str, Any]) -> Py5Shape:
760762
"""$class_Sketch_convert_shape"""
763+
if isinstance(obj, Py5Shape):
764+
return obj
761765
return shape_conversion._convert(self, obj, **kwargs)
762766

763767
def load_image(

0 commit comments

Comments
 (0)