Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept PIL Image instances in kiva.agg draw_image() #682

Merged
merged 3 commits into from
Mar 5, 2021

Conversation

jwiggins
Copy link
Member

@jwiggins jwiggins commented Mar 5, 2021

Fixes #681.

@@ -37,7 +37,7 @@ def _draw_mainlayer(self, gc, view_bounds=None, mode="default"):
if self.image is None:
return

gc.draw_image(self.image, (0, 0, gc.width(), gc.height()))
gc.draw_image(self.image, (0, 0, self.width, self.height))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This got broken by HiDPI support. The correct approach is to use the component bounds.

Copy link
Contributor

@rahulporuri rahulporuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I tested this locally and I don't see the error on this branch that I saw on the main branch .

@rahulporuri
Copy link
Contributor

test failure -

======================================================================
FAIL: test_bad_image_size (enable.tests.test_kiva_graphics_context.TestGCErrors)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/.edm/envs/enable-test-3.6-null/lib/python3.6/site-packages/enable/tests/test_kiva_graphics_context.py", line 26, in test_bad_image_size
    self.assertRaises(ValueError, gc.draw_image, arr)
AssertionError: ValueError not raised by draw_image

----------------------------------------------------------------------

@jwiggins
Copy link
Member Author

jwiggins commented Mar 5, 2021

Yeah. Didn't realize we were testing for input handling done in SWIG.

@jwiggins jwiggins merged commit 4547990 into master Mar 5, 2021
@jwiggins
Copy link
Member Author

jwiggins commented Mar 5, 2021

Thanks for the review

@jwiggins jwiggins deleted the fix/kiva-agg-drawimage branch March 5, 2021 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kiva image_explorer.py fails on kiva.agg backend
2 participants