Fix white gap between image and border#219
Conversation
|
I have manually verified this on Windows as well. |
|
Can you do a quick test with a checkerboard pattern (i.e. alternating pixels black and white)? The last time I fixed this kind of thing elsewhere, that was a good visual check (ha ha) to determine if I didn't make another fencepost error. The math looks correct, though. |
There was a problem hiding this comment.
Is this true for all GraphicsContexts?
There was a problem hiding this comment.
Empirically, it is true for the GraphicsContextArray. I rooted around the kiva source code to find a definitive answer, but gave up.
There was a problem hiding this comment.
You will need to try other GCs to be sure that this is the right place to do this adjustment. The different backends can behave differently, albeit unintentionally. We have been fighting these off-by-(one/half) issues for a long time.
|
Sorry, I meant that literally every pixel should alternate. Each square should be exactly one pixel. If you got the boundaries correct, then you will not see any aliasing. Otherwise, you will see some neat Moiré effects. |
|
I started going in that direction, but quit because the aliasing was making things difficult. :) I'll try that. |
|
The script I used to generate the data is here. |
|
The Quartz backend was the one I was most concerned with since that is the one that has tended to be off-by-half/one compared to the Agg backend. However, it also looks improved. 👍 |
|
Thanks! |
Fix white gap between image and border
Conflicts: chaco/image_plot.py Hopefully, the changes from PR #219 were integrated correctly.













Fixes #218. I have manually tested this with the 'qt4.image', 'qt4.qpainter', and 'wx.image' backends on OSX.
I seen elsewhere the center-pixel adjustment used here, but I am uncertain about the details of why it is needed. For example, the
ColorBardoes not need this adjustment. (Is there something wrong with thekiva.agg.GraphicsContextArrayused in theImagePlot?)@rkern, would you mind reviewing this?