forked from overtake/telegram
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPOPAnimationRuntime.h
executable file
·101 lines (81 loc) · 2.48 KB
/
POPAnimationRuntime.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
/**
Copyright (c) 2014-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
*/
#import <objc/runtime.h>
#import <Foundation/Foundation.h>
#import "POPVector.h"
enum POPValueType
{
kPOPValueUnknown = 0,
kPOPValueInteger,
kPOPValueFloat,
kPOPValuePoint,
kPOPValueSize,
kPOPValueRect,
kPOPValueEdgeInsets,
kPOPValueAffineTransform,
kPOPValueTransform,
kPOPValueRange,
kPOPValueColor,
};
using namespace POP;
/**
Returns value type based on objc type description, given list of supported value types and length.
*/
extern POPValueType POPSelectValueType(const char *objctype, const POPValueType *types, size_t length);
/**
Returns value type based on objc object, given a list of supported value types and length.
*/
extern POPValueType POPSelectValueType(id obj, const POPValueType *types, size_t length);
/**
Array of all value types.
*/
extern const POPValueType kPOPAnimatableAllTypes[10];
/**
Array of all value types supported for animation.
*/
extern const POPValueType kPOPAnimatableSupportTypes[8];
/**
Returns a string description of a value type.
*/
extern NSString *POPValueTypeToString(POPValueType t);
/**
Returns a mutable dictionary of weak pointer keys to weak pointer values.
*/
extern CFMutableDictionaryRef POPDictionaryCreateMutableWeakPointerToWeakPointer(NSUInteger capacity) CF_RETURNS_RETAINED;
/**
Returns a mutable dictionary of weak pointer keys to weak pointer values.
*/
extern CFMutableDictionaryRef POPDictionaryCreateMutableWeakPointerToStrongObject(NSUInteger capacity) CF_RETURNS_RETAINED;
/**
Box a vector.
*/
extern id POPBox(VectorConstRef vec, POPValueType type, bool force = false);
/**
Unbox a vector.
*/
extern VectorRef POPUnbox(id value, POPValueType &type, NSUInteger &count, bool validate);
/**
Read/write block typedefs for convenience.
*/
typedef void(^pop_animatable_read_block)(id obj, CGFloat *value);
typedef void(^pop_animatable_write_block)(id obj, const CGFloat *value);
/**
Read object value and return a Vector4r.
*/
NS_INLINE Vector4r read_values(pop_animatable_read_block read, id obj, size_t count)
{
Vector4r vec = Vector4r::Zero();
if (0 == count)
return vec;
read(obj, vec.data());
return vec;
}
NS_INLINE NSString *POPStringFromBOOL(BOOL value)
{
return value ? @"YES" : @"NO";
}