Embedded Linux------SDL porting (BMP images shown under am335x)

Source: Internet
Author: User

#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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.