diff options
author | Pierre Ossman <ossman@cendio.se> | 2011-03-02 12:45:57 +0000 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2011-03-02 12:45:57 +0000 |
commit | 8c46619688d093a55e7392d39f6a7b6d627c1dcd (patch) | |
tree | e0b7adc9ee6acce61d86cfda001aff07c64b32d9 /common/rfb/ColourMap.h | |
parent | 3270a59ae45a88054e8e18557a56614a5b986d0c (diff) | |
download | tigervnc-8c46619688d093a55e7392d39f6a7b6d627c1dcd.tar.gz tigervnc-8c46619688d093a55e7392d39f6a7b6d627c1dcd.zip |
Provide a simple helper class for basic colour map usage.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4309 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'common/rfb/ColourMap.h')
-rw-r--r-- | common/rfb/ColourMap.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/common/rfb/ColourMap.h b/common/rfb/ColourMap.h index da6cb126..22d6789c 100644 --- a/common/rfb/ColourMap.h +++ b/common/rfb/ColourMap.h @@ -1,4 +1,5 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. + * Copyright 2011 Pierre Ossman <ossman@cendio.se> for Cendio AB * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,5 +31,20 @@ namespace rfb { public: virtual void lookup(int index, int* r, int* g, int* b)=0; }; + + class SimpleColourMap : public ColourMap { + public: + SimpleColourMap(int size = 256) { table = new Colour[size]; }; + ~SimpleColourMap() { delete [] table; }; + + void lookup(int index, int* r, int* g, int* b) + { *r = table[index].r; *g = table[index].g; *b = table[index].b; }; + + void set(int index, int r, int g, int b) + { table[index].r = r; table[index].g = g; table[index].b = b; }; + + protected: + Colour *table; + }; } #endif |