package test;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
public class Test {
public static void test() {
BufferedImage image = new BufferedImage(78,20,BufferedImage.TYPE_INT_RGB);
Graphics2D g = image.createGraphics();
g.setFont(new Font("宋体", Font.PLAIN, 16));
g.drawString("我是白痴", 2, image.getHeight() - 2);
int[] p = image.getRGB(0,0,image.getWidth(),image.getHeight(),new int[image.getWidth()*image.getHeight()],0,image.getWidth());
for(int i=0;i
for(int j=0;j
System.out.print(p[i*image.getWidth()+j]==-1?(i%2==0?"*":"*"):" "+(j==image.getWidth()-1?"\n":""));
}
public static void main(String args[]) {
test();
}
}
参考: 用图形符号“*”组合拼出?-CSDN论坛 http://bbs.csdn.net/topics/210039216