Swiftgram/inc/lottiecommon.h
Hermet Park 53e71eb670 interface: fix to compatible with C language.
C++ structure type declaration is more flexible than C's.
C always need to declare "struct Name" to use.
That's way we use typedef struct Name as a alias "Name".

Here patch just reorder the structure declaration for C language.

Change-Id: I43bc8d1fafb10e42cb22fcad4bc1115925a3cda2
2018-11-26 05:34:00 +00:00

177 lines
3.0 KiB
C

#ifndef _LOTTIE_COMMON_H_
#define _LOTTIE_COMMON_H_
#ifdef _WIN32
#ifdef LOT_BUILD
#ifdef DLL_EXPORT
#define LOT_EXPORT __declspec(dllexport)
#else
#define LOT_EXPORT
#endif
#else
#define LOT_EXPORT __declspec(dllimport)
#endif
#else
#ifdef __GNUC__
#if __GNUC__ >= 4
#define LOT_EXPORT __attribute__((visibility("default")))
#else
#define LOT_EXPORT
#endif
#else
#define LOT_EXPORT
#endif
#endif
/**
* @brief Enumeration for Lottie Player error code.
*/
typedef enum
{
//TODO: Coding convention??
LOT_ANIMATION_ERROR_NONE = 0,
LOT_ANIMATION_ERROR_NOT_PERMITTED,
LOT_ANIMATION_ERROR_OUT_OF_MEMORY,
LOT_ANIMATION_ERROR_INVALID_PARAMETER,
LOT_ANIMATION_ERROR_RESULT_OUT_OF_RANGE,
LOT_ANIMATION_ERROR_ALREADY_IN_PROGRESS,
LOT_ANIMATION_ERROR_UNKNOWN
} LOTErrorType;
typedef enum
{
BrushSolid = 0,
BrushGradient
} LOTBrushType;
typedef enum
{
FillEvenOdd = 0,
FillWinding
} LOTFillRule;
typedef enum
{
JoinMiter = 0,
JoinBevel,
JoinRound
} LOTJoinStyle;
typedef enum
{
CapFlat = 0,
CapSquare,
CapRound
} LOTCapStyle;
typedef enum
{
GradientLinear = 0,
GradientRadial
} LOTGradientType;
typedef struct LOTGradientStop
{
float pos;
unsigned char r, g, b, a;
} LOTGradientStop;
typedef enum
{
MaskModeAdd = 0,
MaskModeSubstract,
MaskModeIntersect,
MaskModeDifference
} LOTMaskMode;
typedef struct LOTMask {
struct {
const float *ptPtr;
int ptCount;
const char* elmPtr;
int elmCount;
} mPath;
LOTMaskMode mMode;
}LOTMask;
typedef enum
{
MatteNone = 0,
MatteAlpha,
MatteAlphaInv,
MatteLuma,
MatteLumaInv
} LOTMatteType;
typedef struct LOTNode {
#define ChangeFlagNone 0x0000
#define ChangeFlagPath 0x0001
#define ChangeFlagPaint 0x0010
#define ChangeFlagAll (ChangeFlagPath & ChangeFlagPaint)
struct {
const float *ptPtr;
int ptCount;
const char* elmPtr;
int elmCount;
} mPath;
struct {
unsigned char r, g, b, a;
} mColor;
struct {
bool enable;
int width;
LOTCapStyle cap;
LOTJoinStyle join;
int meterLimit;
float* dashArray;
int dashArraySize;
} mStroke;
struct {
LOTGradientType type;
LOTGradientStop *stopPtr;
unsigned int stopCount;
struct {
float x, y;
} start, end, center, focal;
float cradius;
float fradius;
} mGradient;
int mFlag;
LOTBrushType mBrushType;
LOTFillRule mFillRule;
} LOTNode;
typedef struct LOTLayerNode {
struct {
LOTMask *ptr;
unsigned int size;
} mMaskList;
struct {
struct LOTLayerNode **ptr;
unsigned int size;
} mLayerList;
struct {
LOTNode **ptr;
unsigned int size;
} mNodeList;
LOTMatteType mMatte;
int mVisible;
} LOTLayerNode;
#endif // _LOTTIE_COMMON_H_