private void DrawThumbnailOverlay(Graphics g, float opacity) { try { if (UpdatingCoverArtImage || UpdatingCoverArtImageList) { return; } if (GUIWindowManager.IsRouted) { this.Hide(); return; } else { this.Show(); } if (CurrentThumbImage == null && _CoverArtImages.Count == 0) { return; } Image img = GetNextImage(); if (img == null) { return; } Rectangle rect = new Rectangle(0, 0, Width, Height); SolidBrush fillBrush = new SolidBrush(Color.FromArgb((int)(255f * opacity), Color.Black)); g.FillRectangle(fillBrush, rect); fillBrush.SafeDispose(); int imgHeight = Height; int imgWidth = imgHeight; if (!_KeepCoverArtAspectRatio) { imgWidth = Width; } int left = (Width - imgHeight) / 2; float[][] matrixItems = { 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, opacity, 0}, new float[] {0, 0, 0, 0, 1} }; ColorMatrix colorMatrix = new ColorMatrix(matrixItems); ImageAttributes imgAttrib = new ImageAttributes(); imgAttrib.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); //g.DrawImage(CurrentThumbImage, new Rectangle(left, 0, imgWidth, imgHeight), 0, 0, // CurrentThumbImage.Width, CurrentThumbImage.Height, GraphicsUnit.Pixel, imgAttrib); g.DrawImage(img, new Rectangle(left, 0, imgWidth, imgHeight), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel, imgAttrib); } catch (Exception ex) { Console.WriteLine("DrawThumbnailOverlay caused an exception:{0}", ex); } }