psplash进度条旋转成功

     pspfalsh是一个嵌入式中显示开机进度的开源软件,http://wiki.openmoko.org/wiki/Splash_screen可以看到相关的一些内容,看了一下,大概是什么进行开机界面设置的一个程序,好像不止一个,分什么Splash screen、U-boot Splash 、psplash 、X splash等,看样子是用在不同的阶段吧,这里只需搞定psplash就可以了。
  psplash开机画面的大概修改过程如下:
  先准备一个png图片文件,
      make-image-header.sh my_image.png HAND
      进行处理,
      mv my_image-img.h psplash-hand-img.h
      修改名字,
      然后configure,然后make,有效,开机画面被成功修改为所准备的png图片。

因为屏的方向与通常的不一致,且旋转参数修改无效,开机画面可以重新绘制,但进度条的方向非得自己改代码了。

首先通常运行时总出现一条横贯左右的白条,经查,该函数作怪,

/* Clear */

  /*psplash_fb_draw_rect (fb,
   0,
   fb->height - (fb->height/6) - h,
   fb->width,
   h,
   0xec, 0xec, 0xe1);*/

删后该问题解决。

 关于进度条,先删了一个进度条的外框函数,感觉没什么用,删后效果还好,该函数为:

/* Draw progress bar border */
  /*psplash_fb_draw_image (fb,
    (fb->width  - BAR_IMG_WIDTH)/2,
    fb->height - (fb->height/10),
    BAR_IMG_WIDTH,
    BAR_IMG_HEIGHT,
    BAR_IMG_BYTES_PER_PIXEL,
    BAR_IMG_RLE_PIXEL_DATA);*/

查看psplash.c里边有关于进度条的函数,

psplash_draw_progress (PSplashFB *fb, int value)
{
  int x, y, width, height, barwidth;

  /* 4 pix border */
  x      = ((fb->width  - BAR_IMG_WIDTH)/2) + 4 ;
  y      = fb->height - (fb->height/6) + 4;
  width  = BAR_IMG_WIDTH - 8;
  height = BAR_IMG_HEIGHT - 8;

  if (value > 0)
    {
      barwidth = (CLAMP(value,0,100) * width) / 100;
      psplash_fb_draw_rect (fb, x + barwidth, y,
       width - barwidth, height,
   0xec, 0xec, 0xe1);
      psplash_fb_draw_rect (fb, x, y, barwidth,
       height, 0x6d, 0x6d, 0x70);
    }
  else
    {
      barwidth = (CLAMP(-value,0,100) * width) / 100;
      psplash_fb_draw_rect (fb, x, y,
       width - barwidth, height,
   0xec, 0xec, 0xe1);
      psplash_fb_draw_rect (fb, x + width - barwidth,
       y, barwidth, height,
       0x6d, 0x6d, 0x70);
    }

  DBG("value: %i, width: %i, barwidth :%i/n", value,
  width, barwidth);
}

看了一下,也就是画方框,之后根据进度画着了色的进度框,改代码如下:

void
psplash_draw_progress (PSplashFB *fb, int value)
{
  int x, y, width, height, barhight;

   x      = 100;
   y      = ((fb->height  - BAR_IMG_WIDTH)/2) + 4;

 width  =BAR_IMG_HEIGHT - 16;//width  = BAR_IMG_WIDTH - 8;
 // height = BAR_IMG_HEIGHT - 8;
  height = BAR_IMG_WIDTH - 8;//height = BAR_IMG_HEIGHT - 16;


  if (value > 0)
    {
      //barwidth = (CLAMP(value,0,100) * width) / 100;
      barhight = (CLAMP(value,0,100) * height ) / 100;
      psplash_fb_draw_rect (fb, x , y+ barhight,//psplash_fb_draw_rect (fb, x + barwidth, y,
       width , height- barhight,//width - barwidth, height,
   0xec, 0xec, 0xe1);
      psplash_fb_draw_rect (fb, x, y, width,
       barhight, 0x6d, 0x6d, 0x70);
    }
  else
    {
      barhight = (CLAMP(-value,0,100) *  height) / 100;
      psplash_fb_draw_rect (fb, x, y,
       width, height- barhight,
   0xec, 0xec, 0xe1);
      psplash_fb_draw_rect (fb, x,
       y, width, barhight,
       0x6d, 0x6d, 0x70);
    }

  DBG("value: %i, width: %i, barhight :%i/n", value,
  width, barhight);
}

改后一试,ok,效果还不错。

 

 

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值