MHEG  17.9.0
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Pages
tmcolor.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2004 Ocean Blue Software Ltd
4  * Copyright © 2000 Koninklijke Philips Electronics N.V
5  *
6  * This file is part of a DTVKit Software Component
7  * You are permitted to copy, modify or distribute this file subject to the terms
8  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
9  *
10  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
11  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
12  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
13  *
14  * If you or your organisation is not a member of DTVKit then you have access
15  * to this source code outside of the terms of the licence agreement
16  * and you are expected to delete this and any associated files immediately.
17  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
18  *******************************************************************************/
26 #ifndef _TMCOLOR_H
27 #define _TMCOLOR_H
28 
29 /*---includes for this file--------------------------------------------------*/
30 
31 #include "mh5base.h"
32 #include "osdtypes.h"
33 
34 /*---Constant and macro definitions for public use---------------------------*/
35 
36 #define DEFAULTTEXTCOLOR "\xff\xff\xff\x00", 4
37 #define TRANSPARENTCOLOR "\xff\xff\xff\xff", 4
38 #define BLACKCOLOR "\x00\x00\x00\x00", 4
39 #define DEFAULTSLIDERCOLOR "\xff\xff\xff\x00", 4
40 #define DEFAULTBUTTONCOLOR "\x50\x50\x50\x00", 4
41 #define DEFAULTHIGHLIGHTCOLOR "\xff\xff\xff\x00", 4
42 #define DEFAULTDESKTOPCOLOUR "\x00\x00\x00\x00", 4
43 
44 /* Macros to convert from discrete red, green, blue and transparent values to
45  * OSDColor values
46  */
47 #define RGB(r, g, b) (0xff000000 | ((r) << 16) | ((g) << 8) | (b))
48 #define RGBT(r, g, b, t) ((((t) ^ 0xff) << 24) | ((r) << 16) | ((g) << 8) | (b))
49 
50 /* Macros to extract red, green, blue, transparent and alpha values from an
51  * OSDColor value
52  */
53 
54 #define GetRValue(osdcolour) (((osdcolour) >> 16) & 0xff)
55 #define GetGValue(osdcolour) (((osdcolour) >> 8) & 0xff)
56 #define GetBValue(osdcolour) ((osdcolour) & 0xff)
57 #define GetTValue(osdcolour) (((osdcolour) >> 24) ^ 0xff)
58 #define GetAValue(osdcolour) ((osdcolour) >> 24)
59 
60 #define GetYValue(red, green, blue) ((U8BIT) (((77 * red + 150 * green + 29 * blue) / 256)))
61 #define GetCBValue(red, green, blue) ((U8BIT)((-44 * red - 87 * green + 131 * blue) / 256 + 128))
62 #define GetCRValue(red, green, blue) ((U8BIT)((131 * red - 110 * green - 21 * blue) / 256 + 128))
63 #define GetMixValue(transparency) ((255 - transparency) / (255 / 63))
64 
65 /* Desktop colour is displayed at the bottom of the MHEG-5 display stack */
66 #define DESKTOP_COLOUR (RGBT(0, 0, 0, 0))
67 
68 /* Fully transparent OSDColor type */
69 #define FULLY_TRANSPARENT (RGBT(0, 0, 0, 255))
70 
71 /*---Enumerations for public use---------------------------------------------*/
72 
73 /*---Global type defs for public use-----------------------------------------*/
74 typedef enum
75 {
76  MHEG_COLOUR_CYAN,
77  MHEG_COLOUR_CYAN1,
78  MHEG_COLOUR_CYAN2,
79  MHEG_COLOUR_CYAN3,
80  MHEG_COLOUR_CYAN4,
81  MHEG_COLOUR_DARKCYAN,
82  MHEG_COLOUR_YELLOW,
83  MHEG_COLOUR_YELLOW1,
84  MHEG_COLOUR_YELLOW2,
85  MHEG_COLOUR_YELLOW3,
86  MHEG_COLOUR_YELLOW4,
87  MHEG_COLOUR_DARKYELLOW,
88  MHEG_COLOUR_MAGENTA,
89  MHEG_COLOUR_MAGENTA1,
90  MHEG_COLOUR_MAGENTA2,
91  MHEG_COLOUR_MAGENTA3,
92  MHEG_COLOUR_MAGENTA4,
93  MHEG_COLOUR_DARKMAGENTA,
94  MHEG_COLOUR_RED,
95  MHEG_COLOUR_RED1,
96  MHEG_COLOUR_RED2,
97  MHEG_COLOUR_RED3,
98  MHEG_COLOUR_RED4,
99  MHEG_COLOUR_DARKRED,
100  MHEG_COLOUR_GREEN,
101  MHEG_COLOUR_GREEN1,
102  MHEG_COLOUR_GREEN2,
103  MHEG_COLOUR_GREEN3,
104  MHEG_COLOUR_GREEN4,
105  MHEG_COLOUR_DARKGREEN,
106  MHEG_COLOUR_BLUE,
107  MHEG_COLOUR_BLUE1,
108  MHEG_COLOUR_BLUE2,
109  MHEG_COLOUR_BLUE3,
110  MHEG_COLOUR_BLUE4,
111  MHEG_COLOUR_DARKBLUE,
112  MHEG_COLOUR_BLACK,
113  MHEG_COLOUR_GRAY,
114  MHEG_COLOUR_GREY,
115  MHEG_COLOUR_WHITE,
116  MHEG_COLOUR_TRANSPARENT
117 } E_MHEG_COLOURS;
118 
119 typedef struct
120 {
121  U8BIT transparancy;
122  U8BIT red;
123  U8BIT green;
124  U8BIT blue;
126 
127 /*---Global variable declarations for public use-----------------------------*/
128 
129 /*---Global Function prototypes for public use-------------------------------*/
130 
138 OSDColor OSDgetColour(const char *colour, int len);
139 
146 MHEG5String OSDsetColour(OSDColor colour);
147 
148 
149 #endif /*_TMCOLOR_H*/
Basis MHEG5 data types.
Definition: mh5base.h:82
OSDColor OSDgetColour(const char *colour, int len)
Converts an MHEG5 colour value to an OSDColor type.
Definition: tmcolor.c:53
Define OSD types.
MHEG5String OSDsetColour(OSDColor colour)
Converts an OSDColor type into an MHEG5 colour value For UK1 profile only RGBTCOLOR is defined...
Definition: tmcolor.c:210
Definition: tmcolor.h:119