嵌入式linux------SDL移植(am335x下显示bmp图片)
2015-07-28 15:51
946 查看
#include<stdio.h> #include "/usr/local/ffmpeg_arm/include/SDL/SDL.h" char *bmp_name[3] = {"000.bmp","111.bmp","222.bmp"}; int main() { int i=0; //The images SDL_Surface* hello = NULL; SDL_Surface* screen = NULL; //Start SDL SDL_Init( SDL_INIT_EVERYTHING );
SDL_ShowCursor(0);
//Set up screen screen = SDL_SetVideoMode( 1024, 768, 32, SDL_SWSURFACE ); while(30) { //Load image hello = SDL_LoadBMP( bmp_name[i++%3]); //Apply image to screen SDL_BlitSurface( hello, NULL, screen, NULL ); //Update Screen SDL_Flip( screen ); //Pause SDL_Delay( 1000*2 ); } //Free the loaded image SDL_FreeSurface( hello ); //Quit SDL SDL_Quit(); return 0; }
编译命令:arm-linux-gcc bmp.c -o bmp -lpthread libSDL.a
参考:MFC下用sdl 显示bmp、rgb、yuv http://blog.csdn.net/mao0514/article/details/10007873
如果要显示jpg图片
SDL_image库的使用
SDL默认只支持bmp格式的图片显示,而大多数情况下,我们需要显示jpeg,png格式图片,这时候我们需要使用SDL扩展库。在开发前应先确认SDL_image库是否已编译安装成功。
首先需要先下载SDL_image,可以从SDL的官网获取最新版本。你也可以从其中的“Libraries”章节下载这个库,就在SDL的主页上。如果你不想为此麻烦,在本文件夹内已有SDL_image-1.2.10.tar.tar,只需按照《SDL编译移植文档》安装即可。
在程序中使用SDL_ttf库,必须使用如下头文件,注意SDL是大写
#include<SDL_image.h>
Linux应用程序链接时要也要链接这个库的-lSDL_image。
相关文章推荐
- 嵌入式linux------SDL移植(am335x下显示bmp图片)
- 嵌入式linux------SDL移植(am335x下显示bmp图片)
- 嵌入式linux------SDL移植(am335x下显示bmp图片) 分类: TI-AM335X ffmpeg-SDL-VLC-Live555 2015-07-28 15:51 131人阅读 评论(0) 收藏
- linux 无敌权限
- CentOS7.1配置远程桌面
- 监控 Linux 系统的 7 个命令行工具
- 如何关闭与查询Linux里边的selinux ?
- Linux里如何查找文件内容
- linux命令行解压缩小工具
- linux 安装protobuf2.5
- Linux C语言程序设计(九)——gdb调试
- Linux最大打开文件描述符数
- Linux C语言程序设计(八)——树的基本概念介绍
- Linux 学习笔记
- linux grep用法大全
- linux vmalloc和kmalloc
- 第一章--linux基础
- Linux find命令详解
- 设置linux主机名
- kali linux 1.1 入门