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

📄 mv_skindlg.h

📁 在MTK平台上开放的一个皮肤工具,可以支持jpg、bmp、png图片
💻 H
字号:
// mv_skinDlg.h : header file
//

#if !defined(AFX_MV_SKINDLG_H__6C23560B_7B2F_4B3B_BF9C_5E1DB6851D6A__INCLUDED_)
#define AFX_MV_SKINDLG_H__6C23560B_7B2F_4B3B_BF9C_5E1DB6851D6A__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


#define SAVE_PATH_LENGTH			255

typedef enum
{
	LCD_SIZE_QVGA,//240*320
	LCD_SIZE_WQVGA,//240*400
	LCD_SIZE_TOTAL
}mv_lcd_size_t;

typedef enum
{		
	IMG_ID_MVPLY_AUDIO_BG,//MV_AUDIO_BG.gif
	/* OSD layer */
	IMG_ID_MVPLY_OSD_INFO_PANNEL,//top_info_pannel.gif
	IMG_ID_MVPLY_OSD_CNTL_PANNEL,//bottom_control_pannel.gif
	IMG_ID_MVPLY_OSD_TITLE_BG,//mv_title_bg.gif
	IMG_ID_MVPLY_OSD_CUR_TIME_BG,//mv_cur_time_bg.gif
	IMG_ID_MVPLY_OSD_BAR_BG,//mv_bar_bg.gif
	IMG_ID_MVPLY_OSD_BAR_ACTIVE,//mv_bar_active_bg.gif
	IMG_ID_MVPLY_OSD_BAR_RIGHT,//mv_bar_r_element.gif
	IMG_ID_MVPLY_OSD_CENTER_BG,//MV_text_bg.gif
	
	/* control pics, all have 3 types: normal, pressed and disabled */
	IMG_ID_MVPLY_OSD_CNTL_BRIGHTNESS,//mv_brightness.gif
	IMG_ID_MVPLY_OSD_CNTL_BRIGHTNESS_P,//
	IMG_ID_MVPLY_OSD_CNTL_BRIGHTNESS_G,//
	IMG_ID_MVPLY_OSD_CNTL_CONTRAST,//mv_contrast.gif
	IMG_ID_MVPLY_OSD_CNTL_CONTRAST_P,
	IMG_ID_MVPLY_OSD_CNTL_CON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_G,
	
	IMG_ID_MVPLY_END
} IMAGEID_LIST_MVPLY;

typedef enum
{
	BMP_FILE=0x01,
	GIF_FILE=0x03,
	PNG_FILE=0x13,
	TOTAL_FILE
}file_type_t;

typedef enum
{
	NORMAL_STATE=0,
	PRESS_STATE,
	DISABLE_STATE,
	TOTAL_STATE
}mv_button_state_t;

typedef struct
{
	unsigned short index;
	unsigned short x;
	unsigned short y;
	unsigned short width;
	unsigned short height;
}mv_img_size_t;

#pragma pack(push) //保存对齐状态

#pragma pack(1)//设定为1字节对齐

typedef struct
{
	unsigned short	bf_type;// 位图文件的类型,必须为BMP(0-1字节)
	unsigned long	bf_size;// 位图文件的大小,以字节为单位(2-5字节)
	unsigned short	bf_reserved1;// 位图文件保留字,必须为0(6-7字节)
	unsigned short	bf_reserved2; // 位图文件保留字,必须为0(8-9字节)
	unsigned long	bf_offbits; // 位图数据的起始位置,以相对于位图(10-13字节)
}bmp_file_header_t;

