Exemplo n.º 1
0
void recovery_usb_transition_cb(
  LIBAROMA_CANVASP dst,
  LIBAROMA_CANVASP bottom,
  LIBAROMA_CANVASP top,
  float state,
  LIBAROMA_RECTP r1,
  LIBAROMA_RECTP r2
){
  if (r2){
    r1=r2;
    LIBAROMA_CANVASP top2 = top;
    top = bottom;
    bottom=top2;
    state=1-state;
  }
  if (!r1){
    return;
  }
  state=libaroma_motion_fluid(state);
  libaroma_canvas_fillcolor(dst,
    libaroma_colorget(NULL,libaroma_wm_get_active_window())->window_bg
  );
  int y1 = r1->y * (1-state);
  int y3 = r1->y+r1->h;
  int y4 = ((dst->h - y3) * state) + y3;
  int y2 = y4 - y1;
  byte vopa=255-(220*state);
  libaroma_draw_ex(
    dst, bottom,
    0, 0, 
    0, r1->y-y1,
    dst->w, y3,
    0,
    vopa
  );
  libaroma_draw_ex(
    dst, bottom,
    0, y4,
    0, y3,
    dst->w, dst->h-y4,
    0,
    vopa
  );
  float statef = state;
  if (statef>1){
    statef=1;
  }
  libaroma_draw_ex(
    dst, top,
    0, y1, 0, 0, dst->w, y2,
    0, 255 * statef
  );
  
}
Exemplo n.º 2
0
/*
 * Function    : libaroma_control_erasebg
 * Return Value: byte
 * Descriptions: erase control background
 */
byte libaroma_control_erasebg(
  LIBAROMA_CONTROLP ctl,
  LIBAROMA_CANVASP canvas
){
  if (ctl==NULL){
    ALOGW("window_control_erasebg ctl is null");
    return 0;
  }
  if (ctl->window==NULL){
    ALOGW("window_control_erasebg ctl doesn't have window");
    return 0;
  }
  LIBAROMA_WINDOWP win = ctl->window;
  if (win->handler!=NULL){
    if (win->handler->control_erasebg!=NULL){
      return win->handler->control_erasebg(
        win, ctl, canvas
      );
    }
  }
  if (win->bg==NULL){
    ALOGW("window_control_erasebg window bg uninitialized");
    return 0;
  }
  libaroma_draw_ex(
    canvas,
    win->bg,
    0, 0, ctl->x, ctl->y, ctl->w, ctl->h,
    0, 0xff
  );
  return 1;
} /* End of libaroma_control_erasebg */
Exemplo n.º 3
0
/*
 * Function    : _libaroma_ctl_pager_direct_canvas
 * Return Value: byte
 * Descriptions: set as direct canvas
 */
byte _libaroma_ctl_pager_direct_canvas(LIBAROMA_CONTROLP ctl, byte state){
  _LIBAROMA_CTL_CHECK(
    _libaroma_ctl_pager_handler, _LIBAROMA_CTL_PAGERP, 0
  );
  //libaroma_mutex_lock(me->mutex);
  int xt = me->scroll_x; // me->page_position * ctl->w;
  if (state){
    if (!me->on_direct_canvas){
      me->on_direct_canvas=1;
    }
  }
  else{
    if (me->on_direct_canvas){
      LIBAROMA_CANVASP ccv = libaroma_control_draw_begin(ctl);
      if (ccv) {
        // libaroma_draw_ex(me->win->dc,ccv,0,0,xt,0,ccv->w,ccv->h,0,0xff);
        libaroma_draw_ex(me->win->dc,ccv,xt,0,0,0,ccv->w,ccv->h,0,0xff);
        libaroma_canvas_free(ccv);
      }
      me->on_direct_canvas=0;
    }
  }
  //libaroma_mutex_unlock(me->mutex);
  return 1;
} /* End of _libaroma_ctl_pager_direct_canvas */
Exemplo n.º 4
0
/* statusbar */
void recovery_statusbar_update(){
  word bgcolor = libaroma_alpha(
    _recovery.status_bgcolor,
    0,51+recovery_statusbar_side_opa
  );
  byte isdark = libaroma_color_isdark(bgcolor);
  word text_color = isdark?0xffff:0;
  
  libaroma_canvas_fillcolor(
    _recovery.status_canvas,
    bgcolor
  );
  
  if (recovery_statusbar_side_w){
    if (recovery_statusbar_overlay_canvas){
      libaroma_draw_rect(
        _recovery.status_canvas,
        0, 0, recovery_statusbar_side_w, _recovery.status_canvas->h,
        0, 0xff
      );
      libaroma_draw_ex(
        _recovery.status_canvas,
        recovery_statusbar_overlay_canvas,
        0, 0,
        recovery_statusbar_overlay_canvas->w-recovery_statusbar_side_w, 0,
        recovery_statusbar_side_w, recovery_statusbar_overlay_canvas->h,
        0, 0xcc
      );
    }
    else{
      libaroma_draw_rect(
        _recovery.status_canvas,
        0, 0, recovery_statusbar_side_w, _recovery.status_canvas->h,
        RGB(cccccc), 0xff
      );
    }
  }
    
  libaroma_draw_text(
    _recovery.status_canvas,
    "AROMA Recovery",
    0,0,text_color,_recovery.status_canvas->w,
    LIBAROMA_FONT(0,3)|
    LIBAROMA_TEXT_SINGLELINE|
    LIBAROMA_TEXT_CENTER,
    140
  );
  libaroma_wm_updatesync(0,0,0,0,1);
}
Exemplo n.º 5
0
/*
 * Function    : libaroma_window_anishow
 * Return Value: byte
 * Descriptions: show window - animated
 */
