DOS下顯示JPG/JPEG圖像文件
使用 eCGUI 0.3 for DOS-16bit (Borland C)
可以從 http://www.ecgui.com/bbs 下載。
/*
Jpeg - JPG圖像顯示,及桌面背景的更換
Website:www.ecgui.com
E-mail:[email protected]
*/
#include "gui.h" /* GUI 的頭文件 */
void MyJPG(HAND hd,MESSAGE msg)
{
if(msg.type == GM_SYSTEM) /* 判斷消息類型,消息類型全部爲大寫 */
switch(msg.message) /* 判斷消息 */
{
case GM_Draw:
{
HDC hdc;
IMAGE img;/* Image 圖像結構 */
hdc=efGDI->Start(msg.pHOST);/* 獲得 HDC 繪圖句柄,開始繪圖 */
img.filename="logo.jpg"; /* 圖像文件名 */
img.type=IMAGE_TYPE_JPG;/* 文件類型*/
img.hdc=hdc;/* 繪圖句柄 */
efImage->Load(&img);/* 初步讀圖像信息 */
efImage->Show(&img,0,0);/* 顯示圖像 */
efGDI->End(msg.pHOST,hdc); /* 釋放 HDC 繪圖句柄 */
}
return;
default:break;
}
}
void imgjpg_init(void); /*函數聲明: 註冊JPEG圖像函數支持*/
HDC StartDesktopDraw(void); /* 函數聲明:獲得 桌面 HDC 繪圖句柄,開始繪圖 */
void EndDesktopDraw(HDC); /*函數聲明: 釋放桌面 HDC 繪圖句柄 */
int gmain(void *data) /* GUI程序 的入口函數 */
{
imgjpg_init();/* *註冊JPEG圖像函數支持*/
{
HDC hdc;/* HDC 繪圖句柄 */
IMAGE img; /* Image 圖像結構 */
hdc=StartDesktopDraw();/* 獲得 桌面 HDC 繪圖句柄,開始繪圖 */
img.filename="alizee.jpg"; /* 圖像文件名 */
img.type=IMAGE_TYPE_JPG; /* 文件類型*/
img.hdc=hdc; /* 繪圖句柄 */
efImage->Load(&img); /* 初步讀圖信息 */
efImage->Show(&img,0,0); /* 顯示圖像 */
EndDesktopDraw(hdc); /* 釋放桌面 HDC 繪圖句柄 */
}
/* 創建一個主窗口 */
CreatObject(0,MAINWINDOW,1,1,"JEPG Picture - Power by eCGUI-www.ecgui.com",5,10,510,570,MyJPG,data);
return True;
}
/* ************** End of file **************** */
;編譯
bcc -mh jpeg.c lib/gui.lib lib/libjpeg.lib
;最好再使用upx.exe 壓縮一下,在開發包的_up 目錄中有upx.exe
_up/upx -5 jpeg.exe
運行結果
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window';}" οnmοuseοver="if(this.resized) this.style.cursor='hand';" οnclick="if(this.resized) {window.open(this.src);}" border="0" width="716">
eCGUI-微型嵌入式GUI/ DOS/Linux/uC/OS-II/等 圖形界面開發
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window';}" οnmοuseοver="if(this.resized) this.style.cursor='hand';" οnclick="if(this.resized) {window.open(this.src);}" border="0">www.ecgui.com
可以從 http://www.ecgui.com/bbs 下載。
/*
Jpeg - JPG圖像顯示,及桌面背景的更換
Website:www.ecgui.com
E-mail:[email protected]
*/
#include "gui.h" /* GUI 的頭文件 */
void MyJPG(HAND hd,MESSAGE msg)
{
if(msg.type == GM_SYSTEM) /* 判斷消息類型,消息類型全部爲大寫 */
switch(msg.message) /* 判斷消息 */
{
case GM_Draw:
{
HDC hdc;
IMAGE img;/* Image 圖像結構 */
hdc=efGDI->Start(msg.pHOST);/* 獲得 HDC 繪圖句柄,開始繪圖 */
img.filename="logo.jpg"; /* 圖像文件名 */
img.type=IMAGE_TYPE_JPG;/* 文件類型*/
img.hdc=hdc;/* 繪圖句柄 */
efImage->Load(&img);/* 初步讀圖像信息 */
efImage->Show(&img,0,0);/* 顯示圖像 */
efGDI->End(msg.pHOST,hdc); /* 釋放 HDC 繪圖句柄 */
}
return;
default:break;
}
}
void imgjpg_init(void); /*函數聲明: 註冊JPEG圖像函數支持*/
HDC StartDesktopDraw(void); /* 函數聲明:獲得 桌面 HDC 繪圖句柄,開始繪圖 */
void EndDesktopDraw(HDC); /*函數聲明: 釋放桌面 HDC 繪圖句柄 */
int gmain(void *data) /* GUI程序 的入口函數 */
{
imgjpg_init();/* *註冊JPEG圖像函數支持*/
{
HDC hdc;/* HDC 繪圖句柄 */
IMAGE img; /* Image 圖像結構 */
hdc=StartDesktopDraw();/* 獲得 桌面 HDC 繪圖句柄,開始繪圖 */
img.filename="alizee.jpg"; /* 圖像文件名 */
img.type=IMAGE_TYPE_JPG; /* 文件類型*/
img.hdc=hdc; /* 繪圖句柄 */
efImage->Load(&img); /* 初步讀圖信息 */
efImage->Show(&img,0,0); /* 顯示圖像 */
EndDesktopDraw(hdc); /* 釋放桌面 HDC 繪圖句柄 */
}
/* 創建一個主窗口 */
CreatObject(0,MAINWINDOW,1,1,"JEPG Picture - Power by eCGUI-www.ecgui.com",5,10,510,570,MyJPG,data);
return True;
}
/* ************** End of file **************** */
;編譯
bcc -mh jpeg.c lib/gui.lib lib/libjpeg.lib
;最好再使用upx.exe 壓縮一下,在開發包的_up 目錄中有upx.exe
_up/upx -5 jpeg.exe
運行結果
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window';}" οnmοuseοver="if(this.resized) this.style.cursor='hand';" οnclick="if(this.resized) {window.open(this.src);}" border="0" width="716">
eCGUI-微型嵌入式GUI/ DOS/Linux/uC/OS-II/等 圖形界面開發
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window';}" οnmοuseοver="if(this.resized) this.style.cursor='hand';" οnclick="if(this.resized) {window.open(this.src);}" border="0">www.ecgui.com
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.