Dear All,

I am currently trying to develop a servlet which produces a GIF file, it
uses Jimi to get an Image file from an existing GIF file, from here
ideally
a Graphics Object should be created, several Ovals based on arguments
should
be created and the image outputted to the GIF.

Using existing source code I manage to create the servlet which draws
Ovals,
the problem I am having is getting the Jimi Image to the Graphics
Object, as
it appears not to have time to load before the Graphics Object is
created. I
know that if you are using Applets you can use a MediaTracker to wait
for an
Image to load, but as I am not using an Applet I cannot find a way for
the
Image to load properly. If anyone knows a way to solve this problem, I
would
be most grateful. Perhaps my approach is wrong?

I have included a slice of code to show my problem..

Regards,
Peter Dolukhanov

---

public void paint(Graphics graphics, HttpServletRequest request)
    {

        Image image = Jimi.getImage("bigmap.gif", Jimi.VIRTUAL_MEMORY);

       Color transparent = ServletTools.getColorParameter(request,
"transparent", Color.magenta);
        Color background = ServletTools.getColorParameter(request,
"background", Color.yellow);
        Color foreground = ServletTools.getColorParameter(request,
"foreground", Color.black);

        // Get the requested image size
        Dimension imageSize = getImageSize(request);

        // Set the transparent color to magenta
        setTransparentColor(transparent);

        // Draw our pretty picture :-)

        graphics.setColor(transparent);

        graphics.drawImage(image, 0, 0, null); // I don't know what to
do
with the null value here as it needs an ImageObserver

        graphics.fillOval(10, 20, 50, 50);
    }

This extends a GifServlet class which creates an Image, paints on it
using
this method, and then outputs it.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to