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

 找回密码
 新人加入
查看: 11855|回复: 5

tcaxLib.pyd 模块函数说明 (英文) [复制链接]

Administrator

TCAX Dev.

Rank: 7Rank: 7Rank: 7

发表于 2011-8-4 18:29:38 |显示全部楼层
## @package tcaxLib
# tcaxLib documentation
#
# API references and usage examples of tcaxLib.pyd


## @struct PIX
# The basic element of a TCAS FX, it contains dozens of DIPs (dynamic isolated pixels).
# It is a tuple that has the following structure ((initX, initY), (width, height), (r1, g1, b1, a1, r2, g2, b2, a2, r3, ...)).
#
# initX a float, offset of the PIX in the horizontal direction
#
# initY a float, offset of the PIX in the vertical direction
#
# width an integer, width of the PIX
#
# height an integer, height of the PIX
#
# rgba all integers, rgba colors of the PIX
#
# Remarks: Although DIP is the basic unit of TCAS files, it is not easy to handle when come to make TCAS FX.
# So in TCAS FX, PIX is the one which is regarded as the basic unit and most tcaxLib APIs are used to manipulate PIXs.
# However DIP can still be used when needed. Most tcaxLib APIs receive PIX as an input parameter and return a new PIX as the output result.
# Note that, you should be definitely sure if you are going to construct your own PIX object through simple assignment operation other than
# APIs provided by tcaxLib, for instance, PIX = ((initX, initY), (width, height), (r1, g1, b1, a1, r2, g2, b2, a2, r3, ...)), any mistake may
# lead to the crash of the host program.


## Get the current tcaxLib version.
# @return unicode string the current version
def tcaxLibGetVersion():


# pix.h

## Get points from PIX.
# @param pix a PIX, the source PIX
# @return ((x1, y1), (x2, y2), ...)
def PixPoints(pix):


## Create a blank PIX.
# @param width an integer, target width of the PIX
# @param height an integer, target height of the PIX
# @param rgba an integer, target rgba of the PIX, usually in hexadecimal
# @return PIX the target PIX
def BlankPix(width, height, rgba):


## Resize a PIX.
# @param pix a PIX, the source PIX that is going to be resized
# @param width an integer, target width
# @param height an integer, target height
# @return PIX the resized PIX
def PixResize(pix, width, height):

## Resize a PIX, the same as PixResize but accept fractional width and height
# @param pix a PIX, the source PIX that is going to be resized
# @param width a float, target width
# @param height a float, target height
# @return PIX the resized PIX
def PixResizeF(pix, width, height):


## Enlarge a PIX.
# @param pix a PIX, the source PIX that is going to be enlarged
# @param x an integer, the value that is increased in the horizontal direction
# @param y an integer, the value that is increased in the vertical direction
# @return PIX the target PIX
def PixEnlarge(pix, x, y):


## Crop a PIX.
# @param pix a PIX, the source PIX that is going to be cropped
# @param left an integer, offset from the left side
# @param top an integer, offset from the top
# @param right an integer, offset from the left side, or when it is negative, offset from the right side
# @param bottom an integer, offset from the top, or when it is negative, offset from the bottom
# @return PIX the target PIX
def PixCrop(pix, left, top, right, bottom):


## Strip the blank border of a PIX.
# @param pix a PIX, the source PIX whose blank border if any is going to be stripped out
# @return PIX the target PIX
def PixStrip(pix):


## Apply a texture on a PIX.
# Remark: the texture will be resized to fit the target pix, and the positions will be just ignored.
# @param pix a PIX, the source PIX that is going to be overlayed with the texture
# @param texture a PIX, the texture PIX
# @return PIX the target PIX
def PixTexture(pix, texture):


## Apply a mask to a PIX.
# Remark: unlike the PixTexture() function, the positions will be used.
# @param pix a PIX, the source PIX that is going to be masked with the mask
# @param mask a PIX, the mask PIX
# @return PIX the target PIX
def PixMask(pix, mask):


## Replace the alpha channel of the source PIX with the alpha channel of the destination PIX.
# Remark: the transparent pixels of the source PIX will stay unchanged.
# @param pix a PIX, the source PIX whose alpha is going to be replaced by the alpha of the alpha PIX
# @param alpha a PIX, the alpha PIX
# @return PIX the target PIX
def PixReplaceAlpha(pix, alpha):


## Blur a PIX using Gauss IIR blur.
# @param pix a PIX, the source PIX that is going to be blurred
# @param radius an integer, radius of the Gauss kernel
# @return PIX the target PIX
def PixBlur(pix, radius):


## Combine two PIXs.
# @param back a PIX, the back PIX
# @param overlay a PIX, the overlay PIX
# @return PIX the target PIX
def CombinePixs(back, overlay):


## Change the color of a PIX by multiplying factors to each channel of RGBA. The value of each channel will be clipped into [0, 255]
# @param pix a PIX, the source PIX
# @param r_f a float, the red channel factor, if r_f == 1, the red channel will stay the same
# @param g_f a float, the green channel factor, if g_f == 1, the green channel will stay the same
# @param b_f a float, the blue channel factor, if b_f == 1, the blue channel will stay the same
# @param a_f a float, the alpha channel factor, if a_f == 1, the alpha channel will stay the same
# @return PIX the target PIX
def PixColorMul(PIX, r_f, g_f, b_f, a_f):


## Change the color of a PIX by shifting values of each channel of RGBA. The value of each channel will be clipped into [0, 255]
# @param pix a PIX, the source PIX
# @param r an integer, the red channel offset, can be negative, if r == 0, the red channel will stay the same
# @param g an integer, the green channel offset, can be negative, if g == 0, the green channel will stay the same
# @param b an integer, the blue channel offset, can be negative, if b == 0, the blue channel will stay the same
# @param a an integer, the alpha channel offset, can be negative, if a == 0, the alpha channel will stay the same
# @return PIX the target PIX
def PixColorShift(PIX, r, g, b, a):


