⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gui.c

📁 关于嵌入式PCB板UI的程序
💻 C
📖 第 1 页 / 共 2 页
字号:
/*****************************************************************************

File name: GUI.c

Description: gui setup

COPYRIGHT (C) 2004 STMicroelectronics

*****************************************************************************/

/* Includes --------------------------------------------------------------- */

#include <string.h>

#include "stlite.h"
#include "stddefs.h"
#include "stdevice.h"
#include "sttbx.h"
#include "stgxobj.h"

#include "sections.h"   /* memory partitions */
#include "avmem.h"      /* AV memory partition */
#include "errors.h"
#include "evt.h"

#include "layer.h"
#include "blit.h"
#include "gui.h"
#include "osdwrap.h"

#include "../osal/handle.h"
#include "emc_font.h"
#include "./pics/data_bitmap_dvb_logo.h"
#include "./pics/data_struct_dvb_logo.h"

/* Private Types ---------------------------------------------------------- */

/* Private Constants ------------------------------------------------------ */

/* Private Variables ------------------------------------------------------ */

/* Private Macros --------------------------------------------------------- */

/* Private Function prototypes -------------------------------------------- */

/* Constants -------------------------------------------------------------- */
#define RegionWidth	720//660
#define RegionHeight	576//545

#define RegionX 0//38
#define RegionY 0//10
/* Global Variables ------------------------------------------------------- */
int iPAL_Mode;
STBLIT_BlitContext_t BlitContext;
STGXOBJ_Color_t FillColor;
STGXOBJ_Rectangle_t Rectangle;
STOSD_Color_t DrawColor;

STOSD_RegionHandle_t Handle_InfoPanel = 0;
STOSD_RegionHandle_t Handle_ProviewWindow = 0;
STOSD_RegionParams_t InfoPanelParams;
STOSD_RegionParams_t ProviewWindowParams;

STOSD_Color_t backgroundColor;
STOSD_Color_t whitecolor,blackcolor,redcolor,orangecolor,yellowcolor,graycolor;
STOSD_Color_t dialogcolor,darkyellow,progressbarcolor;
STOSD_Color_t lightbluecolor,epgheadcolor,skybluecolor,darkbluecolor,greencolor,menucolor;

extern STLAYER_ViewPortHandle_t LAYER_ViewPortHandle[];

STLAYER_ViewPortSource_t   VPSource;
STLAYER_ViewPortParams_t LayerVpParams;	 
static STGXOBJ_Bitmap_t Bitmap;
static STGXOBJ_Palette_t Palette;
static STLAYER_ViewPortSource_t  Source;

extern char cTransparent;

