- UID
- 9
- 积分
- 4251
- 帖子
- 293
- 主题
- 40
- 论坛币
- 8462
- 威望
- 29
- EP值
- 1646
- MP值
- 8
- 阅读权限
- 100
- 注册时间
- 2011-8-3
- 在线时间
- 151 小时
- 最后登录
- 2022-8-8
|
- from tcaxPy import *
- from gdiFont import * #加入GDIfont模块
- from draw2pix import *
- def tcaxPy_Init():
- global _FontFileName
- global _FaceID
- global _Fs
- global _TextWidth
- global _TextHeight
- global _TextLength
- global _TextAdvDiff
- global _ResolutionX
- global _OffsetX
- global _FD
- global _Spacing # 字体间距
- _FontFileName = GetVal(val_FontFileName)
- _FaceID = GetVal(val_FaceID)
- _Fs = GetVal(val_FontSize)
- _TextHeight = GetVal(val_TextHeight)
- _TextWidth = GetVal(val_TextWidth)
- _TextLength = GetVal(val_TextLength)
- _TextAdvDiff = GetVal(val_TextAdvanceDiff)
- _ResolutionX = GetVal(val_ResolutionX)
- _OffsetX = GetVal(val_OffsetX)
- _FD = 1000 / GetVal(val_FXFPS)
- _Spacing = GetVal(val_Spacing)
- global GdiFont #GDIfont
-
- GdiFont = gfInitFont(GetVal(val_FontFaceName), _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0, False) #GDIfont
-
- global Font
- Font = InitFont(GetVal(val_FontFileName), GetVal(val_FaceID), _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0xFFFFFF, 0, 0)
- cairo_init(100, 100)
- def tcaxPy_Fin():
- gfFinFont(GdiFont) #GDIfont
-
- FinFont(Font)
- def tcaxPy_Main(_i, _j, _n, _BT, _ET, _SK, _KT, _x, _y, _a, _txt):
- ASS_BUF = []
-
- ass_main(ASS_BUF, SubL(_BT-90+_j*5,_BT-30+_j*5,2),an(7)+pos(_x, _y-12)+org(_x,_y)+t(fry(90))+fscx(130)+fscy(130)+color1("9729FF")+bord(0)+fad(100,0), "{\p1}m 0 23 b 6 18 11 13 14 8 b 16 4 16 -2 11 -3 b 6 -4 3 -2 0 0 b 1 1 2 3 3 5 b 4 0 8 1 10 2 b 12 3 12 5 11 7 b 9 11 5 16 2 20 b 2 15 3 9 3 5 b 2 3 1 1 0 0 b -1 1 -2 3 -3 5 b -3 9 -2 15 -2 20 b -5 16 -9 11 -11 7 b -12 5 -12 3 -10 2 b -8 1 -4 0 -3 5 b -2 3 -1 1 0 0 b -3 -2 -6 -4 -10 -3 b -16 -2 -16 4 -14 8 b -11 13 -6 18 0 23 ")
-
- ass_main(ASS_BUF, SubL(_BT-30+_j*5,_BT+(_j+1)*5,1),pos(_x, _y)+org(_x,_y)+fry(270)+t(fry(360))+bord(2), _txt)
- ass_main(ASS_BUF, SubL(_BT+(_j+1)*5,_BT+_SK,1),pos(_x, _y)+bord(2), _txt)
-
-
-
- dx = _x - int((_a + _Spacing) / 2 + 0.5) # 一个固定操作, 将an5的坐标转换为an7
- dy = _y - int(_Fs / 2 + 0.5) # ASS特效默认采用an5坐标, TCAS特效则采用an7坐标
- # _txt PIX
-
- points = gfGetPoints(GdiFont, _txt) #GDIfont
- PIX = PixFromPoints(points) #GDIfont
- points1 = PixPoints(PIX)
- pt_num = len(points1)
-
- dx = _x - int((_a + GetVal(val_Spacing)) / 2 + 0.5) + PIX[0][0]
- dy = _y - int(_Fs / 2 + 0.5) + PIX[0][1]
- # draw PIX
- PIX_draw = draw2pix('m 0 0 m 0 23 b 6 18 11 13 14 8 b 16 4 16 -2 11 -3 b 6 -4 3 -2 0 0 b 1 1 2 3 3 5 b 4 0 8 1 10 2 b 12 3 12 5 11 7 b 9 11 5 16 2 20 b 2 15 3 9 3 5 b 2 3 1 1 0 0 b -1 1 -2 3 -3 5 b -3 9 -2 15 -2 20 b -5 16 -9 11 -11 7 b -12 5 -12 3 -10 2 b -8 1 -4 0 -3 5 b -2 3 -1 1 0 0 b -3 -2 -6 -4 -10 -3 b -16 -2 -16 4 -14 8 b -11 13 -6 18 0 23 ')
- PIX_draw = PixStrip(PIX_draw) # 裁剪空白边框部分, 可以提升效率等
- points_draw = PixPoints(PIX_draw)
- pt_num_draw = len(points_draw)
-
- # 因为两个点集的点数可能不同, 所以需要一个合理的映射, 以下算法只是一个简单示例
- num = max(pt_num, pt_num_draw)
- ts = _BT+_SK
- te = _BT+_SK+_KT
- for i in range(pt_num_draw):
- indice_text = randint(0, pt_num - 1)
- indice_draw = i
- x = dx + points1[indice_text][0]
- y = dy + points1[indice_text][1]
- x_fin = _x + points_draw[indice_draw][0]
- y_fin = _y + points_draw[indice_draw][1]
- DX = _x + points_draw[i][0]
- DY = _y + points_draw[i][1]
- EFT = move(x,y,x_fin-_a/2, y_fin-_Fs/2+5) + color1('FFFFFF') + alpha(255 - PIX[2][4 * (points1[indice_text][1] * PIX[1][0] + points1[indice_text][0]) + 3])
- ass_main(ASS_BUF, SubL(ts, te+70+randint(-30,30), 0, Pix_Style), EFT, PixPt())
-
- ass_main(ASS_BUF, SubL(te+70+randint(-30,30), te+150+randint(-30,30), 0, Pix_Style), move(DX-_a/2,DY-_Fs/2+5,_x-3,_y-30,700,1000) + color1('FFFFFF')+alpha(255 - points_draw[indice_draw][2]), PixPt())
-
-
-
- return (ASS_BUF, None)
复制代码 运行此脚本需要以下附带文件
draw2pix.py
(792 Bytes, 下载次数: 3010)
|
-
1
查看全部评分
-
|