With this change, the ratio between view resolution and rendered image resolution is properly taken into account. I also took the chance to improve the class hierarchy so duplicated code is removed.
Fix forEachLayerAtPixel and improve class hierarchy
I like it a lot. Thanks, and please merge