示例#1
0
static void menu_draw_row_callback(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *data) {
  GRect bounds = layer_get_bounds(cell_layer);
  GPoint p = GPoint(bounds.size.w - 15, (bounds.size.h / 2));
  switch (cell_index->row) {
    case 0:
      menu_cell_basic_draw(ctx, cell_layer, "2k steps/day", NULL, NULL);
    break;
    case 1:
      menu_cell_basic_draw(ctx, cell_layer, "4k steps/day", NULL, NULL);
    break;
    case 2:
      menu_cell_basic_draw(ctx, cell_layer, "6k steps/day", NULL, NULL);
    break;
    case 3:
      menu_cell_basic_draw(ctx, cell_layer, "8k steps/day", NULL, NULL);
    break;
    case 4:
      menu_cell_basic_draw(ctx, cell_layer, "10k steps/day", NULL, NULL);
    break;
    case 5:
      menu_cell_basic_draw(ctx, cell_layer, "15k steps/day", NULL, NULL);
    break;
    case 6:
      menu_cell_basic_draw(ctx, cell_layer, "20k steps/day", NULL, NULL);
    break;
  }

  graphics_context_set_stroke_color(ctx, GColorBlack);
  graphics_context_set_fill_color(ctx, GColorFolly);

  if (menu_cell_layer_is_highlighted(cell_layer)) {
    graphics_context_set_stroke_color(ctx, GColorWhite);
  }
  graphics_draw_circle(ctx, p, 7);

  if (cell_index->row == getStepGoal()) {
    graphics_fill_circle(ctx, p, 5);
  }
}
示例#2
0
/*
 * Battery icon callback handler
 */
void battery_layer_update_callback(Layer *layer, GContext *ctx) {
  
  graphics_context_set_compositing_mode(ctx, GCompOpAssign);

  if (battery_status.state == 1 && battery_status.level > 0 && battery_status.level <= 100) {
    graphics_draw_bitmap_in_rect(ctx, &icon_battery.bmp, GRect(0, 0, 24, 12));
    graphics_context_set_stroke_color(ctx, GColorBlack);
    graphics_context_set_fill_color(ctx, GColorWhite);
    graphics_fill_rect(ctx, GRect(7, 4, (uint8_t)((battery_status.level / 100.0) * 11.0), 4), 0, GCornerNone);
  } else if (battery_status.state == 2 || battery_status.state == 3) {
    graphics_draw_bitmap_in_rect(ctx, &icon_battery_charge.bmp, GRect(0, 0, 24, 12));
  }
}
static void progress_bar_layer_update(ProgressBarLayer *bar, GContext *ctx) {
  ProgressData *data = (ProgressData *)layer_get_data(bar);

  // Outline the progress bar
  graphics_context_set_stroke_color(ctx, GColorBlack);
  GRect bounds = layer_get_bounds(bar);
  graphics_draw_round_rect(ctx, GRect(0, 0, bounds.size.w, bounds.size.h), 4);

  // Fill the progress bar
  graphics_context_set_fill_color(ctx, GColorBlack);
  graphics_fill_rect(ctx, GRect(0, 0, data->progress, bounds.size.h), 4, GCornersAll);
  ++data->progress;
}
示例#4
0
/*
 * Battery icon callback handler
 */
