diff --git a/doc/api/hubs_ev3brick.inc b/doc/api/hubs_ev3brick.inc index 07421a4..3f47e39 100644 --- a/doc/api/hubs_ev3brick.inc +++ b/doc/api/hubs_ev3brick.inc @@ -47,6 +47,8 @@ .. automethod:: pybricks.hubs::EV3Brick.screen.set_font + .. automethod:: pybricks.hubs::EV3Brick.screen.show_image + .. automethod:: pybricks.hubs::EV3Brick.screen.draw_image .. automethod:: pybricks.hubs::EV3Brick.screen.draw_pixel diff --git a/doc/api/resources.rst b/doc/api/resources.rst index 9feccec..0200fd5 100644 --- a/doc/api/resources.rst +++ b/doc/api/resources.rst @@ -10,9 +10,6 @@ Graphical Images .. autoclass:: pybricks.resources.Image :no-members: - .. automethod:: pybricks.resources.Image.clear - - .. rubric:: Drawing Text There are two ways to draw text on images. :meth:`draw_text` lets text be @@ -55,6 +52,13 @@ Graphical Images .. autoattribute:: pybricks.resources.Image.height + .. rubric:: Replacing the Entire Image + + .. automethod:: pybricks.resources.Image.clear + + .. automethod:: pybricks.resources.Image.show_image + + Fonts ^^^^^ diff --git a/doc/common/conf.py b/doc/common/conf.py index 6569c8e..49f6b61 100644 --- a/doc/common/conf.py +++ b/doc/common/conf.py @@ -288,6 +288,8 @@ def find_obj(self, env, modname, classname, name, type, searchmode=0): if classname == 'screen': if name.startswith('Font.') or name == 'Font': modname = 'pybricks.resources' + elif name.startswith('Image.') or name == 'Image': + modname = 'pybricks.resources' else: classname = 'EV3Brick.screen' elif classname == 'speaker': diff --git a/pybricks-projects b/pybricks-projects index d646e0f..37ca782 160000 --- a/pybricks-projects +++ b/pybricks-projects @@ -1 +1 @@ -Subproject commit d646e0fc4963a38c18ae459e3b77d7a39489733a +Subproject commit 37ca78217fdaf4e8c8d1b1df8384b6ad6604eb7a diff --git a/pybricks/resources.py b/pybricks/resources.py index c287308..bd4ee6b 100644 --- a/pybricks/resources.py +++ b/pybricks/resources.py @@ -114,6 +114,15 @@ class Image: no transparency. """ + def show_image(self, source): + """Clears this image, then draws ``source`` centered in this image. + + Arguments: + source (Image or str): + The source :class:`Image`. If the argument is a string, then + the ``source`` image is loaded from file. + """ + def draw_text(self, x, y, text, color=Color.BLACK): """Draws text on the image.