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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.