资源简介
用C语言完成的,将png格式和jpeg格式的图片显示出来,以及转化为bmp格式的功能,其中还附加了一些图片放大缩小和图片旋转的小功能
代码片段和文件信息
/*程序功能:显示jpeg,png型图片,将jpeg,png型图片转化为bmp型
编程人:李佳旭,学号:U201313809
尹力骁,学号:U201313829
*/
#include
#include
#include
#include
#include
#include “pub/osg.h“
#include “pub/system_drv.h“
#include “pub/keymap.h“
#include “pub/keyboard.h“
#include“jpeg_to_bmp.h“
#include“png_to_bmp.h“
#include“show_jpeg_picture.h“
#include“show_png_picture.h“
enum
{
MSG_PGDOWN
MSG_PGUP
MSG_KeyUP
MSG_KeyDOWN
MSG_KeyLEFT
MSG_KeyRIGHT
MSG_KeyTAB
MSG_KeyRETURN
MSG_KeySHIFT
};
typedef struct _T_Message
{
INT32U param0;
INT32U param1;
INT32U param2;
INT32U param3;
}T_Message;
UINT32 Test_queueID;
INT8S *File[100];
INT32U FileIndex=0;
INT8S acPath[200] acMask[200]acFile[200]soundpath[200];
//-------------------------------读取jpeg的任务------------------------------------------------------
void demoTask(void)
{
T_Message RecvMsg;
long done;
struct _finddata_t fileinfo;
int num=0;
getcwd(soundpathsizeof(soundpath));
sprintf(soundpath “%s\\sound“soundpath);
getcwd(acPath sizeof(acPath));
sprintf(acPath “%s\\picture“acPath);
sprintf(acMask “%s\\*.JPG“acPath);
done=_findfirst(acMask &fileinfo);
if(done!=-1)
{
GFMDrawRectangle(00720580 0xff2F4F4F 1);//创建画布
FNTDrawText(0xff20B2AA2450 300 fileinfo.name );
sprintf(acFile “%s/%s“ acPath fileinfo.name );//获取了文件名称
}
PlaySound(“start.wav“NULLSND_FILENAME | SND_ASYNC);//语音提示操作方法
while(1)
{
DTOS_DRV_ReceiveMessage( Test_queueID &RecvMsg);
switch(RecvMsg.param0)
{
case MSG_PGDOWN:
break;
case MSG_PGUP:
break;
case MSG_KeyUP:
break;
case MSG_KeyDOWN:
num=1;
if(done != -1)
{
if(_findnext(done &fileinfo)==0)
{
sprintf(acFile “%s/%s“ acPath fileinfo.name );//获取文件名称
}
else
{
done = _findfirst(acMask &fileinfo);
if(done != -1)
{
sprintf(acFile “%s/%s“ acPath fileinfo.name );//获取文件名称
}
}
}
show_jpeg_picture(acFile);
FNTDrawText(0xff20B2AA24400550 fileinfo.name );
break;
case MSG_KeyLEFT:
break;
case MSG_KeyRIGHT://按RIGHT健读取下一个文件
GFMDrawRectangle(00720580 0xff2F4F4F 1);
PlaySound(NULLNULLSND_FILENAME | SND_PURGE);//随时终止语音
num=0;
if(done != -1)
{
if(_findnext(done &fileinfo)==0)
{
GFMDrawRectangle(5030066924 0xff2F4F4F 1);
FNTDrawText(0xff20B2AA2450 300 fileinfo.name );
sprintf(acFile “%s/%s“ acPath fileinfo.name );//获取文件名称
}
else
{
done = _findfirst(acMask &fileinfo);
if(done != -1)
{
GFMDrawRectangle(5030066924 0xff2F4F4F 1);
FNTDrawText(0xff20B2AA2450 300 fileinfo.name );
sprintf(acFile “%s/%s“ acPath fileinfo.name );//获取文件名称
}
}
}
break;
case MSG_KeyTAB://按TAB键显示picture文件夹里的前十个图片名称
{
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-12-06 13:18 picture switch\
文件 1525 2013-01-27 03:50 picture switch\jconfig.h
文件 15227 2014-10-19 17:02 picture switch\jmorecfg.h
文件 51035 2014-10-19 17:02 picture switch\jpeglib.h
文件 5986 2014-12-04 15:01 picture switch\jpeg_to_bmp.h
目录 0 2014-12-06 13:23 picture switch\libjepg\
目录 0 2014-12-06 13:22 picture switch\libjepg\Debug\
文件 18717 2014-12-06 13:20 picture switch\libjepg\Debug\ansi2knr.obj
文件 5007 2014-12-06 13:21 picture switch\libjepg\Debug\cdjpeg.obj
文件 37786 2014-12-06 13:21 picture switch\libjepg\Debug\cjpeg.obj
文件 17099 2014-12-06 13:20 picture switch\libjepg\Debug\ckconfig.obj
文件 37577 2014-12-06 13:21 picture switch\libjepg\Debug\djpeg.obj
文件 7477 2014-12-06 13:21 picture switch\libjepg\Debug\example.obj
文件 3793 2014-12-06 13:21 picture switch\libjepg\Debug\jaricom.obj
文件 11034 2014-12-06 13:21 picture switch\libjepg\Debug\jcapimin.obj
文件 6364 2014-12-06 13:21 picture switch\libjepg\Debug\jcapistd.obj
文件 20567 2014-12-06 13:21 picture switch\libjepg\Debug\jcarith.obj
文件 11404 2014-12-06 13:21 picture switch\libjepg\Debug\jccoefct.obj
文件 16160 2014-12-06 13:21 picture switch\libjepg\Debug\jccolor.obj
文件 13098 2014-12-06 13:21 picture switch\libjepg\Debug\jcdctmgr.obj
文件 33735 2014-12-06 13:21 picture switch\libjepg\Debug\jchuff.obj
文件 4879 2014-12-06 13:21 picture switch\libjepg\Debug\jcinit.obj
文件 5970 2014-12-06 13:21 picture switch\libjepg\Debug\jcmainct.obj
文件 21722 2014-12-06 13:21 picture switch\libjepg\Debug\jcmarker.obj
文件 21950 2014-12-06 13:21 picture switch\libjepg\Debug\jcmaster.obj
文件 5727 2014-12-06 13:21 picture switch\libjepg\Debug\jcomapi.obj
文件 21231 2014-12-06 13:21 picture switch\libjepg\Debug\jcparam.obj
文件 10085 2014-12-06 13:21 picture switch\libjepg\Debug\jcprepct.obj
文件 15141 2014-12-06 13:21 picture switch\libjepg\Debug\jcsample.obj
文件 11364 2014-12-06 13:21 picture switch\libjepg\Debug\jctrans.obj
文件 12257 2014-12-06 13:21 picture switch\libjepg\Debug\jdapimin.obj
............此处省略222个文件信息
评论
共有 条评论