Index: Core/Common/src/Core.Common.Utils/Core.Common.Utils.csproj =================================================================== diff -u -rbd8291af14687d29a602b64864c37f2e254459f8 -r05e355e482ea4f545f2261e56e2be3fa0ee9d001 --- Core/Common/src/Core.Common.Utils/Core.Common.Utils.csproj (.../Core.Common.Utils.csproj) (revision bd8291af14687d29a602b64864c37f2e254459f8) +++ Core/Common/src/Core.Common.Utils/Core.Common.Utils.csproj (.../Core.Common.Utils.csproj) (revision 05e355e482ea4f545f2261e56e2be3fa0ee9d001) @@ -93,7 +93,7 @@ - + True Index: Core/Common/src/Core.Common.Utils/GraphicsExtensions.cs =================================================================== diff -u --- Core/Common/src/Core.Common.Utils/GraphicsExtensions.cs (revision 0) +++ Core/Common/src/Core.Common.Utils/GraphicsExtensions.cs (revision 05e355e482ea4f545f2261e56e2be3fa0ee9d001) @@ -0,0 +1,70 @@ +using System; +using System.Drawing; +using System.Drawing.Imaging; + +namespace Core.Common.Utils +{ + public static class GraphicsExtensions + { + public static void DrawImageTransparent(this Graphics g, Image image, float opacity) + { + var width = image.Width; + var height = image.Height; + g.DrawImage(image, new Rectangle(0, 0, width, height), 0, 0, + width, height, GraphicsUnit.Pixel, + CalculateOpacityImageAttributes(opacity)); + } + + private static ImageAttributes CalculateOpacityImageAttributes(float opacity) + { + var clippedOpacity = (float) Math.Min(1.0, Math.Max(0.0, opacity)); + float[][] ptsArray = + { + new float[] + { + 1, + 0, + 0, + 0, + 0 + }, + new float[] + { + 0, + 1, + 0, + 0, + 0 + }, + new float[] + { + 0, + 0, + 1, + 0, + 0 + }, + new float[] + { + 0, + 0, + 0, + clippedOpacity, + 0 + }, + new float[] + { + 0, + 0, + 0, + 0, + 1 + } + }; + var clrMatrix = new ColorMatrix(ptsArray); + var imgAttributes = new ImageAttributes(); + imgAttributes.SetColorMatrix(clrMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); + return imgAttributes; + } + } +} \ No newline at end of file Fisheye: Tag 05e355e482ea4f545f2261e56e2be3fa0ee9d001 refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Utils/GraphicsUtils.cs'. Fisheye: No comparison available. Pass `N' to diff?