blob: 41ca0f2287891b3881f8bb467745a4720cf63eef [file] [log] [blame]
george82951e7252005-03-17 17:37:15 +00001/* Copyright (C) 2004 TightVNC Team. 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// -=- PixelFormatList.h
20
21// Definition of the PixelFormatList class, responsible for
22// controlling the list of supported pixel formats.
23
24#include <list>
25
26#include <rfb/Exception.h>
27#include <rfb/PixelFormat.h>
28
29// Definition indexes of the default pixel formats
30#define PF_BGR233 0
31#define PF_RGB555 1
32#define PF_BGR555 2
33#define PF_RGB565 3
34#define PF_BGR565 4
35#define PF_RGB888 5
36#define PF_BGR888 6
37#define PF_DEFAULT_COUNT 7
38
39using namespace rfb;
40using namespace std;
41
42// PixelFormatListElement class, it is
43// an item of the PixelFormatList list.
44
45class PixelFormatListElement {
46public:
47 char format_name[256];
48 PixelFormat PF;
49 void setName(const char *name) {
50 format_name[0] = '\0';
51 strcpy(format_name, name);
52 format_name[strlen(name)] = '\0';
53 }
54 void setPF(PixelFormat *_PF) {
55 memcpy(&PF, _PF, sizeof(PixelFormat));
56 }
57};
58
59class PixelFormatList {
60public:
61 PixelFormatList();
62 PixelFormatListElement operator[](int index);
63 void add(char *format_name, PixelFormat PF);
64 void insert(int index, char *format_name, PixelFormat PF);
65 void remove(int index);
66 int count() { return PFList.size(); }
67
68protected:
69 list <PixelFormatListElement>::iterator getIterator(int index);
70 list <PixelFormatListElement> PFList;
71};