Skip to content

Commit

Permalink
Changes to event/track rendering
Browse files Browse the repository at this point in the history
Issue #297
  • Loading branch information
towsey committed Apr 20, 2020
1 parent 15cebf9 commit bff0696
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/AudioAnalysisTools/AcousticEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public AcousticEventClassMap()
/// Gets or sets a list of tracks.
/// This will be used when two or more events containing single tracks are merged into one combined event.
/// </summary>
public List<Track> Tracks { get; set; }
//public List<Track> Tracks { get; set; }

public bool IsMelscale { get; set; }

Expand Down Expand Up @@ -498,7 +498,10 @@ public void DrawEvent<T>(Image<T> imageToReturn, double framesPerSecond, double
nyquistFrequency: freqBinWidth * sonogramHeight,
imageWidth: imageToReturn.Width,
imageHeight: imageToReturn.Height);
var renderingOptions = new EventRenderingOptions(converter);
var renderingOptions = new EventRenderingOptions(converter)
{
Fill = new SolidBrush(Color.LimeGreen.WithAlpha(0.5f)),
};

foreach (var track in this.tracks)
{
Expand Down
32 changes: 32 additions & 0 deletions src/AudioAnalysisTools/Events/Interfaces/IPointData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ public void DrawPointsAsFill(IImageProcessingContext graphics, EventRenderingOpt

graphics.FillWithBlend(options.Fill, rects);

//graphics.Fill(
// new GraphicsOptions()
// {
// BlendPercentage = 0.5f,
// ColorBlendingMode = SixLabors.ImageSharp.PixelFormats.PixelColorBlendingMode.Multiply,
// },
// Color.FromRgb(0, 255, 0),
// new RectangleF(0, 1, 1, 1));

//var tree = new OmnitreeBoundsLinked<ISpectralPoint, double, double>(
// (ISpectralPoint value, out double minX, out double maxX, out double minY, out double maxY) =>
// {
Expand All @@ -51,6 +60,29 @@ public void DrawPointsAsFill(IImageProcessingContext graphics, EventRenderingOpt
//tree.
}

public void DrawPointsAsFillExperiment(IImageProcessingContext graphics, EventRenderingOptions options)
{
var rects = this
.Points
.Select(p => new RectangularPolygon(options.Converters.GetPixelRectangle(p)))
.Cast<IPath>()
.ToArray();

foreach (var rect in rects)
{
graphics.Fill(
new GraphicsOptions()
{
BlendPercentage = 1.0f,
//ColorBlendingMode = SixLabors.ImageSharp.PixelFormats.PixelColorBlendingMode.Multiply,
ColorBlendingMode = SixLabors.ImageSharp.PixelFormats.PixelColorBlendingMode.Overlay,
},
//Color.FromRgb(0, 255, 0),
Color.LimeGreen,
rect);
}
}

public void DrawPointsAsPath(IImageProcessingContext graphics, EventRenderingOptions options)
{
// visits each point once
Expand Down

0 comments on commit bff0696

Please sign in to comment.