diff --git a/.DS_Store b/.DS_Store index 0d55d6a..780ac67 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Sources/VLSheetView.h b/Sources/VLSheetView.h index d8a122d..5052935 100644 --- a/Sources/VLSheetView.h +++ b/Sources/VLSheetView.h @@ -5,7 +5,7 @@ // // (MN) Matthias Neeracher // -// Copyright © 2005-2011 Matthias Neeracher +// Copyright © 2005-2012 Matthias Neeracher // #import @@ -161,6 +161,13 @@ const uint32_t kNoMeasure = (uint32_t)-1; @end +@interface NSImage (VLSheetViewDrawing) + +- (void) drawAllAtPoint:(NSPoint)p operation:(NSCompositingOperation)op; +- (void) drawAllAtPoint:(NSPoint)p; + +@end + // Local Variables: // mode:ObjC // End: diff --git a/Sources/VLSheetView.mm b/Sources/VLSheetView.mm index 21aad1a..9ab247d 100644 --- a/Sources/VLSheetView.mm +++ b/Sources/VLSheetView.mm @@ -457,9 +457,7 @@ const char * sBreak[3] = {"", "\xE2\xA4\xBE", "\xE2\x8E\x98"}; [bz setLineWidth:2.0]; } if (song->fGoToCoda == m || song->fCoda == m) - [[self musicElement:kMusicCoda] - compositeToPoint: NSMakePoint(x+kCodaX, yy+kCodaY) - operation: NSCompositeSourceOver]; + [[self musicElement:kMusicCoda] drawAllAtPoint:NSMakePoint(x+kCodaX, yy+kCodaY)]; } } @@ -485,9 +483,7 @@ const char * sBreak[3] = {"", "\xE2\xA4\xBE", "\xE2\x8E\x98"}; // // Draw clef // - [[self musicElement:kMusicGClef] - compositeToPoint: NSMakePoint(kClefX, kSystemY+kClefY) - operation: NSCompositeSourceOver]; + [[self musicElement:kMusicGClef] drawAllAtPoint:NSMakePoint(kClefX, kSystemY+kClefY)]; // // Draw measure # // @@ -500,19 +496,13 @@ const char * sBreak[3] = {"", "\xE2\xA4\xBE", "\xE2\x8E\x98"}; if (kProp.fKey > 0) { float x = kClefX+kClefW; for (int i=0; ikProp.fKey; ++i) { - [[self musicElement: kMusicFlat] - compositeToPoint: - NSMakePoint(x, kSystemY+sFlatPos[i]+kFlatY) - operation: NSCompositeSourceOver]; + [[self musicElement: kMusicFlat] drawAllAtPoint:NSMakePoint(x, kSystemY+sFlatPos[i]+kFlatY)]; x += kAccW; } } @@ -1050,4 +1040,18 @@ const float kSemiFloor = -1.0f*kLineH; } @end - + +@implementation NSImage (VLSheetViewDrawing) + +- (void) drawAllAtPoint:(NSPoint)p operation:(NSCompositingOperation)op +{ + [self compositeToPoint:p operation:op]; +} + +- (void) drawAllAtPoint:(NSPoint)p +{ + [self compositeToPoint:p operation:NSCompositeSourceOver]; +} + +@end + diff --git a/Sources/VLSheetViewNotes.mm b/Sources/VLSheetViewNotes.mm index 76522ad..0ec795f 100644 --- a/Sources/VLSheetViewNotes.mm +++ b/Sources/VLSheetViewNotes.mm @@ -127,9 +127,7 @@ } NSPoint xy = NSMakePoint(cursorX-kNoteX, cursorY); - [[self musicElement:cursorElt] - compositeToPoint:xy - operation: NSCompositeSourceOver]; + [[self musicElement:cursorElt] drawAllAtPoint:xy]; if (accidental) { xy.y += kNoteY; @@ -156,9 +154,7 @@ xy.y += kNaturalY; break; } - [[self musicElement:accidental] - compositeToPoint:xy - operation: NSCompositeSourceOver]; + [[self musicElement:accidental] drawAllAtPoint:xy]; } } @@ -198,8 +194,7 @@ s.x -= 2.0f; break; } - [head compositeToPoint:p - operation: NSCompositePlusDarker]; + [head drawAllAtPoint:p operation:NSCompositePlusDarker]; // // Draw accidental // @@ -230,8 +225,7 @@ default: break; } - [[self musicElement:accidental] - compositeToPoint:at operation: NSCompositeSourceOver]; + [[self musicElement:accidental] drawAllAtPoint:at]; } // // Draw stem @@ -261,8 +255,7 @@ [bz lineToPoint:s1]; [bz stroke]; if (flag) - [flag compositeToPoint:s - operation: NSCompositePlusDarker]; + [flag drawAllAtPoint:s operation:NSCompositePlusDarker]; } // // Draw tie @@ -319,8 +312,7 @@ p.x -= kNoteX; break; } - [head compositeToPoint:p - operation: NSCompositeSourceOver]; + [head drawAllAtPoint:p]; } - (void) drawTuplet:(uint16_t)tuplet bracketFrom:(int)startX to:(int)endX atY:(int)y