## Make the color in a PIX with specified rgb value transparent.
# @param pix a PIX, the source PIX
# @param rgb an integer, the target color, not include the alpha channel
# @return PIX the target PIX
def PixColorTrans(PIX, rgb):


## Change the value of colors including alpha channels in the PIX with flat rgba value.
# @param pix a PIX, the source PIX
# @param rgba an integer, the target color
# @return PIX the target PIX
def PixColorRGBA(PIX, rgba):


## Change the value of colors in the PIX with flat rgb value.
# @param pix a PIX, the source PIX
# @param rgb an integer, the target color, not include the alpha channel
# @return PIX the target PIX
def PixColorRGB(PIX, rgb):


## Change the value of alpha channels in the PIX with constant alpha value.
# @param pix a PIX, the source PIX
# @param alpha an integer, the target alpha, in [0, 255]
# @return PIX the target PIX
def PixColorA(PIX, alpha):


## Bilinear Filter, mainly used when creating effects of moving a PIX so that it will look smoother.
# @param pix a PIX, the source PIX
# @param offset_x a float, offset of the PIX in the horizontal direction
# @param offset_y a float, offset of the PIX in the vertical direction
# @return PIX the target PIX
def BilinearFilter(pix, offset_x, offset_y):

## Scale Filter, mainly used when creating effects of moving a PIX so that it will look smoother.
# Remark: unlike BilinearFilter, this filter is best fit for complicated pictures such as textured text, but is bad for solid colored square.
# @param pix a PIX, the source PIX
# @param offset_x a float, offset of the PIX in the horizontal direction
# @param offset_y a float, offset of the PIX in the vertical direction
# @return PIX the target PIX
def ScaleFilter(pix, offset_x, offset_y):


## Create a blank BigPIX.
# Remark: a BigPix is indeed a list that has the following structure [(PIX, offset_x, offset_y, layer), (PIX, offset_x, offset_y, layer), ...],
# BigPix is used to put several PIXs together, therefore you can treate several PIXs as a whole.
# Unlike CombinePix(), BigPix usually contains PIXs that are in different positions. You can use BigPixAdd() to add a PIX to the BigPix, and use
# ConvertBigPix() to convert the BigPix back to PIX. By using BigPix you can even treate a whole text line as a single PIX.
# @return BigPIX the target BigPIX
def InitBigPix():


## Add a PIX to the BigPIX.
# @param bigPix a BigPIX, the source BigPIX
# @param pix a PIX, the PIX that is going to be added
# @param offset_x a float, offset of the PIX in the horizontal direction
# @param offset_y a float, offset of the PIX in the vertical direction
# @param layer an integer, layer of the PIX
# @return 0 on success
def BigPixAdd(bigPix, pix, offset_x, offset_y, layer):


## Convert a BigPIX to PIX.
# @param bigPix a BigPIX, the source BigPIX
# @return PIX the target PIX
def ConvertBigPix(bigPix):


# file.h

## Create an ASS file and returns the handler to the file.
# @param ass_file a string, filename of the target ASS file
# @param ass_header a string, the ASS file header
# @return assFile the handler to the ASS file
def CreateAssFile(ass_file, ass_header):


## Append to an ASS file and returns the handler to the file.
# @param ass_file a string, filename of the target ASS file
# @return assFile the handler to the ASS file
def AppendAssFile(ass_file):


## Write ASS strings to ASS file.
# @param assFile a handler, handler to the ASS file
# @param ASS_BUF a list, the list containing the ASS FX strings
# @return 0 on success
def WriteAssFile(assFile, ASS_BUF):


## Finalize the ASS file (close the handler to the file and destroy contents assigned to it).
# @param assFile a handler, handler to the ASS file
# @return 0 on success
def FinAssFile(assFile):


## Create an TCAS file and returns the handler to the file.
# @param tcas_file a string, filename of the target TCAS file
# @param fx_width an integer, width of the FX
# @param fx_height an integer, height of the FX
# @param fx_fps a float, FPS of the FX
# @return tcasFile the handler to the TCAS file
def CreateTcasFile(tcas_file, fx_width, fx_height, fx_fps):


## Write ASS strings to ASS file.
# @param tcasFile a handler, handler to the TCAS file
# @param TCAS_BUF a list, the list containing the raw TCAS FX data chunks
# @return 0 on success
def WriteTcasFile(tcasFile, TCAS_BUF):


## Finalize the TCAS file (close the handler to the file and destroy contents assigned to it).
# @param tcasFile a handler, handler to the TCAS file
# @return 0 on success
def FinTcasFile(tcasFile):


# text.h

## Initialize a font and returns the handler to the font.
# @param font_file a string, filename of the target font file
# @param face_id an integer, font face id, should always be 1 in TTF files
# @param font_size an integer, font size, in em height
# @param spacing an integer, spacing between texts, can be negative
# @param space_scale a float, scale of white spaces
# @param color an integer, rgb color of the font
# @param bord an integer, border of the font, can be negative
# @param is_outline an integer, 0 - include body, 1 - only retrieve the outline
# @return font the handler to the font
def InitFont(font_file, face_id, font_size, spacing, space_scale, color, bord, is_outline):


## Finalize the font and destroy the handler.
# @param font a handler, the handler to the font
# @return 0 on success
def FinFont(font):


## Initialize a font and retrieves a PIX of the specified text from the font.
# @param font_file a string, filename of the target font file
# @param face_id an integer, font face id, should always be 1 in TTF files
# @param font_size an integer, font size, in em height
# @param spacing an integer, spacing between texts, can be negative
# @param space_scale a float, scale of white spaces
# @param color an integer, rgb color of the font
# @param bord an integer, border of the font, can be negative
# @param is_outline an integer, 0 - include body, 1 - only retrieve the outline
# @param text a string, the text that is going to generate a PIX
# @return PIX the target PIX
def TextPix(font_file, face_id, font_size, spacing, space_scale, color, bord, is_outline, text):

