Ok that works but now I ran into another problem. The
RenderedDynamicImageResource construct takes width, height arguments.
The problem is that the user can dynamically change the size of my
corners which makes it (yet again) impossible for me to use
RenderedDynamicImageResource. Grrr! I want to use it as much as you
want me to use it but it's not easy :)
Is it possible to remove this limitation and have Image read
the dimensions out of the returned BufferedImage?
Gili
On Thu, 10 Mar 2005 08:50:13 -0800, Jonathan Locke wrote:
>
>> 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
>
-------------------------------------------------------
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