fix duplicate connections on the dashboard

This commit is contained in:
LukePulverenti
2013-03-16 12:41:49 -04:00
parent 110ee00517
commit bae89ee824
13 changed files with 79 additions and 88 deletions

View File

@@ -64,6 +64,39 @@ namespace MediaBrowser.Controller.Drawing
return encoders.FirstOrDefault(i => i.MimeType.Equals(mimeType, StringComparison.OrdinalIgnoreCase)) ?? encoders.FirstOrDefault();
}
/// <summary>
/// Determines whether [is pixel format supported by graphics object] [the specified format].
/// </summary>
/// <param name="format">The format.</param>
/// <returns><c>true</c> if [is pixel format supported by graphics object] [the specified format]; otherwise, <c>false</c>.</returns>
public static bool IsPixelFormatSupportedByGraphicsObject(PixelFormat format)
{
// http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fromimage.aspx
if (format.HasFlag(PixelFormat.Indexed))
{
return false;
}
if (format.HasFlag(PixelFormat.Undefined))
{
return false;
}
if (format.HasFlag(PixelFormat.DontCare))
{
return false;
}
if (format.HasFlag(PixelFormat.Format16bppArgb1555))
{
return false;
}
if (format.HasFlag(PixelFormat.Format16bppGrayScale))
{
return false;
}
return true;
}
/// <summary>
/// Crops an image by removing whitespace and transparency from the edges
/// </summary>