RUBY 代码 
[code]dll = "TextBoard.dll" 
 
str_num = Win32API.new(dll, 'GetUtf8StrCharNum', 'LL', 'L') 
gf_rect = Win32API.new(dll, 'bitmap_GradientFill_rect', 'LLLL', 'L') 
gf_xywh = Win32API.new(dll, 'bitmap_GradientFill_xywh', 'LLLLLLL', 'L') 
text_size = Win32API.new(dll, 'text_size', 'LLLL', 'L') 
dt_rect = Win32API.new(dll, 'TB_draw_text_rect', 'LLLLLLLL', 'L') 
dt_xywh = Win32API.new(dll, 'TB_draw_text_xywh', 'LLLLLLLLLLL', 'L') 
 
 
函数原型: 
int GetUtf8StrCharNum(UINT strID, int cTerminate); 
int bitmap_GradientFill_rect(UINT bitmapID, UINT rectID, UINT sLGClrsID, int anglePct); 
int bitmap_GradientFill_xywh(UINT bitmapID, int rectX, int rectY, int rectWdth, int rectHght, UINT sLGClrsID, int anglePct); 
int text_size(UINT bitmapID, UINT strID, int cTerminate, UINT sizeID); 
int TB_draw_text_rect(UINT bitmapID, UINT rectID, UINT strID, int cTerminate, UINT fontARGB, UINT sLGClrsID, int anglePct, int option); 
int TB_draw_text_xywh(UINT bitmapID, int rectX, int rectY, int rectWdth, int rectHght, UINT strID, int cTerminate, UINT fontARGB, UINT sLGClrsID, int anglePct, int option); 
 
 
※函数仅适用于原版RMXP,参数中 **ID 只进行了简单检查 
 
 
GetUtf8StrCharNum 
功  能:获取符合Utf8编码的字符数(不超过0x7FFF_FFFF) 
 
参  数:strID       字符串,String#object_id 
        cTerminate  字符串终止符,实际有效的是低位字节 
                      -1 即 无终止符,终止符不计入字符数 
 
返回值:31 bit   表示 strID错误 或 读取到了非Utf8编码字符 
        0..30bit 表示符合Utf8编码的字符数 
 
示  例:str = "文字\nab\0\x80测试" 
        api.call(str.__id__, -1) => 0x8000_0006 
        api.call(str.__id__, 10) => 2 
        api.call(str.__id__,  0) => 5 
 
 
bitmap_GradientFill_rect/xywh 
功  能:多颜色线性ARGB渐变填充至位图的目标区域 
 
参  数:bitmapID         位图,Bitmap#object_id 
        rectID/rectXYWH  位图的目标区域,rectID 为 Rect#object_id                      
        sLGClrID         描述颜色渐变构成的 String#object_id 
                           由节点进行描述,每个节点为float pos, UINT argb 
                           首节点pos须为 0.0f,尾节点pos须为 1.0f 
                           后一个节点pos至少比前一节点pos大 0.001f 
                           字符串至少2个节点,且字节数须为 8的倍数                            
        anglePct         颜色的方向, 
                           逆时针角度的百分比数,取值范围[-3600W, +3600W] 
 
返回值:0    表示成功 
        -n   表示第n个参数错误,-101 表示 申请内存失败 
 
示  例:rect = Rect.new(-10, -10, 100, 50) 
        str = [0.0, 0xFFFF0000, 0.8, 0xFFFFFF00, 1.0, 0xFF00FF00].pack('fL'*3) 
        angle = 4550(45.5度) 
        api.call(bitmap.__id__, rect.__id__, str.__id__, angle) 
 
 
text_size 
功  能:类似Bitmap#text_size 
        计算含斜体部分 
        字符串只读取符合Utf8的部分 
 
参  数:bitmapID    位图,Bitmap#object_id         
        strID       字符串,String#object_id 
        cTerminate  字符串终止符,参上 
        sizeID[out] 接受文本大小的 object_id 
                      当为 String#object_id 时,至少8字节,写入(textW, textH) 
                      其他视为 Rect#object_id,写入(0, 0, textW, textH) 
 
返回值:0    表示成功 
        -n   表示第n个参数错误,-100 表示 WIN32 API 调用失败 
 
示  例:bitmap.font.size = 33 
        # ……字体设置…… 
 
        str = "文字测试" 
        buf = "\0" * 8 
        api.call(bitmap.__id__, str.__id__, -1, buf.__id__) 
 
 
TB_draw_text_rect/xywh         
功  能:类似Bitmap#draw_text 
        字符串只读取符合Utf8的部分 
        有些字体的缺失字符描绘不同 
        不支持设置的 bitmap_font_color 
        目标区域太小时,不会缩小文本 
 
参  数:bitmapID         位图,Bitmap#object_id 
        rectID/rectXYWH  位图的目标区域,rectID 为 Rect#object_id 
        strID            字符串,String#object_id 
        cTerminate       字符串终止符,参上 
        fontARGB         字体颜色,无法读取到位图设置的颜色自行设置 
                           alpha