中文显示的另一种点阵转换工具
(其实是线阵)用记事本保存在另存为"PicZipper.frm"
VERSION 5.00
Begin VB.Form PicZipper
BorderStyle = 1 'Fixed Single
Caption = "图片压缩"
ClientHeight = 1800
ClientLeft = 45
ClientTop = 390
ClientWidth = 2340
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1800
ScaleWidth = 2340
StartUpPosition = 3 '窗口缺省
Begin VB.PictureBox Picture4
AutoRedraw = -1 'True
DrawWidth = 3
Height = 855
Left = 1440
ScaleHeight = 14.023
ScaleMode = 6 'Millimeter
ScaleWidth = 14.023
TabIndex = 7
Top = 0
Width = 855
End
Begin VB.PictureBox Picture3
AutoRedraw = -1 'True
DrawWidth = 3
Height = 855
Left = 480
ScaleHeight = 14.023
ScaleMode = 6 'Millimeter
ScaleWidth = 14.023
TabIndex = 6
Top = 0
Width = 855
End
Begin VB.CommandButton Command3
Caption = "输入"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1320
TabIndex = 5
Top = 1440
Width = 495
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Left = 0
TabIndex = 4
Text = "Text1"
Top = 1440
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "重现"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 960
TabIndex = 3
Top = 960
Width = 855
End
Begin VB.CommandButton Command1
Caption = "压缩"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 0
TabIndex = 2
Top = 960
Width = 855
End
Begin VB.PictureBox Picture2
AutoRedraw = -1 'True
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 0
ScaleHeight = 21
ScaleMode = 3 'Pixel
ScaleWidth = 21
TabIndex = 1
Top = 480
Width = 375
End
Begin VB.PictureBox Picture1
AutoRedraw = -1 'True
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 0
ScaleHeight = 21
ScaleMode = 3 'Pixel
ScaleWidth = 21
TabIndex = 0
Top = 0
Width = 375
End
End
Attribute VB_Name = "PicZipper"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim F(-10 To 23, -10 To 23) As Boolean
Dim F2(-10 To 23, -10 To 23) As Boolean
Dim a(1 To 1000, 1 To 4) As Integer, LoA As Integer
Dim T(1 To 8, 1 To 2) As Integer
Private Sub Command1_Click()
Dim I As Integer, J As Integer, Tc As Integer, L As Integer
Dim Flag As Boolean, MaxL As Integer, cL As Integer
Dim aI As Integer, aJ As Integer, aT As Integer, aL As Integer
Dim C As Integer
Debug.Print "Begin Character=", Text1
Debug.Print " I", " J", " T", " L"
Command3_Click
For I = 1 To 12
For J = 1 To 12
If Picture1.Point(I - 1, J - 1) = vbBlack Then
F(I, J) = True
Else
F(I, J) = False
End If
F2(I, J) = F(I, J)
If F(I, J) Then Picture3.PSet (I, J)
Next J
Next I
LoA = 0
Do
MaxL = 0
For I = 1 To 12
For J = 1 To 12
For Tc = 1 To 8
cL = 13
Do
L = 0: Flag = True: cL = cL - 1
For C = 0 To cL - 1
If Not F(I + C * T(Tc, 1), J + C * T(Tc, 2)) Then
Flag = False
Exit For
End If
If F2(I + C * T(Tc, 1), J + C * T(Tc, 2)) Then L = L + 1
Next C
Loop Until Flag Or (cL = 1)
If (L > MaxL) And Flag Then
MaxL = L: aI = I: aJ = J: aT = Tc: aL = cL
End If
Next Tc
Next J
Next I
If MaxL > 0 Then
LoA = LoA + 1
a(LoA, 1) = aI
a(LoA, 2) = aJ
a(LoA, 3) = aT
a(LoA, 4) = aL
For C = 0 To aL - 1
F2(aI + C * T(aT, 1), aJ + C * T(aT, 2)) = False
Next C
Debug.Print a(LoA, 1), a(LoA, 2), a(LoA, 3), a(LoA, 4)
End If
Loop Until MaxL = 0
Debug.Print "End LoA=", LoA
End Sub
Private Sub Command2_Click()
Dim I As Integer
Picture2.Cls
Picture4.Cls
For I = 1 To LoA
Picture2.Line (a(I, 1), a(I, 2))-(a(I, 1) + T(a(I, 3), 1) * a(I, 4), a(I, 2) + T(a(I, 3), 2) * a(I, 4))
Picture4.Line (a(I, 1), a(I, 2))-(a(I, 1) + T(a(I, 3), 1) * a(I, 4), a(I, 2) + T(a(I, 3), 2) * a(I, 4))
Next I
End Sub
Private Sub Command3_Click()
Picture1.Cls
Picture1.Print Text1
Picture3.Cls
End Sub
Private Sub Form_Load()
Dim I As Integer, J As Integer
T(1, 1) = -1: T(2, 1) = -1: T(3, 1) = -1
T(1, 2) = -1: T(2, 2) = 0: T(3, 2) = 1
T(4, 1) = 0: T(5, 1) = 0
T(4, 2) = -1: T(5, 2) = 1
T(6, 1) = 1: T(7, 1) = 1: T(8, 1) = 1
T(6, 2) = -1: T(7, 2) = 0: T(8, 2) = 1
For I = -10 To 23
For J = -10 To 23
F(I, J) = False
F2(I, J) = False
Next J
Next I
End Sub
这种方法是用贪心算法尽量将画点转化为画线
虽然占用的存储空间多一些且存储每条线的四元数组中有3个都是淡疼的1~12(没法每个数位存一个)
但是,
毕竟,
图形机画一条线比画几个点快嘛!!
casiokingdom上的程序都是画线的!!! so long! 怎么编成了工程软件? 请某人贴各常用字符表,我来写转换后的List1,大约10000项左右 见http://docs.google.com/leaf?id=0B3hqe_a3A01dOWY4NWZkZjMtZjA3OC00N2I3LThiOTEtYjZjYzE1NTcxOTM4&sort=name&layout=list&num=50 计算了一下,list中一项要10byte,而用贪污算法(大数加小数减大数得精度)得知一项可存储3条线(精度12^4^3)
于是分30000byte给字模,一共3000项,9000条线。
【平均】一个字顶多9条线,于是可以存储1000字。
而贪污算法得一项可以存储4个{1..1000},于是剩20000byte,2000项,只能存8000字,只有一章。。。 有4000左右的字体库就能拿下大部分文章了 我用的是9750,看你们玩好了(内存太小) 我也是9750
64K字模应该够,但是存长篇小说不够。
有9860的storage memory1.5m就好了
军训好了继续研究。。。 我也是9750
64K字模应该够,但是存长篇小说不够。
有9860的storage memory1.5m就好了
军训好了继续研究。。。
GWHBOB 发表于 2010-8-21 13:30 http://www.cncalc.org/images/common/back.gif能否提供exe格式的程序,frm打不开呀若9860在GIA中可读SD就没问题了 ls,没用的,因为程序里不提供数据输出,建议LZ修改 我也是9750
64K字模应该够,但是存长篇小说不够。
有9860的storage memory1.5m就好了
军训好了继续研究。。。
GWHBOB 发表于 2010-8-21 13:30 http://www.cncalc.org/images/common/back.gif我也是9750
64K如果全部存入的话,512个字1KB
总共可以存512*64等于
....等于
等于等于
等于多少啊
等于32768字
这么少。。 我也是9750
64K字模应该够,但是存长篇小说不够。
有9860的storage memory1.5m就好了
军训好了继续研究。。。
GWHBOB 发表于 2010-8-21 13:30 http://www.cncalc.org/images/common/back.gif
这怎么算的??
按LZ提供的方法,每一个汉字占用的空间不同, 首先,字模,教9750如何写字的东西,每个字占用的空间不同。
我可以优化使找字模的o(n)=1
然后,文本,9750背下的课文
别指望9750list的存储效率。
实际操作(ranlist#):100行list=1000byte
(别指望虚数,有虚数后100行=2000byte)
而贪污算法得list一行可存储4个大于0,小于1001的数字
假设我们只有1000个字模,则1byte可存0.4个字,而电脑是0.5个,所以在识字量只有1000的情况下(肯定不认识囧炯冏炅),9750和电脑的存储效率大约相同。
下载 佣兵天下.txt(写得满好的),右键单击,属性,大小,5 110 962 bytes ,合5MB。(winrar压缩后2250kb,谁有空和它比算法?!) 这个存储方法肯定要优化滴!!!!!
在不影响时间复杂度的前提下。
比如,线的开始和结束点需要存储共4个坐标(大于0小于12,贪污得一行可存3组)。可否适当安排线的顺序而使它们只用一个与前一个点的相对坐标储存呢?
当然,这样的话,pc端生成字模的时间复杂度会巨幅增加。。。 现在主要问题是:
我也是9750
64K如果全部存入的话,512个字1KB
总共可以存512*64等于
....等于
等于等于
等于多少啊
等于32768字
这么少。。
看3万字(很乐观了),连一次电脑,
不如打印出来看算啦!! 如果能有个简单快速的LZ类算法实现,就好办了
另:TI的8X+系列内存比较大,只是类B语言速度慢得太恐怖
页:
[1]