java实现图片写入高清字体及带边框的方法
程序员文章站
2024-03-04 21:35:18
本文实例讲述了java实现图片写入高清字体及带边框的方法。分享给大家供大家参考。具体实现方法如下:
graphics2d g2=image.creategraph...
本文实例讲述了java实现图片写入高清字体及带边框的方法。分享给大家供大家参考。具体实现方法如下:
graphics2d g2=image.creategraphics(); //g2.setrenderinghint(renderinghints.key_text_antialiasing,renderinghints.value_text_antialias_on); g2.setrenderinghint(renderinghints.key_antialiasing,renderinghints.value_antialias_on); g2.setrenderinghint(renderinghints.key_antialiasing, renderinghints.value_antialias_on); g2.setrenderinghint(renderinghints.key_stroke_control, renderinghints.value_stroke_pure); g2.setrenderinghint(renderinghints.key_color_rendering, renderinghints.value_color_render_quality); //shadowgraphics.setrenderinghint(renderinghints.key_alpha_interpolation, renderinghints.value_alpha_interpolation_quality); fontrendercontext frc = g2.getfontrendercontext(); textlayout tl = new textlayout("网址:", new font("宋体", font.plain,14), frc); shape sha = tl.getoutline(affinetransform.gettranslateinstance(5,25)); g2.setstroke(new basicstroke(3.0f)); g2.setcolor(color.white); g2.draw(sha); g2.setcolor(color.black); g2.fill(sha); g2.dispose();
希望本文所述对大家的java程序设计有所帮助。
下一篇: Java IO 流总结