Skip to content

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

Merged
jwiggins merged 3 commits into
masterfrom
fix/kiva-agg-drawimage
Mar 5, 2021
Merged

Accept PIL Image instances in kiva.agg draw_image()#682
jwiggins merged 3 commits into
masterfrom
fix/kiva-agg-drawimage

Conversation

@jwiggins
Copy link
Copy Markdown
Member

@jwiggins jwiggins commented Mar 5, 2021

Fixes #681.

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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