TexturePaint does not play well with large images

The JavaDoc for TexturePaint says "The size of the BufferedImage object should be small because the BufferedImage data is copied by the TexturePaint object."

I took that to be a warning about memory use, shrugged, and went ahead and used it anyway.

What it actually means is that for a 2048x1024 pixel image, TexturePaint is unusably slow. The cost seems to be per-operation, so if all you want is a single fillRect, it's acceptable. If you want to draw lots of lines, as I did today: forget it.

My home-grown code to draw textured horizontal lines using BufferedImage.getRGB and BufferedImage.setRGB can draw 2,000 lines in 0.7s, which isn't the kind of performance you show off about, but it's good enough for my application. Using Graphics.drawLine and a TexturePaint took minutes.

If I halve the size (and quarter the area) of the images I'm using to a size that actually fits on my 1920-pixel wide display, the 912 lines draw in 0.1s, which is as good as I could want.

Anyway, that's sunclock/xsunclock/kworldwatch ported to Java. I can now tell you that everyone I'm in regular contact with is in the dark. If only literally.