| 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 | #include <memory> |
| 24 |
| 25 | V_BEGIN_NAMESPACE |
| 26 |
| 27 | class VBitmap { |
| 28 | public: |
| 29 | enum class Format: uchar { |
| 30 | Invalid, |
| 31 | Alpha8, |
| 32 | ARGB32, |
| 33 | ARGB32_Premultiplied |
| 34 | }; |
| 35 |
| 36 | VBitmap() = default; |
| 37 | VBitmap(uint w, uint h, VBitmap::Format format); |
| 38 | VBitmap(uchar *data, uint w, uint h, uint bytesPerLine, VBitmap::Format format); |
| 39 |
| 40 | void reset(uint w, uint h, VBitmap::Format format=Format::ARGB32); |
| 41 | uint stride() const; |
| 42 | uint width() const; |
| 43 | uint height() const; |
| 44 | uint depth() const; |
| 45 | VBitmap::Format format() const; |
| 46 | bool valid() const; |
| 47 | uchar * data(); |
| 48 | uchar * data() const; |
| 49 |
| 50 | void fill(uint pixel); |
| 51 | void updateLuma(); |
| 52 | private: |
| 53 | struct Impl; |
| 54 | std::shared_ptr<Impl> mImpl; |
| 55 | }; |
| 56 |
| 57 | V_END_NAMESPACE |
| 58 |
| 59 | #endif // VBITMAP_H |
| 60 |