static U8 Palette_RGB_LG[ 769 ] =
{
    0x00, 0x00, 0x00, 0xF8, 0xD8, 0x88, 0x40, 0x60, 0x90, 
    0x00, 0x30, 0x00, 0x00, 0x30, 0x40, 0x80, 0x88, 0xC0, 
    0x40, 0x70, 0xB8, 0x08, 0x00, 0x28, 0x28, 0x30, 0x40, 
    0x48, 0x40, 0x00, 0xC0, 0x88, 0x00, 0x00, 0x40, 0x80, 
    0xC0, 0xC0, 0xC0, 0xF8, 0xC8, 0x48, 0x20, 0x00, 0x00, 
    0xA0, 0xA0, 0xA0, 0x00, 0xFF, 0x00, 0x00, 0x88, 0xD0, 
    0x48, 0x48, 0x50, 0xF8, 0xE8, 0xC0, 0x98, 0xC8, 0xD8, 
    0x40, 0xA8, 0xD8, 0xE8, 0xA8, 0x00, 0x60, 0x88, 0x90, 
    0x00, 0x40, 0x60, 0x90, 0xA0, 0xA8, 0x38, 0x50, 0x80, 
    0x00, 0xA0, 0x88, 0x20, 0x40, 0x60, 0x68, 0x60, 0x60, 
    0x80, 0xC0, 0xE8, 0x00, 0x20, 0x00, 0x00, 0x00, 0xFF, 
    0x80, 0x40, 0x00, 0x10, 0x28, 0x38, 0x40, 0x00, 0x80, 
    0x20, 0x00, 0x40, 0x20, 0x08, 0x20, 0x18, 0x40, 0x80, 
    0xC0, 0xD0, 0xE8, 0x00, 0x10, 0x18, 0x80, 0xA0, 0x90, 
    0x48, 0x70, 0x98, 0x30, 0x28, 0x00, 0x58, 0x80, 0xC8, 
    0xE0, 0xE8, 0xE8, 0x60, 0xA0, 0xC8, 0xF8, 0xC0, 0x20, 
    0x00, 0xFF, 0xFF, 0xA8, 0xC0, 0xE8, 0x90, 0x80, 0x90, 
    0x08, 0x48, 0x48, 0x08, 0x20, 0x28, 0xE8, 0x80, 0x00, 
    0x18, 0x20, 0x00, 0x18, 0x30, 0x60, 0x88, 0x60, 0x00, 
    0x10, 0x00, 0x00, 0x40, 0x30, 0x00, 0x28, 0x60, 0x98, 
    0x00, 0x28, 0x50, 0x30, 0x40, 0x40, 0x48, 0x48, 0x38, 
    0x30, 0xA0, 0xE8, 0xFF, 0x00, 0x00, 0x48, 0x58, 0x68, 
    0xF8, 0xB8, 0x10, 0x60, 0x80, 0xA0, 0x20, 0x50, 0xA0, 
    0xF0, 0xF0, 0xF0, 0x00, 0x10, 0x00, 0x08, 0x08, 0x98, 
    0xA0, 0x88, 0x38, 0x08, 0x20, 0x40, 0x80, 0xA8, 0xC0, 
    0x60, 0x48, 0x00, 0xD8, 0x98, 0x00, 0xB0, 0xB0, 0xB0, 
    0x00, 0xA8, 0xE8, 0x20, 0x90, 0x90, 0xFF, 0xFF, 0x00, 
    0x28, 0x48, 0x78, 0x70, 0x70, 0x70, 0x90, 0xC0, 0xF8, 
    0x20, 0x50, 0x90, 0xD0, 0xE0, 0xE8, 0x70, 0xB0, 0xD8, 
    0x08, 0x18, 0x30, 0xF0, 0xF8, 0xF8, 0x08, 0x00, 0x00, 
    0x88, 0x88, 0x90, 0x20, 0x80, 0x90, 0xF8, 0xE8, 0xA8, 
    0x40, 0x80, 0x80, 0x00, 0x40, 0x00, 0x40, 0x80, 0xC0, 
    0xFF, 0x00, 0xFF, 0x20, 0x40, 0x48, 0xD8, 0xD8, 0xD8, 
    0xF8, 0xA8, 0x00, 0x98, 0xA8, 0xB0, 0x30, 0x40, 0x60, 
    0x50, 0x00, 0x80, 0x20, 0x20, 0x40, 0x50, 0x80, 0xA0, 
    0x28, 0x40, 0x00, 0x60, 0x90, 0xD0, 0x18, 0x18, 0x10, 
    0x18, 0x38, 0x70, 0xA8, 0x78, 0x00, 0x10, 0x28, 0x50, 
    0x80, 0x20, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x20, 0x90, 
    0x50, 0x00, 0x20, 0xA8, 0x80, 0x00, 0x88, 0x88, 0x80, 
    0x00, 0x00, 0x58, 0xF8, 0xE0, 0x90, 0xD8, 0x80, 0x00, 
    0x10, 0x40, 0xA0, 0xC8, 0xC8, 0xD0, 0xF8, 0xD8, 0x70, 
    0x18, 0x08, 0x18, 0xA8, 0xB0, 0xB8, 0x10, 0x90, 0xE8, 
    0x60, 0x60, 0x60, 0xB0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 
    0x58, 0x98, 0xC0, 0xF0, 0xB0, 0x00, 0x70, 0x78, 0x80, 
    0x08, 0x40, 0x78, 0x40, 0x58, 0x88, 0x28, 0x40, 0x68, 
    0x70, 0x68, 0x68, 0x90, 0xC0, 0xE0, 0xA0, 0x40, 0x00, 
    0x30, 0x00, 0xA0, 0x18, 0x00, 0x60, 0x20, 0x48, 0x90, 
    0xC0, 0xD8, 0xE0, 0x40, 0x70, 0xA8, 0x60, 0x88, 0xC8, 
    0x00, 0xFF, 0x00, 0x78, 0x98, 0xC8, 0xB0, 0xE0, 0xF8, 
    0x90, 0x90, 0x90, 0x10, 0x18, 0x20, 0x20, 0x18, 0x00, 
    0x98, 0x70, 0x00, 0x48, 0x38, 0x18, 0x58, 0x68, 0x78, 
    0x68, 0x98, 0xB0, 0xF8, 0xF8, 0xE8, 0x90, 0xB0, 0xE8, 
    0x70, 0x50, 0x00, 0x20, 0x88, 0xC0, 0x10, 0x48, 0x00, 
    0x00, 0x00, 0x08, 0x00, 0x00, 0xFF, 0x80, 0x10, 0x00, 
    0x10, 0x10, 0x80, 0x80, 0x80, 0x88, 0x00, 0x10, 0x40, 
    0x18, 0x60, 0x98, 0xF8, 0xE0, 0x80, 0x40, 0x70, 0x80, 
    0x10, 0x30, 0x40, 0x90, 0x80, 0xD0, 0x50, 0x78, 0xB8, 
    0x00, 0x10, 0x20, 0x20, 0x30, 0x50, 0x58, 0x40, 0x00, 
    0xC0, 0x90, 0x00, 0x00, 0x50, 0x90, 0x00, 0xFF, 0xFF, 
    0xC0, 0xC8, 0xC0, 0xF8, 0xD0, 0x58, 0x18, 0x10, 0x00, 
    0xA8, 0xA8, 0xA8, 0x08, 0x90, 0xD0, 0x50, 0x58, 0x58, 
    0xF8, 0xF0, 0xD8, 0xE8, 0xB0, 0x08, 0x08, 0x38, 0x60, 
    0x88, 0xA0, 0xB8, 0x40, 0x48, 0x80, 0x00, 0x90, 0xB0, 
    0x20, 0x40, 0x68, 0x68, 0x68, 0x68, 0x80, 0xD0, 0xE0, 
    0xFF, 0x00, 0x00, 0x00, 0x20, 0x10, 0x80, 0x58, 0x00, 
    0x20, 0x28, 0x28, 0x40, 0x00, 0x90, 0x20, 0x00, 0x50, 
    0x18, 0x20, 0x38, 0x20, 0x48, 0x88, 0x08, 0x08, 0x10, 
    0x28, 0x28, 0x10, 0x68, 0xA8, 0xD8, 0xF8, 0xC0, 0x30, 
    0xB0, 0xD0, 0xE8, 0x90, 0x88, 0x88, 0xF8, 0x88, 0x00, 
    0x18, 0x40, 0x68, 0xF2, 0xD3, 0x04, 0x90, 0x68, 0x00, 
    0x50, 0x38, 0x00, 0x30, 0x70, 0xA0, 0x00, 0x30, 0x50, 
    0x38, 0x48, 0x58, 0x48, 0x60, 0x70, 0xF2, 0xC3, 0x04, 
    0x70, 0x80, 0xA0, 0x00, 0x00, 0xA8, 0x80, 0x80, 0x68, 
    0x10, 0x20, 0x40, 0x90, 0xA8, 0xD0, 0x68, 0x50, 0x00, 
    0xD8, 0xA0, 0x00, 0xB8, 0xB8, 0xB8, 0xFF, 0x00, 0xFF, 
    0x00, 0xB0, 0xF8, 0x78, 0x78, 0x78, 0x90, 0xD0, 0xF8, 
    0x8A, 0x55, 0x16, 0xD8, 0xE8, 0xF8, 0x70, 0xB8, 0xE8, 
    0x08, 0x20, 0x38, 0xF8, 0xF8, 0xF8, 0x08, 0x08, 0x08, 
    0x18, 0x78, 0xB0, 0xDA, 0x8B, 0x46, 0x00, 0x40, 0x10, 
    0x48, 0x88, 0xB8, 0x28, 0x40, 0x50, 0x98, 0xA8, 0xB8, 
    0xFF, 0xFF, 0xFF, 0x30, 0x40, 0x00, 0x18, 0x40, 0x78, 
    0x10, 0x30, 0x58, 0xDC, 0x9A, 0x4E, 0xB8, 0x88, 0x00, 
    0xB0, 0xC0, 0xD0, 0x50, 0xA8, 0xD8, 0x11, 0x73, 0x18, 
    0x19, 0x6B, 0x4E, 0x48, 0x68, 0xA8, 0x3A, 0x6D, 0x10, 
    0x10, 0x20, 0x28, 0x72, 0xCE, 0x4E, 0xF8, 0xF8, 0xF0, 
    0x69, 0xB7, 0x38
};
extern void msm_ShowMainMenu(void);
extern void EMC_HideAllRegions(void);
/* Functions -------------------------------------------------------------- */
BOOL SRGRA_OSALSystemInit(void)
{
	static HDL_InitParams_t  HDLInitParam;

	/* Init OSAL */
	if ( OSAL_Init() != 0 )
	{
			return( 1 ) ;
	}
	  /* Init Handle Module  */
	HDLInitParam.iNbrParent = 10; 
	if ( HDL_Init( &HDLInitParam ) != HDL_kNoError ) 
	{
			STTBX_Print(("STVAPI Handle Init Failure"));
			return( 1 ) ;
	}
	return(0);
}

