Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. |
| 2 | * |
| 3 | * This is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation; either version 2 of the License, or |
| 6 | * (at your option) any later version. |
| 7 | * |
| 8 | * This software is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this software; if not, write to the Free Software |
| 15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 16 | * USA. |
| 17 | */ |
| 18 | // |
| 19 | // PixelFormat - structure to represent a pixel format. Also has useful |
| 20 | // methods for reading & writing to streams, etc. |
| 21 | // |
| 22 | |
| 23 | #ifndef __RFB_PIXELFORMAT_H__ |
| 24 | #define __RFB_PIXELFORMAT_H__ |
| 25 | |
| 26 | #include <rfb/Pixel.h> |
| 27 | #include <rfb/ColourMap.h> |
| 28 | |
| 29 | namespace rdr { class InStream; class OutStream; } |
| 30 | |
| 31 | namespace rfb { |
| 32 | |
| 33 | class PixelFormat { |
| 34 | public: |
| 35 | PixelFormat(int b, int d, bool e, bool t, |
| 36 | int rm=0, int gm=0, int bm=0, int rs=0, int gs=0, int bs=0); |
| 37 | PixelFormat(); |
| 38 | bool equal(const PixelFormat& other) const; |
| 39 | void read(rdr::InStream* is); |
| 40 | void write(rdr::OutStream* os) const; |
| 41 | Pixel pixelFromRGB(rdr::U16 red, rdr::U16 green, rdr::U16 blue, ColourMap* cm=0) const; |
| 42 | void rgbFromPixel(Pixel pix, ColourMap* cm, Colour* rgb) const; |
| 43 | void print(char* str, int len) const; |
| 44 | bool parse(const char* str); |
| 45 | |
| 46 | int bpp; |
| 47 | int depth; |
| 48 | bool bigEndian; |
| 49 | bool trueColour; |
| 50 | int redMax; |
| 51 | int greenMax; |
| 52 | int blueMax; |
| 53 | int redShift; |
| 54 | int greenShift; |
| 55 | int blueShift; |
| 56 | }; |
| 57 | } |
| 58 | #endif |