I noticed a bug in the selection extend. If you draw a selection outside of the image the height or width(depends on the direction) will be 0. By the way: Maybe it's useful to have a bitBlt which also applies the selection of the paintdevice, so that you don't have to do this in every tool/filter.