]> git.cworth.org Git - scherzo/blobdiff - score.c
Add some color coding of input notes.
[scherzo] / score.c
diff --git a/score.c b/score.c
index 26c5a02818e6ba60ad6f77c7e00141719ff16ddb..db07d5e9d57f33436688db8741d2a4442d519760 100644 (file)
--- a/score.c
+++ b/score.c
@@ -75,10 +75,10 @@ score_create (void *ctx)
        return NULL;
 
     /* Also sets space_height and line_width */
-    score_set_staff_height (score, 24);
+    score_set_staff_height (score, 76);
 
     /* Just to have some nominal width. */
-    score->width = 800;
+    score->width = 1000;
 
     score->braces = NULL;
     score->num_braces = 0;
@@ -243,7 +243,10 @@ _draw_note (score_t *score, cairo_t *cr,
        }
     }
 
-    cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
+    cairo_set_source_rgb (cr,
+                         note->color.r,
+                         note->color.g,
+                         note->color.b);
     cairo_show_glyphs (cr, &note_glyph, 1);
 
     cairo_restore (cr);
@@ -442,6 +445,10 @@ score_add_note (score_staff_t *staff,
     note->octave = octave;
     note->duration = duration;
 
+    note->color.r = 0.0;
+    note->color.g = 0.0;
+    note->color.b = 0.0;
+
     line = _score_note_to_line (staff, note);
     if (line < 0) {
        int lines = (int) (- line);
@@ -496,6 +503,17 @@ score_remove_note (score_note_t *note)
     }
 }
 
+void
+score_set_note_color_rgb (score_note_t *note,
+                         double r,
+                         double g,
+                         double b)
+{
+    note->color.r = r;
+    note->color.g = g;
+    note->color.b = b;
+}
+
 score_note_t *
 score_staff_find_note (score_staff_t *staff,
                       score_pitch_t pitch,