coderrick
coderrick

Reputation: 1011

How to set a line border around a Layer in Pebble C API?

Is there a way to giver a Layer Object in Pebble C a black (Or any kind) line border?

Upvotes: 0

Views: 105

Answers (1)

The Resetter
The Resetter

Reputation: 11

Since you can't draw outside the layer frame, you should want to draw a border just inside it.

You could draw the layer and then draw a rectangle just inside it.

OR

You could have a layer, and another over it, but slightly smaller and appropriately coloured and reduced in size.

OR

You could place a bitmap with the border on the layer.

Edit: Since you asked for code, here is some...

You register a callback after initializing the layer itself with this: layer_set_update_proc( layer, layer_update_proc );

Your callback (which is a separate function) could look like this, with other added garnish:

static void layer_update_proc( Layer *layer, GContext *ctx ) {
 GRect rect_bounds = GRect( 10, 10, 40, 60 );
 graphics_draw_rect( ctx, rect_bounds );
}

Upvotes: 1

Related Questions