From 8c46619688d093a55e7392d39f6a7b6d627c1dcd Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 2 Mar 2011 12:45:57 +0000 Subject: [PATCH] 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 --- common/rfb/ColourMap.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 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 -- 2.39.5