java完成圖片寫入高清字體及帶邊框的辦法。本站提示廣大學習愛好者:(java完成圖片寫入高清字體及帶邊框的辦法)文章只能為提供參考,不一定能成為您想要的結果。以下是java完成圖片寫入高清字體及帶邊框的辦法正文
本文實例講述了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法式設計有所贊助。