diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2013-01-28 15:33:30 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2013-04-23 13:35:16 (GMT) |
commit | 449479a3a285c84fa1d109a2cf768c5489911a19 (patch) | |
tree | 41a965d0b3d918f69e71f2a62a218af455cbf4f2 | |
parent | f72e853658d060b0edbad1f17162b7cac805eb9a (diff) |
Draw loops using lines with rounded caps instead of rectangles.
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
-rw-r--r-- | Jam/JamMain.py | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/Jam/JamMain.py b/Jam/JamMain.py index 799a784..2acc96f 100644 --- a/Jam/JamMain.py +++ b/Jam/JamMain.py @@ -943,6 +943,15 @@ class JamMain(Gtk.EventBox): def _drawNotes(self, ctx, beats, notes, active): #self.gc.set_clip_mask(self.sampleNoteMask) ctx.save() + if active: + ctx.set_source_rgb(*CairoUtil.gdk_color_to_cairo( + self.colors["Note_Border_Active"])) + else: + ctx.set_source_rgb(*CairoUtil.gdk_color_to_cairo( + self.colors["Note_Border_Inactive"])) + line_width = self.sampleNoteHeight - 2 + ctx.set_line_width(line_width) + ctx.set_line_cap(cairo.LINE_CAP_ROUND) for note in notes: # draw N notes x = self.ticksToPixels(note.cs.onset) # include end cap offset @@ -950,31 +959,10 @@ class JamMain(Gtk.EventBox): width = endX - x if width < 5: width = 5 - endX = x + width y = self.pitchToPixels(note.cs.pitch) - # draw fill - if active: - ctx.set_source_rgb(*CairoUtil.gdk_color_to_cairo( - self.colors["Note_Fill_Active"])) - else: - ctx.set_source_rgb(*CairoUtil.gdk_color_to_cairo( - self.colors["Note_Fill_Inactive"])) - #self.gc.set_clip_origin(x, y - self.sampleNoteHeight) - ctx.rectangle(x + 1, y + 1, width + 1, self.sampleNoteHeight - 2) - ctx.fill() - # draw border - if active: - ctx.set_source_rgb(*CairoUtil.gdk_color_to_cairo( - self.colors["Note_Border_Active"])) - else: - ctx.set_source_rgb(*CairoUtil.gdk_color_to_cairo( - self.colors["Note_Border_Inactive"])) - #self.gc.set_clip_origin(x, y) - ctx.rectangle(x, y, width, self.sampleNoteHeight) - ctx.fill() - #self.gc.set_clip_origin(endX - self.sampleNoteMask.endOffset, y) - ctx.rectangle(endX, y, 3, self.sampleNoteHeight) - ctx.fill() + ctx.move_to(x + 1, y + (line_width / 2)) + ctx.line_to(x + width - 1, y + (line_width / 2)) + ctx.stroke() ctx.restore() def prepareKeyImage(self, key): |