## Retrieve a PIX of the specified text from a font.
# @param font a handler, the handler to the font
# @param text a string, the text that is going to generate a PIX
# @return PIX the target PIX
def TextPix(font, text):


## Get text outline points.
# @param font_file a string, filename of the target font file
# @param face_id an integer, font face id, should always be 1 in TTF files
# @param font_size an integer, font size, in em height
# @param text a string, the text of which the outline will be retrieved
# @param density a float, the density of points that we want to have, 1.0 is commonly used, however it can be less or larger than 1 according to the need
# @return ((x1, y1), (x2, y2), ...)
def TextOutlinePoints(font_file, face_id, font_size, text, density):

## Get text outline points.
# @param font a handler, the handler to the font
# @param text a string, the text of which the outline will be retrieved
# @param density a float, the density of points that we want to have, 1.0 is commonly used, however it can be less or larger than 1 according to the need
# @return ((x1, y1), (x2, y2), ...)
def TextOutlinePoints(pyFont, text, density):


## Initialize a font and retrieves the metrics of the specified text from the font.
# @param font_file a string, filename of the target font file
# @param face_id an integer, font face id, should always be 1 in TTF files
# @param font_size an integer, font size, in em height
# @param spacing an integer, spacing between texts, can be negative
# @param space_scale a float, scale of white spaces
# @param text a string, the text that is going to be measured
# @return (0 width, 1 height, 2 horiBearingX, 3 horiBearingY, 4 horiAdvance, 5 vertBearingX, 6 vertBearingY, 7 vertAdvance, 8 x_ppem, 9 y_ppem, 10 x_scale, 11 y_scale, 12 ascender, 13 descender, 14 px_height, 15 max_advance)
def TextMetrics(font_file, face_id, font_size, spacing, space_scale, text):

## Retrieve the metrics of the specified text from a font.
# @param font a handler, the handler to the font
# @param text a string, the text that is going to generate a PIX
# @return (0 width, 1 height, 2 horiBearingX, 3 horiBearingY, 4 horiAdvance, 5 vertBearingX, 6 vertBearingY, 7 vertAdvance, 8 x_ppem, 9 y_ppem, 10 x_scale, 11 y_scale, 12 ascender, 13 descender, 14 px_height, 15 max_advance)
def TextMetrics(font, text):


# image.h

## Retrieve a PIX from a PNG image.
# @param filename a string, filename of the target image, it should be a PNG file
# @return PIX the target PIX
def ImagePix(filename):

## Retrieve a PIX from a PNG image, and resize the PIX to specified size.
# @param filename a string, filename of the target image, it should be a PNG file
# @param width an integer, width of the target PIX
# @param height an integer, height of the target PIX
# @return PIX the target PIX
def ImagePix(filename, width, height):


## Save a PIX to a PNG file.
# @param filename a string, filename of the target image
# @param pix a PIX, the target PIX that is going to be saved
# @return 0 on success
def SavePix(filename, pix):

## Resize a PIX to specified size and save it to a PNG file.
# @param filename a string, filename of the target image
# @param pix a PIX, the target PIX that is going to be saved
# @param width an integer, width of the target PIX
# @param height an integer, height of the target PIX
# @return 0 on success
def SavePix(filename, pix, width, height):


# utility.h

## Get the text outline (which is consisted of contours, lines, bezier arcs) as a string of ASS drawing commands.
# @param font_file a string, filename of the target font file
# @param face_id an integer, font face id, should always be 1 in TTF files
# @param font_size an integer, font size, in em height
# @param text a string, the text of which the outline will be retrieved
# @param x an integer, position x of the offset
# @param y an integer, position y of the offset
# @return unicode string the target ASS drawing commands
def TextOutlineDraw(font_file, face_id, font_size, text, x, y):

## Get the text outline (which is consisted of contours, lines, bezier arcs) as a string of ASS drawing commands.
# @param font a handler, the handler to the font
# @param text a string, the text of which the outline will be retrieved
# @param x an integer, position x of the offset
# @param y an integer, position y of the offset
# @return unicode string the target ASS drawing commands
def TextOutlineDraw(pyFont, text, x, y):


## Check if a text string is a CJK string, here CJK means "Chinese or Japanese or Korea" not "Chinese & Japanese & Korea".
# @param text a string, the target text that is going to be checked
# @return 1 - true, 0 - false
def IsCjk(text):


## Change the text to fit the vertical text layout, only used for ASS FX.
# @param text a string, the target text that is going to be updated
# @return string the target text
def VertLayout(text):


## Show progress only needed in tcax py user mode.
# @param total an integer, total texts
# @param completed an integer, texts that had been completed
# @param file_id an integer, tcax py script file id
# @param file_num an integer, number of tcax py scripts that the FX used
# @return 0 on success
def ShowProgress(total, completed, file_id, file_num):


## Get points of a linear bezier curve.
# @param nPoints an integer, number of points you want to have
# @param xs a float, position x of the start point
# @param ys a float, position y of the start point
# @param xe a float, position x of the end point
# @param ye a float, position y of the end point
# @return ((x1, y1), (x2, y2), ...)
def Bezier1(nPoints, xs, ys, xe, ye):

## Get points of a quadratic bezier curve.
# @param nPoints an integer, number of points you want to have
# @param xs a float, position x of the start point
# @param ys a float, position y of the start point
# @param xe a float, position x of the end point
# @param ye a float, position y of the end point
# @param xc a float, position x of the control point
# @param yc a float, position y of the control point
# @return ((x1, y1), (x2, y2), ...)
def Bezier2(nPoints, xs, ys, xe, ye, xc, yc):

