本来以为很容易,还是折腾了好一阵子,在此分享一下心得:
1、准备好要更换的图片
注:png、jpg格式均可
2、将图片转换成raw格式
使用linux下的ImageMagick自带的convert命令,进行raw格式转换,命令为:
convert -depth 8 initlogo.png rgb:initlogo.raw
注:ubuntu 10.04 默认已经安装ImgageMagick工具,如果当前系统没有安装,可以执行下面的命令安装:
sudo apt-get install imagemagick
3、将raw格式转换成rle格式
需要用到android编译后的rgb2565工具,在android/out/host/linux-x86/bin目录下(android为当前源码所在目录),转换命令如下:
rgb2565 -rle <initlogo.raw> initlogo.rle
到目前为止,启动需要显示的图像已经做好了,就是initlogo.rle,注意文件名必须是这个,如果想改文件名,需要修改android/system/core/init/init.h中的宏:
#define INIT_IMAGE_FILE "/initlogo.rle"
4、如果你的Android系统使用24bit显示,还需要修改android logo显示代码:
< void android_memset24(void *_ptr, unsigned short val, unsigned count)
< {
< unsigned char *ptr = (unsigned char *)_ptr;
< count >>= 1;
< while(count--) {
< *ptr++ = ((val&0x001F )<<3);//B
< *ptr++ = ((val&0x07E0 )>>3);//G
< *ptr++ = ((val&0xF800 )>>8);//R
< ptr++;//the forth byte not use
< }
< }
<
64c52
< #define fb_size(fb) ((fb)->vi.xres * (fb)->vi.yres * (fb)->vi.bits_per_pixel / 8)
---
> #define fb_size(fb) ((fb)->vi.xres * (fb)->vi.yres * 2)
149,171c137,145
<
< if(fb.vi.bits_per_pixel == 16) {
< while (count > 3) {
< unsigned n = ptr[0];
< if (n > max)
< break;
< android_memset16(bits, ptr[1], n << 1);
< bits += n;
< max -= n;
< ptr += 2;
< count -= 4;
< }
< }else{
< while (count > 3) {
< unsigned n = ptr[0];
< if (n > max)
< break;
< android_memset24(bits, ptr[1], n << 1);
< bits += n << 1;
< max -= n;
< ptr += 2;
< count -= 4;
< }
---
> while (count > 3) {
> unsigned n = ptr[0];
> if (n > max)
> break;
> android_memset16(bits, ptr[1], n << 1);
> bits += n;
> max -= n;
> ptr += 2;
> count -= 4;
178c152
< // unlink(fn); //不让它显示完后删除logo图片
---
> unlink(fn);
参考网页:
http://blog.csdn.net/xiyu_1986/article/details/6610830
http://blog.csdn.net/yicao821/article/details/7199189
http://blog.csdn.net/zhaomx/article/details/6228514
posted on 2013-08-02 17:44
lfc 阅读(1101)
评论(0) 编辑 收藏 引用