Пример #1
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);    
}
Пример #2
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);
  }
}
Пример #3
0
static void
widget_paint_predicate(widget_t* w, widget_traversal_event_t event, void* data)
{
  (void)data;

  if (event == WIDGET_TRAVERSAL_BEFORE_CHILDREN) {
    gfx_ctx_push();

    if (w->bg_color != TRANSPARENT)
      gfx_set_bg_color(w->bg_color);

    if (w->needs_paint && widget_is_visible(w)) {
      paint_event_t event = {
          .id = EVT_PAINT,
          .widget = w,
      };

      gfx_clear_rect(w->rect);

      CALL_WC(w, on_paint)(&event);

      w->needs_paint = false;
    }