<jsp:useBean id="zz" scope="session" class="javaside.Rbl.jspImage" /><%
int iW, iH ; // Taille de l image a generer
String sFormat ; // Format (gif/png)
String t = null ;
t = request.getParameter("width") ;
if (t == null)
iW = 300 ;
else
iW = java.lang.Integer.parseInt(t) ;
t = request.getParameter("height") ;
if (t == null)
iH = 250 ;
else
iH = java.lang.Integer.parseInt(t) ;
t = request.getParameter("format") ;
if (t == null)
sFormat = "gif" ;
else
sFormat = t ;
// Initialisation et definition de la taille de l image
zz.init(iW, iH) ;
zz.loadImage("icon.gif", 0) ;
zz.setColor(0xF0F0F0) ;
zz.setFont("Verdana", 1, 22) ;
zz.fillRect(0, 0, 250, 130) ;
zz.setColor(0x4040FF) ;
zz.fillRect(35, 90, 80, 30);
zz.drawImage(0, 140, 25) ;
zz.setColor( 0xFF4040 ) ;
zz.drawOval(135, 90, 80, 30) ;
zz.setColor( 0x40FF40 ) ;
zz.drawOval(165, 105, 80, 30) ;
zz.fillZone(150, 100, 0xA0F0A0);
// zz.fillZone(180, 112, 0xF08080);
zz.setColor(0) ;
zz.drawString("JavaSide.com...", 25, 82) ;
zz.fillZone(90, 80, 0xF08080);
zz.setFont("Serif", 2, 18) ;
zz.drawString("Serif 16", 5, 36) ;
zz.setColor( 0x0000FF ) ;
zz.setFont("Courier", 1, 12 ) ;
zz.drawString( new java.util.Date().toString(), 5, 152) ;
zz.drawImagePart(0, 90, 170, 9, 3, 20, 16) ;
zz.drawImagePart(0, 90, 190, 26, 17, 20, 16) ;
zz.build() ;
response.reset();
response.setContentType("image/" + sFormat );
response.addHeader("Content-Disposition","filename=jspImage." + sFormat);
if (sFormat.equalsIgnoreCase("png"))
response.getOutputStream().write(zz.getImage(1));
else
response.getOutputStream().write(zz.getImage(0));
response.flushBuffer();
zz.clear() ;
%> |
|