diff options
| author | LukePulverenti <luke.pulverenti@gmail.com> | 2013-03-16 12:41:49 -0400 |
|---|---|---|
| committer | LukePulverenti <luke.pulverenti@gmail.com> | 2013-03-16 12:41:49 -0400 |
| commit | bae89ee8243fea06ba1e17c1f1ed6da890e9f08c (patch) | |
| tree | 22a01644778de380f4e279c628fcef28f4edadbc /MediaBrowser.Controller/Drawing/ImageExtensions.cs | |
| parent | 110ee005178ca3ad04616bc2c7c0445582d56684 (diff) | |
fix duplicate connections on the dashboard
Diffstat (limited to 'MediaBrowser.Controller/Drawing/ImageExtensions.cs')
| -rw-r--r-- | MediaBrowser.Controller/Drawing/ImageExtensions.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/Drawing/ImageExtensions.cs b/MediaBrowser.Controller/Drawing/ImageExtensions.cs index cecbfe74a..32268011f 100644 --- a/MediaBrowser.Controller/Drawing/ImageExtensions.cs +++ b/MediaBrowser.Controller/Drawing/ImageExtensions.cs @@ -65,6 +65,39 @@ namespace MediaBrowser.Controller.Drawing } /// <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> /// <param name="bmp">The BMP.</param> |