ST_ErrorCode_t GUI_Setup(void)
{
	ST_ErrorCode_t ErrCode = ST_NO_ERROR;
	STOSD_Color_t tempColor;
	tempColor.Value.PaletteEntry = 112;

	ErrCode = EMC_CreateViewPort(&VPSource,&LayerVpParams,RegionX,RegionY,RegionWidth,RegionHeight,tempColor);
	
	backgroundColor.Type = STOSD_COLOR_TYPE_PALETTE;
	backgroundColor.Value.PaletteEntry = 0;

	/* dark blue*/
	epgheadcolor.Type = STOSD_COLOR_TYPE_PALETTE;
	epgheadcolor.Value.PaletteEntry = 231;
	
	/*red*/
	redcolor.Type = STOSD_COLOR_TYPE_PALETTE;
	redcolor.Value.PaletteEntry = 64;

	/*orange*/
	orangecolor.Type = STOSD_COLOR_TYPE_PALETTE;
	orangecolor.Value.PaletteEntry = 206;

	yellowcolor.Type = STOSD_COLOR_TYPE_PALETTE;
	yellowcolor.Value.PaletteEntry = 47;
	
	/*white*/
	whitecolor.Type = STOSD_COLOR_TYPE_PALETTE;
	whitecolor.Value.PaletteEntry = 69;/*88;*//*112;*//*241;*/

	/*black*/
	blackcolor.Type = STOSD_COLOR_TYPE_PALETTE;
	blackcolor.Value.PaletteEntry = 233;

	/*light blue*/
	lightbluecolor.Type = STOSD_COLOR_TYPE_PALETTE;
	lightbluecolor.Value.PaletteEntry =44;

	/*dialog background color*/
	dialogcolor.Type = STOSD_COLOR_TYPE_PALETTE;
	dialogcolor.Value.PaletteEntry =199;

	darkyellow.Type = STOSD_COLOR_TYPE_PALETTE;
	darkyellow.Value.PaletteEntry =109;

	progressbarcolor.Type = STOSD_COLOR_TYPE_PALETTE;
	progressbarcolor.Value.PaletteEntry =101;

	skybluecolor.Type = STOSD_COLOR_TYPE_PALETTE;
	skybluecolor.Value.PaletteEntry =250;

	darkbluecolor.Type = STOSD_COLOR_TYPE_PALETTE;
	darkbluecolor.Value.PaletteEntry =212;

	greencolor.Type = STOSD_COLOR_TYPE_PALETTE;
	greencolor.Value.PaletteEntry =255;

	menucolor.Type = STOSD_COLOR_TYPE_PALETTE;
	menucolor.Value.PaletteEntry = 165;

	graycolor.Type = STOSD_COLOR_TYPE_PALETTE;
	graycolor.Value.PaletteEntry = 223;
/*
	for(i = 0;i<16;i++)
	 	for(j = 0;j<16;j++)
	 	{
	 		tempColor.Value.PaletteEntry = i*16+j;
	 		STOSD_FillRectangle(0,100+j*(16+5),100+i*(16+5),16,16,tempColor);
	 	}
*/
	STOSD_PutRectangle(0,250,230,(STOSD_Bitmap_t *)&Bitmap_Struct_DVB_Logo);
	//EMC_DrawTextRectangle(0, 200, 20, 100, 30, "Hello World", JLEFT,FONT_ARIAL16_18, TRUE, tempColor, tempColor, tempColor);
	ProviewWindowParams.PositionX = 0;
	ProviewWindowParams.PositionY = 0;
	ProviewWindowParams.Width = LayerVpParams.InputRectangle.Width;
	ProviewWindowParams.Height= LayerVpParams.InputRectangle.Height;

	//ErrCode = OSD_HideViewPort();
	sttbx_Print("\nErrCode = %s\n",GetErrorText(ErrCode));
	return ErrCode;
}
/* Functions -------------------------------------------------------------- */
ST_ErrorCode_t OSD_ShowViewPort(void)
{
	ST_ErrorCode_t ErrCode = ST_NO_ERROR;
	ErrCode = STLAYER_EnableViewPort(LAYER_ViewPortHandle[LAYER_OSD]);
	return ErrCode;
}

ST_ErrorCode_t OSD_HideViewPort(void)
{
	ST_ErrorCode_t ErrCode = ST_NO_ERROR;
	ErrCode = STLAYER_DisableViewPort(LAYER_ViewPortHandle[LAYER_OSD]);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -