Make dial legend radii consistent
This commit is contained in:
parent
ea40f38d27
commit
20efe78764
6 changed files with 12 additions and 10 deletions
|
@ -42,7 +42,6 @@ double hexagram_dial_angle(hexagram_dial *dial, double value);
|
|||
|
||||
int hexagram_dial_draw_legend(hexagram_dial *dial,
|
||||
cairo_t *cr,
|
||||
double radius,
|
||||
double value,
|
||||
char *text);
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
#define DIAL_MAIN_BEZEL_WIDTH 16
|
||||
|
||||
#define DIAL_MAIN_MARK_RADIUS_MIN
|
||||
#define DIAL_MAIN_MARK_RADIUS_MAX
|
||||
#define DIAL_LEGEND_RADIUS_MAIN 0.675
|
||||
#define DIAL_LEGEND_RADIUS_BOTTOM 0.725
|
||||
|
||||
static inline double _min(double a, double b) {
|
||||
return a < b?
|
||||
|
@ -200,12 +200,15 @@ double hexagram_dial_angle(hexagram_dial *dial, double value) {
|
|||
|
||||
int hexagram_dial_draw_legend(hexagram_dial *dial,
|
||||
cairo_t *cr,
|
||||
double radius,
|
||||
double value,
|
||||
char *text) {
|
||||
double angle = hexagram_dial_angle(dial, value);
|
||||
cairo_text_extents_t extents;
|
||||
|
||||
double radius = dial->type == HEXAGRAM_DIAL_MAIN?
|
||||
DIAL_LEGEND_RADIUS_MAIN:
|
||||
DIAL_LEGEND_RADIUS_BOTTOM;
|
||||
|
||||
cairo_text_extents(cr, text, &extents);
|
||||
|
||||
cairo_move_to(cr,
|
||||
|
|
|
@ -31,10 +31,10 @@ static int draw_bg(hexagram_gauge *gauge, cairo_t *cr) {
|
|||
cairo_set_font_size(cr, fuel->dial.radius * 0.1);
|
||||
|
||||
cairo_set_source_rgb(cr, 1, 0, 0);
|
||||
hexagram_dial_draw_legend(&fuel->dial, cr, 0.725, 0, "0");
|
||||
hexagram_dial_draw_legend(&fuel->dial, cr, 0, "0");
|
||||
|
||||
cairo_set_source_rgb(cr, 1, 1, 1);
|
||||
hexagram_dial_draw_legend(&fuel->dial, cr, 0.725, fuel->dial.max_value, "1");
|
||||
hexagram_dial_draw_legend(&fuel->dial, cr, fuel->dial.max_value, "1");
|
||||
|
||||
cairo_set_line_width(cr, 6.0);
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ static int draw_bg(hexagram_gauge *gauge, cairo_t *cr) {
|
|||
goto error_snprintf;
|
||||
}
|
||||
|
||||
hexagram_dial_draw_legend(&speedo->dial, cr, 0.68, speed, buf);
|
||||
hexagram_dial_draw_legend(&speedo->dial, cr, speed, buf);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -52,7 +52,7 @@ static int draw_bg(hexagram_gauge *gauge, cairo_t *cr) {
|
|||
|
||||
snprintf(buf, sizeof(buf), "%d", (int)(rpm / TACHO_INTERVAL_LEGEND));
|
||||
|
||||
hexagram_dial_draw_legend(&tacho->dial, cr, 0.675, rpm, buf);
|
||||
hexagram_dial_draw_legend(&tacho->dial, cr, rpm, buf);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -31,10 +31,10 @@ static int draw_bg(hexagram_gauge *gauge, cairo_t *cr) {
|
|||
cairo_set_font_size(cr, thermo->dial.radius * 0.1);
|
||||
|
||||
cairo_set_source_rgb(cr, 1, 1, 1);
|
||||
hexagram_dial_draw_legend(&thermo->dial, cr, 0.725, thermo->dial.min_value, "C");
|
||||
hexagram_dial_draw_legend(&thermo->dial, cr, thermo->dial.min_value, "C");
|
||||
|
||||
cairo_set_source_rgb(cr, 1, 0, 0);
|
||||
hexagram_dial_draw_legend(&thermo->dial, cr, 0.725, thermo->dial.max_value, "H");
|
||||
hexagram_dial_draw_legend(&thermo->dial, cr, thermo->dial.max_value, "H");
|
||||
|
||||
cairo_set_line_width(cr, 6.0);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue