Beispiel #1
0
static void
calib_widget_paint(paint_event_t* event)
{
  calib_screen_t* s = widget_get_instance_data(event->widget);
  const point_t* marker_pos;

  if (!s->calib_complete) {
    marker_pos = &ref_pts[s->ref_pt_idx];

    if (s->sample_idx == 0)
      gfx_set_fg_color(YELLOW);
    else if (s->sample_idx < NUM_SAMPLES_PER_POINT)
      gfx_set_fg_color(RED);
    else
      gfx_set_fg_color(GREEN);
  }
  else {
    marker_pos = &s->last_touch_pos;
    gfx_set_fg_color(COBALT);
  }
  rect_t r = {
      marker_pos->x - (MARKER_SIZE / 2),
      marker_pos->y - (MARKER_SIZE / 2),
      MARKER_SIZE,
      MARKER_SIZE};
  gfx_fill_rect(r);
}
Beispiel #2
0
static void con_draw1()
{
    // save old values first.
    void *old = gfx_select_font(gfx_font_small);
    
//#if defined(FW_D13_020) || defined(FW_S13_020)
//#else 
//    // slow?
//    {
//        static int cnt = 0 ;
//        cnt++ ;
//        if( cnt % 16 == 0 ) {
//            gfx_set_fg_color(bgcolor); 
//            gfx_blockfill(0,0,159,109);
//        }
//    }
//#endif
    
    // erase bottom stripe.
    gfx_set_fg_color(bgcolor); 
    gfx_blockfill(0, MAX_Y-10, MAX_X, MAX_Y); 
    // erase left 1 pixels
    gfx_blockfill(0, 0, LEFT_POS-1, MAX_Y); 
    
    
    gfx_set_fg_color(fgcolor);
    gfx_set_bg_color(bgcolor); 

    for(int y=0;y<Y_SIZE;y++) {
        char *p = con_buf[y];
        wchar_t *w = wide ;
        wchar_t *we = wide + MAX_BUF -1 ;
        char *sp2 = small ;
        for(int x=0;x<MAX_XPOS;x++) {
            if( *p == 0 ) {
                char c = ' ' ;
                *w++ = c ;         
                *sp2++ = c ;
            } else {
                char c = *p++ ;
                *w++ = c ;         
                *sp2++ = c ;
            }
            if( w >= we ) {
                break ;
            }
        }
        *w = 0 ;
        *sp2 = 0;
        gfx_drawtext7(small, LEFT_POS, y * LINE_HEIGHT);
    }

    gfx_select_font(old);    
}
Beispiel #3
0
static void
icon_paint(paint_event_t* event)
{
  icon_t* i = widget_get_instance_data(event->widget);

  rect_t rect = widget_get_rect(event->widget);
  point_t center = rect_center(rect);

  if (!widget_is_enabled(event->widget)) {
    gfx_set_bg_color(DARK_GRAY);
    gfx_clear_rect(rect);
  }

  /* draw icon */
  if (i->image != NULL) {
    gfx_set_fg_color(i->icon_color);
    gfx_draw_bitmap(
        center.x - (i->image->width / 2),
        center.y - (i->image->height / 2),
        i->image);
  }
}