X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=score.h;h=ece395137be54c92949c3d1951cc3f0d9368e1df;hb=6024b2beade6f8376df4795d407fa2704c23befb;hp=26b976683cadb23bcfc47870fe7abe7022a00626;hpb=66812a216aa78f33ddff8753dd62f8450ef3220a;p=scherzo diff --git a/score.h b/score.h index 26b9766..ece3951 100644 --- a/score.h +++ b/score.h @@ -23,18 +23,26 @@ #include -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); -void -score_init (score_t *score); +/* 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); +/* 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);