读书人

3520a SDL_tff库干bmp 也就是osd

发布时间: 2013-01-26 13:47:02 作者: rapoo

3520a SDL_tff库做bmp 也就是osd

之前用点陈字库做过3515,3520a的字库,现在为新需求,要用矢量字库做osd。决定用SDL_tff库做。

配置freetype:

xy@xy-pc:~/aaa/freetype-2.4.10$ CC=arm-hisiv200-linux-gcc ./configure --prefix=/home/xy/aaa/bin --host=arm-linux

编译安装:make ,make install。

配置SDL:

xy@xy-pc:~/aaa/SDL-1.2.15$ CC=arm-hisiv200-linux-gcc CXX=arm-hisiv200-linux-cpp ./configure --prefix=/home/xy/aaa/bin --host=arm-linux --disable-alsa --disable-pulseaudio

编译安装。


配置SDL_tff:

xy@xy-pc:~/aaa/SDL_ttf-2.0.11$CC=arm-hisiv200-linux-gcc ./configure --with-freetype-prefix=/home/xy/aaa/bin --host=arm-linux

编译安装.


    /* Convert to 16 bits per pixel */    SDL_Surface *temp = SDL_CreateRGBSurface(SDL_SWSURFACE,    text->w, text->h, 16,\    0x00FF0000, 0x0000FF00, 0x000000FF,/*0x00FF0000, 0x0000FF00, 0x000000FF*/    0);    SDL_Rect bounds;    if (temp != NULL)    {    bounds.x = 0;    bounds.y = 0;    bounds.w = text->w;    bounds.h = text->h;    if (SDL_LowerBlit(text, &bounds, temp, &bounds) < 0) {    SDL_FreeSurface(text);    SDL_SetError("Couldn't convert image to 16 bpp");    text = NULL;    }    }    stBitmap.u32Width = temp->w;    stBitmap.u32Height = temp->h;    stBitmap.pData=temp->pixels;    stBitmap.enPixelFormat= PIXEL_FORMAT_RGB_1555 ;    SDL_FreeSurface(text);    SDL_FreeSurface(temp);

添加以上代码,基本就可以达到了。

因为自己的不细心,调试了大半天。真是不应该啊。其实早知道这样做,但是思维上总是背道而驰。

以后编程应该更细心,至少节省时间啊。。。。

读书人网 >操作系统

热点推荐