圣诞快乐!

释放双眼,带上耳机,听听看~!

圣诞节要到了,作为程序员当然要用代码来庆祝一下~

圣诞快乐!

废话不多说直接上代码:

     BufferedImage image = new BufferedImage(150, 40, BufferedImage.TYPE_INT_ARGB);
        Graphics2D g = image.createGraphics();
        g.setFont(new Font("华文新魏", Font.BOLD, 20));
        g.drawString("圣诞快乐", 2, image.getHeight() - 10);
        int[] p = image.getRGB(0, 0, image.getWidth(), image.getHeight(), new int[image.getWidth() * image.getHeight()],
                0, image.getWidth());
        char[] cs = { '圣', '诞', '快', '乐' };
        int ics = 0;
        for (int i = 0; i < image.getHeight(); i++) {
            for (int j = 0; j < image.getWidth(); j++) {
                int off = i * image.getWidth() + j;
                if (p[off] != 0) {
                    System.out.print(cs[ics]);
                    ics = (ics + 1) % 4;
                } else {
                    System.out.print(" ");
                }
                if (j == image.getWidth() - 1) {
                    System.out.println();
                }
            }
        }
实验室

使用 Stream API 高逼格 优化 Java 代码!

2021-11-18 10:53:40

实验室

电视频道播放器 IPTV v6.2.5

2022-12-31 10:32:07

版权声明 1 本网站名称:怀特博客
2 本站永久网址:https://www.ylesb.com
3 本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请联系站长QQ466534434进行删除处理。
4 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
5 本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
6 本站资源大多存储在云盘,如发现链接失效,请联系我们我们会第一时间更新。
阿里云WordPress

Optimized by WPJAM Basic