## Get points of a cubic bezier curve.
# @param nPoints an integer, number of points you want to have
# @param xs a float, position x of the start point
# @param ys a float, position y of the start point
# @param xe a float, position x of the end point
# @param ye a float, position y of the end point
# @param xc1 a float, position x of the 1st control point
# @param yc1 a float, position y of the 1st control point
# @param xc2 a float, position x of the 2nd control point
# @param yc2 a float, position y of the 2nd control point
# @return ((x1, y1), (x2, y2), ...)
def Bezier3(nPoints, xs, ys, xe, ye, xc1, yc1, xc2, yc2):

## Get points of a Nth order bezier curve with random control points within the specified interval.
# @param nPoints an integer, number of points you want to have
# @param xs a float, position x of the start point
# @param ys a float, position y of the start point
# @param xe a float, position x of the end point
# @param ye a float, position y of the end point
# @param xl1 a float, position x of the 1st limit point
# @param yl1 a float, position y of the 1st limit point
# @param xl2 a float, position x of the 2nd limit point
# @param yl2 a float, position y of the 2nd limit point
# @param order an integer, the order of the bezier curve
# @return ((x1, y1), (x2, y2), ...)
def BezierN(nPoints, xs, ys, xe, ye, xl1, yl1, xl2, yl2, order):


# tcasfunc.h

## Append a PIX to the TCAS_BUF list.
# @param TCAS_BUF a list, the list containing the raw TCAS FX data chunks
# @param pix a PIX, the target PIX that is going to be added into the TCAS_BUF
# @param start an integer, the starting time of the PIX
# @param end an integer, the end time of the PIX
# @param offsetX a float, offset of the PIX in the horizontal direction
# @param offsetY a float, offset of the PIX in the vertical direction
# @param layer an integer, layer of the PIX
# @return 0 on success
def tcas_main(TCAS_BUF, pix, start, end, offsetX, offsetY, layer):

## Append a pair of key frame PIXs to the TCAS_BUF list.
# @param TCAS_BUF a list, the list containing the raw TCAS FX data chunks
# @param pix_start a PIX, the target start key frame PIX that is going to be added into the TCAS_BUF
# @param pix_end a PIX, the target end key frame PIX that is going to be added into the TCAS_BUF
# @param start an integer, the starting time of the PIX
# @param end an integer, the end time of the PIX
# @param offsetX a float, offset of the PIX in the horizontal direction
# @param offsetY a float, offset of the PIX in the vertical direction
# @param type an integer, type of the key frame PIX, 1 - normal, 2 - use bilinear filtering to make smooth motion
# @param layer an integer, layer of the PIX
# @return 0 on success
def tcas_keyframe(TCAS_BUF, pix_start, pix_end, start, end, offsetX, offsetY, type, layer):








Rank: 4

发表于 2012-1-25 22:52:14 |显示全部楼层
请问有中文版的吗,本人的英语实在太那个了

Rank: 4

发表于 2013-6-13 22:04:04 |显示全部楼层
除了标题 都是英语!太可怕了 奶大 给点福利吧 不然会shi的 T_T

Administrator

TCAX Dev.

Rank: 7Rank: 7Rank: 7

发表于 2013-6-13 22:33:02 |显示全部楼层
yyxxlc 发表于 2013-6-13 22:04
除了标题 都是英语!太可怕了 奶大 给点福利吧 不然会shi的 T_T

福利 http://www.tcax.org/docs/tcaxLib/namespacemembers_func.html

教程帖, http://www.tcax.org/forum.php?mo ... =1079&fromuid=2

Rank: 4

发表于 2013-12-14 22:07:45 |显示全部楼层
表酱紫啊  英语苦手....

Rank: 4

发表于 2021-7-26 14:22:45 |显示全部楼层
本帖最后由 Seekladoom 于 2021-8-22 02:01 编辑

【如上内容的谷歌机翻】
## @package tcaxLib
#tcaxLib文档

#API的引用和tcaxLib.pyd使用示例


## @struct PIX
#TCAS的FX的基本元件,它含有几十个的DIP(动态隔离像素)。
# 它是一个具有以下结构的元组 ((initX, initY), (width, height), (r1, g1, b1, a1, r2, g2, b2, a2, r3, ...))。
#
# initX 一个浮点数,PIX 在水平方向的 偏移量
#
# initY 一个浮点数,PIX 在垂直方向的偏移量
#
# width 一个整数,PIX 的宽度
#
# height 一个整数,PIX 的高度
#
# rgba 所有整数,PIX 的 rgba 颜色
#
# 备注:虽然DIP是TCAS文件的基本单位,但在制作TCAS FX时并不容易处理。
# 所以在 TCAS FX 中,PIX 被视为基本单元,大多数 tcaxLib API 用于操作 PIX。
# 但是,在需要时仍然可以使用 DIP。大多数 tcaxLib API 接收 PIX 作为输入参数,并返回一个新的 PIX 作为输出结果。
# 注意,除了
tcaxLib提供的API之外,你应该确定你是否要通过简单的赋值操作来构造你自己的PIX对象,例如,PIX = ((initX, initY), (width, height), ( r1, g1, b1, a1, r2, g2, b2, a2, r3, ...)),任何错误都可能
导致宿主程序崩溃。


## 获取当前的 tcaxLib 版本。
# @return unicode string 当前版本
def tcaxLibGetVersion():


# pix.h

## 从 PIX 获取点数。
# @param pix 一个 PIX,源 PIX
# @return ((x1, y1), (x2, y2), ...)
def PixPoints(pix):


## 创建一个空白的 PIX。
# @param width 一个整数,PIX 的目标宽度
# @param height 一个整数,PIX 的目标高度
# @param rgba 一个整数,PIX 的目标 rgba,通常为十六进制
# @return PIX 目标 PIX
def BlankPix(宽度、高度、rgba):


## 调整 PIX 的大小。
# @param pix 一个 PIX,要调整大小的源 PIX
# @param width 一个整数,目标宽度
# @param height 一个整数,目标高度
# @return PIX 调整后的 PIX
def PixResize(pix, width, height):

