?? fsgui_bmpui.c
字號:
/**************************************************************
** FILE
** fsGUI_BmpUI.c
**
** DESCRIPTION
** On the base of fsGUI_new.c, build a new GUI with bmp for MP3/JPEG/GAME.
**
**
** Creator: zhaoyanhua
** Date: 2004-6-3 10:17
****************************************************************/
#include "global.h"
#include "func.h"
#include "memmap.h"
#include "util.h"
#include "graph.h"
#include "memcfg.h"
#include "framebuf.h"
#include "macro.h"
#include "stc.h"
#include "cfont.h"
#include "vfdfunc.h"
#include "osd.h"
#include "image.h"
#include "nesinit.h"
#include "fs96602.h"
#include "fsNAV.h"
#include "fsGUI.h"
#include "fsGUI1.h"
#include "fsGUI1.h"
//#include "fsGUI_new.h"
#ifdef JPG_OLD_PARSER_FLOW
#ifdef JPG_EFFECT
#include "jpegeffect.h"
#endif
#else
#include "pic_effect.h"
#endif
#ifdef FS_BMP_GUI
#include "FrameBuf_BmpUI.h"
#include "fsGUI_Palette.h"
#include "fsGUI_Bmp.h"
#include "fsGUI_BmpUI.h"
const BITMAP_LAYOUT g_aBitmapLayout[] =
{
//absolute postion
{0, 0, 720, 0, 0, 1}, //bg.bmp top line //0
{0, 171, 720, 0, 1, 1}, //bg.bmp middle line //0
{0, 382, 720, 0, 2, 1}, //bg.bmp bottom line //1
{54, 27, 0, 0, 3, 1}, //tab_bar2-1.bmp //2
{244, 35, 0, 0, 7, 0},//MP3_icon_L.bmp //3
{348, 35, 0, 0, 8, 0},//JPG_icon_L.bmp //4
#if defined(SUPPORT_NESGAME)||defined(SUPPORT_SPG_GAME)
{555, 34, 0, 0, 9, 0},//VIDEO_icon_L.bmp //5
{454, 33, 0, 0, 10, 0},//GAME_icon_L.bmp //6
#else
{449, 36, 0, 0, 9, 0},//VIDEO_icon_L.bmp //5
{560, 35, 0, 0, 10, 0},//GAME_icon_L.bmp //6
#endif
{78, 76, 0, 0, 11, 1},//playing_bar_3_1.bmp //7
{635, 76, 0, 0, 12, 1},//playing_bar_3_3 //8
#ifdef GPS_MP3_UI//frank.huang 050923
{99, 99, 0, 0, 14, 0},//animation1.bmp //9
{99, 99, 0, 0, 15, 0},//animation2.bmp //10
#else
{99, 84, 0, 0, 14, 0},//animation1.bmp //9
{99, 84, 0, 0, 15, 0},//animation2.bmp //10
#endif
//opsite postion. when use these bmp, must add its start position
{0, 0, 105, 1, 4, 1},//tab_bar2-2.bmp //11
{0, 0, 105, 1, 5, 0},//tab_bar_shine.bmp //12
{0, 0, 105, 1, 6, 1},//tab_bar_down.bmp //13
{0, 0, 0, 0, 13, 1},//playing_bar_3_2.bmp //14
{0, 0, 0, 0, 16, 1},//FILE bg Cornre LT //15
{0, 0, 0, 0, 17, 1},//FILE bg Cornre RT //16
{0, 0, 0, 0, 18, 1},//FILE bg Cornre LB //17
{0, 0, 0, 0, 19, 1},//FILE bg Cornre RB //18
{0, 0, 0, 0, 20, 0},//MP3_icon_S.bmp //19
{0, 0, 0, 0, 21, 0},//JPEG_icon_S.bmp //20
#if defined(SUPPORT_NESGAME)||defined(SUPPORT_SPG_GAME)
{0, 0, 0, 0, 22, 1},//Game_icon_S.bmp //22
{0, 0, 0, 0, 23, 0},//Video_icon_S.bmp //23
#else
{0, 0, 0, 0, 22, 0},//Video_icon_S.bmp //22
{0, 0, 0, 0, 23, 1},//Game_icon_S.bmp //23
#endif
{0, 0, 0, 0, 24, 1},//FileBg10_0.bmp //23
{0, 0, 0, 0, 25, 1},//FileBg10_1.bmp //24
{0, 0, 0, 0, 26, 1},//FileBg10_2.bmp //25
{0, 0, 0, 0, 27, 1},//FileBg10_3.bmp //26
{0, 0, 0, 0, 28, 1},//FileBg10_4.bmp //27
{0, 0, 0, 0, 29, 1},//FileBg10_5.bmp //28
{0, 0, 0, 0, 30, 1},//FileBg10_6.bmp //29
{0, 0, 0, 0, 31, 1},//FileBg10_7.bmp //30
{0, 0, 0, 0, 32, 1},//FileBg10_8.bmp //31
{0, 0, 0, 0, 33, 1},//FileBg10_9.bmp //32
{0, 0, 0, 0, 34, 1},//folder_icon //33
#ifdef GPS_MP3_UI//frank.huang 050915
{0, 0, 0, 0, 35, 1},//folder_icon //34
{0, 0, 0, 0, 36, 1},//PATH_INFO_BACKGROUND_L //35
{0, 0, 0, 0, 37, 1},//PATH_INFO_BACKGROUND_R //36
{89, 65, 0, 0, 38, 1},//MP3_PAGE_ICON //37
{89, 65, 0, 0, 39, 1},//JPG_PAGE_ICON //38
{89, 65, 0, 0, 40, 1},//VIDEO_PAGE_ICON //39
{0, 0, 32*PER_PAGE, 1, 41, 1},//VIDEO_PAGE_ICON //40
{0, 0, 0, 0, 42, 1},//ARROW_U //41
{0, 0, 0, 0, 43, 1},//ARROW_D //42
{0, 0, 0, 0, 44, 1},//SLIDER_BLOCK //43
{0, 0, 0, 0, 45, 1},//SLIDER_BLOCK_U //44
{0, 0, 0, 0, 46, 1},//SLIDER_BLOCK_D //45
#endif
};
/*
* Description:
* Draw all the buttons,including background and icon
* NOTE:
* This function has be defined in fsGUI_pub.c
*
* we only modify the codes of DrawButton.
*
*Creater:
* feeling
*Date:
* 2004-06-08
*/
void DrawButton(void)
{
BYTE iBtnState = 0;
#ifdef AUDIO_SHOW_SAVER
if (bDisableGUI) return;
#endif
//draw the left and right edge of button array
FSGUI_LayoutBmp(LAY_TAB_BAR2_1);
//draw the backgroud
FSGUI_DrawBackGround(fsArea[FS_AREA_BUTTONBACKGROUND].xStart,
fsArea[FS_AREA_BUTTONBACKGROUND].yStart,
fsArea[FS_AREA_BUTTONBACKGROUND].xSize,
fsArea[FS_AREA_BUTTONBACKGROUND].ySize,
LAY_TAB_BAR2_2);
//draw the buttons
//draw MP3 button
#ifdef USE_FSGUI_TO_PLAY_CD//frank.huang add 051014 in order not to show button in CD-FSUI
if(cd_type_loaded==CDDA)
return;
#endif
if (pFsJpeg->gifsMP3Count)
{
if (pFsJpeg->ControlArea == CNT_AREA_MP3BUTTON)
iBtnState = HL_STATE;
else if (pFsJpeg->gifsFuncBtn == FS_FUNC_MP3)
iBtnState = DOWN_STATE;
else
iBtnState = UP_STATE;
FSGUI_DrawOneButton(FS_FUNC_MP3,iBtnState);
}
else
{
FSGUI_DrawOneButton(FS_FUNC_MP3, UP_STATE);
}
//draw JPEG button
if (pFsJpeg->gifsJPEGCount)
{
if (pFsJpeg->ControlArea == CNT_AREA_JPEGBUTTON)
iBtnState = HL_STATE;
else if (pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG)
iBtnState = DOWN_STATE;
else
iBtnState = UP_STATE;
FSGUI_DrawOneButton(FS_FUNC_JPEG, iBtnState);
}
else
{
FSGUI_DrawOneButton(FS_FUNC_JPEG, UP_STATE);
}
#if defined(SUPPORT_NESGAME)||defined(SUPPORT_SPG_GAME)
//draw GAME button
if (pFsJpeg->gifsGAMECount)
{
if (pFsJpeg->ControlArea == CNT_AREA_GAMEBUTTON)
iBtnState = HL_STATE;
else if (pFsJpeg->gifsFuncBtn == FS_FUNC_GAME)
iBtnState = DOWN_STATE;
else
iBtnState = UP_STATE;
FSGUI_DrawOneButton(FS_FUNC_GAME, iBtnState);
}
else
{
FSGUI_DrawOneButton(FS_FUNC_GAME, UP_STATE);
}
#endif//#ifdef SUPPORT_NESGAME
#ifdef SUPPORT_FILE_SYSTEM_MODE
//draw video button
if (pFsJpeg->gifsOtherCount)
{
if (pFsJpeg->ControlArea == CNT_AREA_OTHERBUTTON)
iBtnState = HL_STATE;
else if (pFsJpeg->gifsFuncBtn == FS_FUNC_OTHER)
iBtnState = DOWN_STATE;
else
iBtnState = UP_STATE;
FSGUI_DrawOneButton(FS_FUNC_OTHER,iBtnState);
}
else
{
FSGUI_DrawOneButton(FS_FUNC_OTHER, UP_STATE);
}
#endif
FSGUI_ShowBtnTitle();
#ifdef DISP_REGION_BOTTOM
//if define OSD_BMP_DISPLAY, Jpeg Thumnail state display should show in top,
//and quit Thumbnail state,display should show in bottom,so note jpeg mode here.
if (pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG)
pFsJpeg->g_nJpegMode = JPEG_NORMAL_MODE;
#endif
}//end DrawButton
/*
* Description:
* draw the bmp defined in g_aBitLayout[] according to the index.
*
* INPUT:
* LayoutIndex --> index of g_aBitMapLayout[]
*
*/
void FSGUI_LayoutBmp(UINT8 LayoutIndex)
{
const BITMAP_LAYOUT* pLayout = &g_aBitmapLayout[LayoutIndex];
//only draw bmp no need repeat
if ((pLayout->uiXRepeat != 0)
||(pLayout->uiYRepeat != 0))
return;
FrameBuf_DrawBmp(pLayout->uiXPos, pLayout->uiYPos,
g_aBitmap[pLayout->uiIndex],
g_aPalette[pLayout->uiPalette]);
}
/*
* Description:
* draw the bmp defined in g_aBitmapLayout[] according to the index.
*
* NOTE:
* the postion of the bmp is not fixed ,it can be variable.
*
* INPUT:
* xStart --> the bmp x position
* yStart ---> the bmp y position
* LayoutIndex --> index of g_aBitmapLayout[]
*
*/
void FSGUI_LayPosVariableBmp(UINT16 xStart, UINT16 yStart,UINT8 LayoutIndex)
{
const BITMAP_LAYOUT* pLayout = &g_aBitmapLayout[LayoutIndex];
//only draw bmp no need repeat
if ((pLayout->uiXRepeat != 0)
||(pLayout->uiYRepeat != 0))
return;
//the position of the bmp is fixed ,can not draw with this function.
if ((pLayout->uiXPos != 0) || (pLayout->uiYPos != 0))
return;
FrameBuf_DrawBmp(xStart, yStart,
g_aBitmap[pLayout->uiIndex],
g_aPalette[pLayout->uiPalette]);
}
/*
* Description:
* Draw a background by repeating the same bmp in Framebuf
* NOTE:
* the bmp is a bmp of Line generally,this only for a line,which width is 1 piexl
*
* INPUT:
* xStart --> the background x start position
* yStart --> the background y start position
* xRepeat --> bmp repeat times in x axis
* yRepeat --> bmp repreat times in y axis
* LayoutIndex --> index of g_aBitMapLayout[]
* Creator: zhaoyanhua
* Date: 2004-6-3 10:07
* Update: suqiaoli 2004-6-8
* Update: yltseng 2004-6-23
*/
void FSGUI_DrawBackGround(UINT16 xStart, UINT16 yStart, UINT16 xRepeat, UINT16 yRepeat,UINT8 LayoutIndex)
{
const BITMAP_LAYOUT* pLayout = &g_aBitmapLayout[LayoutIndex];
const UINT8 *bmp = g_aBitmap[pLayout->uiIndex];
const YCrCb_COLOR *Palette = g_aPalette[pLayout->uiPalette];
int i = 0;
int j = 0;
int k = 0;
const BYTE *pBmp = bmp + 3;
int iBmpWidth = bmp[0];
int iBmpHeigth = bmp[1];
UINT32 uiYBase = SDRAM_BASE + 1024 * REF0_LUMA + xStart;
UINT32 uiCBase = SDRAM_BASE + 1024 * REF0_CHROMA + 2 * ( xStart >> 1 );
//wanghaoying 2005-9-28 19:08 moved here.
#ifdef GPS_MP3_UI
if(xRepeat<=1)//frank.huang 050922 add for when(xREPEAT==1) show BackGround
{
const YCrCb_COLOR *pPalette = g_aPalette[pLayout->uiPalette];
UINT16 uiCurX;
UINT16 uiCurY;
printf("uiWidth=%d\n",iBmpWidth);
printf("xRepeat=%d\n",xRepeat);
for (j = 0, uiCurY = yStart; j < yRepeat; j++, uiCurY += iBmpHeigth )
{
for (i = 0, uiCurX = xStart; i < xRepeat; i++, uiCurX += iBmpWidth )
{
FrameBuf_DrawBmp( uiCurX, uiCurY, bmp,pPalette);
}
}
}
else
#endif
{
for (j = 0; j < iBmpHeigth; j++)
{
BYTE* pY = (BYTE*) ( uiYBase + OFFSET_Y( yStart + j ) );
UINT16* pC = (UINT16*) ( uiCBase + OFFSET_C( (yStart + j) >> 1 ) );
//draw pixel start from x axis
for (i = 0; i < iBmpWidth; i++)
{
int ColorIndex = *pBmp++;
if (ColorIndex == 0) //index 0 is transparent
continue;
YCrCb_COLOR PixelValue = *(Palette+ColorIndex);
pY[i] = PixelValue.uiY;
pC[i>>1] = PixelValue.uiCrCb;
}
//one bmp in x axis has been drawn.
//Its data has been saved in pY[], and pC[]
//so we can draw the other same bmp(repeat) with the same pY,pCrcb
BYTE* pNextY = pY;
for( k = 1; k < xRepeat; k++ )
{
pNextY += iBmpWidth;
UINT16* pNextC = pC + ( ( iBmpWidth * k ) >> 1 );
for( i = 0; i < iBmpWidth; i++ )
{
pNextY[i] = pY[i];
pNextC[i>>1] = pC[i>>1];
}
}
}
}
/*
int i = 0;
int j = 0;
const BITMAP_LAYOUT* pLayout = &g_aBitmapLayout[LayoutIndex];
const UINT8 *pBmp = g_aBitmap[pLayout->uiIndex];
const YCrCb_COLOR *pPalette = g_aPalette[pLayout->uiPalette];
UINT8 uiWidth = pBmp[0];
UINT8 uiHeight = pBmp[1];
UINT16 uiCurX;
UINT16 uiCurY;
for (j = 0, uiCurY = yStart; j < yRepeat; j++, uiCurY += uiHeight )
{
for (i = 0, uiCurX = xStart; i < xRepeat; i++, uiCurX += uiWidth )
{
FrameBuf_DrawBmp( uiCurX, uiCurY, pBmp,pPalette);
}
}
*/
}
/*
* Description:
* draw one button according its type.
*
* INPUT:
* type ---> FS_FUNC_MP3 NOTE: different type has different button icon.
* FS_FUNC_JPEG
* FS_FUNC_GAME
* FS_FUNC_OTHERS
* state --> HL_STATE //HL in this button
* DOWN_STATE //now playing the type file
* UP_STATE //has no HL and no playing file
*
*Creater:feeling
*
*Date:2004-06-08
*/
void FSGUI_DrawOneButton(BYTE type, BYTE state)
{
#ifdef GPS_MP3_UI//frank.huang 050927
return;//don't show button in gps_mp3 ui
#endif
const BITMAP_LAYOUT* pBgLayout;
UINT8 uiBgIndex = 0, uiIcnIndex = 0, uiBgYPos = 0;
UINT16 uiBgXPos = 0;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -