-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGenericAnimationView.h
More file actions
94 lines (72 loc) · 3.35 KB
/
Copy pathGenericAnimationView.h
File metadata and controls
94 lines (72 loc) · 3.35 KB
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
/*
File: GenericAnimationView.h
Abstract: Generic Animation View is the base view to which all
animation layers are added. It draws the animation layers based
on supplied parameters and handles the layers as a stack of
Animation Frames that can be rearranged in the overall application
view hierarchy. Animation layers can be drawn with an image (from
file or dynamically generated such as a screenshot) or using a
background color.
Copyright (c) 2011 Dillion Tan
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
#import "AnimationDelegate.h"
#import "AnimationFrame.h"
@interface GenericAnimationView : UIView {
UIImage *templateImage;
// size of the view determines size of all Animation Frames
float templateWidth;
float templateHeight;
// number of logical parts in an Animation Frame
int imageUnitQuantity;
}
// Stack of Animation Frames
// Image data is grouped into Animation Frames, each frame contains the set of images displayed in between sequences
@property (nonatomic, retain) NSMutableArray *imageStackArray;
// set inset to restrict text frame size
@property (nonatomic) CGPoint textInset;
// set offset from position to align text
@property (nonatomic) CGPoint textOffset;
// font size (different from UILabel font size property)
@property (nonatomic) float fontSize;
// provide a font from plist or use inbuilt fonts
// if the rendering is very slow, change the font
@property (nonatomic, assign) NSString *font;
// font alignment
@property (nonatomic, assign) NSString *fontAlignment;
// truncation mode to set for CATextLayer
@property (nonatomic, assign) NSString *textTruncationMode;
// view has to know the type of animation to be able to prepare (draw, slice) the animation layers
@property (nonatomic) AnimationType animationType;
- (id)initWithAnimationType:(AnimationType)aType
frame:(CGRect)aFrame;
// method to override for subclasses
- (BOOL)printText:(NSString *)tickerString
usingImage:(UIImage *)aImage
backgroundColor:(UIColor *)aBackgroundColor
textColor:(UIColor *)aTextColor;
- (CALayer *)layerWithFrame:(CGRect)aFrame
contentGravity:(NSString *)aContentGravity
cornerRadius:(float)aRadius
doubleSided:(BOOL)aValue;
- (void)rearrangeLayers:(DirectionType)aDirectionType :(int)step;
@end