typedef struct
{
	unsigned long	bi_size; // 本结构所占用字节数(14-17字节)
	unsigned long	bi_width;// 位图的宽度,以像素为单位(18-21字节)
	unsigned long	bi_height;// 位图的高度,以像素为单位(22-25字节)
	unsigned short	bi_planes;// 目标设备的级别,必须为1(26-27字节)
	unsigned short	bi_bitcount;// 每个像素所需的位数,必须是1(双色),(28-29字节)
								// 4(16色),8(256色)或24(真彩色)之一
	unsigned long	bi_compression; // 位图压缩类型,必须是 0(不压缩),(30-33字节)
									// 1(BI_RLE8压缩类型)或2(BI_RLE4压缩类型)之一
	unsigned long	bi_sizeimage;// 位图的大小,以字节为单位(34-37字节)
	unsigned long	bi_xpelspermeter;// 位图水平分辨率,每米像素数(38-41字节)
	unsigned long	bi_ypelspermeter;// 位图垂直分辨率,每米像素数(42-45字节)
	unsigned long	bi_clrused;// 位图实际使用的颜色表中的颜色数(46-49字节)
	unsigned long	bi_clrimportant;// 位图显示过程中重要的颜色数(50-53字节)
}bmp_info_header_t;

typedef struct
{
	unsigned char	gf_type_g;// 必须为G
	unsigned char	gf_type_i;// 必须为I
	unsigned char	gf_type_f;// 必须为F
	//gif当前使用的版本号"87a" "89a" or new version
	unsigned char	gf_ver_str1;
	unsigned char	gf_ver_str2;
	unsigned char	gf_ver_str3;

	unsigned short	gf_width;// gif文件的宽度,以像素为单位(6-7字节)
	unsigned short	gf_height;// gif文件的高度,以像素为单位(8-9字节)
}gif_file_header_t;

typedef struct
{
	unsigned char	pf_area0;// 必须为0x89
	unsigned char	pf_area1;// 必须为P(0x50)
	unsigned char	pf_area2;// 必须为N(0x4e)
	unsigned char	pf_area3;// 必须为G(0x47)
	unsigned char	pf_area4;// 必须为0x0d
	unsigned char	pf_area5;// 必须为0x0a
	unsigned char	pf_area6;// 必须为0x1a
	unsigned char	pf_area7;// 必须为0x0a

	unsigned long	pf_h_len;
	unsigned short	pf_width;// png文件的宽度,以像素为单位
	unsigned short	pf_height;// png文件的高度,以像素为单位
}png_file_header_t;

#pragma pack(pop)//恢复对齐状态

/*
颜色表中rgb_color_table_t结构数据的个数有bi_bitcount来确定:
当biBitCount=1,4,8时,分别有2,16,256个表项;
当biBitCount=24时,没有颜色表项。
*/
typedef struct//color table
{
	char rgb_blue;// 蓝色的亮度(值范围为0-255)
	char rgb_green; // 绿色的亮度(值范围为0-255)
	char rgb_red; // 红色的亮度(值范围为0-255)
	char rgb_reserved;// 保留,必须为0
} rgb_color_table_t;

typedef struct
{
	int				file_type;
	unsigned short	width;
	unsigned short	height;
	char			name[SAVE_PATH_LENGTH+1];
}file_attr_t;

/////////////////////////////////////////////////////////////////////////////
// CMv_skinDlg dialog

class CMv_skinDlg : public CDialog
{
// Construction
public:

	int lcd_size;//0: QVGA 1:WQVGA
	int show_skin_flag;//0:not show skin,show logo 1:show skin, other :not show
	int button_state;
	char m_dir_path[SAVE_PATH_LENGTH];
	char m_default_path[SAVE_PATH_LENGTH];
	file_attr_t m_file_attr[IMG_ID_MVPLY_END];

	unsigned long img_offset[IMG_ID_MVPLY_END];
	
	void process_button(int edit_index, int img_index);
	void set_update_area(void);
	int select_paths(char *p_path);
	void file_ext_convert_down(char *p_des, const char *p_src);
	void file_ext_convert_up(char *p_des, const char *p_src);
	BOOL select_file(char *p_path, char *p_file_name, int img_index, int *img_w, int *img_h, int *type);
	BOOL bmp_file_parse( FILE *p_file, int img_index ,int *img_w, int *img_h );
	BOOL gif_file_parse(FILE *p_file, int img_index,int *img_w, int *img_h );
	BOOL png_file_parse(FILE *p_file, int img_index,int *img_w, int *img_h );

