Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 60a2da85 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

ASS: Add the string to color conversion function and a sample ass file

parent 7b55412f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!3Add documents
......@@ -6,7 +6,35 @@ Style::Style(const QString & /*unused*/)
{
}
QColor Color::fromString(const QString &) noexcept
QColor
Color::fromString(const QString &colorString) noexcept
{
return QColor{};
/* Ignore the '&H' at the begeing of the color if needed */
int startIndex = 0;
if (colorString.startsWith("&"))
startIndex++;
if (colorString.startsWith("H") || colorString.startsWith("h"))
startIndex++;
/* A valid string color is like 'AARRGGBB' for now (skipped 'aH') */
if (colorString.size() - startIndex != 8) {
qCritical() << "Found an invalid color string:" << colorString;
return QColor(0, 0, 0, 0);
}
bool ok_alpha = false;
bool ok_red = false;
bool ok_green = false;
bool ok_blue = false;
int alpha = colorString.mid(startIndex, 2).toInt(&ok_alpha, 16);
int red = colorString.mid(startIndex + 2, 2).toInt(&ok_red, 16);
int green = colorString.mid(startIndex + 4, 2).toInt(&ok_green, 16);
int blue = colorString.mid(startIndex + 6, 2).toInt(&ok_blue, 16);
if (!(ok_alpha && ok_red && ok_green && ok_blue)) {
qCritical() << "Found an invalid color string:" << colorString;
return QColor(0, 0, 0, 0);
}
return QColor(red, green, blue, alpha);
}
......@@ -8,7 +8,6 @@
namespace Vivy::Ass
{
namespace Color
{
QColor fromString(const QString &) noexcept;
......
[Script Info]
; Script generated by Aegisub 3.2.2
; http://www.aegisub.org/
; Note that the comments with the Aegisub templates will be ignored by Vivy
Title: Default Aegisub file
ScriptType: v4.00+
WrapStyle: 0
ScaledBorderAndShadow: yes
YCbCr Matrix: TV.601
PlayResX: 1280
PlayResY: 720
[Aegisub Project Garbage]
; This section will be ignored by Vivy
Last Style Storage: Default
Audio File: op1.mkv
Video Zoom Percent: 0.250000
Scroll Position: 6
Active Line: 10
[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Def-furigana,Amaranth,30,&H00FFFFFF,&H00F5481A,&H00000000,&H00B48300,0,0,0,0,100,100,0,0,1,2,0,8,10,10,20,1
Style: DEFAULT-furigana,Amaranth,30,&H00FFFFFF,&H00F5481A,&H00000000,&H00B48300,0,0,0,0,100,100,0,0,1,2,0,8,10,10,20,1
Style: Default-furigana,Arial,10,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,1,1,2,10,10,10,1
Style: Def,Amaranth,60,&H00F5481A,&H00FFF0A4,&H00000000,&H00B48300,0,0,0,0,100,100,0,0,1,4,0,8,10,10,20,1
[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Comment: 0,0:00:00.00,0:00:00.00,Def,CODE,0,0,0,code line all,ci = { 0, 0, 0, 0, 0, 0, 0, 0 }; cn = _G.unicode.len(orgline.text_stripped);
Comment: 0,0:00:00.00,0:00:00.00,Def,CODE,0,0,0,code once,function char_counter(ref) ci[ref] = ci[ref] + 1; return "" end; math.randomseed( _G.os.time());
Comment: 1,0:00:00.00,0:00:00.00,Def,BACK,0,0,0,template char all noblank,!char_counter(1)!!retime("start2syl",-1200+ci[1]/cn*600,-50)!{\fad(200,0)\c!line.styleref.color3!\pos($x,$y)}
Comment: 20,0:00:00.00,0:00:00.00,Def,,0,0,0,template char all noblank,!char_counter(2)!!retime("start2syl",-1200+ci[2]/cn*600,-50)!{\fad(200,0)\bord0\c!line.styleref.color2!\pos($x,$y)}
Comment: 2,0:00:00.00,0:00:00.00,Def,BACK,0,0,0,template char all noblank,!retime("syl",-50,-50-$dur/4)!{\c!line.styleref.color4!\3c!line.styleref.color4!\blur5\bord8\move($x,$y,$x,!$y-($height/6)!,0,!$dur/3!)\t(0,!13*$dur/12!,\blur0\bord!line.styleref.outline!\c!line.styleref.color3!\3c!line.styleref.color3!)}
Comment: 30,0:00:00.00,0:00:00.00,Def,,0,0,0,template char all noblank,!retime("syl",-50,-50-$dur/4)!{\bord0\c!line.styleref.color2!\t(0,!$sdur < 50 and "0" or $dur/3!,\c!line.styleref.color1!)\move($x,$y,$x,!$y-($height/6)!,0,!$dur/3!)}
Comment: 2,0:00:00.00,0:00:00.00,Def,BACK,0,0,0,template char all noblank,!retime("postsyl",-50-$dur/4,$dur/12)!{\c!line.styleref.color4!\3c!line.styleref.color4!\blur5\bord8\t(!-3*$dur/4!,!$dur/3!,\blur0\bord!line.styleref.outline!\c!line.styleref.color3!\3c!line.styleref.color3!)\move($x,!$y-($height/6)!,$x,!$y!,0,!$dur/3!)}
Comment: 30,0:00:00.00,0:00:00.00,Def,,0,0,0,template char all noblank,!retime("postsyl",-50-$dur/4,$dur/12)!{\bord0\move($x,!$y-($height/6)!,$x,!$y!,0,!$dur/3!)}
Comment: 1,0:00:00.00,0:00:00.00,Def,BACK,0,0,0,template char all noblank,!char_counter(7)!!retime("syl2end",$dur/12,200+(ci[7]/cn*600))!{\fad(0,150)\c!line.styleref.color3!\pos($x,$y)\t(!line.duration-200!,!line.duration-150!,\blur2)\t(!line.duration-200!,!line.duration-130!,\2c!line.styleref.color1!)\t(!line.duration-300!,!line.duration-100!,\bord0\shad0)}
Comment: 20,0:00:00.00,0:00:00.00,Def,,0,0,0,template char all noblank,!char_counter(8)!!retime("syl2end",$dur/12,200+(ci[8]/cn*600))!{\fad(0,150)\bord0\pos($x,$y)}
Dialogue: 0,0:00:00.37,0:00:05.77,Def,,0,0,0,karaoke,{\k48}As {\k54}You {\k52}Like {\k51}My {\k50}Plea{\kf285}sure
Dialogue: 0,0:00:16.57,0:00:21.26,Def,,0,0,0,karaoke,{\k25}hi{\k52}ka{\k17}ri {\k50}wo {\k17}me{\k44}za{\k26}shi{\k56}te {\k14}u{\k32}ma{\k18}re{\k31}te {\k19}ki{\k68}ta
Dialogue: 0,0:00:21.61,0:00:27.03,Def,,0,0,80,karaoke,{\k34}ki{\k18}zu{\k116}na {\k34}ho{\k25}so{\k17}i {\k16}i{\k34}to {\k49}ni {\k31}mu{\k22}su{\k34}ba{\k17}re{\kf95}te
Dialogue: 0,0:00:27.56,0:00:32.20,Def,,0,0,0,karaoke,{\k23}shi{\k51}me{\k17}i {\k52}de {\k15}me{\k54}za{\k16}me{\k53}ta {\k20}ko{\k25}u{\k24}fu{\k30}ku {\k22}ka{\k62}ra
Dialogue: 0,0:00:32.55,0:00:38.81,Def,,0,0,80,karaoke,{\k36}tsu{\k21}mu{\kf117}gu {\k34}i{\k35}ku{\k18}tsu{\k35}mo{\k49}no {\k36}ho{\k18}ko{\k29}ra{\k23}shi{\k64}i {\k38}ki{\k32}o{\k41}ku
Dialogue: 0,0:00:40.30,0:00:41.64,Def,,0,0,0,karaoke,{\k18}a{\k16}na{\k17}ta {\k16}no {\k19}ta{\k19}me {\k29}ni
Dialogue: 0,0:00:43.03,0:00:45.45,Def,,0,0,80,karaoke,{\k19}ko{\k12}no {\k19}se{\k23}ka{\k19}i {\k29}he {\k26}kan{\k26}sha {\k69}to
Dialogue: 0,0:00:45.65,0:00:51.50,Def,,0,0,0,karaoke,{\k47}u{\k49}chu{\k42}u {\k80}ip{\k20}pa{\k15}i {\kf152}no {\k20}ha{\k33}na{\k34}ta{\k36}ba {\k57}wo
Dialogue: 0,0:00:51.72,0:00:55.13,Def,,0,0,80,karaoke,{\k38}shu{\k37}ku{\k18}me{\k15}i {\k20}sa{\k52}e {\k19}u{\k14}n{\k21}me{\k28}i {\k20}sa{\k32}e {\k27}mo
Dialogue: 0,0:00:55.19,0:00:57.61,Def,,0,0,0,karaoke,{\k52}do{\k38}zo {\k17}ka{\k17}ga{\k17}ya{\k48}ka{\k20}se{\k33}te
Dialogue: 0,0:00:57.80,0:01:02.53,Def,,0,0,80,karaoke,{\k34}ta{\k16}no{\k23}shi{\k18}n{\k14}da{\k34}ri {\k34}wa{\k20}ra{\k29}u {\k17}no {\k35}wo {\k34}ma{\k18}mo{\k18}re{\k15}ru {\k18}yo{\k19}ro{\k17}ko{\k60}bi
Dialogue: 0,0:01:02.76,0:01:05.67,Def,,0,0,0,karaoke,{\k31}a{\k36}ko{\k19}ga{\k14}re{\k21}te{\k51}ru {\k14}a{\k18}ko{\k20}ga{\k32}re{\k35}te
Dialogue: 0,0:01:05.69,0:01:08.54,Def,,0,0,80,karaoke,{\k17}i{\k32}ru {\k51}mot{\k34}to {\k17}tsu{\k19}yo{\k16}ku {\k47}na{\k24}re{\k28}ru
Dialogue: 0,0:01:08.76,0:01:13.80,Def,,0,0,0,karaoke,{\k34}na{\k16}ki{\k20}go{\k13}e {\k20}sa{\k35}e {\k33}u{\k17}ta {\k30}no {\k23}you {\k33}ni {\k34}ki{\k15}ka{\k18}se{\k24}te {\k13}a{\k17}ge{\k21}ta{\k88}i
Dialogue: 0,0:01:14.05,0:01:18.80,Def,,0,0,80,karaoke,{\k37}ko{\k100}no {\k36}me{\k38}ku{\k15}ru {\k47}me{\k37}ku {\k35}ji{\k36}ka{\k35}n {\k59}ni
Dialogue: 0,0:01:19.05,0:01:28.22,Def,,0,0,0,karaoke,{\k34}na{\k17}mi{\k18}da {\k15}ma{\kf380}de {\k36}a{\k15}zu{\k33}ke{\k33}te {\k44}ho{\k59}shi{\kf212}i{\kf21}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter