public AssSubtitle(Danmaku danmaku, Dictionary <int, float> bottomSubtitles, Dictionary <int, float> topSubtitles, int videoWidth, int videoHeight, int baseFontSize, int lineCount, int bottomMargin, float tuneSeconds) { this.danmaku = danmaku; this.bottomSubtitles = bottomSubtitles; this.topSubtitles = topSubtitles; this.videoWidth = videoWidth; this.videoHeight = videoHeight; this.baseFontSize = baseFontSize; this.lineCount = lineCount; this.bottomMargin = bottomMargin; this.tuneSeconds = tuneSeconds; this.textLength = danmaku.Content.Length; this.startTime = danmaku.ShowTime; this.endTime = GetEndTime(danmaku.ShowTime, this.tuneSeconds); this.fontSize = (int)danmaku.Size - 25 + baseFontSize; this.position = GetPosition(); this.styledText = GetStyledText(); }
private bool NeedWhiteBorder(Danmaku danmaku) { var colour = danmaku.Colour; if (colour == 0) { return(true); } var hls = danmaku.Colour.ToRgb().ToHls(); if (hls.H > 30 && hls.H < 210 && hls.L < 33) { return(true); } if ((hls.L < 30 || hls.H > 210) && hls.L < 66) { return(true); } return(false); }