gfxtools/Color/src/Palette12.cpp
changeset 0 f58d6ec98e88
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gfxtools/Color/src/Palette12.cpp	Thu Dec 17 09:14:18 2009 +0200
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*       
+*
+*/
+
+
+#include "ColorImp.h"
+
+const TRgb KPalette12[30] =
+	{
+    0x00F7EFFF,
+    0x00EFD7FF,
+    0x00E6BEFF,
+    0x00D69EFF,
+    0x00CE7DFF,
+    0x00BD59FF,
+    0x00AD39FF,
+    0x00A514FF,
+    0x008C00EF,
+    0x007300C5,
+    0x006300A5,
+    0x004A0084,
+    0x003A0063,
+    0x00290042,
+    0x00190029,
+    0x00080010,
+    0x00FEFEFE,
+    0x00AD3DFF,
+    0x00D6A2FF,
+    0x00FEFEFE, // undefined
+    0x00FEFEFE, // undefined
+    0x00FEFEFE, // undefined
+    0x00FEFEFE, // undefined
+	0x0000EEFF,		// coding yellow
+	0x000000DD,		// coding red
+	0x00FF7700,		// coding blue
+	0x0000EE00,		// coding green
+    0x00339900,  // nokia brand color green 253
+    0x00CC3300,  // nokia brand color blue 254
+	0x00DD00DD		// mask pink
+	};
+
+TRgb TPalette12::Color(int aIndex) const
+	{
+	// color rotation for palette
+	if (aIndex == 0)
+		return TRgb(0x00000000);
+	else if (aIndex == 0xff)
+		return TRgb(0x00ffffff);
+	else if (aIndex == 215)
+		return TRgb(0x00dd00dd);
+	else if (aIndex < StandardGrayBase)
+		{
+		return TRgb(KColorCubeMap[aIndex/36], KColorCubeMap[(aIndex/6)%6], KColorCubeMap[aIndex%6]);
+		}
+	else if (aIndex < SchemeSpecificColorBase)
+		{
+		int gray = aIndex - StandardGrayBase;
+		return TRgb(KStandardGray[gray], KStandardGray[gray], KStandardGray[gray]);
+		}
+	else
+		{
+		return TRgb(KPalette12[aIndex - SchemeSpecificColorBase]);
+		}
+	};
+
+// End of File