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

📄 res_show.c

📁 智原mp3 SDK 开发包 与巨力 有mp3 wma ogg decoder
💻 C
字号:
#include <string.h>
#include "api.h"
#include "lcd.h"
#include "key.h"
#include "common.h"
#include "res_show.h"
#include "prefer.h"


#define IMAGE_OFFSET 268224L

RES_ENTRY_T res_entry; 
extern UINT16 pixel_buf[];
extern void delay(UINT16 n);
INT8U res_buf[50];

BOOLEAN  bResShowPic(INT16U id,INT8U x,INT8U y)
{
	INT16U width,high,length;
	INT16U count;
	UINT16 pitch;	
	INT8U buf1[32];		
	
	api_bSectionFileOpen(SYS_IMAGE_FILEID);
	api_bSectionFileSeek(id * sizeof(RES_ENTRY_T)+IMAGE_OFFSET, SEEK_SET);		 
	api_u16SectionFileRead(buf1, sizeof(RES_ENTRY_T));
	res_entry.u32Offset = (INT32U)buf1[0] | ((INT32U)buf1[1]<<8) | ((INT32U)buf1[2]<<16) | ((INT32U)buf1[3]<<24); 
	api_bSectionFileSeek(res_entry.u32Offset+IMAGE_OFFSET, SEEK_SET);		
	api_u16SectionFileRead(buf1,4);		
	width = buf1[0] | (buf1[1]<<8);
	high = buf1[2] | (buf1[3]<<8);	
		
	lcd_set_disply_mode(0x00,0x22);
	
	lcd_set_rw_area(x,y,(INT8U)width,(INT8U)high);
	pitch = (UINT16)width*4;
	
	length = width * high*2;
	
	if(length<512)
	{
		api_u16SectionFileRead(pixel_buf,length);
		lcd_put_data((UINT16)pixel_buf,length);
	}
	else
	{
		count = length/512;
		while(count--)
		{
			api_u16SectionFileRead(pixel_buf,512);
			lcd_put_data((UINT16)pixel_buf,512);
		}
		pitch = length%512;
		api_u16SectionFileRead(pixel_buf,pitch);
		lcd_put_data((UINT16)pixel_buf,pitch);			
	}
	return TRUE;	
}
	

int ResShowMultiString(INT16U id, INT8U string_id, INT8U x, INT8U y)
{
	INT8U *p,AddBuf;
	INT8U StrLength,string_idtemp;	
	api_bSectionFileOpen(SYS_IMAGE_FILEID);
	api_bSectionFileSeek(id * sizeof(RES_ENTRY_T)+IMAGE_OFFSET, SEEK_SET);
	api_u16SectionFileRead(res_buf, sizeof(RES_ENTRY_T));
    	res_entry.u32Offset = (INT32U)res_buf[0] | ((INT32U)res_buf[1]<<8) | ((INT32U)res_buf[2]<<16) | ((INT32U)res_buf[3]<<24);
    	res_entry.u16Length = res_buf[4] | (res_buf[5]<<8);	
	api_bSectionFileSeek(res_entry.u32Offset+IMAGE_OFFSET, SEEK_SET);
	api_u16SectionFileRead(res_buf,50);

	//定位到 string_id
	p = res_buf;
	string_idtemp=string_id;
	
	while(string_id)
	{
		
		AddBuf=1;
		while(*p!=0)
		{
			AddBuf++;    //找到第string_id 个0
			p++;
		}
		string_id--;
		res_entry.u32Offset += AddBuf;
		api_bSectionFileSeek(res_entry.u32Offset+IMAGE_OFFSET, SEEK_SET);
		api_u16SectionFileRead(res_buf,50);
		p = res_buf;
		
	}
	
	string_id=string_idtemp;
			
	StrLength=(INT8U)strlen(p);
	
	if(x == 255)    //居中显示
	{
		if(tUserPreference.u8LanguageId==0)
			lcd_puts((128-(INT8U)strlen(p)*8)/2,y,p,FONTSIZE_HYPER);
		if(tUserPreference.u8LanguageId>4)
			lcd_puts((128-(INT8U)strlen(p)*8)/2,y,p,FONTSIZE_8x8);
		else
			lcd_puts((128-(INT8U)strlen(p)*8)/2,y,p,FONTSIZE_HYPER);								
	}
	else
	{
		if(tUserPreference.u8LanguageId==0)
			lcd_puts(x,y,p,FONTSIZE_HYPER);
		else if(tUserPreference.u8LanguageId>4)
			lcd_puts(x,y,p,FONTSIZE_8x8);			
		else
			lcd_puts(x,y,p,FONTSIZE_HYPER);
	}
	
	return 1;
}
	

⌨️ 快捷键说明

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