Thanks for all your answers, I haven't try anything yet since I've been on a few days vacation, but I'm sure I'll get it by one of the methods. I'll tell you about it.
Pretty cool the grafity wall! Julia -----Mensaje original----- De: Peter Dolukhanov [mailto:[EMAIL PROTECTED]] Enviado el: mi�rcoles, 01 de mayo de 2002 14:50 Para: [EMAIL PROTECTED] Asunto: Re: Any idea of how to draw a line or a square on top of an image? The code should read: // Get existing image URL theURL = new URL("http://path.to/your/image.gif"); BufferedImage buffImage = (PlanarImage)JAI.create("url",theURL).getAsBufferedImage(); // Create a new graphics object Graphics graphics = buffImage.getGraphics(); // 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(); -----Original Message----- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]] On Behalf Of Peter Dolukhanov Sent: 01 May 2002 13:47 To: [EMAIL PROTECTED] Subject: Re: Any idea of how to draw a line or a square on top of an image? 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 ========================= 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 ----------------------------------------------------------------- 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
