Swiftgram/inc/lottiecommon.h
Hermet Park 0a325b079e Put samsung copyright header to all our own source code.
Change-Id: I3cebcfef827425d16092ee7a26c39f7733572eb7
2018-12-26 19:18:29 +09:00

215 lines
4.3 KiB
C

/*
* Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
*
* Licensed under the Flora License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://floralicense.org/license/
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#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
/**
* @defgroup Lottie_Animation Lottie_Animation
*
* Lottie Animation is a modern style vector based animation design. Its animation
* resource(within json format) could be generated by Adobe After Effect using
* bodymovin plugin. You can find a good examples in Lottie Community which
* shares many free resources(see: www.lottiefiles.com).
*
* This Lottie_Animation is a common engine to manipulate, control Lottie
* Animation from the Lottie resource - json file. It provides a scene-graph
* node tree per frames by user demand as well as rasterized frame images.
*
*/
/**
* @ingroup Lottie_Animation
*/
/**
* @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 {
unsigned char 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_