-
Notifications
You must be signed in to change notification settings - Fork 4
/
display.pp
2961 lines (2872 loc) · 99.2 KB
/
display.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(**********************************************************************
This file is part of ax_pokl run time library
This unit is similar as unit Graph in Free Pascal run time library
This unit use Windows API GDI+ to create window and draw pictures
Display Unit Copyright (C) 2014 by ax_pokl
See the GNU General Public License for details about the copyright
这个文件是ax_pokl运行时库的一部分
本单元库类似于Free Pascal运行时库中的Graph单元库
本单元库使用Windows API GDI+来创建窗口以及绘制图片
Display单元库版权所有(c)2014年ax_pokl
有关版权的详细信息请参考GNU通用公共许可协议
**********************************************************************
说明概要
更新时间:2017-12-07 07:33:19
下载地址:http://axpokl.com/display.zip
支持各种字符串,字符数组,整型变量的转换。
支持ansistring作为无限长度整型变量进行算术,逻辑,按位运算。
支持任意大小窗口创建。可使用24位RGB真彩色进行绘图。
支持字符串文本输出。可更改字体大小,颜色,粗细等。
支持简单绘图。如:画点,画线,画矩形,画椭圆等。
支持任意类型图片读取;可以剪切,拉伸及绘制到屏幕。
支持文件拖拽以及键盘,鼠标事件的获取和发送。
支持各种类型音频文件播放。可控制音量及快进快退。可同时播放多个音频文件。
支持文件内容快速块状读取。可读取各种不同类型的内容。
**********************************************************************
温馨提示
请使用{$APPTYPE GUI}关闭控制台。关闭后不能使用write和read过程。
请不断使用IsNextMsg();向窗口发送消息防止窗口失去响应。
请不断使用FreshWin();使绘制到屏幕缓冲区的位图生效。
位图的默认背景色为透明色,请在读取位图后自行设置位图的背景色。
**********************************************************************
内联函数
sgn 求符号值
abs 求二范数
max 求最大值
min 求最小值
arcsin 求反正弦
arccos 求反余弦
arctan2 求辐角
字符串转换函数
i2s 整型转十进制字符串
s2pc 十进制字符串串转字符数组指针
s2i 十进制字符串转整型
as2s 字节进制字符串转十进制字符串
s2as 十进制字符串转字节进制字符串
as2pc 字节进制字符串转字符数组指针
pc2as 字符数组指针转字节进制字符串
i2as 整型转字节进制字符串
as2i 字节进制字符串转字节
i2hc 字节转十六进制字符
hc2i 十六进制字符转字节
i2hs 整型转十六进制字符串
hs2i 十六进制字符串转字节
as2hs 字节进制字符串转十六进制字符串
hs2as 十六进制字符串转字节进制字符串
字节字符串运算函数
asrev 倒转字节进制字符串
aslong 填充字节进制字符串开头#0
asshort 删除字节进制字符串开头#0
assame 填充双字节进制字符串开头#0
asadd 字节进制字符串算术加法
assub 字节进制字符串算术减法
asmul 字节进制字符串算术乘法
asdiv 字节进制字符串算术除法
asmod 字节进制字符串算术取模
asinc 字节进制字符串算术增加
asdec 字节进制字符串算术减少
asequ 字节进制字符串逻辑相等
asneq 字节进制字符串逻辑不等
aslss 字节进制字符串逻辑小于
asgtr 字节进制字符串逻辑大于
asleq 字节进制字符串逻辑小于等于
asgeq 字节进制字符串逻辑大于等于
asnot 字节进制字符串按位取反
asand 字节进制字符串按位与
asor 字节进制字符串按位或
asxor 字节进制字符串按位异或
asshl 字节进制字符串按位左移
asrol 字节进制字符串按位循环左移
asshr 字节进制字符串按位右移
asror 字节进制字符串按位循环右移
控制函数
NewThread 新线程
PauseThread 暂停线程
ResumeThread 继续线程
StopThread 停止线程
MsgBox 弹出窗口
Delay 等待时间
Sound 扬声器发音
FreshFPS 刷新刷新率
GetFPSL 获取瞬时刷新率
GetFPSR 获取平均刷新率
GetFPS 获取平均刷新率
GetError 获取错误代码
窗口屏幕函数
CreateWin 显示窗口
FreshWin 刷新窗口
CloseWin 关闭窗口
IsWin 判断窗口状态
GetTime 获取窗口建立时间
SetTitle 设置窗口标题
GetTitle 获取窗口标题
SetSize 设置窗口大小
GetWidth 获取窗口宽度
GetHeight 获取窗口高度
GetScrWidth 获取屏幕宽度
GetScrHeight 获取屏幕高度
SetPos 设置窗口位置
GetPosX 获取窗口横坐标
GetPosY 获取窗口纵坐标
GetBorderTitle 获取窗口边标题框高度
GetBorderWidth 获取窗口边框宽度
GetBorderHeight 获取窗口边框高度
GetWin 获取窗口绘图位图
GetScr 获取窗口实时位图
GetHwnd 获取窗口窗口句柄
GetDraw 获取窗口绘图句柄
颜色函数
GetBGColor 获取窗口背景颜色
SetBGColor 设置窗口背景颜色
GetFGColor 获取窗口前景颜色
SetFGColor 设置窗口前景颜色
颜色函数
SetPenWidth 设置画笔宽度
SetPenColor 设置画笔颜色
SetBrushColor 设置画刷颜色
GetAlpha 获取RGBA透明分量
GetBlue 获取RGBA蓝色分量
GetGreen 获取RGBA绿色分量
GetRed 获取RGBA红色分量
GetRGBA 拼接RGBA颜色
GetRGB 拼接RGB颜色
Byte2Long 字节型拼接长整型
Long2Byte 长整型拆分字节型
Double2Long 双浮点拼接长整型
Long2Double 长整型拆分双浮点
RGB2HSL 红绿蓝转色饱亮
RGB2HSV 红绿蓝转色饱明
RGB2HSI 红绿蓝转色饱强
RGB2HSN 红绿蓝转色饱长
HSL2RGB 色饱亮转红绿蓝
HSV2RGB 色饱明转红绿蓝
HSI2RGB 色饱强转红绿蓝
HSN2RGB 色饱长转红绿蓝
MixColor 混合RGB颜色
字体文本函数
SetFont 将字体选入位图
SetFontWidth 设置字体宽度
SetFontHeight 设置字体长度
SetFontSize 设置字体大小
SetFontWeight 设置字体粗体
SetFontLtalic 设置字体斜体
SetFontUnderLine 设置字体下划线
SetFontStrikeOut 设置字体删除线
SetFontCharSet 设置字体字符集
SetFontName 设置字体名称
GetStringSize 获取文本大小
GetStringWidth 获取文本宽度
GetStringHeight 获取文本高度
DrawText 输出文本活动宽度
DrawTextln 输出文本行活动宽度
DrawTextw 输出文本固定宽度
DrawTextlnw 输出文本行固定宽度
绘图函数
GetPixel 获取点
SetPixel 设置点
GetBBPixel 获取缓存点
SetBBPixel 设置缓存点
Line 画线
LineBB 画缓存线
Bar 画方
Clear 清屏
Triangle 画三角
Arc 画弧
Pie 画饼
Chord 画半圆
Ellipse 画椭圆
Circle 画圆
位图函数
CreateBMP 创建位图
ReleaseBMP 释放位图
LoadBMP 读取位图
SaveBMP 保存位图
DrawBMP 绘制位图
MixBMP 混合位图
BlurBMPBox 模糊位图均值
BlurBMPGau 模糊位图高斯
CreateBB 创建位图缓存
ReleaseBB 释放位图缓存
GetBB 获取位图缓存
SetBB 设置位图缓存
MixBB 混合位图缓存
BlurBBBox 模糊位图缓存均值
BlurBBGau 模糊位图缓存高斯
鼠标键盘函数
PreesKey 按下键盘按键
DownKey 按住键盘按键
UpKey 弹起键盘按键
PreesMouse 按下鼠标按键
DownMouse 按住鼠标按键
UpMouse 弹起鼠标按键
WheelMouse 滚动鼠标滚轮
MoveMouse 移动鼠标相对
MoveMouseAbs 移动鼠标绝对
MoveMouseWin 移动鼠标窗口
MoveMousePos 移动鼠标绘图
消息函数
SendMsg 发送消息给窗口
IsNextMsg 尝试取新消息
GetNextMsg 获取新消息
WaitNextMsg 等待新消息
IsMsg 判断消息号
GetMsg 获取消息参数
WaitMsg 等待消息参数
IsKey 判断键盘按键
GetKey 获取键盘按键
WaitKey 等待键盘按键
IsMouse 判断鼠标按键
GetMouse 获取鼠标按键
WaitMouse 等待鼠标按键
IsMouseWheel 判断鼠标滚轮按键
WaitMouseWheel 等待鼠标滚轮按键
IsMouseMove 判断鼠标移动
GetMouseMove 获取鼠标移动
WaitMouseMove 等待鼠标移动
IsDropFile 判断拖拽文件
WaitDropFile 等待拖拽文件
GetDropFile 获取拖拽文件
GetMouseAbsX|Y 获取鼠标绝对位置
GetMouseWinX|Y 获取鼠标窗口位置
GetMousePosX|Y 获取鼠标绘图位置
音频函数
LoadAudio 读取音频
PlayAudio 开始播放
StopAudio 停止播放
PauseAudio 暂停播放
ResumeAudio 继续播放
GetAudioVol 获取音量
SetAudioVol 设置音量
GetAudioPos 获取位置
SetAudioPos 设置位置
GetAudioLen 获取长度
文件函数
IsFile 判断文件存在
NewFile 创建文件
NewDir 创建文件夹
CopyFile 复制文件
MoveFile 移动文件
DeleteFile 删除文件
OpenFile 打开文件
CloseFile 关闭文件
GetFileLen 获取文件长度
GetFilePos 获取文件位置
SetFilePos 设置文件位置
GetByte 读取字节
GetWord 读取字
GetLongword 读取双字
GetWord64 读取四字
GetWord128 读取八字
GetWord256 读取十六字
GetInteger 读取不定长整数
GetPchar 读取字符数组
GetString 读取字节字符串
**********************************************************************
参数 说明 类型 说明
x 左坐标 longword
y 上坐标 longword
w 宽度 longword
h 高度 longword
c 颜色 longword AGBR(透明+蓝绿红)
cbg 背景颜色 longword 画刷颜色
cfg 前景颜色 longword 画笔颜色
pos 位置 longword x*$10000+y
r 半径 longword
a 角度|弧度 word|double double=word/360*2*pi
s 字符串 ansistring pchar=@s[1]
k 键盘按键 byte 详见key.inc
m 鼠标按键 byte 详见key.inc
t 时间 longword|double double=longword/1000
hz 频率 longword
b 位图 pbitmap 详见type
v 音量 longword 0到1000
i 整数 longword或其它 可能是数组
as 字符串 ansistring
c 字符 char
pc 字符指针 pchar ^char[]
th 线程号码 longword
id 音频号码 longword
**********************************************************************)
unit Display;
interface // 接口
uses Windows;
// Type 数据类型
type bitmap=record //位图类型
Handle:longword; //位图句柄
DC:longword; //位图屏幕
Width:longword; //位图宽度
Height:longword; //位图长度
Color:longword; //位图背景颜色
end;
type pbitmap=^bitmap; //位图指针
type bitbuf=record //位图缓存类型
bmi:BITMAPINFO; //位图缓存位图信息
len:longword; //位图缓存长度
buf:Pointer; //位图缓存
bmp:pbitmap; //位图缓存位图指针
end;
type pbitbuf=^bitbuf; //位图缓存指针
type word64=array[1..2]of longword;//四字类型
type word128=array[1..4]of longword;//八字类型
type word256=array[1..8]of longword;//十六字类型
type TGdiStartup=record
Version:longint;
DebugEventCallback:Pointer;
SuppressBackgroundThread:Boolean;
SuppressExternalCodecs:Bool;
end;
// Const 常量
const TransParent=$000001;
Black=$010101;
Navy=$800000;
DarkBlue=$8B0000;
MediumBlue=$CD0000;
Blue=$FF0000;
DarkGreen=$006400;
Green=$008000;
Teal=$808000;
DarkCyan=$8B8B00;
DeepSkyBlue=$FFBF00;
DarkTurquoise=$D1CE00;
MediumSpringGreen=$9AFA00;
Lime=$00FF00;
SpringGreen=$7FFF00;
Cyan=$FFFF00;
Aqua=$FFFF00;
MidnightBlue=$701919;
DodgerBlue=$FF901E;
LightSeaGreen=$AAB220;
ForestGreen=$228B22;
SeaGreen=$578B2E;
DarkSlateGray=$4F4F2F;
LimeGreen=$32CD32;
MediumSeaGreen=$71B33C;
Turquoise=$D0E040;
RoyalBlue=$E16941;
SteelBlue=$B48246;
DarkSlateBlue=$8B3D48;
MediumTurquoise=$CCD148;
Indigo=$82004B;
DarkOliveGreen=$2F6B55;
CadetBlue=$A09E5F;
CornflowerBlue=$ED9564;
MediumAquamarine=$AACD66;
DimGray=$696969;
SlateBlue=$CD5A6A;
OliveDrab=$238E6B;
SlateGray=$908070;
LightSlateGray=$998877;
MediumSlateBlue=$EE687B;
LawnGreen=$00FC7C;
Chartreuse=$00FF7F;
Aquamarine=$D4FF7F;
Maroon=$000080;
Purple=$800080;
Olive=$008080;
Gray=$808080;
SkyBlue=$EBCE87;
LightSkyBlue=$FACE87;
BlueViolet=$E22B8A;
DarkRed=$00008B;
DarkMagenta=$8B008B;
SaddleBrown=$13458B;
DarkSeaGreen=$8FBC8F;
LightGreen=$90EE90;
MediumPurple=$DB7093;
DarkViolet=$D30094;
PaleGreen=$98FB98;
DarkOrchid=$CC3299;
Amethyst=$CC6699;
YellowGreen=$32CD9A;
Sienna=$2D52A0;
Brown=$2A2AA5;
DarkGray=$A9A9A9;
LightBlue=$E6D8AD;
GreenYellow=$2FFFAD;
PaleTurquoise=$EEEEAF;
LightSteelBlue=$DEC4B0;
PowderBlue=$E6E0B0;
FireBrick=$2222B2;
DarkGoldenrod=$0B86B8;
MediumOrchid=$D355BA;
RosyBrown=$8F8FBC;
DarkKhaki=$6BB7BD;
Silver=$C0C0C0;
MediumVioletRed=$8515C7;
IndianRed=$5C5CCD;
Peru=$3F85CD;
Chocolate=$1E69D2;
Tan=$8CB4D2;
LightGrey=$D3D3D3;
Thistle=$D8BFD8;
Orchid=$D670DA;
Goldenrod=$20A5DA;
PaleVioletRed=$9370DB;
Crimson=$3C14DC;
Gainsboro=$DCDCDC;
Plum=$DDA0DD;
BurlyWood=$87B8DE;
LightCyan=$FFFFE0;
Lavender=$FAE6E6;
DarkSalmon=$7A96E9;
Violet=$EE82EE;
PaleGoldenrod=$AAE8EE;
LightCoral=$8080F0;
Khaki=$8CE6F0;
AliceBlue=$FFF8F0;
Honeydew=$F0FFF0;
Azure=$FFFFF0;
SandyBrown=$60A4F4;
Wheat=$B3DEF5;
Beige=$DCF5F5;
WhiteSmoke=$F5F5F5;
MintCream=$FAFFF5;
GhostWhite=$FFF8F8;
Salmon=$7280FA;
AntiqueWhite=$D7EBFA;
Linen=$E6F0FA;
LightGoldenrodYellow=$D2FAFA;
OldLace=$E6F5FD;
Red=$0000FF;
Fuchsia=$FF00FF;
Magenta=$FF00FF;
DeepPink=$9314FF;
OrangeRed=$0045FF;
Tomato=$4763FF;
HotPink=$B469FF;
Coral=$507FFF;
DarkOrange=$008CFF;
LightSalmon=$7AA0FF;
Orange=$00A5FF;
LightPink=$C1B6FF;
Pink=$CBC0FF;
Gold=$00D7FF;
PeachPuff=$B9DAFF;
NavajoWhite=$ADDEFF;
Moccasin=$B5E4FF;
Bisque=$C4E4FF;
MistyRose=$E1E4FF;
BlanchedAlmond=$CDEBFF;
PapayaWhip=$D5EFFF;
LavenderBlush=$F5F0FF;
Seashell=$EEF5FF;
Cornsilk=$DCF8FF;
LemonChiffon=$CDFAFF;
FloralWhite=$F0FAFF;
Snow=$FAFAFF;
Yellow=$00FFFF;
LightYellow=$E0FFFF;
Ivory=$F0FFFF;
White=$FFFFFF;
const M_LEFT=0;
M_RIGHT=1;
M_MIDDLE=2;
const K_UK=0;
K_LMOUSE=1;
K_RMOUSE=2;
K_CANCEL=3;
K_MMOUSE=4;
K_X1MOUSE=5;
K_X2MOUSE=6;
K_BACK=8;
K_TAB=9;
K_CLEAR=12;
K_ENTER=13;
K_SHIFT=16;
K_CTRL=17;
K_ALT=18;
K_PAUSE=19;
K_CAPS=20;
K_ESC=27;
K_SPACE=32;
K_PGUP=33;
K_PGDN=34;
K_END=35;
K_HOME=36;
K_LEFT=37;
K_UP=38;
K_RIGHT=39;
K_DOWN=40;
K_SELECT=41;
K_PRINT=42;
K_EXECUTE=43;
K_PRTSC=44;
K_INS=45;
K_DEL=46;
K_HELP=47;
K_0=48;
K_1=49;
K_2=50;
K_3=51;
K_4=52;
K_5=53;
K_6=54;
K_7=55;
K_8=56;
K_9=57;
K_A=65;
K_B=66;
K_C=67;
K_D=68;
K_E=69;
K_F=70;
K_G=71;
K_H=72;
K_I=73;
K_J=74;
K_K=75;
K_L=76;
K_M=77;
K_N=78;
K_O=79;
K_P=80;
K_Q=81;
K_R=82;
K_S=83;
K_T=84;
K_U=85;
K_V=86;
K_W=87;
K_X=88;
K_Y=89;
K_Z=90;
K_LWIN=91;
K_RWIN=92;
K_APPS=93;
K_SLEEP=95;
K_N0=96;
K_N1=97;
K_N2=98;
K_N3=99;
K_N4=100;
K_N5=101;
K_N6=102;
K_N7=103;
K_N8=104;
K_N9=105;
K_MUL=106;
K_ADD=107;
K_SEP=108;
K_SUB=109;
K_DEC=110;
K_DIV=111;
K_F1=112;
K_F2=113;
K_F3=114;
K_F4=115;
K_F5=116;
K_F6=117;
K_F7=118;
K_F8=119;
K_F9=120;
K_F10=121;
K_F11=122;
K_F12=123;
K_F13=124;
K_F14=125;
K_F15=126;
K_F16=127;
K_F17=128;
K_F18=129;
K_F19=130;
K_F20=131;
K_F21=132;
K_F22=133;
K_F23=134;
K_F24=135;
K_NUM=144;
K_SCR=145;
K_LSHIFT=160;
K_LCTRL=162;
K_LALT=164;
K_RSHIFT=161;
K_RCTRL=163;
K_RALT=165;
const PI=3.1415926535897932384626433832795028841971694;
const MAXCHAR=$100; //最大字符串长度
const BUFFSIZE=$1000; //缓冲区大小
const DELAYTIMEKEY=20; //默认按键时长
DELAYTIMEDEFAULT=1; //默认等待时长
DELAYTIMEMIN=1; //默认最短等待时长
const FONTWIDTHDEFAULT=10; //默认字体宽度
FONTHEIGHTDEFAULT=20; //默认字体高度
const MINHZ=100; //最小频率
MAXHZ=15000; //最大频率
const _mdn:array[0..2] of longword=(MOUSEEVENTF_LEFTDOWN,MOUSEEVENTF_RIGHTDOWN,MOUSEEVENTF_MIDDLEDOWN);
const _mup:array[0..2] of longword=(MOUSEEVENTF_LEFTUP,MOUSEEVENTF_RIGHTUP,MOUSEEVENTF_MIDDLEUP);
const _bdn:array[0..2] of longword=(WM_LBUTTONDOWN,WM_MBUTTONDOWN,WM_RBUTTONDOWN);
const _bup:array[0..2] of longword=(WM_LBUTTONUP,WM_MBUTTONUP,WM_RBUTTONUP);
const _bufmax=$100000; //文件缓冲区大小
const _thmax=$100; //最大线程数量
const _mswinmax=$10000; //窗口消息数目
const _msusrmax=$10000; //用户消息数目
const _mscntmax=$10000; //消息时间数目
const GDIImageFormatBMP:TGUID='{557CF400-1A04-11D3-9A73-0000F81EF32E}';
GDIImageFormatJPG:TGUID='{557CF401-1A04-11D3-9A73-0000F81EF32E}';
GDIImageFormatGIF:TGUID='{557CF402-1A04-11D3-9A73-0000F81EF32E}';
GDIImageFormatEMF:TGUID='{557CF403-1A04-11D3-9A73-0000F81EF32E}';
GDIImageFormatWMF:TGUID='{557CF404-1A04-11D3-9A73-0000F81EF32E}';
GDIImageFormatTIF:TGUID='{557CF405-1A04-11D3-9A73-0000F81EF32E}';
GDIImageFormatPNG:TGUID='{557CF406-1A04-11D3-9A73-0000F81EF32E}';
GDIImageFormatICO:TGUID='{557CF407-1A04-11D3-9A73-0000F81EF32E}';
const DEFAULTCLASS='DisplayCass';
const maxpara=$100;
// Internal Variable 内部变量
var _w,_h,_x,_y:longint; //窗口宽高坐标
_cbg,_cfg:longword; //窗口背前景颜色
_style:longword; //窗口样式
var _hw:longword; //窗口句柄
_dc:longword; //绘图句柄
var _wc:wndClassW; //窗口注册结构
_wca:ATOM; //窗口注册句柄
_class:PWideChar=DEFAULTCLASS; //窗口类名称
_ms:msg; //消息结构
_mst:msg; //消息结构缓存
_main:bitmap; //缓冲位图结构
_pmain:pbitmap; //缓冲位图指针
_mscr:bitmap; //屏幕位图结构
_pmscr:pbitmap; //屏幕位图指针
var _bufz:longword; //位图缓存当前位置
_bufcb,_bufcg,_bufcr:byte; //位图缓存当前颜色
var _tbegin:double; //窗口建立时间
_tfreq,_tcount:Int64;
_winb:boolean; //窗口状态
_draw:procedure; //绘图函数
var _pe:longword; //画笔
_pew:longword=1; //画刷
_br:longword; //画刷
var _fx,_fy:longint; //文字输出位置
_fw,_fh,_fwg:longword; //字体长宽粗细
_flt,_fud, //字体斜体下划线
_fsk,_fcs:longword; //字体删除线字符集
_ffn:ansistring; //字体名称
_fns:longword; //字体结构
_strz:size; //字符串大小
_tm:textmetric; //文本格式
var _fnm:longword=256; //拖拽文件名长度
_fn:pchar; //拖拽文件名
var _cid:longword; //全局音频标识符
_cam:longword=256; //音频字符串长度
_ca:pchar; //音频字符串
var _fhdl:longword; //文件句柄
_fpos:longword; //文件指针位置
_flen:longword; //文件长度
var _buflen:longword=$10000; //缓冲区长度
_buf:array[1.._bufmax]of byte; //缓存区
_bufpos:longword; //缓冲区位置指针
_bufrem:longword; //缓冲区剩余量
var _th:array[0.._thmax-1]of longword;//线程句柄
var _thi:longword; //线程句柄号
var _mswin:array[0.._mswinmax-1]of msg;//窗口消息
_mswini:longword=0;
_mswinj:longword=0;
var _msusr:array[1.._msusrmax]of msg; //用户消息
_msusri:longword=1;
_msi:longword=1;
var _mscnt:array[0.._mscntmax-1]of double;//消息时间
_mscnti:longword=0;
_mscntj:longword=0;
var _GdiStart:TGdiStartup;
_GdiToken:LongWord;
_GdiGraph:longword;
_GdiImage:longword;
_GdiWideChar:array[0..MAXCHAR-1]of WideChar;
var _para:ansistring='';
_para_count:longword;
_para_list:array[0..maxpara]of ansistring;
var _paraw:unicodestring='';
_paraw_count:longword;
_paraw_list:array[0..maxpara]of unicodestring;
// Functions Interface 函数接口
function sgn(x:double):longint;
function abs(a:longint):longint;
function abs(a:double):double;
function abs(a,b:double):double;
function abs(a,b,c:double):double;
function max(a,b:longint):longint;
function min(a,b:longint):longint;
function max(a,b:double):double;
function min(a,b:double):double;
function max(a,b,c:double):double;
function min(a,b,c:double):double;
function arcsin(x:double):double;
function arccos(x:double):double;
function arctan2(x,y:double):double;
function i2s(i:longint):ansistring;
function i2s(i:longword):ansistring;
function i2s(i:int64):ansistring;
function i2s(i:qword):ansistring;
function i2s(i:word64):ansistring;
function i2s(i,l:longint;c:char):ansistring;
function i2s(i,l:longint):ansistring;
function s2pc(s:string):pchar;
function s2i(s:ansistring):longword;
function as2s(s:ansistring):ansistring;
function s2as(s:ansistring):ansistring;
function as2pc(s:ansistring):pchar;
function pc2as(pc:pchar):ansistring;
function i2as(i:byte):ansistring;
function as2i(s:ansistring):byte;
function i2hc(i:byte):char;
function hc2i(c:char):byte;
function i2hs(i:byte):ansistring;
function hs2i(s:ansistring):byte;
function as2hs(s:ansistring):ansistring;
function hs2as(s:ansistring):ansistring;
function i2as(i:word):ansistring;
function i2as(i:longword):ansistring;
function i2as(i:word64):ansistring;
function i2as(i:word128):ansistring;
function i2as(i:word256):ansistring;
function i2hs(i:word):ansistring;
function i2hs(i:longword):ansistring;
function i2hs(i:word64):ansistring;
function i2hs(i:word128):ansistring;
function i2hs(i:word256):ansistring;
function asrev(s:ansistring):ansistring;
function aslong(s:ansistring;l:longint):ansistring;
function asshort(s:ansistring):ansistring;
function assame(var s1,s2:ansistring):longword;
function asadd(s1,s2:ansistring):ansistring;
function assub(s1,s2:ansistring):ansistring;
function asmul(s1,s2:ansistring):ansistring;
function asdiv(s1,s2:ansistring):ansistring;
function asmod(s1,s2:ansistring):ansistring;
procedure asinc(var s1:ansistring;s2:ansistring);
procedure asinc(var s1:ansistring);
procedure asdec(var s1:ansistring;s2:ansistring);
procedure asdec(var s1:ansistring);
function asequ(s1,s2:ansistring):boolean;
function asneq(s1,s2:ansistring):boolean;
function aslss(s1,s2:ansistring):boolean;
function asgtr(s1,s2:ansistring):boolean;
function asleq(s1,s2:ansistring):boolean;
function asgeq(s1,s2:ansistring):boolean;
function asnot(s:ansistring):ansistring;
function asand(s1,s2:ansistring):ansistring;
function asor(s1,s2:ansistring):ansistring;
function asxor(s1,s2:ansistring):ansistring;
function asshl(s1,s2:ansistring):ansistring;
function asrol(s1,s2:ansistring):ansistring;
function asshr(s1,s2:ansistring):ansistring;
function asror(s1,s2:ansistring):ansistring;
function NewThread(th:pointer):longword;
procedure PauseThread(thi:longword);
procedure ResumeThread(thi:longword);
procedure StopThread(thi:longword);
function MsgBoxW(s,title:unicodestring;i:longword):longword;
function MsgBox(s,title:ansistring;i:longword):longword;
procedure MsgBoxW(s,title:unicodestring);
procedure MsgBox(s,title:ansistring);
procedure MsgBoxW(s:unicodestring);
procedure MsgBox(s:ansistring);
procedure Delay(t:double);
procedure Delay(t:longword);
procedure Delay();
procedure Sound(hz:longword;t:longword);
procedure Sound(hz:longword;t:double);
procedure Sound(hz:longword);
procedure FreshFPS();
procedure AddFPS();
function GetFPSL():longword;
function GetFPSR():double;
function GetFPS():longword;
function GetError():longword;
procedure CreateWin(w,h:longword;cfg,cbg:longword;style:longword);
procedure CreateWin(w,h:longword;cfg,cbg:longword);
procedure CreateWin(w,h:longword;c:longword);
procedure CreateWin(w,h:longword);
procedure CreateWin(cbg:longword);
procedure CreateWin();
procedure FreshWin();
procedure CloseWin();
function IsWin():boolean;
procedure SetDrawProcedure(th:tprocedure);
function GetTimeR():double;
function GetTime():longword;
procedure SetTitle(s:ansistring);
procedure SetTitleW(s:unicodestring);
function GetTitle():ansistring;
function GetTitleW():unicodestring;
procedure SetSize(w,h:longword);
function GetWidth():longword;
function GetHeight():longword;
function GetSize():longword;
function GetScrWidth():longint;
function GetScrHeight():longint;
function GetScrSize():longword;
function GetScrCapsX():double;
function GetScrCapsY():double;
function GetBorderTitle():longint;
function GetBorderWidth():longint;
function GetBorderHeight():longint;
function GetBorderSize():longword;
procedure SetPos(x,y:longword);
function GetPosX():longint;
function GetPosY():longint;
function GetPos():longword;
function GetWin():pbitmap;
function GetScr():pbitmap;
function GetHwnd(b:pbitmap):longword;
function GetHwnd():longword;
function GetDraw(b:pbitmap):longword;
function GetDraw():longword;
function GetBGColor():longword;
procedure SetBGColor(c:longword);
function GetFGColor():longword;
procedure SetFGColor(c:longword);
procedure SetPenWidth(pew:longword);
procedure SetPenColor(b:pbitmap;c:longword);
procedure SetPenColor(c:longword);
procedure SetBrushColor(b:pbitmap;c:longword);
procedure SetBrushColor(c:longword);
function GetAlpha(c:longword):byte;
function GetBlue(c:longword):byte;
function GetGreen(c:longword):byte;
function GetRed(c:longword):byte;
function GetRGBA(r,g,b,a:byte):longword;
function GetRGB(r,g,b:byte):longword;
procedure Byte2Long(a,b,c,d:byte;var l:longword);
procedure Long2Byte(l:longword;var a,b,c,d:byte);
procedure Double2Long(a,b,c,d:double;var l:longword);
procedure Long2Double(l:longword;var a,b,c,d:double);
procedure RGB2HSL(r,g,b:double;var h,s,l:double);
procedure RGB2HSV(r,g,b:double;var h,s,v:double);
procedure RGB2HSI(r,g,b:double;var h,s,i:double);
procedure RGB2HSN(r,g,b:double;var h,s,n:double);
procedure HSL2RGB(h,s,l:double;var r,g,b:double);
procedure HSV2RGB(h,s,v:double;var r,g,b:double);
procedure HSI2RGB(h,s,i:double;var r,g,b:double);
procedure HSN2RGB(h,s,n:double;var r,g,b:double);
function RGB2HSL(rgb:longword):longword;
function RGB2HSV(rgb:longword):longword;
function RGB2HSI(rgb:longword):longword;
function RGB2HSN(rgb:longword):longword;
function HSL2RGB(hsn:longword):longword;
function HSV2RGB(hsn:longword):longword;
function HSI2RGB(hsn:longword):longword;
function HSN2RGB(hsn:longword):longword;
procedure MixColor(rgb1,rgb2:longword;var rgb3:longword;m:double);
procedure MixColor(rgb1,rgb2:longword;var rgb3:longword);
procedure SetFont(b:pbitmap);
procedure SetFont();
procedure SetFontWidth(w:longword);
procedure SetFontHeight(h:longword);
procedure SetFontSize(w,h:longword);
procedure SetFontWeight(wg:longword);
procedure SetFontLtalic(lt:longword);
procedure SetFontUnderLine(ud:longword);
procedure SetFontStrikeOut(sk:longword);
procedure SetFontCharSet(cs:longword);
procedure SetFontName(s:ansistring);
procedure GetStringSize(s:ansistring);
function GetStringWidth(s:ansistring):longword;
function GetStringHeight(s:ansistring):longword;
procedure DrawTextXY(b:pbitmap;s:ansistring;x,y:longint;w,h:longword;cfg,cbg:longword);
procedure DrawTextXY(b:pbitmap;s:ansistring;x,y:longint;cfg,cbg:longword);
procedure DrawTextXY(b:pbitmap;s:ansistring;x,y:longint;cfg:longword);
procedure DrawTextXY(s:ansistring;x,y:longint;cfg,cbg:longword);
procedure DrawTextXY(s:ansistring;x,y:longint;cfg:longword);
procedure DrawTextXY(s:ansistring;x,y:longword);
procedure DrawText(s:ansistring;cfg,cbg:longword);
procedure DrawText(s:ansistring;cfg:longword);
procedure DrawText(s:ansistring);
procedure DrawTextlnXY(s:ansistring;x,y:longint;cfg,cbg:longword);
procedure DrawTextlnXY(s:ansistring;x,y:longint;cfg:longword);
procedure DrawTextlnXY(s:ansistring;x,y:longword);
procedure DrawTextln(s:ansistring;cfg,cbg:longword);
procedure DrawTextln(s:ansistring;cfg:longword);
procedure DrawTextln(s:ansistring);
procedure DrawTextln();
procedure DrawTextXYw(b:pbitmap;s:ansistring;x,y:longint;cfg,cbg:longword);
procedure DrawTextXYw(b:pbitmap;s:ansistring;x,y:longint;cfg:longword);
procedure DrawTextXYw(s:ansistring;x,y:longint;cfg,cbg:longword);
procedure DrawTextXYw(s:ansistring;x,y:longint;cfg:longword);
procedure DrawTextXYw(s:ansistring;x,y:longword);
procedure DrawTextw(s:ansistring;cfg,cbg:longword);
procedure DrawTextw(s:ansistring;cfg:longword);
procedure DrawTextw(s:ansistring);
procedure DrawTextlnXYw(s:ansistring;x,y:longint;cfg,cbg:longword);
procedure DrawTextlnXYw(s:ansistring;x,y:longint;cfg:longword);
procedure DrawTextlnXYw(s:ansistring;x,y:longword);
procedure DrawTextlnw(s:ansistring;cfg,cbg:longword);
procedure DrawTextlnw(s:ansistring;cfg:longword);
procedure DrawTextlnw(s:ansistring);
function GetPixel(b:pbitmap;x,y:longword):longword;
function GetPixel(x,y:longword):longword;
procedure SetPixel(b:pbitmap;x,y:longword;c:longword);
procedure SetPixel(x,y:longword;c:longword);
procedure SetPixel(x,y:longword);
function GetBBPixel(bb:pbitbuf;x,y:longword):longword;
procedure SetBBPixel(bb:pbitbuf;x,y,c:longword);
procedure Line(b:pbitmap;x,y,w,h:longint;c:longword);
procedure Line(x,y,w,h:longint;c:longword);
procedure Line(x,y,w,h:longint);
procedure LineBB(bb:pbitbuf;x,y,w,h:longint;c:longword);
procedure Bar(b:pbitmap;x,y,w,h:longint;cfg,cbg:longword);
procedure Bar(b:pbitmap;x,y,w,h:longint;c:longword);
procedure Bar(x,y,w,h:longint;cfg,cbg:longword);
procedure Bar(x,y,w,h:longint;c:longword);
procedure Bar(x,y,w,h:longint);
procedure Clear(b:pbitmap;c:longword);
procedure Clear(b:pbitmap);
procedure Clear(c:longword);
procedure Clear();
procedure Triangle(b:pbitmap;x1,y1,x2,y2,x3,y3:longint;cfg,cbg:longword);
procedure Triangle(x1,y1,x2,y2,x3,y3:longint;cfg,cbg:longword);
procedure Triangle(x1,y1,x2,y2,x3,y3:longint;c:longword);
procedure Triangle(x1,y1,x2,y2,x3,y3:longint);
procedure Arc(b:pbitmap;x,y,rx,ry:longint;sa,ea:double;cfg,cbg:longword);
procedure Arc(x,y,rx,ry:longint;sa,ea:double;cfg,cbg:longword);
procedure Arc(x,y,rx,ry:longint;sa,ea:double;c:longword);
procedure Arc(x,y,rx,ry:longint;sa,ea:double);
procedure Pie(b:pbitmap;x,y,rx,ry:longint;sa,ea:double;cfg,cbg:longword);
procedure Pie(x,y,rx,ry:longint;sa,ea:double;cfg,cbg:longword);
procedure Pie(x,y,rx,ry:longint;sa,ea:double;c:longword);
procedure Pie(x,y,rx,ry:longint;sa,ea:double);
procedure Chord(b:pbitmap;x,y,rx,ry:longint;sa,ea:double;cfg,cbg:longword);
procedure Chord(x,y,rx,ry:longint;sa,ea:double;cfg,cbg:longword);
procedure Chord(x,y,rx,ry:longint;sa,ea:double;c:longword);
procedure Chord(x,y,rx,ry:longint;sa,ea:double);
procedure Ellipse(b:pbitmap;x,y,rx,ry:longint;cfg,cbg:longword);
procedure Ellipse(x,y,rx,ry:longint;cfg,cbg:longword);
procedure Ellipse(x,y,rx,ry:longint;c:longword);
procedure Ellipse(x,y,rx,ry:longint);
procedure Circle(b:pbitmap;x,y,r:longint;cfg,cbg:longword);
procedure Circle(x,y,r:longint;cfg,cbg:longword);
procedure Circle(x,y,r:longint;c:longword);
procedure Circle(x,y,r:longint);
function CreateBMP(b:pbitmap;w,h:longword;c:longword):pbitmap;
function CreateBMP(b:pbitmap):pbitmap;
function CreateBMP(w,h:longword;c:longword):pbitmap;
function CreateBMP(w,h:longword):pbitmap;
function CreateBMP():pbitmap;
procedure ReleaseBMP(b:pbitmap);
procedure ReleaseBMP();
function LoadBMP(s:ansistring;c:longword):pbitmap;
function LoadBMP(s:ansistring):pbitmap;
procedure SaveBMP(b:pbitmap;s:ansistring);
procedure DrawBMP(bs,bd:pbitmap;xs,ys,ws,hs,xd,yd,wd,hd:longword;c:longword);
procedure DrawBMP(bs,bd:pbitmap;xs,ys,ws,hs,xd,yd,wd,hd:longword);
procedure DrawBMP(bs,bd:pbitmap;xs,ys,xd,yd,w,h:longword;c:longword);
procedure DrawBMP(bs,bd:pbitmap;xs,ys,xd,yd,w,h:longword);
procedure DrawBMP(bs,bd:pbitmap;xd,yd,wd,hd:longword;c:longword);
procedure DrawBMP(bs,bd:pbitmap;xd,yd,wd,hd:longword);
procedure DrawBMP(bs,bd:pbitmap;xd,yd:longword;c:longword);
procedure DrawBMP(bs,bd:pbitmap;xd,yd:longword);
procedure DrawBMP(bs,bd:pbitmap;c:longword);
procedure DrawBMP(bs,bd:pbitmap);
procedure DrawBMP(bs:pbitmap;xs,ys,ws,hs,xd,yd,wd,hd:longword;c:longword);
procedure DrawBMP(bs:pbitmap;xs,ys,ws,hs,xd,yd,wd,hd:longword);
procedure DrawBMP(bs:pbitmap;xs,ys,xd,yd,w,h:longword;c:longword);
procedure DrawBMP(bs:pbitmap;xs,ys,xd,yd,w,h:longword);