Solve rotate problem and re-add space line

This commit is contained in:
910JQK
2014-02-03 16:54:30 +08:00
parent 49b338b1f9
commit 0aad472e48
9 changed files with 91 additions and 93 deletions

View File

@ -318,6 +318,7 @@ def WriteCommentBilibiliPositioned(f, c, width, height, styleid):
except IndexError:
logging.warning(_('Invalid comment: %r') % c)
def WriteCommentAcfunPositioned(f, c, width, height, styleid):
AcfunPlayerSize = (560, 400)
ZoomFactor = GetZoomFactor(AcfunPlayerSize, (width, height))
@ -445,11 +446,7 @@ def WriteCommentSH5VPositioned(f, c, width, height, styleid):
styles.append('\\fs%s' % fsize)
if rotate_y is not None and rotate_z is not None:
styles.append('\\frz%s' % round(rotate_z))
if not (-1 < rotate_z < 1):
styles.append('\\frx%s' % round(rotate_y*math.sin(rotate_z*math.pi/180.0)))
styles.append('\\fry%s' % round(rotate_y*math.cos(rotate_z*math.pi/180.0)))
else:
styles.append('\\fry%s' % round(rotate_y))
styles.append('\\fry%s' % round(rotate_y))
if color is not None:
styles.append('\\c&H%02X%02X%02X&' % (color & 0xff, (color >> 8) & 0xff, (color >> 16) & 0xff))
if color == 0x000000:
@ -507,6 +504,7 @@ def GetZoomFactor(SourceSize, TargetSize):
GetZoomFactor.Cached_Result = (1, 0, 0)
return GetZoomFactor.Cached_Result
def ProcessComments(comments, f, width, height, bottomReserved, fontface, fontsize, alpha, lifetime, reduced, progress_callback):
styleid = 'Danmaku2ASS_%04x' % random.randint(0, 0xffff)
WriteASSHead(f, width, height, fontface, fontsize, alpha, styleid)