2015-02-19 18:57:10 -07:00
|
|
|
|
using ImageMagickSharp;
|
|
|
|
|
using MediaBrowser.Model.Drawing;
|
2013-09-19 10:45:48 -07:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Server.Implementations.Drawing
|
|
|
|
|
{
|
2014-01-01 11:26:31 -07:00
|
|
|
|
public class PlayedIndicatorDrawer
|
2013-09-19 10:45:48 -07:00
|
|
|
|
{
|
2015-02-19 18:57:10 -07:00
|
|
|
|
private const int FontSize = 52;
|
|
|
|
|
private const int OffsetFromTopRightCorner = 38;
|
2013-09-19 10:45:48 -07:00
|
|
|
|
|
2015-02-19 18:57:10 -07:00
|
|
|
|
public void DrawPlayedIndicator(MagickWand wand, ImageSize imageSize)
|
2013-09-19 10:45:48 -07:00
|
|
|
|
{
|
2015-02-19 18:57:10 -07:00
|
|
|
|
var x = imageSize.Width - OffsetFromTopRightCorner;
|
2013-09-19 10:45:48 -07:00
|
|
|
|
|
2015-02-19 18:57:10 -07:00
|
|
|
|
using (var draw = new DrawingWand())
|
2013-09-19 10:45:48 -07:00
|
|
|
|
{
|
2015-02-19 18:57:10 -07:00
|
|
|
|
using (PixelWand pixel = new PixelWand())
|
|
|
|
|
{
|
|
|
|
|
pixel.Color = "#52B54B";
|
|
|
|
|
pixel.Opacity = 0.2;
|
|
|
|
|
draw.FillColor = pixel;
|
|
|
|
|
draw.DrawCircle(x, OffsetFromTopRightCorner, x - 20, OffsetFromTopRightCorner - 20);
|
2013-09-19 10:45:48 -07:00
|
|
|
|
|
2015-02-19 18:57:10 -07:00
|
|
|
|
pixel.Opacity = 0;
|
|
|
|
|
pixel.Color = "white";
|
|
|
|
|
draw.FillColor = pixel;
|
|
|
|
|
draw.Font = "Webdings";
|
|
|
|
|
draw.FontSize = FontSize;
|
|
|
|
|
draw.FontStyle = FontStyleType.NormalStyle;
|
|
|
|
|
draw.TextAlignment = TextAlignType.CenterAlign;
|
|
|
|
|
draw.FontWeight = FontWeightType.RegularStyle;
|
|
|
|
|
draw.TextAntialias = true;
|
|
|
|
|
draw.DrawAnnotation(x + 4, OffsetFromTopRightCorner + 14, "a");
|
2013-09-19 10:45:48 -07:00
|
|
|
|
|
2015-02-19 18:57:10 -07:00
|
|
|
|
draw.FillColor = pixel;
|
|
|
|
|
wand.CurrentImage.DrawImage(draw);
|
2013-09-19 10:45:48 -07:00
|
|
|
|
}
|
2015-02-19 18:57:10 -07:00
|
|
|
|
|
2013-09-19 10:45:48 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|