1 enum border_style {BORDER_OUTLINE, BORDER_OPAQUE};
2 enum style_type {KRY_STYLE_SSA, KRY_STYLE_ASS, KRY_STYLE_COMMENT};
3 
4 class kryStyle
5 {
6 public:
7   kryStyle();
8   ~kryStyle();
9   kryStyle *Copy();
10 
11   gboolean Compare(kryStyle *s2);
12 
13   void SetName(char *name);
14   static void SetNameStatic(kryStyle *style, char *name);
15   void SetFontName(char *name);
16   static void SetFontNameStatic(kryStyle *style, char *fontname);
17 
18   char *GetName();
19   static char *GetNameStatic(kryStyle *style);
20   char *GetFontName();
21   static char *GetFontNameStatic(kryStyle *style);
22   double GetFontSize();
23   static double GetFontSizeStatic(kryStyle *style);
24 
25   gboolean GetBold();
26   static gboolean GetBoldStatic(kryStyle *style);
27   gboolean GetItalic();
28   static gboolean GetItalicStatic(kryStyle *style);
29   gboolean GetUnderline();
30   static gboolean GetUnderlineStatic(kryStyle *style);
31   gboolean GetStrikethrough();
32   static gboolean GetStrikethroughStatic(kryStyle *style);
33 
34   void SetBold(gboolean bold);
35   static void SetBoldStatic(kryStyle *style, gboolean bold);
36   void SetItalic(gboolean italic);
37   static void SetItalicStatic(kryStyle *style, gboolean italic);
38   void SetUnderline(gboolean underline);
39   static void SetUnderlineStatic(kryStyle *style, gboolean underline);
40   void SetStrikethrough(gboolean underline);
41   static void SetStrikethroughStatic(kryStyle *style, gboolean underline);
42 
43   void SetAlignment(int alignment);
44   static void SetAlignmentStatic(kryStyle *style, int alignment);
45   int GetAlignment();
46   static int GetAlignmentStatic(kryStyle *style);
47 
48   double GetFontScaleX();
49   static double GetFontScaleXStatic(kryStyle *style);
50   double GetFontScaleY();
51   static double GetFontScaleYStatic(kryStyle *style);
52   double GetFontSpacing();
53   static double GetFontSpacingStatic(kryStyle *style);
54 
55   double GetFontAngleX();
56   double GetFontAngleY();
57   double GetFontAngleZ();
58   static double GetFontAngleZStatic(kryStyle *style);
59 
60   void SetFontSize(double size);
61   static void SetFontSizeStatic(kryStyle *style, double size);
62   void SetFontScaleX(double scale);
63   static void SetFontScaleXStatic(kryStyle *style, double scale);
64   void SetFontScaleY(double scale);
65   static void SetFontScaleYStatic(kryStyle *style, double scale);
66   void SetFontSpacing(double spacing);
67   static void SetFontSpacingStatic(kryStyle *style, double spacing);
68   void SetFontAngleX(double angle);
69   static void SetFontAngleXStatic(kryStyle *style, double angle);
70   void SetFontAngleY(double angle);
71   static void SetFontAngleYStatic(kryStyle *style, double angle);
72   void SetFontAngleZ(double angle);
73   static void SetFontAngleZStatic(kryStyle *style, double angle);
74 
75   unsigned int GetColorPrimary();
76   static unsigned int GetColorPrimaryStatic(kryStyle *style);
77   unsigned int GetColorSecondary();
78   static unsigned int GetColorSecondaryStatic(kryStyle *style);
79   unsigned int GetColorTertiary();
80   static unsigned int GetColorTertiaryStatic(kryStyle *style);
81   unsigned int GetColorOutline();
82   static unsigned int GetColorOutlineStatic(kryStyle *style);
83   unsigned int GetColorShadow();
84   static unsigned int GetColorShadowStatic(kryStyle *style);
85   unsigned int GetColorBack();
86   static unsigned int GetColorBackStatic(kryStyle *style);
87 
88   unsigned int *GetColorPrimaryPtr();
89   unsigned int *GetColorSecondaryPtr();
90   unsigned int *GetColorOutlinePtr();
91   unsigned int *GetColorShadowPtr();
92 
93   void SetColorPrimary(unsigned int color);
94   static void SetColorPrimaryStatic(kryStyle *style, unsigned int color);
95   void SetColorSecondary(unsigned int color);
96   static void SetColorSecondaryStatic(kryStyle *style, unsigned int color);
97   void SetColorTertiary(unsigned int color);
98   static void SetColorTertiaryStatic(kryStyle *style, unsigned int color);
99   void SetColorOutline(unsigned int color);
100   static void SetColorOutlineStatic(kryStyle *style, unsigned int color);
101   void SetColorShadow(unsigned int color);
102   static void SetColorShadowStatic(kryStyle *style, unsigned int color);
103   void SetColorBack(unsigned int color);
104   static void SetColorBackStatic(kryStyle *style, unsigned int color);
105 
106   void SetMarginTop(int margin);
107   void SetMarginLeft(int margin);
108   static void SetMarginLeftStatic(kryStyle *style, int margin);
109   void SetMarginRight(int margin);
110   static void SetMarginRightStatic(kryStyle *style, int margin);
111   void SetMarginBottom(int margin);
112   void SetMarginVertical(int margin);
113   static void SetMarginVerticalStatic(kryStyle *style, int margin);
114 
115   int GetMarginTop();
116   static int GetMarginTopStatic(kryStyle *style);
117   int GetMarginLeft();
118   static int GetMarginLeftStatic(kryStyle *style);
119   int GetMarginRight();
120   static int GetMarginRightStatic(kryStyle *style);
121   int GetMarginBottom();
122   static int GetMarginBottomStatic(kryStyle *style);
123 
124   enum style_type GetType();
125   void SetType(enum style_type type);
126 
127   void SetBorderStyle(enum border_style style);
128   static void SetBorderStyleStatic(kryStyle *style, enum border_style type);
129 
130   double GetBorderSize();
131   static double GetBorderSizeStatic(kryStyle *style);
132   double GetShadowSize();
133   static double GetShadowSizeStatic(kryStyle *style);
134 
135   void SetBorderSize(double size);
136   static void SetBorderSizeStatic(kryStyle *style, double size);
137   void SetShadowSize(double size);
138   static void SetShadowSizeStatic(kryStyle *style, double size);
139 
140   enum border_style GetBorderStyle();
141   static enum border_style GetBorderStyleStatic(kryStyle *style);
142 
143   int GetBlur();
144   void SetBlur(int blur);
145 
146   int GetCharset();
147   static int GetCharsetStatic(kryStyle *style);
148   void SetCharset(int charset);
149   static void SetCharsetStatic(kryStyle *style, int charset);
150 
151   int GetRelative();
152 
153   void SetAlphaLevel(int alpha);
154   static void SetAlphaLevelStatic(kryStyle *style, int level);
155 
156   int GetAlphaLevel();
157   static int GetAlphaLevelStatic(kryStyle *style);
158 
159   void Ref();
160   void Unref();
161   static void DestroyStatic(kryStyle *style);
162 
163   char *GetPrefix();
164   void SetPrefix(char *text);
165 
166 #ifdef _WINDOWS
167   void LoadIntoLogfont(LOGFONTW *logfonta);
168 #endif
169   friend GList *sub_ssa_build_style_list(char *buffer);
170 private:
171   // name of the style
172   char *m_name;
173   // name of the font
174   char *m_font_name;
175   // used for storing comments
176   char *m_prefix;
177   // angle of rotation around x axis
178   double m_font_anglex;
179   // angle of rotation around y axis
180   double m_font_angley;
181   // angle of rotation around z axis
182   double m_font_anglez;
183   // font size
184   double m_font_size;
185   // font height scaling (in percent)
186   double m_font_scaley;
187   // font width scaling (in percent)
188   double m_font_scalex;
189   // font spacing
190   double m_font_spacing;
191   // primary color
192   unsigned int m_color_primary;
193   // secondary color
194   unsigned int m_color_secondary;
195   // tertiary color
196   unsigned int m_color_tertiary;
197   // outline color
198   unsigned int m_color_outline;
199   // shadow color
200   unsigned int m_color_shadow;
201   // back color
202   unsigned int m_color_back;
203   // font weight
204   int m_bold;
205   // font italic
206   int m_italic;
207   // border style
208   enum border_style m_border_style;
209   // size of the border
210   double m_shadow_size;
211   // size of the shadow
212   double m_border_size;
213   // alignment (based on numpad)
214   int m_alignment;
215   // left margin
216   int m_margin_left;
217   // right margin
218   int m_margin_right;
219   // top margin
220   int m_margin_top;
221   // bottom margin
222   int m_margin_bottom;
223   // alpha level
224   int m_alpha_level;
225   // character set
226   int m_charset;
227   // strikethrough
228   int m_strikethrough;
229   // underline
230   int m_underline;
231   // blur
232   int m_blur;
233   // relative to video rectangle
234   int m_relative;
235 
236   enum style_type m_type;
237 
238   int m_refcount;
239 };
240 
241 
242