void battery_layer_update_callback(Layer *layer, GContext *ctx) {

  graphics_context_set_compositing_mode(ctx, GCompOpAssign);

  if (!battery_plugged) {
    graphics_draw_bitmap_in_rect(ctx, icon_battery, GRect(0, 0, 24, 12));
    graphics_context_set_stroke_color(ctx, GColorBlack);
    graphics_context_set_fill_color(ctx, GColorWhite);
    graphics_fill_rect(ctx, GRect(7, 4, (uint8_t)((battery_level / 100.0) * 11.0), 4), 0, GCornerNone);
  } else {
    graphics_draw_bitmap_in_rect(ctx, icon_battery_charge, GRect(0, 0, 24, 12));
  }
}
示例#5
0
static void hexagon_update_proc( Layer *layer, GContext *context ){
    struct _hexagon_layer_data *layer_data = hexagon_get_layer_data(layer);
        
    graphics_context_set_fill_color(context, layer_data->color);
    gpath_draw_filled(context, layer_data->path);
    
    if( layer_data->border_path ){
        graphics_context_set_stroke_color(context, layer_data->border_color);
        graphics_context_set_stroke_width(context,(uint8_t)layer_data->border_width);
        gpath_draw_outline(context, layer_data->border_path);
    }
    
}
示例#6
0
void status_layer_update_callback(Layer *layer, GContext* ctx) {
  // Fill the background:
  graphics_context_set_fill_color(ctx, GColorBlack);  
  graphics_fill_rect(ctx, GRect(0, 0, BOX_WIDTH, BOX_HEIGHT), 2, GCornersAll);
    
  // Status
  graphics_context_set_fill_color(ctx, GColorBlack);  
  graphics_context_set_stroke_color(ctx, GColorWhite);  
  graphics_context_set_text_color(ctx, GColorWhite);
  graphics_draw_round_rect(ctx, layer_get_bounds(layer), 2);
  graphics_draw_text(ctx, statusbuffer, fonts_get_system_font(FONT_KEY_ROBOTO_CONDENSED_21), 
                    GRect(4, 0, 120, 40), GTextOverflowModeWordWrap, GTextAlignmentLeft, NULL);
}
static void platform_update_proc(Layer *layer, GContext *ctx) {
  // Could change this later for platform movement OR could make a new func with gpath_move_to()
  
  GRect bounds = layer_get_bounds(layer);
  GPoint center = grect_center_point(&bounds);
  
  graphics_context_set_fill_color(ctx, GColorBlack);
  graphics_context_set_stroke_color(ctx, GColorWhite);
  
  gpath_draw_filled(ctx, platform_path);
  gpath_draw_outline(ctx, platform_path);
  
}
void path_layer_update_callback(Layer *me, GContext *ctx) {
    (void)me;

    graphics_context_set_stroke_color(ctx, GColorBlack);

    GPoint p0, p1;

    if (nb_points < 2) {
        return;
    }

    for (int i = 0; i < ((nb_points > NUM_POINTS ? NUM_POINTS : nb_points) - 1); i++) {
        p0 = pts[(NUM_POINTS+cur_point-i) % NUM_POINTS];
        p1 = pts[(NUM_POINTS+cur_point-i-1) % NUM_POINTS];

        p0.x = (XINI + (p0.x * SCREEN_W / (map_scale/10))) % MAP_VSIZE_X;
        p0.y = (YINI - (p0.y * SCREEN_W / (map_scale/10))) % MAP_VSIZE_Y;
        p1.x = (XINI + (p1.x * SCREEN_W / (map_scale/10))) % MAP_VSIZE_X;
        p1.y = (YINI - (p1.y * SCREEN_W / (map_scale/10))) % MAP_VSIZE_Y;

        graphics_draw_line(
            ctx,
            p0,
            p1
        );
    }

    for (int i = 0; i < s_live.nb; i++) {
        p0.x = (XINI + (s_live.friends[i].xpos * SCREEN_W / (map_scale/10))) % MAP_VSIZE_X;
        p0.y = (YINI - (s_live.friends[i].ypos * SCREEN_W / (map_scale/10))) % MAP_VSIZE_Y;

        graphics_draw_pixel(ctx, p0);
        graphics_draw_circle(ctx, p0, 3);

        if (i == 0) {
#if DEBUG
            snprintf(s_data.debug2, sizeof(s_data.debug2),
                     "%d|%d\n"
                     "%d|%d\n"
                     "%d|%d\n"
                     "%d|%d\n",
                     s_live.friends[i].xpos,s_live.friends[i].ypos,
                     p0.x,p0.y,
                     pathFrame.origin.x,pathFrame.origin.y,
                     s_live.friends[i].name_frame.origin.x,s_live.friends[i].name_frame.origin.y
                    );
#endif
        }
    }

}
示例#9
0
文件: game.c 项目: phmagic/snakey
static void game_layer_update_proc(Layer *layer, GContext *ctx)
{
    // Draw the apple
    graphics_context_set_stroke_color(ctx, GColorBlack);
    graphics_draw_circle(ctx, GPoint(apple->x,apple->y), APPLE_SIZE);

    // Draw the snake
    snake_section_t *current_section = snake->head;
    while (current_section) {
        graphics_context_set_fill_color(ctx, GColorBlack);
        graphics_fill_circle(ctx, GPoint(current_section->x,current_section->y), SNAKE_BODY_WIDTH);
        current_section = current_section->next;
    }
}
示例#10
0
static void battery_update_proc(Layer *layer, GContext *ctx) {
  static BatteryChargeState c_state;
  c_state = battery_state_service_peek();
  
  graphics_context_set_stroke_color(ctx, c_state.is_charging ? GColorWhite : GColorBlack);
  graphics_draw_rect(ctx, GRect(0,0,15,15));
  
  graphics_context_set_stroke_color(ctx, GColorWhite);
  graphics_context_set_fill_color(ctx, GColorWhite);

  switch(c_state.charge_percent/10){
    case 10: graphics_fill_rect(ctx, GRect(1,1,13,13), 0, GCornerNone); break;
    case 9: graphics_draw_rect(ctx, GRect(2,10,3,3));
    case 8: graphics_draw_rect(ctx, GRect(6,10,3,3));
    case 7: graphics_draw_rect(ctx, GRect(2,6,3,3));
    case 6: graphics_draw_rect(ctx, GRect(10,10,3,3));
    case 5: graphics_draw_rect(ctx, GRect(2,2,3,3));
    case 4: graphics_draw_rect(ctx, GRect(6,6,3,3));
    case 3: graphics_draw_rect(ctx, GRect(10,6,3,3));
    case 2: graphics_draw_rect(ctx, GRect(6,2,3,3));
    case 1: graphics_draw_rect(ctx, GRect(10,2,3,3));
  }
}
示例#11
0
void dim_layer_update_proc(DimLayer* dim_layer, GContext *ctx)
{
    DimLayerData* data = layer_get_data(dim_layer);
    GRect bounds = layer_get_bounds(dim_layer);
    
    graphics_context_set_stroke_color(ctx, (data->dim_mode == DimModeBright ? GColorWhite : GColorBlack));
    for (register int16_t y = bounds.origin.y; y < bounds.origin.y + bounds.size.h; y++)
    {
        for (register int16_t x = bounds.origin.x + y % 2; x < bounds.origin.x + bounds.size.w; x += 2)
        {
            graphics_draw_pixel(ctx, GPoint(x, y));
        }
    }
}
示例#12
0
static void draw_background_and_borders(Layer *layer, GContext *ctx) {
  GRect bounds = layer_get_bounds(layer);
  if (get_element_data(layer)->black) {
    graphics_context_set_fill_color(ctx, element_bg(layer));
    graphics_fill_rect(ctx, GRect(0, 0, bounds.size.w, bounds.size.h), 0, GCornerNone);
  }
  graphics_context_set_stroke_color(ctx, element_fg(layer));
  if (get_element_data(layer)->bottom) {
    graphics_draw_line(ctx, GPoint(0, bounds.size.h - 1), GPoint(bounds.size.w - 1, bounds.size.h - 1));
  }
  if (get_element_data(layer)->right) {
    graphics_draw_line(ctx, GPoint(bounds.size.w - 1, 0), GPoint(bounds.size.w - 1, bounds.size.h - 1));
  }
}
示例#13
0
void line_layer_update_callback(Layer *me, GContext* ctx) {
    (void)me;
    
    graphics_context_set_stroke_color(ctx, GColorWhite);
    
    graphics_draw_line(ctx, GPoint(6, 79), GPoint(52, 79));
    graphics_draw_line(ctx, GPoint(6, 80), GPoint(52, 80));
    graphics_draw_line(ctx, GPoint(92, 79), GPoint(144-6, 79));
    graphics_draw_line(ctx, GPoint(92, 80), GPoint(144-6, 80));
    
    //graphics_draw_line(ctx, GPoint(6, 79), GPoint(144-6, 79));
    //raphics_draw_line(ctx, GPoint(6, 80), GPoint(144-6, 80));
    
}
示例#14
0
// Layer representing the background
void canvas_update_proc(Layer *layer, GContext *ctx) {
  graphics_context_set_stroke_color(ctx, GColorMidnightGreen);
  graphics_context_set_fill_color(ctx, GColorDarkGreen);  
  GRect rect_bounds = GRect(0, 120, 180, 180);
  graphics_draw_rect(ctx, rect_bounds);
  graphics_fill_rect(ctx, rect_bounds, 10, GCornersAll);
  APP_LOG(APP_LOG_LEVEL_INFO, conditions_buffer);
  
  Weather weather = current_weather();
  
  if (weather == CLOUDY) {

  }
}
示例#15
0
static void update_proc(Layer *layer, GContext *ctx)
{
	graphics_context_set_stroke_color(ctx, GColorWhite);
	graphics_context_set_fill_color(ctx, GColorWhite);

	draw_digit(layer, ctx, 0, 2, now->tm_hour / 10);
	draw_digit(layer, ctx, 1, 4, now->tm_hour % 10);
	draw_digit(layer, ctx, 2, 3, now->tm_min  / 10);
	draw_digit(layer, ctx, 3, 4, now->tm_min  % 10);
#ifdef SHOW_SECONDS
	draw_digit(layer, ctx, 4, 3, now->tm_sec  / 10);
	draw_digit(layer, ctx, 5, 4, now->tm_sec  % 10);
#endif
}
void circle_proc(Layer *layer, GContext *ctx){
    graphics_context_set_stroke_color(ctx, GColorBlack);
    graphics_context_set_fill_color(ctx, GColorBlack);
    int i;
    for(i = 0; i < 4; i++){
        int fix = 17+(30*i);
        graphics_draw_circle(ctx, GPoint(fix, CIRCLE_HEIGHT), CIRCLE_RADIUS);
    }
    int k;
    for(k = 0; k < circles_filled; k++){
        int fix = 17+(30*k);
        graphics_fill_circle(ctx, GPoint(fix, CIRCLE_HEIGHT), CIRCLE_RADIUS);
    }
}
示例#17
0
文件: tippy2.c 项目: Med116/tippy
// This is the layer update callback which is called on render updates
static void path_layer_update_callback(Layer *me, GContext *ctx) {
  (void)me;

     GRect bounds = layer_get_bounds(me);

    // Draw a black filled rectangle with sharp corners
    //gpath_draw_outline(ctx, bounds);
    graphics_context_set_stroke_color(ctx, GColorBlack);
    graphics_draw_rect(ctx, bounds);

    //graphics_context_set_fill_color(ctx, GColorWhite);
    //gpath_draw_filled(ctx, current_path);
  
}
示例#18
0
/*
 * Icon bar update handler
 */
