zoukankan      html  css  js  c++  java
  • IO水印文字效果

    import java.awt.Color;
    import java.awt.Font;
    import java.awt.Graphics;
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.io.IOException;
    import java.util.Random;
    import javax.imageio.ImageIO;
    public class Meinv {
     public static void main(String[] args) throws IOException {
      String src = "D:\Demo\op";
      String dst = "D:\Demo\op\ting3";
      BufferedImage s = ImageIO.read(new File (src));
    int width = s.getWidth();
    int height = s.getHeight();
    BufferedImage black = new BufferedImage(width, height,10);
    black.getGraphics().drawImage(s, 0, 0, width, height,null );
    BufferedImage i = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);
    Graphics g = i .getGraphics();
    g.drawImage(black,0,0,width,height,null);
    Random rand = new Random();
    g.setColor(new Color(rand.nextInt(255),rand.nextInt(255),rand.nextInt(255)));
    g.fillRect(0, 0, width, height);

    g.setColor(new Color(255,255,255,120));
    g.setFont(new Font("",Font.BOLD,40));
    int x= width - 200;
    int y = height -40;
    g.drawString("王昭君",x,y);
     }
    }
  • 相关阅读:
    USACO 3.3 A Game
    USACO 3.3 Camelot
    USACO 3.3 Shopping Offers
    USACO 3.3 TEXT Eulerian Tour中的Cows on Parade一点理解
    USACO 3.3 Riding the Fences
    USACO 3.2 Magic Squares
    USACO 3.2 Stringsobits
    USACO 3.2 Factorials
    USACO 3.2 Contact
    USACO 3.1 Humble Numbers
  • 原文地址:https://www.cnblogs.com/wangqianbao/p/13088796.html
Copyright © 2011-2022 走看看