/*** Picture setting fillet *@paramSrcimage *@paramradius *@paramBorder *@parampadding *@return * @throwsIOException*/ Public StaticBufferedImage Setradius (BufferedImage srcimage,intRadiusintBorderintPaddingthrowsioexception{intwidth =srcimage.getwidth (); intHeight =srcimage.getheight (); intCanvaswidth = width + padding * 2; intCanvasheight = height + padding * 2; BufferedImage Image=Newbufferedimage (Canvaswidth, Canvasheight, Bufferedimage.type_int_argb); Graphics2D GS=Image.creategraphics (); Gs.setcomposite (ALPHACOMPOSITE.SRC); Gs.setrenderinghint (renderinghints.key_antialiasing, renderinghints.value_antialias_on); Gs.setcolor (Color.White); Gs.fill (NewRoundrectangle2d.float (0, 0, Canvaswidth, canvasheight, radius, radius)); Gs.setcomposite (Alphacomposite.srcatop); Gs.drawimage (SetClip (srcimage, radius), padding, padding,NULL); if(Border!=0) {gs.setcolor (Color.gray); Gs.setstroke (NewBasicstroke (border)); Gs.drawroundrect (padding, padding, canvaswidth-2 * padding, canvasHeight-2 *padding, radius, radius); } gs.dispose (); returnimage; } /*** Picture setting fillet *@paramSrcimage *@return * @throwsIOException*/ Public StaticBufferedImage Setradius (BufferedImage srcimage)throwsioexception{intRadius = (srcimage.getwidth () + srcimage.getheight ())/6; returnSetradius (Srcimage, RADIUS, 2, 5); } /*** Picture Cut fillet *@paramSrcimage *@paramradius *@return */ Public StaticBufferedImage SetClip (BufferedImage srcimage,intradius) { intwidth =srcimage.getwidth (); intHeight =srcimage.getheight (); BufferedImage Image=Newbufferedimage (width, height, bufferedimage.type_int_argb); Graphics2D GS=Image.creategraphics (); Gs.setrenderinghint (renderinghints.key_antialiasing, renderinghints.value_antialias_on); Gs.setclip (NewRoundrectangle2d.double (0, 0, width, height, radius, radius)); Gs.drawimage (Srcimage,0, 0,NULL); Gs.dispose (); returnimage; }
Java Picture set fillet (set border, narration)