TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua

 找回密码
 新人加入
查看: 5288|回复: 3
打印 上一主题 下一主题

[已解决] Usage of BigPix [复制链接]

Moderator

Effect Researcher.

Rank: 5Rank: 5

跳转到指定楼层
楼主
发表于 2016-4-8 14:43:55 |只看该作者 |倒序浏览
本帖最后由 面麻 于 2016-4-11 15:15 编辑

Problem: I tried to make pix of a line as a whole, but no words showed when previewing avs script.
Is it the reason that I made wrong with the usage of gloabl variable?
Or the misunderstanding of BigPix structure, especially the InitBigPix() function?

Codes listed below:
  1. from tcaxPy import *


  2. def tcaxPy_Init():
  3.     global font
  4.     global font_out
  5.     global font_size
  6.     font_file   = GetVal(val_FontFileName)
  7.     face_id     = GetVal(val_FaceID)
  8.     font_size   = GetVal(val_FontSize)
  9.     spacing     = GetVal(val_Spacing)
  10.     space_scale = GetVal(val_SpaceScale)
  11.     color       = DecRGB(GetVal(val_1C))
  12.     bord        = GetVal(val_Bord)
  13.     font = InitFont(font_file, face_id, font_size, spacing, space_scale, color, bord, 0)
  14.     font_out = InitFont(font_file, face_id, font_size, spacing, space_scale, color, 3 * bord, 1)


  15. def tcaxPy_User():
  16.     pass


  17. def tcaxPy_Fin():
  18.     FinFont(font)
  19.     FinFont(font_out)


  20. def tcaxPy_Main(_i, _j, _n, _start, _end, _elapk, _k, _x, _y, _a, _txt):

  21.     #ASS_BUF  = []        # used for saving ASS FX lines
  22.     TCAS_BUF = []        # used for saving TCAS FX raw data

  23.     # an5 -> an7, TCAS uses an7
  24.     ux = _x - int(_a / 2 + 0.5)
  25.     uy = _y - int(font_size / 2 + 0.5)

  26.     if _j == 0:
  27.         global LINEPIX
  28.         LINEPIX = InitBigPix()

  29.     texture = ImagePix('x3.png')
  30.     PIX = TextPix(font, _txt)
  31.     PIX = PixTexture(PIX, texture)
  32.     BORD = TextPix(font_out, _txt)
  33.     BORD = PixColorRGB(BORD, 0xFF0000)
  34.     BORD = PixBlur(BORD, 4)

  35.     PIX = CombinePixs(BORD, PIX)
  36.     BigPixAdd(LINEPIX, PIX, ux, uy, 0)

  37.     if _j == _n - 1:
  38.         ALINEPIX = ConvertBigPix(LINEPIX)
  39.         #tcaxLog(ALINEPIX)

  40.         ts = 10 * _start
  41.         te = 10 * _end

  42.         tcas_main(TCAS_BUF, ALINEPIX, ts, te, ux, uy, 0)

  43.     return (None, TCAS_BUF)
复制代码

Administrator

TCAX Dev.

Rank: 7Rank: 7Rank: 7

沙发
发表于 2016-4-8 20:27:39 |只看该作者
the main cause of disappearance of your BigPix is that the pos information is already contained in ALINEPIX, however you specified another offset to it by line 58. just use tcas_main(TCAS_BUF, ALINEPIX, ts, te, 0, 0, 0) will output the right effect you expected.


useful links for your reference:

http://www.tcax.org/forum.php?mod=viewthread&tid=132

http://www.tcax.org/forum.php?mod=viewthread&tid=207

http://www.tcax.org/forum.php?mod=viewthread&tid=283


I had wrote some demos about PIX and BigPix, I think it's a good idea for me to pack them and upload to the forum before my hard disc go bad :)

Moderator

Effect Researcher.

Rank: 5Rank: 5

板凳
发表于 2016-4-8 21:25:05 |只看该作者
It's pretty grateful of you to offer me these references.
After learning about basic conception of tcas, it seems that creating a line effect has become more difficult than syllable effects, such as line clip.
Maybe it's because of my lack of knowledge about tcas. (Ignore this //

Administrator

TCAX Dev.

Rank: 7Rank: 7Rank: 7

地板
发表于 2016-4-9 00:28:16 |只看该作者
面麻 发表于 2016-4-8 21:25
It's pretty grateful of you to offer me these references.
After learning about basic conception of t ...


Well, I do agree with you about the difficulty of tcas, since it exposes more details to the FXer, and the built-in (ease of use) PIX APIs are far to be rich (compared to ASS tags). Another point is that API is harder to use than tags. :)

At the very beginning, I designed the TCAS format just to be a supplement of ASS for handling Pix Effects (Using ASS to output often resulted in huge files, and slow to preview.).  But after I finishing the specification of TCAS I found that ASS and TCAS are actually two different major approaches to subtitle effects (Both of them have the full ability of making a complete subtitle effects), one represents vectorial system, and the other for bitmap system. They protogenetically have their own strong and weak aspects. e.g.

Vectorial System is good at resizing, rotation, transformation, etc.

Bitmap System is good at texturing, masking, coloring, etc.



您需要登录后才可以回帖 登录 | 新人加入

GitHub|TCAX 主页

GMT+8, 2024-11-22 01:25

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部
RealH