nbsp; 182. 183. response.setHeader("Cache-Control", "no-cache"); 184. 185. response.setDateHeader("Expires", 0); 186. 187. response.setContentType("image/jpeg"); 188. 189. int width = 75, height = 20; 190. 191. BufferedImage image = new BufferedImage(width, height, 192. 193. BufferedImage.TYPE_INT_RGB); 194. 195. Graphics g = image.getGraphics(); 196. 197. Random random = new Random(); 198. 199. g.setColor(getRandColor(200, 250)); 200. 201. g.fillRect(1, 1, width - 1, height - 1); 202. 203. g.setColor(new Color(102, 102, 102)); 204. 205. g.drawRect(0, 0, width - 1, height - 1); 206. 207. g.setFont(imgFont); 208. 209. g.setColor(getRandColor(160, 200)); 210. 211. for (int i = 0; i < 155; i++) { 212. 213. int x = random.nextInt(width - 1); 214. 215. int y = random.nextInt(height - 1); 216. 217. int xl = random.nextInt(6) + 1; 218. 219. int yl = random.nextInt(12) + 1; 220. 221. g.drawLine(x, y, x + xl, y + yl); 222. 223. } 224. 225. for (int i = 0; i < 70; i++) { 226. 227. int x = random.nextInt(width - 1); 228. 229. int y = random.nextInt(height - 1); 230. 231. int xl = random.nextInt(12) + 1; 232. 233. int yl = random.nextInt(6) + 1; 234. << 上一页 [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] 下一页
|