This answer applies to both "Richie Bab A. Boyboy" and " Vill�n
Pizarro":

The answer you are looking for lies most probably in using a Servlet
combined with the Java Advanced Imaging (JAI), available from
java.sun.com.

There are codecs to produce JPEGs and other formats, however if you are
looking to output GIF, the freeware code by ACME is recommended.

In terms of adding shapes to images, this can be easily done, the
procedure would be as follows.

                // Get existing image
                URL theURL = new URL("http://path.to/your/image.gif";);
                RenderedImage image = JAI.create("url",theURL);
            PlanarImage planImage = (PlanarImage)image;
                BufferedImage buffImage =
planImage.getAsBufferedImage();
    
                // Create a new graphics object
                Graphics graphics = buffImage.getGraphics();
                graphics.drawImage(buffImage, 0, 0, null);
                
                // Draw a rectangle on the image
                graphics.drawRect(0, 0, 10, 10);

                // Send to browser
                out = response.getOutputStream();
                response.setContentType("image/gif");
                GifEncoder encoder; // Use the ACME GifEncoder
                encoder = new GifEncoder(buffImage, out);
                encoder.encode();
                out.flush();

Hope this helps,

Regards,
Peter Dolukhanov
                
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]] On Behalf Of Vill�n Pizarro
Sent: 30 April 2002 13:33
To: [EMAIL PROTECTED]
Subject: Any idea of how to draw a line or a square on top of an image?

Hello everyone:

I have an image in a page, and I need to paint a square (or 4 lines )on
top of it depending of certain parameters, to represent a selected area.

Any idea of how can I do this? Or how can jsp help to do this?

Thanks a lot,

Julia


-----------------------------------------------------------------
Este correo electr�nico y, en su caso, cualquier fichero anexo al mismo,
contiene informaci�n de car�cter confidencial exclusivamente dirigida a
su destinatario o destinatarios. Queda prohibida su divulgaci�n, copia o
distribuci�n a terceros sin la previa autorizaci�n escrita de Indra. En
el caso de haber recibido este correo electr�nico por error, se ruega
notif�quese inmediatamente esta circunstancia mediante reenv�o a la
direcci�n electr�nica del remitente.
-----------------------------------------------------------------
The information in this e-mail and in any attachments is confidential
and solely for the attention and use of the named addressee(s). You are
hereby notified that any dissemination, distribution or copy of this
communication is prohibited without the prior written consent of Indra.
If you have received this communication in error, please, notify the
sender by reply e-mail.
-----------------------------------------------------------------

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

==========================================================================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