#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); Set up screens Screen = Sdl_setvideomode (1024x768, 768, +, sdl_swsurface); while (+) { //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;}
Compile command: ARM-LINUX-GCC bmp.c-o bmp-lpthread LIBSDL.A
Reference:MFC displays BMP, RGB, YUV http://blog.csdn.net/mao0514/article/details/10007873 with SDL
If you want to display a JPG picture
Sdl_image use of libraries
sdl bmp format pictures, and in most cases we need to display the Span style= "font-family: ' Times New Roman ', serif;" >jpeg,png format picture, this time we need to use the Span style= "font-family: ' Times New Roman ', serif;" >sdl extension library. Before development, you should confirm the sdl_image whether the library has been compiled and installed successfully.
you first need to downloadSdl_image, you can fromSDLwebsite for the latest version. You can also get from the "Libraries "section to download this library, right in theSDLon the home page. If you do not want to be bothered, there are already in this folderSdl_image-1.2.10.tar.tar, just follow theSDLcompile the porting document to install.
sdl_ttf library, you must use the following header file note sdl uppercase
#include <SDL_image.h>
Linux To link to this library when the application is linked -lsdl_image .
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Embedded Linux------SDL porting (BMP images shown under am335x)