2 Copyright 2008 Mark Calderbank
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29 UINT windowx, windowy,windoww,windowh;
30 UINT framewidth,frameheight;
38 Palette(UCHAR tBpp = 8);
39 UCHAR getBpp() const { return bpp; }
40 void reset() { numColours = 0; }
41 void setBpp(UCHAR tBpp);
42 ULONG getColour(UCHAR index) const {
43 return index < maxColours ? colour[index] : 0; }
44 void setColour(UCHAR index, ULONG tColour);
45 void setYCrCbA(UCHAR index, UCHAR tY, UCHAR tCr, UCHAR tCb, UCHAR tA);
46 const std::vector<ULONG>& getColourVector() const { return colour; }
47 const std::vector<UCHAR>& getYVector() const { return Y; }
48 const std::vector<UCHAR>& getCrVector() const { return Cr; }
49 const std::vector<UCHAR>& getCbVector() const { return Cb; }
50 const std::vector<UCHAR>& getAVector() const { return A; }
51 const UINT getNumColours()const{return numColours;};
53 const static UINT MAX_DEPTH = 8;
54 std::vector<ULONG> colour;
56 std::vector<UCHAR> Cr;
57 std::vector<UCHAR> Cb;
60 UINT maxColours, numColours;
61 void argb2yrba(ULONG argb, UCHAR& y, UCHAR& cr, UCHAR& cb, UCHAR& a);
62 ULONG yrba2argb(UCHAR y, UCHAR cr, UCHAR cb, UCHAR a);
68 std::vector<UCHAR> bitmap;
71 Bitmap(UINT tWidth = 0, UINT tHeight = 0, UCHAR tBpp = 8);
73 UINT getWidth() const { return width; }
74 UINT getHeight() const { return height; }
75 UCHAR getIndex(UINT x, UINT y) const;
76 ULONG getColour(UINT x, UINT y) const;
77 const std::vector<UCHAR> & rawData() const { return bitmap; }
78 void setSize(UINT tWidth, UINT tHeight);
79 bool setIndex(UINT x, UINT y, UCHAR index);
80 void setAllIndices(UCHAR index);