diff --git a/README.md b/README.md index f398d5d..cb15dee 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,13 @@ ## VS Stock Action Bar ### New Features - Floating mode! -- Rectangular/round backgrounds on all watches! +- Rectangular/round/radial backgrounds on all watches! - Adjustable spread (distance between icons)! - Increased max icon size (unlimited width; 25px height)! - Custom bar corner radius! - Custom bar width/height! - Custom bar/icon x/y offsets! +- Toggle-able bar AA! ### Missing Features (unplanned) - Anything to do with back button overrides - Fully custom animations @@ -17,7 +18,8 @@ - Duration, move distance/direction, and move axis are all configurable - They can also be disabled ### Pending Features -- Optional AA on bar corners - Legacy (background invert) animations support - Customizable round bar size +- Customizable radial bar length +- Separate select icon x offset (especially useful for the radial bar) - Legacy and default theme setters diff --git a/src/c/neat_bar.c b/src/c/neat_bar.c index 08a357d..c05b2d8 100644 --- a/src/c/neat_bar.c +++ b/src/c/neat_bar.c @@ -142,11 +142,11 @@ static void s_select_up_handler(ClickRecognizerRef recognizer, void *context) { static void s_main_layer_update_proc(Layer *layer, GContext *ctx) { graphics_context_set_fill_color(ctx, s_current_neat_bar->background_color); + graphics_context_set_antialiased(ctx, s_current_neat_bar->bar_enable_aa); switch (s_current_neat_bar->bar_style) { case NEAT_BAR_STYLE_RADIAL: { - GRect visual = s_current_neat_bar->main_grect_visual; graphics_fill_radial(ctx, grect_inset(layer_get_bounds(layer), GEdgeInsets(-1)), GOvalScaleModeFitCircle, - visual.size.w, + s_current_neat_bar->main_grect_visual.size.w, DEG_TO_TRIGANGLE(60), // ~2 o'clock DEG_TO_TRIGANGLE(120) // ~4 o'clock ); @@ -161,7 +161,6 @@ static void s_main_layer_update_proc(Layer *layer, GContext *ctx) { break; } default: - graphics_context_set_antialiased(ctx, false); graphics_fill_rect(ctx, s_current_neat_bar->main_grect_visual, s_current_neat_bar->rect_bar_corner_radius, s_current_neat_bar->bar_x_offset > 0 ? GCornersAll : GCornersLeft); } } @@ -257,6 +256,18 @@ void neat_bar_layer_set_bar_style(NeatBarLayer *neat_bar, uint8_t bar_style) { layer_mark_dirty(neat_bar->main_layer); } +// default: true (color); always false on b&w watches +void neat_bar_layer_set_bar_aa(NeatBarLayer *neat_bar, bool enable_aa) { +#if PBL_BW + return; +#endif + if (enable_aa == neat_bar->bar_enable_aa) { + return; + } + neat_bar->bar_enable_aa = enable_aa; + layer_mark_dirty(neat_bar->main_layer); +} + // default: 0 void neat_bar_layer_set_rect_bar_floating(NeatBarLayer *neat_bar, uint16_t x_offset) { if (x_offset == neat_bar->bar_x_offset) { @@ -408,8 +419,13 @@ NeatBarLayer *neat_bar_layer_create() { // neat_bar exclusives :D neat_bar->bar_style = DEFAULT_BAR_STYLE; - neat_bar->rect_bar_corner_radius = 0; +#if PBL_BW + neat_bar->bar_enable_aa = false; +#else + neat_bar->bar_enable_aa = true; +#endif neat_bar->bar_x_offset = 0; + neat_bar->rect_bar_corner_radius = 0; neat_bar->icons_spread = DEFAULT_SPREAD; neat_bar->icons_x_offset = DEFAULT_ICONS_X_OFFSET; neat_bar->icons_y_offset = 0; diff --git a/src/c/neat_bar.h b/src/c/neat_bar.h index 5d35e74..271299e 100644 --- a/src/c/neat_bar.h +++ b/src/c/neat_bar.h @@ -28,8 +28,9 @@ typedef struct { // neat_bar exclusives :D uint8_t bar_style; // 0 = rect, 1 = round, 2 = radial - uint16_t rect_bar_corner_radius; + bool bar_enable_aa; uint16_t bar_x_offset; + uint16_t rect_bar_corner_radius; int8_t icons_spread; int8_t icons_x_offset; int8_t icons_y_offset; @@ -51,6 +52,7 @@ void neat_bar_layer_set_animations_move_axis(NeatBarLayer *neat_bar, bool use_y_ void neat_bar_layer_set_animations_move_distance(NeatBarLayer *neat_bar, int8_t distance); void neat_bar_layer_set_animations_duration(NeatBarLayer *neat_bar, uint8_t duration_ms); void neat_bar_layer_set_bar_style(NeatBarLayer *neat_bar, uint8_t bar_style); +void neat_bar_layer_set_bar_aa(NeatBarLayer *neat_bar, bool enable_aa); void neat_bar_layer_set_rect_bar_floating(NeatBarLayer *neat_bar, uint16_t x_offset); void neat_bar_layer_set_rect_bar_corner_radius(NeatBarLayer *neat_bar, uint16_t corner_radius); void neat_bar_layer_set_bar_width(NeatBarLayer *neat_bar, uint16_t width);