Tag Archives: graphics

Swing dashed line performance

Drawing dashed lines in Swing can be surprisingly slow, and worse, the default implementation seems to be sub-optimal.  Of course, for most apps, this isn’t a big deal, but performance-sensitive apps that draw a lot of dashed lines (or draw them often) can suffer. The first thing to optimize is to only draw the portion […]

Unit testing graphics code

I recently worked on a project that involved heavy use of custom graphics.  Specifically, lots of lines.  The code was sufficiently important and complex that it needed to be unit tested.  However, I had never unit tested drawing code before. A simple strategy would be to paint to an image, then compare the result with […]