MHEG5  15.3.0
source/core/inc/tmcolor.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
00003  * Copyright © 2004 Ocean Blue Software Ltd
00004  * Copyright © 2000 Koninklijke Philips Electronics N.V
00005  *
00006  * This file is part of a DTVKit Software Component
00007  * You are permitted to copy, modify or distribute this file subject to the terms
00008  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
00009  * 
00010  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
00011  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
00012  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
00013  * 
00014  * If you or your organisation is not a member of DTVKit then you have access
00015  * to this source code outside of the terms of the licence agreement
00016  * and you are expected to delete this and any associated files immediately.
00017  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
00018  *******************************************************************************/
00026 #ifndef _TMCOLOR_H
00027 #define _TMCOLOR_H
00028 
00029 /*---includes for this file--------------------------------------------------*/
00030 
00031 #include "mh5base.h"
00032 #include "osdtypes.h"
00033 
00034 /*---Constant and macro definitions for public use---------------------------*/
00035 
00036 #define DEFAULTTEXTCOLOR        "\xff\xff\xff\x00", 4
00037 #define TRANSPARENTCOLOR        "\xff\xff\xff\xff", 4
00038 #define BLACKCOLOR              "\x00\x00\x00\x00", 4
00039 #define DEFAULTSLIDERCOLOR      "\xff\xff\xff\x00", 4
00040 #define DEFAULTBUTTONCOLOR      "\x50\x50\x50\x00", 4
00041 #define DEFAULTHIGHLIGHTCOLOR   "\xff\xff\xff\x00", 4
00042 #define DEFAULTDESKTOPCOLOUR    "\x00\x00\x00\x00", 4
00043 
00044 /* Macros to convert from discrete red, green, blue and transparent values to
00045  * OSDColor values
00046  */
00047 #define RGB(r, g, b)        (0xff000000 | ((r) << 16) | ((g) << 8) | (b))
00048 #define RGBT(r, g, b, t)    ((((t) ^ 0xff) << 24) | ((r) << 16) | ((g) << 8) | (b))
00049 
00050 /* Macros to extract red, green, blue, transparent and alpha values from an
00051  *  OSDColor value
00052  */
00053 
00054 #define GetRValue(osdcolour)        (((osdcolour) >> 16) & 0xff)
00055 #define GetGValue(osdcolour)        (((osdcolour) >> 8) & 0xff)
00056 #define GetBValue(osdcolour)        ((osdcolour) & 0xff)
00057 #define GetTValue(osdcolour)        (((osdcolour) >> 24) ^ 0xff)
00058 #define GetAValue(osdcolour)        ((osdcolour) >> 24)
00059 
00060 #define GetYValue(red, green, blue) ((U8BIT) (((77 * red + 150 * green + 29 * blue) / 256)))
00061 #define GetCBValue(red, green, blue) ((U8BIT)((-44 * red - 87 * green + 131 * blue) / 256 + 128))
00062 #define GetCRValue(red, green, blue) ((U8BIT)((131 * red - 110 * green - 21 * blue) / 256 + 128))
00063 #define GetMixValue(transparency)     ((255 - transparency) / (255 / 63))
00064 
00065 /* Desktop colour is displayed at the bottom of the MHEG-5 display stack */
00066 #define DESKTOP_COLOUR      (RGBT(0, 0, 0, 0))
00067 
00068 /* Fully transparent OSDColor type */
00069 #define FULLY_TRANSPARENT   (RGBT(0, 0, 0, 255))
00070 
00071 /*---Enumerations for public use---------------------------------------------*/
00072 
00073 /*---Global type defs for public use-----------------------------------------*/
00074 typedef enum
00075 {
00076    MHEG_COLOUR_CYAN,
00077    MHEG_COLOUR_CYAN1,
00078    MHEG_COLOUR_CYAN2,
00079    MHEG_COLOUR_CYAN3,
00080    MHEG_COLOUR_CYAN4,
00081    MHEG_COLOUR_DARKCYAN,
00082    MHEG_COLOUR_YELLOW,
00083    MHEG_COLOUR_YELLOW1,
00084    MHEG_COLOUR_YELLOW2,
00085    MHEG_COLOUR_YELLOW3,
00086    MHEG_COLOUR_YELLOW4,
00087    MHEG_COLOUR_DARKYELLOW,
00088    MHEG_COLOUR_MAGENTA,
00089    MHEG_COLOUR_MAGENTA1,
00090    MHEG_COLOUR_MAGENTA2,
00091    MHEG_COLOUR_MAGENTA3,
00092    MHEG_COLOUR_MAGENTA4,
00093    MHEG_COLOUR_DARKMAGENTA,
00094    MHEG_COLOUR_RED,
00095    MHEG_COLOUR_RED1,
00096    MHEG_COLOUR_RED2,
00097    MHEG_COLOUR_RED3,
00098    MHEG_COLOUR_RED4,
00099    MHEG_COLOUR_DARKRED,
00100    MHEG_COLOUR_GREEN,
00101    MHEG_COLOUR_GREEN1,
00102    MHEG_COLOUR_GREEN2,
00103    MHEG_COLOUR_GREEN3,
00104    MHEG_COLOUR_GREEN4,
00105    MHEG_COLOUR_DARKGREEN,
00106    MHEG_COLOUR_BLUE,
00107    MHEG_COLOUR_BLUE1,
00108    MHEG_COLOUR_BLUE2,
00109    MHEG_COLOUR_BLUE3,
00110    MHEG_COLOUR_BLUE4,
00111    MHEG_COLOUR_DARKBLUE,
00112    MHEG_COLOUR_BLACK,
00113    MHEG_COLOUR_GRAY,
00114    MHEG_COLOUR_GREY,
00115    MHEG_COLOUR_WHITE,
00116    MHEG_COLOUR_TRANSPARENT
00117 } E_MHEG_COLOURS;
00118 
00119 typedef struct
00120 {
00121    U8BIT transparancy;
00122    U8BIT red;
00123    U8BIT green;
00124    U8BIT blue;
00125 } S_MHEG_OSD_COLOUR_MAP;
00126 
00127 /*---Global variable declarations for public use-----------------------------*/
00128 
00129 /*---Global Function prototypes for public use-------------------------------*/
00130 
00138 OSDColor OSDgetColour(const char *colour, int len);
00139 
00146 MHEG5String OSDsetColour(OSDColor colour);
00147 
00148 
00149 #endif /*_TMCOLOR_H*/
 All Data Structures Files Functions Variables Typedefs Defines