Ejemplo n.º 1
0
//added by gac and is probably wrong
void month_display_layer_update_callback(Layer *me, GContext* ctx) {

  PblTm t;

  get_time(&t);
  
  unsigned int angle;
  
  //angle = (( t.tm_mon % 12 ) * 30) + (t.tm_mday / 2);
  angle = (( ( t.tm_mon + 1 ) % 12 ) * 30);
  
  angle = angle - (angle % 2);  //use modulo 2 for smaller black overlaps

  GPoint center = grect_center_point(&me->frame);

  graphics_context_set_fill_color(ctx, GColorWhite);

  graphics_fill_circle(ctx, center, 25);

  graphics_context_set_fill_color(ctx, GColorBlack);

  for(; angle < 355; angle += 2) {  //has to be same increment as the modulo in line 231

    gpath_rotate_to(&month_segment_path, (TRIG_MAX_ANGLE / 360) * angle);

    gpath_draw_filled(ctx, &month_segment_path);
  }

  graphics_fill_circle(ctx, center, 20);
}
Ejemplo n.º 2
0
void draw_circle(Layer *layer, GContext *gctxt){
	GPoint circ_center = GPoint(WIDTH/2, (HEIGHT/2));
    //Emblacken the screen
	graphics_context_set_fill_color(gctxt, GColorBlack); graphics_fill_rect(gctxt, GRect(0,0,WIDTH,HEIGHT), 0, GCornerNone); 
	//Draw outer circle 
	graphics_context_set_fill_color(gctxt, GColorWhite);
	graphics_fill_circle(gctxt, circ_center, (WIDTH/2)-8);
	//Draw inner circle
	graphics_context_set_fill_color(gctxt, GColorBlack);
	graphics_fill_circle(gctxt, circ_center, (WIDTH/4));
	//Draw hour line
	graphics_context_set_stroke_color(gctxt, GColorBlack);
    graphics_draw_line(gctxt, get_endpoint(circ_center, (WIDTH/4), MINUTE_ANGLE), get_endpoint(circ_center, (WIDTH/2), MINUTE_ANGLE));
    graphics_draw_line(gctxt, get_endpoint(circ_center, (WIDTH/4), SECOND_ANGLE), get_endpoint(circ_center, (WIDTH/2), SECOND_ANGLE));
	
	
	graphics_context_set_stroke_color(gctxt, GColorWhite);
	graphics_draw_line(gctxt, circ_center, get_endpoint(circ_center, (WIDTH/4), HOUR_ANGLE));
	
	//graphics_context_set_stroke_color(gctxt, GColorBlack);
	//int32_t angle = (TRIG_MAX_ANGLE * 4 / 12);
	//GPoint start;
	//GPoint end;
	//int32_t c = 0;
	//while(c!=12){
	//	angle = (TRIG_MAX_ANGLE * c / 12);	
	//   start = get_endpoint(circ_center, (WIDTH/6)+33, angle);
	//    end = get_endpoint(circ_center, (WIDTH/2), angle);
		//graphics_draw_line(gctxt, start, end);
	//	c = c + 3;
	//}
}
Ejemplo n.º 3
0
static void canvas_update_proc(Layer *layer, GContext *ctx) {
  // Custom drawing happens here!
  
  Layer *window_layer = window_get_root_layer(s_main_window);
  GRect bounds = layer_get_bounds(window_layer);
  
  int x,y;
  int midpoint_x=bounds.size.w/2;
  int midpoint_y=bounds.size.h/2;
  int adjusted_minutes=90-minutes*6;
  x=midpoint_x+cos(3.14*adjusted_minutes/180)*(3*midpoint_x/5);
  y=midpoint_y-sin(3.14*adjusted_minutes/180)*(3*midpoint_y/5);
  GPoint center = GPoint(x, y);
  uint16_t radius = midpoint_x/4;

  // Draw the outline of a circle
  graphics_context_set_stroke_color(ctx, GColorCadetBlue);
  graphics_draw_circle(ctx, center, radius);

  // Fill a circle
  graphics_context_set_fill_color(ctx, GColorCadetBlue);
  graphics_fill_circle(ctx, center, radius);
  
  radius=radius/4;
  center = GPoint(x-6, y-6);
  graphics_context_set_fill_color(ctx, GColorCeleste);
  graphics_fill_circle(ctx, center, radius);
  

}
Ejemplo n.º 4
0
// Draw the stick figures current pose with an offset
void stick_figure_draw(StickFigure *stick_figure, GContext *ctx, GPoint offset) {
  SkeletonFrame skeleton = stick_figure->cur_skeleton;
  graphics_context_set_fill_color(ctx, GColorBlack);
  // draw body
  prv_drawing_thick_line(ctx, prv_gpoint_add(skeleton.head, offset),
    prv_gpoint_add(skeleton.chest, offset));
  prv_drawing_thick_line(ctx, prv_gpoint_add(skeleton.chest, offset),
    prv_gpoint_add(skeleton.waist, offset));
  // draw head
  graphics_context_set_fill_color(ctx, GColorBlack);
  graphics_fill_circle(ctx, prv_gpoint_add(skeleton.head, offset), 16);
  graphics_context_set_fill_color(ctx, GColorWhite);
  graphics_fill_circle(ctx, prv_gpoint_add(skeleton.head, offset), 12);
  // draw right arm
  prv_drawing_thick_line(ctx, prv_gpoint_add(skeleton.chest, offset),
    prv_gpoint_add(skeleton.elbow_r, offset));
  prv_drawing_thick_line(ctx, prv_gpoint_add(skeleton.elbow_r, offset),
    prv_gpoint_add(skeleton.hand_r, offset));
  // draw left arm
  prv_drawing_thick_line(ctx, prv_gpoint_add(skeleton.chest, offset),
    prv_gpoint_add(skeleton.elbow_l, offset));
  prv_drawing_thick_line(ctx, prv_gpoint_add(skeleton.elbow_l, offset),
    prv_gpoint_add(skeleton.hand_l, offset));
  // draw right leg
  prv_drawing_thick_line(ctx, prv_gpoint_add(skeleton.waist, offset),
    prv_gpoint_add(skeleton.knee_r, offset));
  prv_drawing_thick_line(ctx, prv_gpoint_add(skeleton.knee_r, offset),
    prv_gpoint_add(skeleton.foot_r, offset));
  // draw left leg
  prv_drawing_thick_line(ctx, prv_gpoint_add(skeleton.waist, offset),
    prv_gpoint_add(skeleton.knee_l, offset));
  prv_drawing_thick_line(ctx, prv_gpoint_add(skeleton.knee_l, offset),
    prv_gpoint_add(skeleton.foot_l, offset));
}
Ejemplo n.º 5
0
static void grill_proc(Layer *layer, GContext *ctx) {
    // headlights
    graphics_fill_circle(ctx, GPoint(16, 22), 10);
    graphics_fill_circle(ctx, GPoint(126, 22), 10);

    // indicators
    graphics_fill_circle(ctx, GPoint(21,  40), 4);
    graphics_fill_circle(ctx, GPoint(121, 40), 4);


    int g = 3;
    int w = 7;
    int l = (144 - ((9*w) + (8*g))) / 2;
    for (int i = 0; i < 9; i++)
    {
        int y = 10;
        int h = 50;
        if(i == 0 || i == 8) {
            y = 12;
            h = 47;
        }
        graphics_context_set_fill_color(ctx, GColorBlack);
        graphics_fill_rect(ctx, GRect(l + (i * (w+g)), y, w, h), 3, GCornersAll);
        graphics_context_set_fill_color(ctx, GColorDarkGray);
        graphics_fill_rect(ctx, GRect(l + (i * (w+g))+1, y+1, w-2, h-2), 2, GCornersAll);
    }
}
Ejemplo n.º 6
0
void hour_display_layer_update_callback(Layer *me, GContext* ctx) {

  PblTm t;

  get_time(&t);

  unsigned int angle;

  #if TWENTY_FOUR_HOUR_DIAL
    angle = (t.tm_hour * 15) + (t.tm_min / 4);
  #else
    angle = (( t.tm_hour % 12 ) * 30) + (t.tm_min / 2);
  #endif

  angle = angle - (angle % 6);

  GPoint center = grect_center_point(&me->frame);

  graphics_context_set_fill_color(ctx, GColorWhite);

  graphics_fill_circle(ctx, center, 45);

  graphics_context_set_fill_color(ctx, GColorBlack);

  for(; angle < 355; angle += 6) {

    gpath_rotate_to(&hour_segment_path, (TRIG_MAX_ANGLE / 360) * angle);

    gpath_draw_filled(ctx, &hour_segment_path);
  }

  graphics_fill_circle(ctx, center, 40);
}
Ejemplo n.º 7
0
void drawCirclePlayer(GContext* ctx, GPoint center) {

  graphics_context_set_fill_color(ctx, COLOR_FOREGROUND);
  graphics_fill_circle(ctx, center, 15);
  graphics_context_set_fill_color(ctx, COLOR_BACKGROUND);
  graphics_fill_circle(ctx, center, 13);
}
Ejemplo n.º 8
0
void second_display_layer_update_callback(Layer *me, GContext* ctx) {

  PblTm t;

  get_time(&t);

  unsigned int angle = t.tm_sec * 6;

  GPoint center = grect_center_point(&me->frame);

  graphics_context_set_fill_color(ctx, GColorWhite);

  graphics_fill_circle(ctx, center, 65);

  graphics_context_set_fill_color(ctx, GColorBlack);

  for(; angle < 355; angle += 6) {

    gpath_rotate_to(&second_segment_path, (TRIG_MAX_ANGLE / 360) * angle);

    gpath_draw_filled(ctx, &second_segment_path);

  }

  graphics_fill_circle(ctx, center, 60);

}
Ejemplo n.º 9
0
static void minute_display_layer_update_callback(Layer *layer, GContext* ctx) {

  time_t now = time(NULL);
  struct tm *t = localtime(&now);

  unsigned int angle = t->tm_min * 6;

  gpath_rotate_to(minute_segment_path, (TRIG_MAX_ANGLE / 360) * angle);

  GRect bounds = layer_get_bounds(layer);
  GPoint center = grect_center_point(&bounds);

  graphics_context_set_fill_color(ctx, GColorWhite);

  graphics_fill_circle(ctx, center, 77);

  graphics_context_set_fill_color(ctx, GColorBlack);

  // Note: I had intended to use the `GCompOpAssignInverted` mode here
  //       but it appears it's ignored for path/shape drawing.

  gpath_draw_filled(ctx, minute_segment_path);

  graphics_fill_circle(ctx, center, 52);
}
Ejemplo n.º 10
0
static void hour_display_update_proc(Layer *layer, GContext* ctx) {
  time_t now = time(NULL);
  struct tm *t = localtime(&now);

  unsigned int angle = (t->tm_hour % 12) * 30;
  GRect bounds = layer_get_bounds(layer);
  GPoint center = grect_center_point(&bounds);

  graphics_context_set_fill_color(ctx, GColorWhite);
  graphics_fill_circle(ctx, center, 48);

  for (unsigned int i = 0; i < 360; i += 15) {
    if ((i != angle) && (i != (angle + 15)) && (i != ((angle - 15 + 360) % 360)) ) {
      gpath_rotate_to(s_hour_segment_path, (TRIG_MAX_ANGLE / 360) * i);
      graphics_context_set_fill_color(ctx, GColorBlack);
      gpath_draw_filled(ctx, s_hour_segment_path);
    }
  }

  // Stray pixels
  graphics_context_set_fill_color(ctx, GColorBlack);
  graphics_fill_circle(ctx, center, 5);
  graphics_context_set_stroke_color(ctx, GColorBlack);
  if ((angle != 0) && (angle != 330)) {
    graphics_draw_pixel(ctx, GPoint(71, 77));
    graphics_draw_pixel(ctx, GPoint(71, 78));
  }
}
Ejemplo n.º 11
0
static void hands_layer_update_callback(Layer *layer, GContext* ctx) {

  GPoint center = GPoint(CENTER_X, CENTER_Y);

// hours and minutes
//  int32_t hour_angle = TRIG_MAX_ANGLE * (now->tm_hour * 5 + now->tm_min / 12) / 60;
  int32_t hour_angle = (TRIG_MAX_ANGLE * (((hour % 12) * 6) + (min / 10))) / (12 * 6);
  int32_t min_angle = TRIG_MAX_ANGLE * min / 60;
  gpath_rotate_to(hour_path, hour_angle);
  gpath_rotate_to(hour_in_path, hour_angle);
  gpath_rotate_to(min_path, min_angle);
  graphics_context_set_fill_color(ctx, GColorWhite);
  graphics_context_set_stroke_color(ctx, GColorBlack);
  gpath_draw_filled(ctx, hour_path);
  gpath_draw_outline(ctx, hour_path);
  graphics_context_set_fill_color(ctx, GColorBlack);
  gpath_draw_filled(ctx, hour_in_path);
  graphics_context_set_fill_color(ctx, GColorWhite);
  graphics_draw_circle(ctx, center, DOTS_SIZE+4);
  gpath_draw_filled(ctx, min_path);
  gpath_draw_outline(ctx, min_path);
  graphics_fill_circle(ctx, center, DOTS_SIZE+3);

  // center dot
  graphics_context_set_fill_color(ctx, GColorBlack);
  graphics_fill_circle(ctx, center, DOTS_SIZE);
}
Ejemplo n.º 12
0
void top_layer_update_callback(Layer *me, GContext* ctx) {
    (void)me;
    
    graphics_context_set_fill_color(ctx, cols2[ph][1]);
    graphics_fill_circle(ctx, GPoint(centerx,centery), 5);
    graphics_context_set_fill_color(ctx, cols2[ph][0]);
    graphics_fill_circle(ctx, GPoint(centerx,centery), 2);
}
Ejemplo n.º 13
0
static void bezel_layer_update_proc(Layer *layer, GContext *ctx) {
  GRect bounds = layer_get_bounds(layer);
  GPoint center = grect_center_point(&bounds);
  graphics_context_set_fill_color(ctx, FG_COLOR);
  graphics_fill_circle(ctx, center, BEZEL_RADIUS + (BEZEL_WIDTH / 2));
  graphics_context_set_fill_color(ctx, BG_COLOR);
  graphics_fill_circle(ctx, center, BEZEL_RADIUS - (BEZEL_WIDTH / 2));
}
Ejemplo n.º 14
0
void center_display_layer_update_callback(Layer *me, GContext* ctx) {
	(void) me;

	GPoint center = grect_center_point(&GRECT_FULL_WINDOW);
	graphics_context_set_fill_color(ctx, GColorBlack);
	graphics_fill_circle(ctx, center, 4);
	graphics_context_set_fill_color(ctx, GColorWhite);
	graphics_fill_circle(ctx, center, 3);
}
Ejemplo n.º 15
0
/**
 * Redraw the dial layer
 * draws the white clock dial
 */