byte libaroma_window_anishow(
    LIBAROMA_WINDOWP win,
    byte animation,
    int duration){
  __CHECK_WM(0);
  if (!win){
    return 0;
  }
  if (win->parent!=NULL){
    ALOGW("Child window cannot shown directly...");
    return 0;
  }
  
  /* set initial focus
    libaroma_window_setfocus(win, NULL);
  */
  
  if ((!animation)||(duration<50)){
    return libaroma_wm_set_active_window(win);
  }
  
  /* lock and retval */
  byte retval = 0;
  win->lock_sync = 1;
  
  if (libaroma_wm_set_active_window(win)){
    win->active=2;
    
    /* draw window into temp canvas */
    LIBAROMA_CANVASP wmc = win->dc;
    LIBAROMA_CANVASP tdc = libaroma_canvas(wmc->w,wmc->h);
    libaroma_draw(tdc,wmc,0,0,0);
    win->dc=tdc; /* switch dc */
    
    LIBAROMA_CANVASP back = libaroma_canvas(wmc->w, wmc->h);
    libaroma_draw(back,wmc,0,0,0);
    
    /* invalidate now */
    libaroma_window_invalidate(win, 10);
    
    long start = libaroma_tick();
    int delta = 0;
    while ((delta=libaroma_tick()-start)<duration){
      float state = ((float) delta)/((float) duration);
      if (state>=1.0){
        break;
      }
      switch (animation){
        case LIBAROMA_WINDOW_SHOW_ANIMATION_SLIDE_LEFT:
        case LIBAROMA_WINDOW_SHOW_ANIMATION_PAGE_LEFT:
          {
            float swift_out_state = libaroma_cubic_bezier_swiftout(state);
            int x = win->w - (swift_out_state * win->w);
            int w = win->w - x;
            if (w>0){
              if (animation==LIBAROMA_WINDOW_SHOW_ANIMATION_SLIDE_LEFT){
                if (w<win->w){
                  libaroma_draw_ex(
                    wmc,
                    back,
                    0, 0, win->w - (win->w - w), 0, win->w - w, win->h,
                    0, 0xff
                  );
                }
              }
              libaroma_draw_ex(
                wmc,
                win->dc,
                x, 0, 0, 0, w, win->h,
                0, 0xff
              );
              if (animation==LIBAROMA_WINDOW_SHOW_ANIMATION_SLIDE_LEFT){
                libaroma_wm_sync(win->x,win->y,win->w,win->h);
              }
              else{
                libaroma_wm_sync(win->x+x,win->y,w, win->h);
              }
            }
          }
          break;
        case LIBAROMA_WINDOW_SHOW_ANIMATION_SLIDE_RIGHT:
        case LIBAROMA_WINDOW_SHOW_ANIMATION_PAGE_RIGHT:
          {
            float swift_out_state = libaroma_cubic_bezier_swiftout(state);
            int x = 0 - (win->w - (swift_out_state * win->w));
            int w = win->w + x;
            if (w>0){
              if (animation==LIBAROMA_WINDOW_SHOW_ANIMATION_SLIDE_RIGHT){
                if (w<win->w){
                  libaroma_draw_ex(
                    wmc,
                    back,
                    w, 0, 0, 0, win->w - w, win->h,
                    0, 0xff
                  );
                }
              }
              libaroma_draw_ex(
                wmc,
                win->dc,
                0, 0, win->w-w, 0, w, win->h,
                0, 0xff
              );
              if (animation==LIBAROMA_WINDOW_SHOW_ANIMATION_SLIDE_RIGHT){
                libaroma_wm_sync(win->x,win->y,win->w,win->h);
              }
              else{
                libaroma_wm_sync(win->x,win->y,w, win->h);
              }
            }
          }
          break;
        default:
          /* invalid animation */
          start=0;
          break;
      }
    }
    
    retval = 1;
    libaroma_draw(wmc,win->dc,0,0,0);
              
    win->dc=wmc; /* switch dc back */
  
    /* cleanup */
    libaroma_canvas_free(back);
    libaroma_canvas_free(tdc);
  }
  
  win->lock_sync = 0;
  
  /* sync view now */
  if (retval){
    win->active=1;
    libaroma_window_sync(win, 0, 0, win->w, win->h);
  }
  
  /* send activate */
  LIBAROMA_MSG _msg;
  libaroma_window_process_event(win,libaroma_wm_compose(
    &_msg, LIBAROMA_MSG_WIN_ACTIVE, NULL, 10, 0)
  );
  
  return retval;
} /* End of libaroma_window_show */