| 1 |
// |
|---|
| 2 |
// SubContext.h |
|---|
| 3 |
// SSARender2 |
|---|
| 4 |
// |
|---|
| 5 |
// Created by Alexander Strange on 7/28/07. |
|---|
| 6 |
// Copyright 2007 __MyCompanyName__. All rights reserved. |
|---|
| 7 |
// |
|---|
| 8 |
|
|---|
| 9 |
#import <Cocoa/Cocoa.h> |
|---|
| 10 |
#import "SubRenderer.h" |
|---|
| 11 |
|
|---|
| 12 |
enum {kSubTypeSSA, kSubTypeASS, kSubTypeSRT, kSubTypeSMI}; |
|---|
| 13 |
enum {kSubCollisionsNormal, kSubCollisionsReverse}; |
|---|
| 14 |
enum {kSubLineWrapTopWider = 0, kSubLineWrapSimple, kSubLineWrapNone, kSubLineWrapBottomWider}; |
|---|
| 15 |
enum {kSubAlignmentLeft, kSubAlignmentCenter, kSubAlignmentRight}; |
|---|
| 16 |
enum {kSubAlignmentBottom, kSubAlignmentMiddle, kSubAlignmentTop}; |
|---|
| 17 |
enum {kSubBorderStyleNormal = 1, kSubBorderStyleBox = 3}; |
|---|
| 18 |
enum {kSubPositionNone = INT_MAX}; |
|---|
| 19 |
|
|---|
| 20 |
typedef ATSURGBAlphaColor SubRGBAColor; |
|---|
| 21 |
|
|---|
| 22 |
@interface SubStyle : NSObject { |
|---|
| 23 |
@public; |
|---|
| 24 |
NSString *name; |
|---|
| 25 |
NSString *fontname; |
|---|
| 26 |
Float32 size; |
|---|
| 27 |
SubRGBAColor primaryColor, secondaryColor, outlineColor, shadowColor; |
|---|
| 28 |
Float32 scaleX, scaleY, tracking, angle; |
|---|
| 29 |
Float32 outlineRadius, shadowDist; |
|---|
| 30 |
unsigned marginL, marginR, marginV; |
|---|
| 31 |
BOOL bold, italic, underline, strikeout; |
|---|
| 32 |
UInt8 alignH, alignV, borderStyle; |
|---|
| 33 |
__strong void* ex; |
|---|
| 34 |
Float32 platformSizeScale; |
|---|
| 35 |
SubRenderer *delegate; |
|---|
| 36 |
} |
|---|
| 37 |
+(SubStyle*)defaultStyleWithDelegate:(SubRenderer*)delegate; |
|---|
| 38 |
-(SubStyle*)initWithDictionary:(NSDictionary *)s scriptVersion:(UInt8)version delegate:(SubRenderer *)renderer; |
|---|
| 39 |
@end |
|---|
| 40 |
|
|---|
| 41 |
@interface SubContext : NSObject { |
|---|
| 42 |
@public; |
|---|
| 43 |
|
|---|
| 44 |
float resX, resY; |
|---|
| 45 |
UInt8 scriptType, collisions, wrapStyle; |
|---|
| 46 |
NSDictionary *styles; SubStyle *defaultStyle; |
|---|
| 47 |
NSDictionary *headers; |
|---|
| 48 |
NSString *headertext; |
|---|
| 49 |
} |
|---|
| 50 |
|
|---|
| 51 |
-(SubContext*)initWithHeaders:(NSDictionary *)headers styles:(NSArray *)styles extraData:(NSString *)ed delegate:(SubRenderer*)delegate; |
|---|
| 52 |
-(SubContext*)initWithNonSSAType:(UInt8)type delegate:(SubRenderer*)delegate; |
|---|
| 53 |
-(SubStyle*)styleForName:(NSString *)name; |
|---|
| 54 |
@end |
|---|
| 55 |
|
|---|
| 56 |
extern UInt8 SSA2ASSAlignment(UInt8 a); |
|---|
| 57 |
extern void ParseASSAlignment(UInt8 a, UInt8 *alignH, UInt8 *alignV); |
|---|
| 58 |
extern SubRGBAColor ParseSSAColor(unsigned rgb); |
|---|
| 59 |
extern BOOL ParseFontVerticality(NSString **fontname); |
|---|