Confused? Who, me? Okay, I confess, graphics are a gaping hole in my Java
knowledge. Here's the working solution I came up with in the end, using a
BufferedDynamicImageResource. I'll have to do some more figuring to see how
to do it with a RenderedDynamicImageResource.
BufferedDynamicImageResource resource = new
BufferedDynamicImageResource();
BufferedImage image;
try {
image = ImageIO.read(((WebApplication)
Application.get()).getServletContext().getResourceAsStream("/WEB-INF/classes/images/image.png"));
Graphics graphics = image.getGraphics();
graphics.drawString(user.getName(), 443, 215);
} catch (IOException ioe) {
// ...
}
resource.setImage(image);
add(new Image("bothCardImage", resource));
Al Maw wrote:
>
> Sounds to me like you're somewhat confused. ;-)
> Load the image from the classpath into a bufferedimage as you would
> outside of Wicket (Foo.class.getResourceAsStream() or whatever it is).
> Draw text, etc. on it as you see fit.
> Display it with Wicket if you want to via a BufferedDynamicImageResource.
>
> If you don't want the overhead of storing the image in the session,
> use a RenderedDynamicImageResource and load the classpath resource
> image in the render method.
>
> These things are always a trade-off between having to do the graphics
> drawing operations every time you render the page, and keeping the
> image hanging around which takes up space. Your choice.
>
> Regards,
>
> Al
>
>
--
View this message in context:
http://www.nabble.com/Wicket-Image--%3E-Java-Image-tp19034138p19164891.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]