Make bar AA optional

This commit is contained in:
2026-07-22 23:15:42 -04:00
parent 4a7487fa10
commit a357067441
3 changed files with 27 additions and 7 deletions
+4 -2
View File
@@ -4,12 +4,13 @@
## VS Stock Action Bar ## VS Stock Action Bar
### New Features ### New Features
- Floating mode! - Floating mode!
- Rectangular/round backgrounds on all watches! - Rectangular/round/radial backgrounds on all watches!
- Adjustable spread (distance between icons)! - Adjustable spread (distance between icons)!
- Increased max icon size (unlimited width; 25px height)! - Increased max icon size (unlimited width; 25px height)!
- Custom bar corner radius! - Custom bar corner radius!
- Custom bar width/height! - Custom bar width/height!
- Custom bar/icon x/y offsets! - Custom bar/icon x/y offsets!
- Toggle-able bar AA!
### Missing Features (unplanned) ### Missing Features (unplanned)
- Anything to do with back button overrides - Anything to do with back button overrides
- Fully custom animations - Fully custom animations
@@ -17,7 +18,8 @@
- Duration, move distance/direction, and move axis are all configurable - Duration, move distance/direction, and move axis are all configurable
- They can also be disabled - They can also be disabled
### Pending Features ### Pending Features
- Optional AA on bar corners
- Legacy (background invert) animations support - Legacy (background invert) animations support
- Customizable round bar size - Customizable round bar size
- Customizable radial bar length
- Separate select icon x offset (especially useful for the radial bar)
- Legacy and default theme setters - Legacy and default theme setters
+20 -4
View File
@@ -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) { 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_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) { switch (s_current_neat_bar->bar_style) {
case NEAT_BAR_STYLE_RADIAL: { 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, 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(60), // ~2 o'clock
DEG_TO_TRIGANGLE(120) // ~4 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; break;
} }
default: 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); 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); 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 // default: 0
void neat_bar_layer_set_rect_bar_floating(NeatBarLayer *neat_bar, uint16_t x_offset) { void neat_bar_layer_set_rect_bar_floating(NeatBarLayer *neat_bar, uint16_t x_offset) {
if (x_offset == neat_bar->bar_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 exclusives :D
neat_bar->bar_style = DEFAULT_BAR_STYLE; 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->bar_x_offset = 0;
neat_bar->rect_bar_corner_radius = 0;
neat_bar->icons_spread = DEFAULT_SPREAD; neat_bar->icons_spread = DEFAULT_SPREAD;
neat_bar->icons_x_offset = DEFAULT_ICONS_X_OFFSET; neat_bar->icons_x_offset = DEFAULT_ICONS_X_OFFSET;
neat_bar->icons_y_offset = 0; neat_bar->icons_y_offset = 0;
+3 -1
View File
@@ -28,8 +28,9 @@ typedef struct {
// neat_bar exclusives :D // neat_bar exclusives :D
uint8_t bar_style; // 0 = rect, 1 = round, 2 = radial 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 bar_x_offset;
uint16_t rect_bar_corner_radius;
int8_t icons_spread; int8_t icons_spread;
int8_t icons_x_offset; int8_t icons_x_offset;
int8_t icons_y_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_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_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_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_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_rect_bar_corner_radius(NeatBarLayer *neat_bar, uint16_t corner_radius);
void neat_bar_layer_set_bar_width(NeatBarLayer *neat_bar, uint16_t width); void neat_bar_layer_set_bar_width(NeatBarLayer *neat_bar, uint16_t width);