MHEG5
15.3.0
|
00001 /******************************************************************************* 00002 * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org) 00003 * Copyright © 2006 Ocean Blue Software Ltd 00004 * 00005 * This file is part of a DTVKit Software Component 00006 * You are permitted to copy, modify or distribute this file subject to the terms 00007 * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org 00008 * 00009 * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 00010 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES 00011 * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 00012 * 00013 * If you or your organisation is not a member of DTVKit then you have access 00014 * to this source code outside of the terms of the licence agreement 00015 * and you are expected to delete this and any associated files immediately. 00016 * Further information on DTVKit, membership and terms can be found at www.dtvkit.org 00017 *******************************************************************************/ 00025 #ifndef _OSD_UTILS_H 00026 #define _OSD_UTILS_H 00027 00028 /*---includes for this file--------------------------------------------------*/ 00029 00030 /* compiler library header files */ 00031 00032 /* third party header files */ 00033 00034 /* OBS header files */ 00035 #include <techtype.h> 00036 00037 /*---Constant and macro definitions for public use-----------------------------*/ 00038 00039 /* Macros to extract red, green, blue, transparent and alpha values from an 00040 * OSDColor value 00041 */ 00042 #define GetRValue(osdcolour) (((osdcolour) >> 16) & 0xff) 00043 #define GetGValue(osdcolour) (((osdcolour) >> 8) & 0xff) 00044 #define GetBValue(osdcolour) ((osdcolour) & 0xff) 00045 #define GetTValue(osdcolour) (((osdcolour) >> 24) ^ 0xff) 00046 #define GetAValue(osdcolour) ((osdcolour) >> 24) 00047 00048 00049 /* Macros to convert from discrete red, green, blue and transparent values to 00050 * OSDColor values 00051 */ 00052 #define RGB(r, g, b) (0xff000000 | ((r) << 16) | ((g) << 8) | (b)) 00053 #define RGBT(r, g, b, t) ((((t) ^ 0xff) << 24) | ((r) << 16) | ((g) << 8) | (b)) 00054 #define RGBA(r, g, b, a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)) 00055 00056 #define MakeHD2Color(osdcol) (((osdcol >> 16) & 0xf000) | ((osdcol >> 12) & 0x0f00) \ 00057 | ((osdcol >> 8) & 0x00f0) | ((osdcol >> 4) & 0x000f)) 00058 00059 /* 00060 * HD2Colour is two byte colour, again in the ARGB format: 00061 * Alpha bits 15..12 00062 * Red bits 11..8 00063 * Green bits 7.. 4 00064 * Blue bits 3.. 0 00065 * 00066 * Note: 00067 * For bits 15..12, the value of 0xf represents completely opaque, 00068 * and the value of 0x0 represents completely transparent. 00069 */ 00070 typedef U16BIT HD2Color; 00071 00072 00073 #ifdef OSD_8_BIT 00074 00075 #ifndef PALETTE_OFFSET 00076 #define PALETTE_OFFSET 0 00077 #endif 00078 #define OFFSET_TRANS (PALETTE_OFFSET + 0) 00079 #define OFFSET_OPAQUE (PALETTE_OFFSET + 49) 00080 extern OSDColor *mg_palette; 00081 00082 00083 /*---Enumerations for public use-----------------------------------------------*/ 00084 00085 /*---Global type defs for public use-------------------------------------------*/ 00086 00087 /*---Global Function prototypes for public use---------------------------------*/ 00088 00089 /*!************************************************************************** 00090 * @fn OSD_FindNearestColourIndex 00091 * @brief Return nearest colour index. 00092 * @param U8BIT r Red component of colour 00093 * U8BIT g Green component of colour 00094 * U8BIT b Blue component of colour 00095 * U8BIT a Alpha component of colour 00096 * @return U8BIT Index of nearest colour in the 00097 * MHEG palette 00098 * @warning This function depends on the order of the MHEG palette. 00099 * @bug 00100 ****************************************************************************/ 00101 extern U8BIT OSD_FindNearestColourIndex(OSDColor target); 00102 00103 /*!************************************************************************** 00104 * @fn OSD_BlendPixels 00105 * @brief Plots pixels into a buffer, comparing the new and old values to 00106 * ensure that pixels with transparent components are correctly 00107 * blended together. 00108 * @param U8BIT* pixel Destination pointer for the pixel 00109 * This contains the old pixel 00110 * U8BIT colour Colour index of the new pixel 00111 * @return None 00112 * @warning None 00113 * @bug None 00114 ****************************************************************************/ 00115 void OSD_BlendPixels(U8BIT *pixel, U8BIT colour); 00116 00117 /*!************************************************************************** 00118 * @fn OSD_IsColourOpaque 00119 * @brief Tell whether a colour is opaque or not 00120 * @param U8BIT colour The colour 00121 * @return TRUE if the colour is opaque, FALSE otherwise 00122 * @warning This function depends on the order of the MHEG palette. 00123 * @bug None. 00124 ****************************************************************************/ 00125 /* BOOLEAN OSD_IsColourOpaque(U8BIT colour); */ 00126 #define OSD_IsColourOpaque(colour) (colour >= OFFSET_OPAQUE) 00127 00128 #endif /*OSD_8_BIT*/ 00129 00130 #endif /* _OSD_UTILS_H */ 00131