Skip to content

Commit cd6879a

Browse files
visual: improve rendering
To improve the rendering and ease the visualization of the word trellis, this patch adds the following changes: - Render small dots at the end of each line - Show horizontal stripes, so we can easily detect which word each line is related to.
1 parent dd66475 commit cd6879a

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

julius/visual.c

+29-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ static gchar *css_colors =
9595
".text-best {color: rgb(195, 117, 0); font-weight: bold;} \n"
9696
".pass2 {color: rgb(47, 47, 47);} \n"
9797
".pass2-best {color: rgb(195, 195, 47);} \n"
98-
".shadow {color: rgb(0, 0, 0);}";
98+
".shadow {color: rgb(0, 0, 0);}"
99+
".stripe {color: #dcdcdc;}";
99100

100101
/**********************************************************************/
101102
/* graph scaling */
@@ -506,6 +507,10 @@ my_render_arc(GtkWidget *widget,
506507

507508
cairo_stroke(cr);
508509

510+
/* draw a small dot at the end of the line */
511+
cairo_arc(cr, x2 + 0.5, y2 + 0.5, 2.0, 0.0, 2.0 * M_PI);
512+
cairo_fill(cr);
513+
509514
cairo_restore(cr);
510515
gtk_style_context_restore(ctx);
511516
}
@@ -1403,7 +1408,28 @@ draw_popnodes_old(GtkWidget *widget,
14031408
/* will be called for each exposure/configure event */
14041409
/**********************************************************************/
14051410

1406-
/**
1411+
static void
1412+
draw_horizontal_stripes(GtkWidget *widget,
1413+
cairo_t *cr)
1414+
{
1415+
GtkStyleContext *ctx;
1416+
WORD_INFO *winfo;
1417+
gint i;
1418+
1419+
ctx = gtk_widget_get_style_context(widget);
1420+
winfo = re->process_list->lm->winfo;
1421+
1422+
gtk_style_context_save(ctx);
1423+
gtk_style_context_add_class(ctx, "stripe");
1424+
1425+
for(i=0;i<winfo->num;i++) {
1426+
gtk_render_line(ctx, cr, 0, scale_y_wid(i), canvas_width, scale_y_wid(i));
1427+
}
1428+
1429+
gtk_style_context_restore(ctx);
1430+
}
1431+
1432+
/**
14071433
* <JA>
14081434
* 描画キャンパス内に表示すべき全ての単語情報を pixmap に描画する.
14091435
*
@@ -1420,6 +1446,7 @@ drawarea_draw(GtkWidget *widget,
14201446
cairo_t *cr,
14211447
gpointer user_data)
14221448
{
1449+
draw_horizontal_stripes(widget, cr);
14231450

14241451
if (re->speechlen != 0) {
14251452
draw_waveform(widget, cr);

0 commit comments

Comments
 (0)