EXTFN void icon_bar_update_callback(Layer *layer, GContext *ctx) {

  int running_horizontal = ICON_BAR_WIDTH;

  graphics_context_set_fill_color(ctx, BACKGROUND_COLOR);
  graphics_fill_rect(ctx, layer_get_bounds(layer), 0, GCornerNone);

  graphics_context_set_fill_color(ctx, GColorWhite);
  graphics_context_set_stroke_color(ctx, GColorBlack);

#ifdef PBL_COLOR
  graphics_context_set_compositing_mode(ctx, GCompOpSet);
#endif

  // Don't draw if we're currently doing
  if (!is_animation_complete())
    return;

  // Battery icon (always showing)
  battery_layer_update_callback(layer, ctx, &running_horizontal);
  running_horizontal += ICON_PAD_BATTERY;

  // Comms icon / Bluetooth icon
  if (icon_state[IS_COMMS] || icon_state[IS_BLUETOOTH]) {
    paint_icon(ctx, &running_horizontal, 9, icon_state[IS_COMMS] ? RESOURCE_ID_COMMS_ICON : RESOURCE_ID_BLUETOOTH_ICON,
               icon_state[IS_COMMS] ? BMP_CACHE_COMMS_ICON : BMP_CACHE_BLUETOOTH_ICON);
  }
  
  // Record icon
  if (icon_state[IS_RECORD]) {
    paint_icon(ctx, &running_horizontal, 10, RESOURCE_ID_ICON_RECORD, BMP_CACHE_ICON_RECORD);
  }

  // Alarm icon
  if (icon_state[IS_ALARM_RING] || icon_state[IS_ALARM]) {
    paint_icon(ctx, &running_horizontal, 12, icon_state[IS_ALARM_RING] ? RESOURCE_ID_ALARM_RING_ICON : RESOURCE_ID_ALARM_ICON,
              icon_state[IS_ALARM_RING] ? BMP_CACHE_ALARM_RING_ICON : BMP_CACHE_ALARM_ICON);
  }

  // Ignore icon
  if (icon_state[IS_IGNORE]) {
    paint_icon(ctx, &running_horizontal, 9, RESOURCE_ID_IGNORE, BMP_CACHE_IGNORE );
  }

  // Export icon
  if (icon_state[IS_EXPORT]) {
    paint_icon(ctx, &running_horizontal, 9, RESOURCE_ID_EXPORT, BMP_CACHE_EXPORT);
  }

}
/*
 * Draws linear gradient using graphics_draw_pixel() + draws info about used method.
 */
