fillPolygon performance versus drawImage
This is probably a naive question...
I need to display a frequently varying rectangles, that can have different size and color. A typical size of an individual rectangle is about 5 by 5 pixels, but there can be up to 100x110 rectangles per display (a typical bitmap display). I need to display it from with a JComponent.
My big question is: what is the fastest way to do it?
I can either loop over the number of rectangles and each time call Graphics.fillRect(), or I can create an image using MemoryImageSource followed by createImage and eventually Graphics.drawImage() function. Which one (or a different method) shall I use?
Also, where can I find information about how Graphics.fillRect() work? Does this
function fills in an array of pixels with one color, and then creates an object
equivalent to an image, so in essence it is the same as calling drawImage?
Or is the mechanism completely different?