static void dial_layer_draw(Layer *layer, GContext *ctx) {
  graphics_context_set_fill_color(ctx, GColorWhite);
  // draw the white minute circle
  graphics_fill_circle(ctx, center, clock_radius);   
  
  // draw the black center circle for hour display
  graphics_context_set_fill_color(ctx, GColorBlack);
  graphics_fill_circle(ctx, center, hour_radius);
}
Ejemplo n.º 16
0
static void updateScreen(Layer *layer, GContext *ctx) {
	graphics_context_set_fill_color(ctx, GColorWhite);
	graphics_fill_circle(ctx, center, outerCircleOuterRadius);
	graphics_context_set_fill_color(ctx, GColorBlack);
	graphics_fill_circle(ctx, center, outerCircleInnerRadius);
	graphics_draw_arc(ctx, center, outerCircleOuterRadius+1, OUTER_CIRCLE_THICKNESS+2, min_a1, min_a2, GColorBlack);

	graphics_draw_arc(ctx, center, innerCircleOuterRadius, INNER_CIRCLE_THICKNESS, hour_a1, hour_a2, GColorWhite);
}
Ejemplo n.º 17
0
void center_display_layer_update_callback(Layer *me, GContext* ctx) {
  (void)me;

  GPoint center = grect_center_point(&me->frame);
  graphics_context_set_fill_color(ctx, GColorWhite);
  graphics_fill_circle(ctx, center, 10);
  graphics_context_set_fill_color(ctx, GColorBlack);
  graphics_fill_circle(ctx, center, 9);
}
Ejemplo n.º 18
0
static void update_spin_circle_proc(Layer *layer, GContext *ctx) {
  if(!s_spinning){
    return;
  }
  graphics_context_set_stroke_color(ctx, GColorWhite);
  graphics_context_set_fill_color(ctx, GColorWhite);
  graphics_fill_circle(ctx, s_spin_circle_center, RADIUS + BORDER);
  graphics_context_set_fill_color(ctx, GColorBlack);
  graphics_fill_circle(ctx, s_spin_circle_center, RADIUS);
}
Ejemplo n.º 19
0
static void draw_clock_layer_inner(Layer *layer, GContext *ctx) {
	uint16_t offset = 1 + (THICKNESS * 2) + (OFFSET * 2);

	graphics_context_set_fill_color(ctx, GColorBlack);
	graphics_fill_circle(ctx, s_clock_center, s_clock_center.x - offset);
	graphics_context_set_fill_color(ctx, GColorWhite);
	gpath_rotate_to(s_hand_path_inner, s_hand_angle[2]);
	gpath_draw_filled(ctx, s_hand_path_inner);
	graphics_fill_circle(ctx, s_clock_center, s_clock_center.x - offset - THICKNESS);
}
Ejemplo n.º 20
0
static void hour_display_layer_update_callback(Layer *layer, GContext* ctx) {


  time_t now = time(NULL);
  struct tm *t = localtime(&now);

  // Because of how we're drawing the segments I'm not currently
  // accounting for per-minute moving of the hour hand.
  //unsigned int angle = (((t.tm_hour % 12) * 30) + (t.tm_min/2));
  unsigned int angle = (t->tm_hour % 12) * 30;


  GRect bounds = layer_get_bounds(layer);
  GPoint center = grect_center_point(&bounds);

  graphics_context_set_fill_color(ctx, GColorWhite);

  graphics_fill_circle(ctx, center, 48);


  for (unsigned int i = 0; i < 360; i+=15) {

    if ((i != angle) && (i != (angle + 15)) && (i != ((angle-15+360) % 360)) ) {

      gpath_rotate_to(hour_segment_path, (TRIG_MAX_ANGLE / 360) * i);

      graphics_context_set_fill_color(ctx, GColorBlack);

      gpath_draw_filled(ctx, hour_segment_path);

    }

  }

  // Due to (I assume) rounding/precision errors with rotation
  // of paths there's a few stray pixels left behind after the
  // above method of drawing segments.

  // This draws a circle over almost all the stray pixels--at the
  // cost of not quite matching the mock-up.
  graphics_context_set_fill_color(ctx, GColorBlack);
  graphics_fill_circle(ctx, center, 5);

  // But there's still two stray pixels left--and enlarging the cover
  // up circle to fit them starts to be obvious so we touch them up
  // individually.
  graphics_context_set_stroke_color(ctx, GColorBlack);

  if ((angle != 0) && (angle != 330)) {
    graphics_draw_pixel(ctx, GPoint(71, 77));
    graphics_draw_pixel(ctx, GPoint(71, 78));
  }

}
Ejemplo n.º 21
0
static void draw_cell(GContext* context, GPoint center, bool filled) {
	// Each cell is a bit
	graphics_context_set_fill_color(context, GColorWhite);
	graphics_fill_circle(context, center, CIRCLE_RADIUS);

	if(!filled) {
		// This draws circles with a line thickness greater than 1 pixel
		graphics_context_set_fill_color(context, GColorBlack);
		graphics_fill_circle(context, center, CIRCLE_RADIUS - CIRCLE_LINE_THICKNESS);
	}
}
Ejemplo n.º 22
0
void draw_fill_circle(GContext *ctx, GPoint center, uint16_t *radius)
{
    graphics_context_set_fill_color(ctx, CIRCLOCK_COLOR_FOREGROUND);
    graphics_fill_circle(ctx, center, *radius);
    
    *radius -= CIRCLOCK_HAND_HEIGHT;
    graphics_context_set_fill_color(ctx, CIRCLOCK_COLOR_BACKGROUND);
    graphics_fill_circle(ctx, center, *radius);
    
    *radius -= CIRCLOCK_HAND_MARGIN;
}
Ejemplo n.º 23
0
void minutes_proc(Layer *layer, GContext *ctx){
	for(int j = c_enabled; j > 0; j--){
		if(pulse_enabled_c){
			graphics_context_set_stroke_color(ctx, GColorWhite);
			graphics_fill_circle(ctx, GPoint(circle_coords[0][j], circle_coords[1][j]), ci_value);
			graphics_draw_circle(ctx, GPoint(circle_coords[0][j], circle_coords[1][j]), ci_value+1);
		}
		else{
			graphics_fill_circle(ctx, GPoint(circle_coords[0][j], circle_coords[1][j]), 3);
		}
	}
}
Ejemplo n.º 24
0
static void canvas_update_proc(Layer *layer, GContext *ctx) {
  // Custom drawing happens here!
  
  Layer *window_layer = window_get_root_layer(s_main_window);
  GRect bounds = layer_get_bounds(window_layer);
  
  int x,y;
  int left=bounds.size.w/10+2;
  int right=bounds.size.w-left;
  int adjusted_steps=steps/(target_steps/5);
  uint16_t radius = bounds.size.w/8;
  
  if(adjusted_steps>4) adjusted_steps=4;
  
  printf("adj steps %d", adjusted_steps);
  
  y=bounds.size.h/2;
  x=left;
  GPoint center = GPoint(x, y);
  
  graphics_context_set_stroke_width(ctx, 2);
  graphics_context_set_stroke_color(ctx, GColorInchworm);  
  graphics_draw_circle(ctx, center, radius);
  // Draw the outline of a circle
  for(int i=0;i<adjusted_steps;i++)
  {
    x=x+((right-left)/6);
    center = GPoint(x, y);
    graphics_draw_circle(ctx, center, radius);
  }
  
  // Fill a circle
  GPoint p1 = GPoint(center.x-radius, center.y-radius+4);  
  GPoint p2 = GPoint(center.x+radius, center.y-radius+4);  
  graphics_context_set_fill_color(ctx, GColorInchworm);
  graphics_fill_circle(ctx, center, radius);
  
  graphics_context_set_stroke_color(ctx, GColorBlack);  
  graphics_context_set_stroke_width(ctx, 1);
  graphics_context_set_fill_color(ctx, GColorBlack);
  
  for(int i=0;i<2*radius;i+=4)
  {
    p1.y=center.y-radius+i;
    p2.y=center.y-radius+i;
    graphics_draw_line(ctx, p1, p2);
  }
  radius=radius/4;
  
  graphics_fill_circle(ctx, center, radius);

  
}
Ejemplo n.º 25
0
void draw_round_bar(GContext *ctx, GPoint l_p, GPoint r_p, int height) {
	
	graphics_fill_circle(ctx, l_p, height/2);
	graphics_draw_circle(ctx, l_p, height/2);
	
	graphics_fill_circle(ctx, r_p, height/2);
	graphics_draw_circle(ctx, r_p, height/2);
	
	GRect bar = {
		.origin = {l_p.x, 0},
		.size = {r_p.x - l_p.x, height}
	};
Ejemplo n.º 26
0
static void dots_layer_update_proc(Layer *layer, GContext* ctx) {
	GRect bounds = layer_get_bounds(layer);
	DotsLayer* dl = *(DotsLayer**)layer_get_data(layer);
	int dots_left = bounds.size.w / 2 - ((dl->num_dots - 1) * DOT_PITCH) / 2;
	for (int i = 0; i < dl->num_dots; ++i) {
		graphics_context_set_fill_color(ctx, GColorWhite);
		graphics_fill_circle(ctx, GPoint(dots_left + i * DOT_PITCH, DOT_RAD), DOT_RAD);
		if (i == dl->active_dot) {
			graphics_context_set_fill_color(ctx, GColorBlack);
			graphics_fill_circle(ctx, GPoint(dots_left + i * DOT_PITCH, DOT_RAD), DOT_INNER_RAD);
		}
	}
}
Ejemplo n.º 27
0
static void weather_animate_update(Layer *me, GContext *ctx) {
    int dots = 3;
    int spacer = 15;

    graphics_context_set_fill_color(ctx, GColorBlack);

    for (int i=1; i<=dots; i++) {
        if (i == animation_step) {
            graphics_fill_circle(ctx, GPoint((i*spacer), 8), 5);
        } else {
            graphics_fill_circle(ctx, GPoint((i*spacer), 8), 3);
        }
    }
}
Ejemplo n.º 28
0
static void path_layer_update_callback(Layer *path, GContext *ctx) 
{
  gpath_draw_filled(ctx, s_needle_north);gpath_draw_filled(ctx, s_needle_north);       
              
  // creating centerpoint                 
  GRect bounds = layer_get_frame(path);          
  GPoint path_center = GPoint(bounds.size.w / 2, bounds.size.h / 2);  
  graphics_fill_circle(ctx, path_center, 3);       

  // then put a white circle on top               
  graphics_context_set_fill_color(ctx, GColorWhite);
  graphics_fill_circle(ctx, path_center, 2);
	layer_mark_dirty(s_path_layer);
}
Ejemplo n.º 29
0
static void draw_circle(GContext *ctx, GPoint circle_center, bool filled) {
  graphics_context_set_fill_color(ctx, GColorBlack);
  graphics_fill_circle(ctx, circle_center, canvas_circle_radius);

  if (canvas_fill_px > 0) {
  graphics_context_set_fill_color(ctx, GColorWhite);
  graphics_fill_circle(ctx, circle_center, canvas_circle_radius - canvas_fill_px);
  }

  if (!filled) {
    graphics_context_set_fill_color(ctx, GColorWhite);
    graphics_fill_circle(ctx, circle_center, canvas_circle_radius - canvas_border_px);
  }
}
Ejemplo n.º 30
0
void day_display_layer_update_callback(Layer *me, GContext* ctx) {

  PblTm t;

  get_time(&t);
  
  unsigned int angle;

  unsigned int maxdays;
	
  switch (t.tm_mon)  //figure out max days in the month
	{
	case 3:  //April
	case 5:  //June
	case 8:  //Sep
	case 10: //Nov
   		maxdays = 30;
	  
   		break;
	case 1:
   		maxdays = 28;
	 
   		break;
	default:
    	maxdays = 31;
	  
  }
	
  angle = (( t.tm_mday % maxdays ) * 360 / maxdays ) + (t.tm_hour);

  angle = angle - (angle % 3);  //use modulo 3 for smaller black overlaps

  GPoint center = grect_center_point(&me->frame);

  graphics_context_set_fill_color(ctx, GColorWhite);

  graphics_fill_circle(ctx, center, 35);

  graphics_context_set_fill_color(ctx, GColorBlack);

  for(; angle < 355; angle += 3) {  //has to be same increment as the modulo in line 231

    gpath_rotate_to(&day_segment_path, (TRIG_MAX_ANGLE / 360) * angle);

    gpath_draw_filled(ctx, &day_segment_path);
  }

  graphics_fill_circle(ctx, center, 30);
}