JSP implementation drawing

xiaoxiao2021-03-06  72

<% @ page language = "java" contenttype = "image / jpeg; charSet = GB2312"%>

<

% @ page import = "java.util. *, java.awt. *"%>

<

% @ page import = "java.awt.image. *, com.sun.image.codec.jpeg. *"%>

<%

Int width = 600, height = 500;

BufferedImage Image = New BufferedImage (width, height, bufferedimage.type_int_rgb);

Graphics g = image.getgraphics ();

G.SetColor (New Color (236, 233, 216));

g.fillRect (0, 0, Width, Height);

g.setcolor (color.white);

G.fillRect (11,35, width-21, height-47);

g.setcolor (color.ble);

G. DrawRect (10, 34, Width-20, Height-46);

g.dispose ();

ServletOutputStream Sos = response.getOutputStream ();

JPEGIMAGEENCODER Encoder = JPEGCODEC.CREATEJPEGENCODER (SOS);

Encoder.encode (image);

%>

转载请注明原文地址:https://www.9cbs.com/read-92273.html

New Post(0)