## 调整 PIX 的大小,与 PixResize 相同,但接受部分宽度和高度
# @param pix 一个 PIX,将要调整大小的源 PIX
# @param width a float, target width
# @param height a float, target height
# @return PIX 调整后的 PIX
def PixResizeF(pix, width, height):


## 放大 PIX。
# @param pix 一个PIX,要放大的源PIX
# @param x 一个整数,水平方向增加的值
# @param y 一个整数,垂直方向增加的值
#@返回 PIX 目标 PIX
def PixEnlarge(pix, x, y):


## Crop a PIX。
# @param pix 一个 PIX,将被裁剪的源 PIX
# @param left 一个整数,从左侧偏移
# @param top 一个整数,从顶部偏移
# @param right 一个整数,从左侧偏移side,或者当它是负数时,从右侧偏移
# @param bottom 一个整数,从顶部偏移,或者当它是负数时,从底部偏移
# @return PIX 目标 PIX
def PixCrop(pix, left, top , right, bottom):


## 去除 PIX 的空白边框。
# @param pix 一个 PIX,源 PIX,其空白边框将被剥离
# @return PIX 目标 PIX
def PixStrip(pix):


## 在 PIX 上应用纹理。
# 备注:纹理将调整大小以适应目标像素,位置将被忽略。
# @param pix 一个 PIX,将与纹理叠加的源 PIX
# @param texture a PIX,纹理 PIX
# @return PIX 目标 PIX
def PixTexture(pix, texture):


## 应用蒙版一个 PIX。
# 备注:与 PixTexture() 函数不同,将使用位置。
# @param pix 一个PIX,将被掩码屏蔽的源PIX
# @param mask a PIX,掩码PIX
# @return PIX 目标PIX
def PixMask(pix, mask):


## 替换alpha 通道源 PIX 与目标 PIX 的 alpha 通道。
# 备注:源PIX的透明像素将保持不变。
# @param pix a PIX,其 alpha 将被 alpha PIX 的 alpha 替换的源 PIX
# @param alpha a PIX,alpha PIX
# @return PIX 目标 PIX
def PixReplaceAlpha(pix, alpha):


# # 使用高斯 IIR 模糊来模糊 PIX。
# @param pix 一个 PIX,将被模糊的源 PIX
# @param radius 一个整数,高斯内核的半径
# @return PIX 目标 PIX
def PixBlur(pix, radius):


## 合并两个 PIX。
# @param 返回 PIX,返回 PIX
# @param 覆盖一个 PIX,覆盖 PIX
# @return PIX 目标 PIX
def CombinePixs(back, overlay):


## 通过将因子乘以 RGBA 的每个通道来更改 PIX 的颜色。每个通道的值将被剪裁成[0, 255]
# @param pix a PIX,源PIX
# @param r_f a float,红色通道因子,如果r_f == 1,红色通道将保持不变
# @param g_f a float,绿色通道系数,如果g_f == 1,绿色通道保持不变
#@param b_f a float,蓝色通道系数,如果b_f == 1,蓝色通道保持不变
# @param a_f 一个浮点数,alpha 通道因子,如果 a_f == 1,alpha 通道将保持不变
# @return PIX 目标 PIX
def PixColorMul(PIX, r_f, g_f, b_f, a_f):


## 通过移动 RGBA 的每个通道的值来更改 PIX 的颜色。每个通道的值都会被剪裁成[0, 255]
#@param pix a PIX,源PIX
# @param r 一个整数,红色通道偏移量,可以为负数,如果r == 0,红色通道会保持不变
#@param g 一个整数,绿色通道偏移量,可以为负,如果 g == 0,绿色通道将保持不变
# @param b 一个整数,蓝色通道偏移量,可以为负,如果 b == 0,蓝色通道将保持不变
# @param a 一个整数,alpha 通道偏移量,可以为负,如果 a == 0,alpha 通道将保持不变
# @return PIX 目标 PIX
def PixColorShift( PIX、r、g、b、a):


## 使具有指定 rgb 值的 PIX 中的颜色透明。
# @param pix 一个 PIX,源 PIX
# @param rgb 一个整数,目标颜色,不包括 alpha 通道
# @return PIX 目标 PIX
def PixColorTrans(PIX, rgb):


## 改变颜色的值,包括 alpha PIX 中具有平坦 rgba 值的通道。
# @param pix 一个 PIX,源 PIX
# @param rgba 一个整数,目标颜色
# @return PIX 目标 PIX
def PixColorRGBA(PIX, rgba):


## 用平面 rgb 值改变 PIX 中的颜色值。
# @param pix 一个 PIX,源 PIX
# @param rgb 一个整数,目标颜色,不包括 alpha 通道
# @return PIX 目标 PIX
def PixColorRGB(PIX, rgb):


## 使用恒定 alpha 值更改 PIX 中的 alpha 通道值。
# @param pix 一个PIX,源PIX
# @param alpha 一个整数,目标alpha,in [0, 255]
# @return PIX 目标PIX
def PixColorA(PIX, alpha):


##双线性过滤器,主要用于创建移动 PIX 的效果,使其看起来更平滑。
# @param pix 一个PIX,源PIX
# @param offset_x a float,PIX 在水平方向的
偏移# @param offset_y a float,PIX 在垂直方向的偏移
# @return PIX 目标PIX
def BilinearFilter( pix、offset_x、offset_y):

## Scale Filter,主要用于创建移动 PIX 的效果,使其看起来更平滑。
# 备注:与 BilinearFilter 不同,此过滤器最适合纹理文本等复杂图片,但不适用于纯色方块。
# @param pix 一个PIX,源PIX
# @param offset_x a float,PIX 在水平方向的
偏移# @param offset_y a float,PIX 在垂直方向的偏移
# @return PIX 目标PIX
def ScaleFilter( pix, offset_x, offset_y):


