special-draw
special-draw
is a very simple way to implement
advanced graphical effects in your
Pebble apps.
Some examples of possible modifiers are:
Usage example
static void layer_update_proc(Layer *layer, GContext *ctx) {
// Draw a rect normally.
graphics_draw_rect(ctx, GRect(32, 54, 80, 60));
// Begin a special-draw session.
GSpecialSession * session =
graphics_context_begin_special_draw(ctx);
// Add an opacity modifier...
graphics_context_special_session_add_modifier(session,
graphics_special_draw_create_opacity_modifier(GOpacity2));
// ...and a rotation modifier.
graphics_context_special_session_add_modifier(session,
graphics_special_draw_create_rotation_modifier(TRIG_MAX_ANGLE/8));
// Draw a rectangle. This one will be affected by
// the special-draw modifiers, the previous one won't.
graphics_draw_rect(ctx, GRect(38, 60, 80, 60));
// We're done here.
graphics_context_end_special_draw(session);
}
Goals
-
special-draw
should let you use built-in graphics functions. -
special-draw
should be easy to extend. -
special-draw
should let you chain modifiers.
special-draw
is released under the MIT license.
For more information about the app and modifier APIs, see the README.