java ͸Ã÷ͼƬ
¹ØÓÚJavaÉú³É±³¾°Í¸Ã÷µÄpngͼƬ
×î½üÓõ½Java¶¯Ì¬Éú³É±³¾°Í¸Ã÷µÄͼƬ¹¦ÄÜ£¬´ÓgifºÍpngÖÐÑ¡ÔñÁËpng¸ñʽ£¬¸öÖÐÔµÓɾͲ»ËµÁË£¬ÓÚÊǶ¯ÊÖµ½ÍøÉÏËÑË÷ÓÐÓõĴúÂë¡£ÏÖ°ÑËÑË÷½á¹û×ܽáÈçÏ£º
1. Éú³ÉpngͼƬ
int width = 400;
int height = 300;
// ´´½¨BufferedImage¶ÔÏó
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
// »ñÈ¡Graphics2D
Graphics2D g2d = image.createGraphics();
// »Í¼
g2d.setColor(new Color(255,0,0));
g2d.setStroke(new BasicStroke(1));
g2d.draw
//ÊͷŶÔÏó
g2d.dispose();
// ±£´æÎļþ
ImageIO.write(image, "png", new File("c:/test.png"));
int width = 400;
int height = 300;
// ´´½¨BufferedImage¶ÔÏó
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
// »ñÈ¡Graphics2D
Graphics2D g2d = image.createGraphics();
// »Í¼
g2d.setColor(new Color(255,0,0));
g2d.setStroke(new BasicStroke(1));
g2d.draw
//ÊͷŶÔÏó
g2d.dispose();
// ±£´æÎļþ
ImageIO.write(image, "png", new File("c:/test.png"));
ÕâÖ»ÊÇ»æÖÆͼÐεĴúÂ룬Æä±³¾°ÊǺÚÉ«µÄ£¬ÈçºÎ²ÅÄܱ³¾°Í¸Ã÷ÄØ£¿¼ÌÐøËÑË÷£¬Ã»Óеõ½½á¹û£¬²»¹ýËѳöÒÔÏ´úÂ룬ËüÖ»ÊÇ°Ñ×Ô¼º»æÖƵÄͼÐÎÉèÖÃΪ͸Ã÷»ò°ë͸Ã÷£¬±³¾°²¢²»Í¸Ã÷£¬ÈçÏ£º
2. »æÖÆ°ë͸Ã÷ͼÐÎ
int width = 400;
int height = 300;
// ´´½¨BufferedImage¶ÔÏó
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
// »ñÈ¡Graphics2D
Graphics2D g2d = image.createGraphics();
// ÉèÖÃ͸Ã÷¶È
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1.0f)); // 1.0fΪ͸Ã÷¶È £¬Öµ´Ó0-1.0£¬ÒÀ´Î±äµÃ²»Í¸Ã÷
// »Í¼
Ïà¹ØÎĵµ£º
detachedCriteria.add(Restrictions.or(
Restrictions.like("chengBanDanWeiIds", rForm.getChengBanDanWeiIds()+(char)13, MatchMode.START),
Restrictions.or(
&n ......
Ò»¡¢JavaÔ´Îļþ
1¡¢Ò»¸öJavaÓ¦Óðüº¬Ò»¸ö»ò¶à¸öJavaÔ´Îļþ£¬Ã¿¸öJavaÔ´ÎļþÖ»ÄÜ°üº¬ÏÂÁÐÄÚÈÝ(¿Õ¸ñºÍ×¢ÊͳýÍâ)
l Áã¸ö»òÒ»¸ö°üÉùÃ÷Óï¾ä
l Áã¸ö»ò¶à¸ö°üÒýÈëÓï¾ä
l Áã¸ö»ò¶à¸öÀàÉùÃ÷Óï¾ä
l Áã¸ö»ò¶à¸ö½Ó¿ÚÉùÃ÷
2¡¢Ã¿¸öJavaÔ´Îļþ¿É°üº¬¶à¸öÀà»ò½Ó¿ÚµÄ¶¨Ò壬µ«ÊÇÖÁ¶àÖ»ÓÐÒ»¸öÀà»òÕß½Ó¿ÚÊÇpublicµÄ£¬¶øÇÒJavaÔ´Îļþ±ØÐëÒÔ ......
Flyweight ¶¨Òå:
±ÜÃâ´óÁ¿ÓµÓÐÏàͬÄÚÈݵÄСÀàµÄ¿ªÏú(ÈçºÄ·ÑÄÚ´æ),ʹ´ó¼Ò¹²ÏíÒ»¸öÀà(ÔªÀà).
ÃæÏò¶ÔÏóÓïÑÔµÄÔÔò¾ÍÊÇÒ»Çж¼ÊǶÔÏó,µ«ÊÇÈç¹ûÕæÕýʹÓÃÆðÀ´,ÓÐʱ¶ÔÏóÊý¿ÉÄÜÏԵúÜÅÓ
´ó,±ÈÈç,×Ö´¦ÀíÈí¼þ,Èç¹ûÒÔÿ¸öÎÄ×Ö¶¼×÷Ϊһ¸ö¶ÔÏó,¼¸Ç§¸ö×Ö,¶ÔÏóÊý¾ÍÊǼ¸Ç§,ÎÞÒɺÄ
·ÑÄÚ´æ,ÄÇôÎÒÃÇ»¹ÊÇÒª"Çóͬ´æÒì",ÕÒ³öÕâЩ¶ÔÏóȺµÄ¹²Í¬ ......
ÓÉÓÚJDKÊǹú¼Ê°æµÄ£¬ÔÚ±àÒëµÄʱºò£¬Èç¹ûÎÒÃÇûÓÐÓÃ-encoding²ÎÊýÖ¸¶¨ÎÒÃǵÄJAVAÔ´³ÌÐòµÄ±àÂë¸ñʽ£¬Ôòjavac.exeÊ×ÏÈ»ñµÃÎÒÃDzÙ×÷ϵͳĬÈϲÉÓõıàÂë¸ñʽ£¬Ò²¼´ÔÚ±àÒëjava³ÌÐòʱ£¬ÈôÎÒÃDz»Ö¸¶¨Ô´³ÌÐòÎļþµÄ±àÂë¸ñʽ£¬JDKÊ×ÏÈ»ñµÃ²Ù×÷ϵͳµÄfile.encoding²ÎÊý(Ëü±£´æµÄ¾ÍÊDzÙ×÷ϵͳĬÈϵıàÂë¸ñʽ£¬ÈçWIN2k£¬ËüµÄֵΪGBK)£¬È»º ......
String newStr = new String(oldStr.getBytes(), "UTF-8");
javaÖеÄStringÀàÊÇ°´ÕÕunicode½øÐбàÂëµÄ£¬µ±Ê¹ÓÃString(byte[] bytes, String encoding)¹¹Ôì×Ö·û´®Ê±£¬encodingËùÖ¸µÄÊÇbytesÖеÄÊý¾ÝÊÇ°´ÕÕÄÇÖÖ·½Ê½±àÂëµÄ£¬¶ø²»ÊÇ×îºó²úÉúµÄStringÊÇʲô±àÂ뷽ʽ£¬»»¾ä»°Ëµ£¬ÊÇÈÃϵͳ°ÑbytesÖеÄÊý¾ÝÓÉencoding±à ......