## 创建一个空白的 BigPIX。
# 备注:一个BigPix确实是一个具有以下结构的列表[(PIX, offset_x, offset_y, layer), (PIX, offset_x, offset_y, layer), ...],
# BigPix 用于将多个 PIX 放在一起,因此您可以将多个 PIX 视为一个整体。
# 与CombinePix() 不同,BigPix 通常包含处于不同位置的PIX。您可以使用 BigPixAdd() 将 PIX 添加到 BigPix,并使用
# ConvertBigPix() 将 BigPix 转换回 PIX。通过使用 BigPix,您甚至可以将整个文本行视为单个 PIX。
# @return BigPIX 目标 BigPIX
def InitBigPix():


## 添加一个 PIX 到 BigPIX。
# @param bigPix a BigPIX,源BigPIX
# @param pix a PIX,即将添加的PIX
# @param offset_x a float,PIX 在水平方向的
偏移量# @param offset_y a float,偏移量垂直方向的 PIX
# @param layer 一个整数,PIX 的层
# @return 0 成功
def BigPixAdd(bigPix, pix, offset_x, offset_y, layer):


## 将 BigPIX 转换为 PIX。
# @param bigPix 一个 BigPIX,源 BigPIX
# @return PIX 目标 PIX
def ConvertBigPix(bigPix):


# file.h

## 创建一个 ASS 文件并将处理程序返回给文件。
# @param ass_file 字符串,目标 ASS 文件的文件名
# @param ass_header 字符串,ASS 文件头
# @return assFile ASS 文件的处理程序
def CreateAssFile(ass_file, ass_header):


## 附加到 ASS 文件和将处理程序返回到文件。
# @param ass_file 一个字符串,目标ASS文件的文件名
# @return assFile ASS 文件的处理程序
def AppendAssFile(ass_file):


## 将 ASS 字符串写入 ASS 文件。
# @param assFile 处理程序,ASS 文件处理程序
# @param ASS_BUF 一个列表,该列表包含 ASS FX 字符串
# @return 0 成功
def WriteAssFile(assFile, ASS_BUF):


## 完成 ASS 文件(关闭处理程序)到文件并销毁分配给它的内容)。
# @param assFile 一个处理程序,ASS 文件的处理程序
# @return 0 成功
def FinAssFile(assFile):


## 创建一个 TCAS 文件并将处理程序返回到文件中。
# @param tcas_file 一个字符串,目标 TCAS 文件的文件名
# @param fx_width 一个整数,FX 的宽度
# @param fx_height 一个整数,FX 的高度
# @param fx_fps 一个浮点数,FX 的 FPS
# @return tcasFile 处理程序到 TCAS 文件
def CreateTcasFile(tcas_file, fx_width, fx_height, fx_fps):


## 将 ASS 字符串写入ASS文件。
# @param tcasFile 一个处理程序,TCAS 文件的处理程序
# @param TCAS_BUF 一个列表,该列表包含原始 TCAS FX 数据块
# @return 0 成功
def WriteTcasFile(tcasFile, TCAS_BUF):


## 完成 TCAS 文件(关闭文件的处理程序并销毁分配给它的内容)。
# @param tcasFile 一个处理程序,TCAS 文件的处理程序
# @return 0 成功
def FinTcasFile(tcasFile):


# text.h

## 初始化字体并将处理程序返回给字体。
# @param font_file 一个字符串,目标字体文件的文件名
# @param face_id 一个整数,字体标识,在 TTF 文件中应该始终为 1
# @param font_size 一个整数,字体大小,em 高度
# @param 间隔一个整数, 文本间距, 可以为负
# @param space_scale 一个浮点数, 空格的比例
# @param color 一个整数, rgb 字体颜色
# @param bord 一个整数, 字体的边框, 可以为负
# @param is_outline一个整数,0 - 包含正文,1 - 只检索轮廓
# @return font 处理程序到字体
def InitFont(font_file, face_id, font_size, Spacing, space_scale, color, bord, is_outline):


## 完成字体并销毁处理程序。
# @param font 处理程序,字体处理程序
# @return 0 on success
def FinFont(font):


## 初始化字体并从字体中检索指定文本的 PIX。
# @param font_file 一个字符串,目标字体文件的文件名
# @param face_id 一个整数,字体标识,在 TTF 文件中应该总是 1
# @param font_size 一个整数,字体大小,em 高度
# @param 间隔一个整数, 文本间距, 可以为负
# @param space_scale 一个浮点数, 空格的比例
# @param color 一个整数, rgb 字体颜色
# @param bord 一个整数, 字体的边框, 可以为负
# @param is_outline 一个整数,0 - 包含正文,1 - 只检索轮廓
# @param text 一个字符串,将生成 PIX 的文本
# @return PIX 目标 PIX
def TextPix(font_file, face_id, font_size,间距,空间比例,颜色,边框,is_outline,文本):

##从字体中检索指定文本的PIX。
# @param font 处理程序,字体处理程序
# @param text 一个字符串,将要生成 PIX 的文本
# @return PIX 目标 PIX
def TextPix(font, text):


## 获取文本轮廓点。
# @param font_file 一个字符串,目标字体文件的文件名
# @param face_id 一个整数,字体标识,在 TTF 文件中应始终为 1
# @param font_size 一个整数,字体大小,以em 高度为单位
# @param text 一个字符串,将检索其轮廓的文本
# @param density 一个浮点数,我们想要的点的密度,常用1.0 , 但是可以根据需要小于或大于 1
# @return ((x1, y1), (x2, y2), ...)
def TextOutlinePoints(font_file, face_id, font_size, text, density):

##获取文本轮廓点。
# @param font a handler,字体的handler
# @param text 一个字符串,提取轮廓的文本
# @param density 一个浮点数,我们想要的点的密度,常用1.0,但是它可以根据需要小于或大于 1
# @return ((x1, y1), (x2, y2), ...)
def TextOutlinePoints(pyFont, text, density):


