]> git.cworth.org Git - scherzo/blobdiff - score.h
Make the brace and clef symbols scale with the staff.
[scherzo] / score.h
diff --git a/score.h b/score.h
index 26b976683cadb23bcfc47870fe7abe7022a00626..02b56e3a0956aa18238279b9db474555db6aac4d 100644 (file)
--- a/score.h
+++ b/score.h
 #ifndef SCORE_H
 #define SCORE_H
 
+#include <talloc.h>
 #include <cairo.h>
 
-typedef struct score
-{
-    /* Height of each space on staff. */
-    int space_height;
+typedef struct score score_t;
 
-    /* Total width available to score. */
-    int width;
-} score_t;
+/* Allocate a new, empty score object, (with optional ctx as talloc
+ * owner). If ctx is NULL, the caller should call talloc_free on the
+ * score_t* when done with it. Otherwise, the object will be freed
+ * when ctx is freed. */
+score_t *
+score_create (void *ctx);
 
+/* Set an (approximate) staff height. The actual staff height may
+ * differ due to rounding to achieve evenly spaced, sharply rendered
+ * lines. the actual staff height is returned. */
+int
+score_set_staff_height (score_t *score, int height);
+
+/* Set the total width available for drawing the score. */
 void
-score_init (score_t *score);
+score_set_width (score_t *score, int width);
 
+/* Draw the given score_t onto the given cairo_t.
+ *
+ * The caller can call cairo_translate before calling score_draw to
+ * position the result as desired, (and can call cairo_clip to clip it
+ * if desired). */
 void
 score_draw (score_t *score, cairo_t *cr);