updated licenses info
[platform/core/uifw/lottie-player.git] / src / vector / vdrawable.h
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
3  *
4  * Licensed under the LGPL License, Version 2.1 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     https://www.gnu.org/licenses/
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef VDRAWABLE_H
18 #define VDRAWABLE_H
19 #include <future>
20 #include "vbrush.h"
21 #include "vpath.h"
22 #include "vrle.h"
23 #include "vraster.h"
24
25 class VDrawable {
26 public:
27     enum class DirtyState {
28         None = 0x00000000,
29         Path = 0x00000001,
30         Stroke = 0x00000010,
31         Brush = 0x00000100,
32         All = (None | Path | Stroke | Brush)
33     };
34     enum class Type : unsigned char{
35         Fill,
36         Stroke,
37     };
38     typedef vFlag<DirtyState> DirtyFlag;
39     virtual ~VDrawable() = default;
40     void setPath(const VPath &path);
41     void setFillRule(FillRule rule) { mFillRule = rule; }
42     void setBrush(const VBrush &brush) { mBrush = brush; }
43     void setStrokeInfo(CapStyle cap, JoinStyle join, float meterLimit,
44                        float strokeWidth);
45     void setDashInfo(float *array, uint size);
46     void preprocess(const VRect &clip);
47     VRle rle();
48
49 public:
50     struct StrokeInfo {
51         std::vector<float> mDash;
52         float              width{0.0};
53         float              meterLimit{10};
54         bool               enable{false};
55         CapStyle           cap{CapStyle::Flat};
56         JoinStyle          join{JoinStyle::Bevel};
57     };
58     VBrush            mBrush;
59     VPath             mPath;
60     RleShare          mRleFuture;
61     VRle              mRle;
62     StrokeInfo        mStroke;
63     DirtyFlag         mFlag{DirtyState::All};
64     FillRule          mFillRule{FillRule::Winding};
65     VDrawable::Type   mType{Type::Fill};
66 };
67
68 #endif  // VDRAWABLE_H