C
Chuck Dillon
If you have an array of N Rectangle2D.Double objects, (where N is
potentially tens of thousands), what's the most efficient way to render
them in a single color?
My application needs to render many rectangles (i.e. thousands). My
graphics experience tells me that in general the most efficient way to
render graphics is the case where you "batch" as much of the operation
as possible. That's probably biased by my X experience where you want
to a few drawlines() calls rather than do a lot of drawline() calls
since there's a commuications channel between your client and the X
server. But IMHO batching primitive calls is a good thing.
Applying this to Java, first I looked for a drawLines or drawShapes
method in Graphics2D and did't see any. So next I thought it should be
more efficient to shove a bunch of Rectangle shapes into a GeneralShape
object and draw(path) in one call than to draw(Rectangle) many times.
But I'm not seeing that to be true. In fact, I seem to be seeing a
pathalogical case where it can take a looong time to render a
GeneralPath with on the order of 32k rectangles in it. (JRE/JDK 1.4.1_01)
Thanks for any advice,
-- ced
potentially tens of thousands), what's the most efficient way to render
them in a single color?
My application needs to render many rectangles (i.e. thousands). My
graphics experience tells me that in general the most efficient way to
render graphics is the case where you "batch" as much of the operation
as possible. That's probably biased by my X experience where you want
to a few drawlines() calls rather than do a lot of drawline() calls
since there's a commuications channel between your client and the X
server. But IMHO batching primitive calls is a good thing.
Applying this to Java, first I looked for a drawLines or drawShapes
method in Graphics2D and did't see any. So next I thought it should be
more efficient to shove a bunch of Rectangle shapes into a GeneralShape
object and draw(path) in one call than to draw(Rectangle) many times.
But I'm not seeing that to be true. In fact, I seem to be seeing a
pathalogical case where it can take a looong time to render a
GeneralPath with on the order of 32k rectangles in it. (JRE/JDK 1.4.1_01)
Thanks for any advice,
-- ced