static void update_proc_draw_pixel(Layer *layer, GContext *ctx) {
  // determines gray value per row,
  // calculates dithered pixel color per pixel, and
  // uses graphics_draw_pixel for each pixel to draw the actual color

  for (int16_t y = 0; y < s_window_size.h; y++) {
    const uint8_t row_gray = gray_for_row(y);
    for (int16_t x = 0; x < s_window_size.w; x++) {
      graphics_context_set_stroke_color(ctx, color_for_gray(x, y, row_gray));
      graphics_draw_pixel(ctx, GPoint(x, y));
    }
  }
  draw_method_feedback(ctx, "draw_pixel");
}
示例#20
0
static void battery_proc(Layer *layer, GContext *ctx) {
    // Emulator battery meter on Aplite
    graphics_context_set_stroke_color(ctx, GColorWhite);
    graphics_draw_rect(ctx, GRect(126, 4, 14, 8));
    graphics_draw_line(ctx, GPoint(140, 6), GPoint(140, 9));

    BatteryChargeState state = battery_state_service_peek();
    int width = (int)(float)(((float)state.charge_percent / 100.0F) * 10.0F);
    graphics_context_set_fill_color(ctx, GColorWhite);
    graphics_fill_rect(ctx, GRect(128, 6, width, 4), 0, GCornerNone);
    
    graphics_draw_text(ctx, VERSION, fonts_get_system_font(FONT_KEY_GOTHIC_09), GRect(4, 2, 70, 25), 
                       GTextOverflowModeFill, GTextAlignmentLeft, NULL);
}
示例#21
0
static void dow_update_proc(Layer *layer, GContext *ctx) {
  PblTm t;
   get_time(&t);

  graphics_context_set_fill_color(ctx, GColorWhite);
  graphics_context_set_stroke_color(ctx, GColorBlack);

	int days = (t.tm_wday ? t.tm_wday - 1 : 6) % 7;
	
  int x = (int)(20.5 * days);

	graphics_fill_rect(ctx, GRect(x, 65, 18, 5), 3, GCornersAll );

}
示例#22
0
void battery_layer_update_callback(Layer *layer, GContext* ctx) {
  BatteryChargeState battery = battery_state_service_peek();
  graphics_context_set_stroke_color(ctx, FG_COLOR);
  gpath_draw_outline(ctx, battery_path);
  int width = battery.charge_percent * 10 / 100;
  #ifdef PBL_BW
  graphics_context_set_fill_color(ctx, FG_COLOR);
  #else
  graphics_context_set_fill_color(ctx, battery.is_plugged ? (width < 3 ? GColorRed : GColorGreen) : FG_COLOR);
  #endif
  graphics_fill_rect(ctx, GRect(9, 2, width, 5), 0, GCornerNone);  
  if (battery.is_plugged)
    gpath_draw_outline_open(ctx, charge_path);
}
示例#23
0
void hands_layer_update_callback(Layer *layer, GContext* ctx) {
#if SCREENSHOT
  now->tm_hour = 10;
  now->tm_min = 9;
  now->tm_sec = 36;
#endif
  update_angles();
  
  // hours and minutes
  gpath_rotate_to(hour_path, hour_angle);
  gpath_rotate_to(min_path, min_angle);
  graphics_context_set_fill_color(ctx, FG_COLOR);
  graphics_context_set_stroke_color(ctx, BG_COLOR);
  gpath_draw_filled(ctx, hour_path);
  gpath_draw_outline(ctx, hour_path);
  graphics_fill_circle(ctx, hour_pos, DOTS_SIZE+3);
  gpath_draw_filled(ctx, min_path);
  gpath_draw_outline(ctx, min_path);
  graphics_fill_circle(ctx, min_pos, DOTS_SIZE+3);

  // seconds
  if (!hide_seconds) {
    GPoint sec_end = GPoint(
      sec_pos.x + SEC_RADIUS * sin_lookup(sec_angle) / ONE,
      sec_pos.y - SEC_RADIUS * cos_lookup(sec_angle) / ONE);
    graphics_context_set_fill_color(ctx, BG_COLOR);
    gpath_rotate_to(sec_path, sec_angle);
    gpath_draw_filled(ctx, sec_path);
    graphics_context_set_stroke_color(ctx, FG_COLOR);
    graphics_context_set_compositing_mode(ctx, GCompOpAssignInverted);
    graphics_draw_line(ctx, sec_pos, sec_end);
  }

  // center dot
  graphics_context_set_fill_color(ctx, BG_COLOR);
  graphics_fill_circle(ctx, min_pos, DOTS_SIZE);
}
示例#24
0
static void draw_header_callback(GContext *ctx, const Layer *cell_layer, uint16_t section_index, void *callback_context) {
  GRect bounds = layer_get_bounds(cell_layer);
  graphics_context_set_text_color(ctx, GColorBlack);
  graphics_context_set_stroke_color(ctx, COLOR_FALLBACK(GColorLightGray, GColorBlack));
  int lowerY = bounds.origin.y + bounds.size.h - 1;
  graphics_draw_line(ctx, GPoint(0, bounds.origin.y), GPoint(bounds.size.w, bounds.origin.y));
  graphics_draw_line(ctx, GPoint(0, lowerY), GPoint(bounds.size.w, lowerY));
  graphics_draw_text(ctx,
      stationName,
      fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD),
      GRect(0, -2, bounds.size.w, 18),
      GTextOverflowModeTrailingEllipsis,
      GTextAlignmentCenter,
      NULL);
}
示例#25
0
static void draw_box(Layer *layer, GContext *ctx, GColor border_color, GColor back_color, GColor text_color, char *text) {
  GRect bounds = layer_get_bounds(layer);
  graphics_context_set_fill_color(ctx, back_color);
  graphics_fill_rect(ctx, layer_get_bounds(layer), PBL_IF_RECT_ELSE(8, 0), GCornersAll);
  IF_3(graphics_context_set_stroke_width(ctx, 3)); 
  graphics_context_set_stroke_color(ctx, border_color);
  graphics_draw_round_rect(ctx, layer_get_bounds(layer), PBL_IF_RECT_ELSE(8, 0));
  graphics_context_set_text_color(ctx, text_color);
  GSize text_size = graphics_text_layout_get_content_size(text, s_res_gothic_18_bold, 
                                                          GRect(5, 5, bounds.size.w-10, bounds.size.h-2), 
                                                          GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter);
  graphics_draw_text(ctx, text, s_res_gothic_18_bold, 
                     GRect(5, ((bounds.size.h-text_size.h)/2)-4, bounds.size.w-10, text_size.h), 
                     GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL);
}
示例#26
0
void battery_layer_update(Layer *me, GContext *ctx) 
{
  int8_t spacer  = 7; // pixels
  int8_t start_x = spacer * MAX_DOTS;
  
  graphics_context_set_fill_color(ctx, GColorWhite);
  graphics_context_set_stroke_color(ctx, GColorWhite);
  for (int i=0; i<MAX_DOTS; i++) {
    if (i<dots) {
      graphics_fill_circle(ctx, GPoint(start_x-(i*spacer), 4), 2);
    } else {
      graphics_draw_circle(ctx, GPoint(start_x-(i*spacer), 4), 2);
    }
  } 
}
示例#27
0
文件: cgl.c 项目: joliva/solar
void cgl_draw_marker(CircGaugeLayer *cgl, GContext *ctx) {
	GPoint outer;

	graphics_context_set_stroke_color(ctx, GColorWhite);
	graphics_context_set_fill_color(ctx, GColorWhite);

	int32_t angle = (TRIG_MAX_ANGLE * cgl->value)/60;
	int32_t c_ang = -cos_lookup(angle);
	int32_t s_ang = sin_lookup(angle);

	outer.y = c_ang*(cgl->outRadius)/TRIG_MAX_RATIO + cgl->center.y;
	outer.x = s_ang*(cgl->outRadius)/TRIG_MAX_RATIO + cgl->center.x;

	graphics_fill_circle(ctx, outer, 4);
}
示例#28
0
static void glyph_layer_update_proc(Layer *layer, GContext *ctx) {    
  GRect bounds = layer_get_bounds(layer);
  GPoint center = GPoint(bounds.size.w / 2 - 50, 0);

  for(int i=0; i < ui.glyph_paths_num; i++) {
    gpath_move_to(ui.glyph_path[i], center);

    #ifdef PBL_COLOR
      graphics_context_set_fill_color(ctx, FG_COLOR);
      graphics_context_set_stroke_color(ctx, FG_COLOR);
    #endif

    gpath_draw_filled(ctx, ui.glyph_path[i]); 
  }
}
示例#29
0
文件: speed.c 项目: performa62/pebble
void minute_display_layer_update_callback(Layer *me, GContext* ctx) {
  (void)me;

  PblTm t;

  get_time(&t);

  unsigned int angle = t.tm_min * 6 + t.tm_sec / 10;
  gpath_rotate_to(&minute_hand_path, (TRIG_MAX_ANGLE / 360) * angle);
  
  graphics_context_set_fill_color(ctx, GColorWhite);
  gpath_draw_filled(ctx, &minute_hand_path);
  graphics_context_set_stroke_color(ctx, GColorBlack);
  gpath_draw_outline(ctx, &minute_hand_path);
}
示例#30
0
static void layer_on_update(Layer *this_layer, GContext *ctx) {
  //clearing screen
  graphics_context_set_fill_color(ctx, GColorWhite);
  graphics_fill_rect(ctx, layer_get_bounds(this_layer), 0, GCornersAll);
  
  RotateAndConvertToScreenCoords();
  
  graphics_context_set_stroke_color(ctx, GColorBlack);
  graphics_draw_line(ctx, screen_coords[0], screen_coords[1]);
  graphics_draw_line(ctx, screen_coords[1], screen_coords[2]);
  graphics_draw_line(ctx, screen_coords[2], screen_coords[0]);
  graphics_draw_line(ctx, screen_coords[3], screen_coords[0]);
  graphics_draw_line(ctx, screen_coords[3], screen_coords[1]);
  graphics_draw_line(ctx, screen_coords[3], screen_coords[2]);
}