-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathMMovieOSD.h
133 lines (117 loc) · 3.96 KB
/
MMovieOSD.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
//
// Movist
//
// Copyright 2006 ~ 2008 Yong-Hoe Kim. All rights reserved.
// Yong-Hoe Kim <[email protected]>
//
// This file is part of Movist.
//
// Movist is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// Movist is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
#import "Movist.h"
#import <QuartzCore/QuartzCore.h>
@interface MMovieOSD : NSObject
{
// shadow
NSShadow* _shadow;
NSShadow* _shadowNone;
NSColor* _shadowColor;
float _shadowBlur; // for 640-width-of-movie
float _shadowOffset; // for 640-width-of-movie
int _shadowDarkness;
// text rendering
NSFont* _font;
NSString* _fontName;
float _fontSize; // for 640-width-of-movie
NSColor* _textColor;
NSColor* _strokeColor;
NSNumber* _strokeWidth; // for 640-width-of-movie
NSNumber* _strokeWidth2; // for redraw
NSMutableParagraphStyle* _paragraphStyle;
float _lineSpacing;
// position & margin
int _hPosition; // OSD_HPOSITION_*
int _vPosition; // OSD_VPOSITION_*
int _vPositionPrefs; // OSD_VPOSITION_*
float _hMargin; // percentage of width
float _vMargin; // percentage of height
float _subtitleSync; // for subtitle only
// texture rendering
NSRect _viewBounds;
NSRect _movieRect;
NSRect _drawingRect;
float _autoSizeWidth;
unsigned int _updateMask; // bit-mask of UPDATE_*
NSImage* _texImage; // final rendered image for texture
// for convenience
NSAttributedString* _string;
NSImage* _image;
float _imageBaseWidth;
NSRecursiveLock* _lock;
}
#pragma mark shadow
- (NSColor*)shadowColor;
- (float)shadowBlur;
- (float)shadowOffset;
- (int)shadowDarkness;
- (BOOL)setShadowColor:(NSColor*)shadowColor;
- (BOOL)setShadowBlur:(float)shadowBlur;
- (BOOL)setShadowOffset:(float)shadowOffset;
- (BOOL)setShadowDarkness:(int)darkness;
#pragma mark text
- (void)initTextRendering;
- (NSString*)fontName;
- (float)fontSize;
- (NSTextAlignment)textAlignment;
- (NSColor*)textColor;
- (NSColor*)strokeColor;
- (float)strokeWidth;
- (float)lineSpacing;
- (BOOL)setFontName:(NSString*)name size:(float)size;
- (BOOL)setTextAlignment:(NSTextAlignment)alignment;
- (BOOL)setTextColor:(NSColor*)textColor;
- (BOOL)setStrokeColor:(NSColor*)strokeColor;
- (BOOL)setStrokeWidth:(float)strokeWidth;
- (BOOL)setLineSpacing:(float)lineSpacing;
#pragma mark position
- (unsigned int)hPosition;
- (unsigned int)vPosition;
- (BOOL)setHPosition:(unsigned int)hPosition;
- (BOOL)setVPosition:(unsigned int)vPosition;
- (void)updateVPosition:(BOOL)displayOnLetterBox;
#pragma mark margin
- (float)hMargin;
- (float)vMargin;
- (BOOL)setHMargin:(float)hMargin;
- (BOOL)setVMargin:(float)vMargin;
#pragma mark subtitle-sync
- (float)subtitleSync;
- (void)setSubtitleSync:(float)sync;
#pragma mark making tex-image
- (float)adjustedLineHeight:(float)movieWidth;
- (float)adjustedLineSpacing:(float)movieWidth;
- (NSImage*)makeTexImageForString:(NSAttributedString*)string;
- (NSImage*)makeTexImageForImage:(NSImage*)image;
- (BOOL)setString:(NSAttributedString*)string;
- (BOOL)setImage:(NSImage*)image;
- (BOOL)setImageBaseWidth:(float)baseWidth;
- (void)clearContent;
#pragma mark drawing
- (BOOL)hasContent;
- (NSImage*)texImage;
- (BOOL)setTexImage:(NSImage*)texImage;
- (BOOL)setViewBounds:(NSRect)viewBounds movieRect:(NSRect)movieRect
autoSizeWidth:(float)autoSizeWidth;
- (void)drawOnScreen;
@end