f99b8f20e124a13773bc4d1a54e23a0fa4e63779
[platform/core/uifw/lottie-player.git] / src / vector / vbitmap.h
1 /* 
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
3  * 
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  * 
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  * 
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17  */
18
19 #ifndef VBITMAP_H
20 #define VBITMAP_H
21
22 #include "vrect.h"
23
24 V_BEGIN_NAMESPACE
25
26 class VBitmap {
27 public:
28     enum class Format: uchar {
29         Invalid,
30         Alpha8,
31         ARGB32,
32         ARGB32_Premultiplied
33     };
34
35     VBitmap() = default;
36     VBitmap(uint w, uint h, VBitmap::Format format);
37     VBitmap(uchar *data, uint w, uint h, uint bytesPerLine, VBitmap::Format format);
38
39     uint          stride() const;
40     uint          width() const;
41     uint          height() const;
42     uint          depth() const;
43     VBitmap::Format format() const;
44     bool            valid() const;
45     uchar *         data();
46     uchar *         data() const;
47
48     void    fill(uint pixel);
49 private:
50     struct Impl;
51     std::shared_ptr<Impl> mImpl;
52 };
53
54 V_END_NAMESPACE
55
56 #endif  // VBITMAP_H