Sharpen the patterns.

Draw the patterns with the intended resolution instead of scaling
afterwards. Scaling leads to unclear patterns.

Also:
Make TilingPattern function for paintType switch case.
Make TilingPattern function for bbox clipping.
Make TilingPattern functions for scaling code.
Increase MAX_PATTERN_SIZE to 4096.
Add Singular Value Decomposition function.