You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 17, 2020. It is now read-only.
in old Yutils core (used from FXSpindle) the function Yutils.ass.convert_coloralpha contains an incorrect regular expression:
elseif ass_r_a:find("^&H%x%x%x%x%x%x%x%x$") then -- ASS color+alpha (style)
here an & at the end is missing
elseif ass_r_a:find("^&H%x%x%x%x%x%x%x%x&$") then -- ASS color+alpha (style)
Also at result value this is missing. It may be missed in ealier versions, in current version (aegisub at Ubuntu) its required and used as it seems Or is this an error from aegisub byself?.
Ill tell you this to take care about while redeveloping the library (:
Good luck
My (not so clean) implementation (but for this i have all maybe required values from one function, optimizing and refactoring follows later as usual for me):
coloralpha = function(ass_a_r, g, b, a)
-- result: a, r, g, b, ass_complete, ass_color, ass_alpha
local result = { a = nil, r = nil, g = nil, b = nil, ass = nil, ass_c = nil, ass_a = nil }
g = g and g or false -- set g explicit to false if it not given
if g then -- g is given, with this b should be given too
a = a and a or false -- set a explicit to false if it not given
if a then -- a r g b in numbers is given
r = ass_a_r
else -- r g b in numbers is given
r = ass_a_r
a = 255
end
else -- just ass_a_r is given
if type(ass_a_r) == "string" then -- ass value is given
if ass_a_r:find("^&H%x%x&$") then -- ass alpha is given
a = 255 - tonumber(ass_a_r:sub(3,4), 16)
r, g, b = 0, 0, 0
elseif ass_a_r:find("^&H%x%x%x%x%x%x&$") then -- ass r g b is given
a = 255
r = tonumber(ass_a_r:sub(7,8), 16)
g = tonumber(ass_a_r:sub(5,6), 16)
b = tonumber(ass_a_r:sub(3,4), 16)
elseif ass_a_r:find("^&H%x%x%x%x%x%x%x%x&$") then -- ass r g b a is given
a = 255 - tonumber(ass_a_r:sub(3,4), 16)
r = tonumber(ass_a_r:sub(9,10), 16)
g = tonumber(ass_a_r:sub(7,8), 16)
b = tonumber(ass_a_r:sub(5,6), 16)
else
error(string.format("invalid string %q", ass_a_r))
end
else -- alpha in number is given
a = ass_a_r
r, g, b = 0, 0, 0
end
end
result.a, result.r, result.g, result.b = a, r, g, b
result.ass = string.format("&H%02X%02X%02X%02X&", 255 - a, b, g, r)
result.ass_r = string.format("&H%02X%02X%02X&", b, g, r)
result.ass_a = string.format("&H%02X&", 255 - a)
return unpack(result)
end,
The text was updated successfully, but these errors were encountered:
Hi,
in old Yutils core (used from FXSpindle) the function Yutils.ass.convert_coloralpha contains an incorrect regular expression:
here an & at the end is missing
Also at result value this is missing. It may be missed in ealier versions, in current version (aegisub at Ubuntu) its required and used as it seems Or is this an error from aegisub byself?.
Ill tell you this to take care about while redeveloping the library (:
Good luck
My (not so clean) implementation (but for this i have all maybe required values from one function, optimizing and refactoring follows later as usual for me):
The text was updated successfully, but these errors were encountered: