Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javaͼƬ´¦Àí ÎÄ×Öˮӡ ͼƬˮӡ Ëõ·Å ²¹°×

 ×ª×Ô http://www.javaeye.com/topic/309457
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
/**
* @author Eric Xu
*
*/
public final class ImageUtils {
/**
* ͼƬˮӡ
* @param pressImg ˮӡͼƬ
* @param targetImg Ä¿±êͼƬ
* @param x ÐÞÕýÖµ ĬÈÏÔÚÖмä
* @param y ÐÞÕýÖµ ĬÈÏÔÚÖмä
* @param alpha ͸Ã÷¶È
*/
public final static void pressImage(String pressImg, String targetImg, int x, int y, float alpha) {
try {
File img = new File(targetImg);
Image src = ImageIO.read(img);
int wideth = src.getWidth(null);
int height = src.getHeight(null);
BufferedImage image = new BufferedImage(wideth, height, BufferedImage.TYPE_INT_RGB);
Graphics2D g = image.createGraphics();
g.drawImage(src, 0, 0, wideth, height, null);
//ˮӡÎļþ
Image src_biao = ImageIO.read(new File(pressImg));
int wideth_biao = src_biao.getWidth(null);
int height_biao = src_biao.getHeight(null);
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha));
g.drawImage(src_biao, (wideth - wideth_biao) / 2, (height - height_biao) / 2, wideth_biao, height_biao, null);
//ˮӡÎļþ½áÊø
g.dispose();
ImageIO.write((BufferedImage) image, "jpg", img);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* ÎÄ×Öˮӡ
* @param pressText ˮӡÎÄ×Ö
* @param targetImg Ä¿±êͼƬ
* @param fontName ×ÖÌåÃû³Æ
* @param fontStyle ×ÖÌåÑùʽ
* @param color ×ÖÌåÑÕÉ«
* @param fontSize ×ÖÌå´óС
* @param x ÐÞÕýÖµ
* @param y ÐÞÕýÖµ
* @param alpha ͸Ã÷¶È
*/
public static void pressText(String pressText, String targetImg, String fontName, int fontStyle, Color color, int fontSize, int x, int y, float alpha)


Ïà¹ØÎĵµ£º

javaÖÐorg.apache.commons.digesterÀàÓ÷¨

xmlÎļþÄÚÈÝ£º
 <?xml version="1.0" encoding="UTF-8"?>
<channels>
<channel switchTime="20080101000101" k="1.07" n="6" s="55" channelId="0404" channelName="xxxx.xxxx.xxx.cn"/>
<channel switchTime="20080301010101" k="1.07" n="6" s="55" channelId="0405" channelName="xxx ......

JavaÖз½·¨ÃüÃû¾­Ñé

JavaÖз½·¨ÃüÃûÒ»°ãÊÇ£º¶¯´Ê/¶¯´ÊÐÔ´Ê×飬Ê××ÖĸСд£¬Öм䵥´ÊµÄÊ××Öĸ´óд£¬ÆäËü×ÖĸСд¡£
¾¡Á¿Ó¦Óüòµ¥µÄ¡¢³£Óõĵ¥´Ê£¬Ê¾Àý:
get/set                          first/last
add/remove& ......

Java±ÊÊÔÌâ

ΪÁËÓ¦¸¶2009Äê11ÔÂ8ºÅ¹ã¶«µçÍøµÄ±ÊÊÔÌâÄ¿£¬ÌصØÕÒµ½Ò»ÆªJava±ÊÊÔÌâÄ¿(http://blog.csdn.net/yexianyi/archive/2009/04/25/4123350.aspx)£¬ÏÖÖØÐÂ×ªÔØÊ¹Óá£
Java±ÊÊÔÌ⼯½õ
1.MVCµÄ¸÷¸ö²¿·Ö¶¼ÓÐÄÇЩ¼¼ÊõÀ´ÊµÏÖ?ÈçºÎʵÏÖ?
´ð£ºMVCÊÇModel£­View£­ControllerµÄ¼òд¡£"Model" ´ú±íµÄÊÇÓ¦ÓõÄÒµÎñÂß¼­£¨Í¨¹ýJavaBean£¬EJB× ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