DrawToImage refactoring

Draw to Image functionality moved in a separate file.
Added DrawToImage sample/test/demo project.