示例#1
0
/*
 * Function    : libaroma_draw_text_ex
 * Return Value: int
 * Descriptions: direct text directly from string - extended
 */
int libaroma_draw_text_ex(
  LIBAROMA_CANVASP dest,
  const char * text,
  int x, int y,
  word color,
  int width,
  dword txtflags,
  byte lh,
  byte isshadow,
  int radius,
  word shadow_color,
  byte shadow_opacity,
  int shadow_x,
  int shadow_y
) {
  LIBAROMA_TEXT txt = libaroma_text(
    text,
    color,
    width,
    txtflags,
    lh
  );
  if (!txt){
    return 0;
  }
  if (!libaroma_text_draw_ex(
    dest,
    txt,
    x,
    y,
    0,
    0,
    0,
    isshadow,
    radius,
    shadow_color,
    shadow_opacity,
    shadow_x,
    shadow_y
  )){
    libaroma_text_free(txt);
    return 0;
  }
  int txth=libaroma_text_height(txt);
  libaroma_text_free(txt);
  return txth;
} /* End of libaroma_draw_text_ex */
示例#2
0
LIBAROMA_CONTROLP libaroma_control_label(
  LIBAROMA_WINDOWP win, word id, char * text,
  int x, int y, int w, int h
){
  _LIBAROMA_CONTROL_LABELP me = (_LIBAROMA_CONTROL_LABELP)
    calloc(sizeof(_LIBAROMA_CONTROL_LABEL),1);
  if (!me){
    ALOGW("libaroma_control_label alloc label memory failed");
    return NULL;
  }
  me->text = strdup(text);
  me->textp = libaroma_text(
    me->text,
    libaroma_wm_get_color("control_text"),
    w - libaroma_dp(8),
    LIBAROMA_FONT(0,4)|LIBAROMA_TEXT_SINGLELINE,
    100
  );
  
  LIBAROMA_CONTROLP ctl =
    libaroma_control_new(
      id,
      x, y, w, h,
      libaroma_dp(28),libaroma_dp(32), /* min size */
      me,
      &_libaroma_control_label_handler,
      win
    );
  
  if (!ctl){
    if (me->text){
      free(me->text);
    }
    if (me->textp){
      libaroma_text_free(me->textp);
    }
    free(me);
  }
  return ctl;
}