[Perl]通过GD模块获取字符/汉字的点阵
示例脚本应保存为utf8格式
Code: [全选] [展开/收缩] [Download] (Untitled.pl)
use GD;
use utf8;
my $gd = GD::Image->new(40, 20); #1
my $black = $gd->colorAllocate( 0, 0, 0);
my $white = $gd->colorAllocate(255, 255, 255);
$gd->stringTTF($white, "C:\\windows\\fonts\\msyh.ttf", 20, 0, 0, 20, "中");
my $dt = $gd->wbmp( $black );
my @dts = map { ord($_) } split('', $dt);
for my $e (4 .. $#dts)
{
printf "%08b", $dts[$e];
if (($e-4+1) % 5 == 0 )
{
print "\n";
}
}
0000000000001100000000000000000000000000
0000000000001100000000000000000000000000
0000000000001100000000000000000000000000
0011111111111111111111111000000000000000
0011111111111111111111111000000000000000
0011000000001100000000011000000000000000
0011000000001100000000011000000000000000
0011000000001100000000011000000000000000
0011000000001100000000011000000000000000
0011000000001100000000011000000000000000
0011000000001100000000011000000000000000
0011000000001100000000011000000000000000
0011111111111111111111111000000000000000
0011111111111111111111111000000000000000
0011000000001100000000011000000000000000
0000000000001100000000000000000000000000
0000000000001100000000000000000000000000
0000000000001100000000000000000000000000
0000000000001100000000000000000000000000
0000000000001100000000000000000000000000
再来个
.
****
*****
*******
************
****************
* *********** ***
*** * ************ *****
*** *** * ************** *****
***** **** * *************** *******
**** ******* ** * ***** ********
**** ******** *** *** *********
***** ********** ** *********
**** *********** ** ********
*** ************* *** *******
******** **** *** ********
******** **** **** ***********
******** **** **** ******* ****
**** ** *** **** ****** ****
** *** **** **** *****
** **** **** *** ****
** ** *** *** * ****
** ** *** ** *******
*** * **** ** ******
**** ** *** *** *****
**** ************** *** ******
**** * *********** *******
*** * ********* **********
*** ** ********* ************
** * ********** **************
** * ************** *****************
** ** ***** ********** ********* ********
** ** ***** ********** ********* *******
** ** ****** ********* ******** ****
** *** ********** ******** ******* **
** *** ******* ******* ***** **
* *** ** ****** **** **
* *** **** *** **
***** **** * ***
**** * ***
[Perl]通过GD模块获取字符/汉字的点阵的更多相关文章
- MySQL通过函数获取字符串汉字拼音首字母大写字符串
DELIMITER $$ DROP FUNCTION IF EXISTS `Fun_GetPY`$$ CREATE FUNCTION `HIS`.`Fun_GetPY` (in_string VARC ...
- Swift3.0语言教程获取字符
Swift3.0语言教程获取字符 Swift3.0语言教程获取字符,在字符串中获取某一下标位置(下标索引)处的字符是很常见的功能,在NSString中使用character(at:)方法实现,其语法形 ...
- C#获取字符首字母
///<summary> /// 获取字符首字母 /// </summary> public static string GetPyChar(string c) { if (s ...
- 获取字符宽度:并非自适应。coretext去计算
获取字符宽度:并非自适应.coretext去计算 UniChar ch = [ns_str characterAtIndex:0]; CGGlyph glyph = 0; CTFontGetGlyph ...
- lastIndexOf方法——获取字符最后的索引
1.2.20 lastIndexOf方法——获取字符最后的索引 2013-08-29 14:55:18 我来说两句 收藏 我要投稿 本文所属图书 > Java程序开发参考手册 ...
- javascript 获取字符递增
比如A->B,AA->AB,Z->AA 参考https://blog.csdn.net/xiaotao2004/article/details/75096607 C#版本,改写为ja ...
- python封装configparser模块获取conf.ini值(优化版)
昨天晚上封装了configparser模块,是根据keyname获取的value.python封装configparser模块获取conf.ini值 我原本是想通过config.ini文件中的sect ...
- python使用wmi模块获取windows下的系统信息监控系统-乾颐堂
Python用WMI模块获取Windows系统的硬件信息:硬盘分区.使用情况,内存大小,CPU型号,当前运行的进程,自启动程序及位置,系统的版本等信息. 本文实例讲述了python使用wmi模块获取w ...
- perl HTML::LinkExtor模块(1)
use LWP::Simple; use HTML::LinkExtor; $html = get("http://www.baidu.com"); $link = HTML::L ...
随机推荐
- flutter 交互提示方式
交互提示方式dialog和snackbar 首先看看dialog的方式 new PopupMenuButton( icon: new Icon(Icons.phone_iphone, color: C ...
- Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration
在Apache的配置文件 httpd.conf 中开启 LoadModule headers_module modules/mod_headers.so 即可解决这个问题.
- Kafka源码分析
本文主要针对于Kafka的源码进行分析,版本为kafka-0.8.2.1. 由于时间有限,可能更新比较慢... Kafka.scala // 读取配置文件 val props = Utils.load ...
- delete属性
- OC中数组排序总结
过完节回来,感觉很多东西都生疏了.总结一下数组的排序.应该不会太完美,后续添加补充. OC中的数组排序方法其实不太多,要根据不同的使用场景来使用不同的方法.Foundation框架中一般用到一下几个方 ...
- Red Hat Cluster Suite 组件 fencing FAQ
说明 Red Hat Cluster实现HA的关键组件之一是fencing.没有设置fencing,虽然看上去也能够运行Cluster,但是一旦遇到故障切换就会出现异 常,所以深入理解fencing原 ...
- C++ 重载操作符- 02 重载输入输出操作符
重载输入输出操作符 本篇博客主要介绍两个操作符重载.一个是 <<(输出操作符).一个是 >> (输入操作符) 现在就使用实例来学习:如何重载输入和输出操作符. #include ...
- Linux hostname主机名配置文件与文件 /etc/hosts解析(copy来的,原作者看到了别打我)
1.关于/etc/host,主机名和IP配置文件 Hosts - The static table lookup for host name(主机名查询静态表) hosts文件是Linux系统中一个负 ...
- cannot find -lf2c
sudo apt-get install libf2c2 auso apt-get install libf2c2-dev
- catkin地址
Source: git https://github.com/ros/catkin.git (branch: kinetic-devel)