## 初始化字体并从字体中检索指定文本的度量。
# @param font_file 一个字符串,目标字体文件的文件名
# @param face_id 一个整数,字体标识,在 TTF 文件中应该始终为 1
# @param font_size 一个整数,字体大小,em 高度
# @param 间隔一个整数, 文本间距, 可以为负
# @param space_scale a float, scale of white space
# @param text a string, 要测量的文本
# @return (0 width, 1 height, 2 horiBearingX, 3 horiBearingY, 4 horiAdvance, 5 vertBearingX, 6 vertBearingY, 7 vertAdvance, 8 x_ppem, 9 y_ppem, 10 x_scale, 11 y_scale, 12 上升, 13 下降, 14 px_height, 15 max_advance)
def TextMetrics(font_file, face_id, font_size, spatial, space_scale, text):

## 从字体中检索指定文本的度量。
# @param font 处理程序,字体处理程序
# @param text 一个字符串,将要生成 PIX 的文本
# @return (0 width, 1 height, 2 horiBearingX, 3 horiBearingY, 4 horiAdvance, 5 vertBearingX, 6 vertBearingY, 7 vertAdvance, 8 x_ppem, 9 y_ppem, 10 x_scale, 11 y_scale, 12 上升部, 13 下降部, 14 px_height, 15 max_advance)
def TextMetrics(font, text):


# image.h

## 从 PIX 中检索 PNG图像。
# @param filename 一个字符串,目标图片的文件名,应该是一个PNG文件
# @return PIX 目标PIX
def ImagePix(filename):

## 从 PNG 图像中检索 PIX,并将 PIX 大小调整为指定大小。
# @param filename 一个字符串,目标图片的文件名,应该是一个PNG文件
# @param width 一个整数,目标PIX的宽度
# @param height 一个整数,目标PIX的高度
# @return PIX 目标PIX
def ImagePix(filename, width, height):


## 将 PIX 保存为 PNG 文件。
# @param filename 一个字符串,目标图像的文件名
# @param pix a PIX,将要保存的目标 PIX
# @return 0 成功
def SavePix(filename, pix):

## 将 PIX 调整为指定大小并将其保存为 PNG 文件。
# @param filename 一个字符串,目标图片的文件名
# @param pix 一个 PIX,要保存的目标 PIX
# @param width 一个整数,目标 PIX 的宽度
# @param height 一个整数,目标 PIX 的高度
# @return 0 成功
def SavePix(filename , pix, width, height):


#utility.h

##获取文本轮廓(由轮廓、线条、贝塞尔弧组成)作为一串ASS绘图命令。
# @param font_file 一个字符串,目标字体文件的文件名
# @param face_id 一个整数,字体 ID,在 TTF 文件中应该始终为 1
# @param font_size 一个整数,字体大小,em 高度
# @param text 一个字符串, 将检索轮廓的文本
# @param x 一个整数,偏移量的位置 x
# @param y 一个整数,偏移量的位置 y
# @return unicode string 目标 ASS 绘图命令
def TextOutlineDraw(font_file, face_id, font_size, text, x, y):

## 获取文本轮廓(由轮廓组成) 、线、贝塞尔弧)作为一串 ASS 绘图命令。
# @param font 处理程序,字体处理程序
# @param text 一个字符串,将检索其轮廓的文本
# @param x 一个整数,偏移量的位置 x
# @param y 一个整数,位置 y 的偏移量
# @return unicode string 目标 ASS 绘图命令
def TextOutlineDraw(pyFont, text, x, y):


## 检查文本字符串是否为 CJK 字符串,这里 CJK 的意思是“中文或日文或韩文”,而不是“中日韩文”。
# @param text 一个字符串,要检查的目标文本
# @return 1 - true, 0 - false
def IsCjk(text):


## 更改文本以适应垂直文本布局,仅用于 ASS FX。
# @param text 一个字符串,将要更新
的目标文本 # @return string 目标文本
def VertLayout(text):


## 仅在 tcax py 用户模式下显示进度。
# @param total 一个整数,total texts
# @param 完成一个整数,已经完成的文本
# @param file_id 一个整数,tcax py 脚本文件id
# @param file_num 一个整数,FX 使用的 tcax py 脚本的数量
# @return 0 成功
def ShowProgress(total, completed, file_id, file_num):


## 获取线性贝塞尔曲线的点。
# @param nPoints 一个整数,你想要的点数
# @param xs 一个浮点数,起点的位置 x
# @param ys 一个浮点数,起点的位置 y
# @param xe 一个浮点数,位置 x of终点
# @param ye 一个浮点数,终点的位置 y
# @return ((x1, y1), (x2, y2), ...)
def Bezier1(nPoints, xs, ys, xe, ye):

## 获取二次贝塞尔曲线的点。
# @param nPoints 一个整数,你想要的点数
# @param xs a float,起点的位置x
# @param ys a float,起点的位置y
# @param xe a float,终点的位置x
# @param ye a float,起点的位置y终点
# @param xc 一个浮点数,控制点的位置 x
# @param yc 一个浮点数,控制点的位置 y
# @return ((x1, y1), (x2, y2), ...)
def Bezier2 (nPoints, xs, ys, xe, ye, xc, yc):

## 获取三次贝塞尔曲线的点。
# @param nPoints 一个整数,你想要的点数
# @param xs 一个浮点数,起点的位置 x
# @param ys 一个浮点数,起点的位置 y
# @param xe 一个浮点数,位置 x of终点
# @param ye 一个浮点数,终点的位置 y
# @param xc1 一个浮点数,第一个控制点的位置 x
# @param yc1 一个浮点数,第一个控制点的位置 y
# @param xc2 一个浮点数,位置 x第二个控制点的
#@param yc2 a float, 第二个控制点的位置y
# @return ((x1, y1), (x2, y2), ...)
def Bezier3(nPoints, xs, ys, xe, ye, xc1, yc1, xc2, yc2):

