Closed majg0 closed 5 years ago
I wrote this function which may help you;
function getColorComponents(x) {
let y = x
const RR = y & 0xFF
y >>= 8
const GG = y & 0xFF
y >>= 8
const BB = y & 0xFF
y >>= 8
const AA = ((x << 8) - 1) & 0xFF
return [RR, GG, BB, AA || 255]
}
You can .map(x => ('0' + x.toString(16).toUpperCase()).slice(-2)).join('')
$ getColorComponents(-2147483640)
.map(x => ('0' + x.toString(16).toUpperCase()).slice(-2))
.join('')
> "080000FF"
@martingronlund Thanks for your report and codes, but after testing several edge cases in Aegisub with libass renderer, I found it's not an intuitive thing. You can check ce8d33d for details.
@martingronlund BTW, currently ass-compiler
doesn't support SSA format, I'll support it someday.
@weizhenye wow, great job with the extensive suite. Thank you very much for your diligence.
I'm closing this issue. Ofc, feel free to reopen if you disagree.
Greetings!
First of all, thank you for your ASS libraries!
I have found a minor error; Colors should, according to spec, be able to be specified as long integers (I'm guessing
long
here means "at least 32-bit", like in C).Spec states:
The integer should be considered a signed integer, as seen in the test file:
You can see the error using your fantastic online viewer 👍