The fact that it is transient does not solve the problem I
mentioned. What I am saying is that if I render the exact same corner
multiple times (by hitting refresh on my browser 1000 times) then
render(Graphics2D) will get triggered 1000 times and I will have to
repaint it. What I am saying is that I know for a fact when the image
needs to be regenerated and when it should use the cached version and
RenderedDynamicImageResource does not give me the capability to do much
about it. The most I can do is g2d.drawImage(cachedImage) I guess but I
doubt it is as efficient as just giving it the BufferedImage
directly... I don't want to be cloning the image contents on every
rendering if I don't have to.
sorry, but you're wrong.
what is checked into HEAD /does/ solve your problem.
you get one shot to render your image and then it's cached until serialized. see for yourself:
private transient byte[] imageData;
/**
* @return The image data for this dynamic image
*/
protected byte[] getImageData()
{
if (imageData == null)
{
final BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
render((Graphics2D)image.getGraphics());
imageData = toImageData(image);
}
return imageData;
}
to support your need to refresh on-demand, i just added an invalidate() method which clears the transient imageData cache:
/**
* Causes the image to be redrawn the next time its requested.
*/
public void invalidate()
{
imageData = null;
}boy, that was a tough piece of code to write! ;-)
jon
Gili
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