## 获取指定区间内带有随机控制点的 N 阶贝塞尔曲线的点。
# @param nPoints 一个整数,你想要的点数
# @param xs 一个浮点数,起点的位置 x
# @param ys 一个浮点数,起点的位置 y
# @param xe 一个浮点数,位置 x of终点
# @param ye a float,终点的位置y
# @param xl1 a float,第一个极限点的位置x # @param yl1 a float,第一个极限点的
位置y
# @param xl2 a float,位置x第二个极限点的
#@param yl2 a float, 第二个极限点的位置y
# @param order 一个整数,贝塞尔曲线的顺序
# @return ((x1, y1), (x2, y2), .. .)
def BezierN(nPoints, xs, ys, xe, ye, xl1, yl1, xl2, yl2, order):


# tcasfunc.h

## 在 TCAS_BUF 列表中添加一个 PIX。
# @param TCAS_BUF 一个列表,包含原始 TCAS FX 数据块的列表
# @param pix 一个 PIX,将要加入 TCAS_BUF 的目标 PIX
# @param start 一个整数,PIX 的开始时间
# @param end 一个整数,PIX 的结束时间
# @param offsetX 一个浮点数,PIX 在水平方向的
偏移量 # @param offsetY 一个浮点数,PIX 在垂直方向的偏移量
# @param layer 一个整数, PIX 的层
# @return 0 on success
def tcas_main(TCAS_BUF, pix, start, end, offsetX, offsetY, layer):

## 将一对关键帧 PIX 附加到 TCAS_BUF 列表中。
# @param TCAS_BUF 一个列表,包含原始 TCAS FX 数据块的列表
# @param pix_start a PIX,将要添加到 TCAS_BUF 中的目标起始关键帧 PIX
# @param pix_end a PIX,目标结束关键帧即将加入TCAS_BUF的PIX
# @param start 一个整数,PIX的开始时间
# @param end 一个整数,PIX 的结束时间
# @param offsetX 一个浮点数,PIX 在水平方向的
偏移量 # @param offsetY 一个浮点数,PIX 在垂直方向的偏移量
# @param type 一个整数,关键帧 PIX 的类型,1 - 正常,2 - 使用双线性过滤使运动平滑
# @param layer 一个整数,PIX 的层
# @return 0 成功
def tcas_keyframe(TCAS_BUF, pix_start, pix_end, start, end, offsetX、offsetY、类型、层):

总共54个函数:
  1. - A -
  2. def AppendAssFile(ass_file):

  3. - B -
  4. def Bezier1(nPoints, xs, ys, xe, ye):
  5. def Bezier2(nPoints, xs, ys, xe, ye, xc, yc):
  6. def Bezier3(nPoints, xs, ys, xe, ye, xc1, yc1, xc2, yc2):
  7. def BezierN(nPoints, xs, ys, xe, ye, xl1, yl1, xl2, yl2, order):
  8. def BigPixAdd(bigPix, pix, offset_x, offset_y, layer):
  9. def BilinearFilter(pix, offset_x, offset_y):
  10. def BlankPix(width, height, rgba):

  11. - C -
  12. def CombinePixs(back, overlay):
  13. def ConvertBigPix(bigPix):
  14. def CreateAssFile(ass_file, ass_header):
  15. def CreateTcasFile(tcas_file, fx_width, fx_height, fx_fps):

  16. - F -
  17. def FinAssFile(assFile):
  18. def FinFont(font):
  19. def FinTcasFile(tcasFile):

  20. - I -
  21. def ImagePix(filename):
  22. def ImagePix(filename, width, height):
  23. def InitBigPix():
  24. def InitFont(font_file, face_id, font_size, spacing, space_scale, color, bord, is_outline):
  25. def IsCjk(text):

  26. - P -
  27. def PixBlur(pix, radius):
  28. def PixColorA(PIX, alpha):
  29. def PixColorMul(PIX, r_f, g_f, b_f, a_f):
  30. def PixColorRGBA(PIX, rgba):
  31. def PixColorRGB(PIX, rgb):
  32. def PixColorShift(PIX, r, g, b, a):
  33. def PixColorTrans(PIX, rgb):
  34. def PixCrop(pix, left, top, right, bottom):
  35. def PixEnlarge(pix, x, y):
  36. def PixMask(pix, mask):
  37. def PixPoints(pix):
  38. def PixReplaceAlpha(pix, alpha):
  39. def PixResize(pix, width, height):
  40. def PixResizeF(pix, width, height):
  41. def PixStrip(pix):
  42. def PixTexture(pix, texture):

  43. - S -
  44. def SavePix(filename, pix):
  45. def SavePix(filename, pix, width, height):
  46. def ScaleFilter(pix, offset_x, offset_y):
  47. def ShowProgress(total, completed, file_id, file_num):

  48. - T -
  49. def tcas_keyframe(TCAS_BUF, pix_start, pix_end, start, end, offsetX, offsetY, type, layer):
  50. def tcas_main(TCAS_BUF, pix, start, end, offsetX, offsetY, layer):
  51. def tcaxLibGetVersion():
  52. def TextPix(font_file, face_id, font_size, spacing, space_scale, color, bord, is_outline, text):
  53. def TextPix(font, text):
  54. def TextOutlineDraw(font_file, face_id, font_size, text, x, y):
  55. def TextOutlineDraw(pyFont, text, x, y):
  56. def TextOutlinePoints(font_file, face_id, font_size, text, density):
  57. def TextOutlinePoints(pyFont, text, density):
  58. def TextMetrics(font_file, face_id, font_size, spacing, space_scale, text):
  59. def TextMetrics(font, text):

  60. - V -
  61. def VertLayout(text):

  62. - W -
  63. def WriteAssFile(assFile, ASS_BUF):
  64. def WriteTcasFile(tcasFile, TCAS_BUF):
复制代码


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

GitHub|TCAX 主页

GMT+8, 2024-3-29 08:42

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部
RealH