	BOOL show_jpg_gif(CPaintDC    *dc,CString file_path, int x, int y, int w, int h);
	BOOL draw_img(int img_index);

	CMv_skinDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CMv_skinDlg)
	enum { IDD = IDD_MV_SKIN_DIALOG };
		// NOTE: the ClassWizard will add data members here
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMv_skinDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CMv_skinDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnRadioQvga();
	afx_msg void OnRadioWqvga();
	afx_msg void OnButtonSelectPictureDir();
	afx_msg void OnButtonSelectAudioPic();
	afx_msg void OnButtonSelectTitlePic();
	afx_msg void OnButtonSelectControlPic();
	afx_msg void OnButtonSelectTitleBgPic();
	afx_msg void OnButtonSelectTimeBgPic();
	afx_msg void OnButtonSelectProgressPic();
	afx_msg void OnButtonSelectProgrssPic();
	afx_msg void OnButtonSelectTextBgPic();
	afx_msg void OnButtonSelectBrightnessNormalPic();
	afx_msg void OnButtonSelectBrightnessPressPic();
	afx_msg void OnButtonSelectBrightnessDisablePic();
	afx_msg void OnButtonSelectContrastNormalPic();
	afx_msg void OnButtonSelectContrastPressPic();
	afx_msg void OnButtonSelectContrastDisablePic();
	afx_msg void OnButtonSelectPlayNormalPic();
	afx_msg void OnButtonSelectPlayPressPic();
	afx_msg void OnButtonSelectPlayDisablePic();
	afx_msg void OnButtonSelectPauseNormalPic();
	afx_msg void OnButtonSelectPausePressPic();
	afx_msg void OnButtonSelectPauseDisablePic();
	afx_msg void OnButtonSelectStopNormalPic();
	afx_msg void OnButtonSelectStopPressPic();
	afx_msg void OnButtonSelectStopDisablePic();
	afx_msg void OnButtonSelectPreviousNormalPic();
	afx_msg void OnButtonSelectPreviousPressPic();
	afx_msg void OnButtonSelectPreviousDisablePic();
	afx_msg void OnButtonSelectNextNormalPic();
	afx_msg void OnButtonSelectNextPressPic();
	afx_msg void OnButtonSelectNextDisablePic();
	afx_msg void OnButtonSelectZoomNormalPic();
	afx_msg void OnButtonSelectZoomPressPic();
	afx_msg void OnButtonSelectZoomDisablePic();
	afx_msg void OnButtonSelectAudionIconNormalPic();
	afx_msg void OnButtonSelectAudionIconPressPic();
	afx_msg void OnButtonSelectAudionIconDisablePic();
	afx_msg void OnButtonSelectMuteIconNormalPic();
	afx_msg void OnButtonSelectMuteIconPressPic();
	afx_msg void OnButtonSelectMuteIconDisablePic();
	afx_msg void OnButtonSelectTextInfoNormalPic();
	afx_msg void OnButtonSelectTextInfoPressPic();
	afx_msg void OnButtonSelectTextInfoDisablePic();
	afx_msg void OnButtonCreateSkin();
	afx_msg void OnButtonSelectRightProgrssPic();
	afx_msg void OnButtonMinimize();
	afx_msg void OnButtonSelectBookmarkNormalPic();
	afx_msg void OnButtonSelectBookmarkPressPic();
	afx_msg void OnButtonSelectBookmarkDisablePic();
	afx_msg void OnButtonPreview();
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	//}}AFX_MSG
	afx_msg LRESULT OnMvSkinMaxmizeMsg(WPARAM wParam,LPARAM lParam);
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MV_SKINDLG_H__6C23560B_7B2F_4B3B_BF9C_5E1DB6851D6A__INCLUDED_)

⌨️ 快捷键说明

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