internal void DrawFrameImage(GaugeGraphics g) { GraphicsPath graphicsPath = null; Pen pen = null; Region region = null; try { graphicsPath = GetFramePath(g, 0f); RectangleF frameRectangle = GetFrameRectangle(g); Region clip = null; if (ClipImage) { RenderShadow(g); region = new Region(graphicsPath); clip = g.Clip; g.Clip = region; } else if (ShadowOffset != 0f) { using (Brush brush = g.GetShadowBrush()) { RectangleF rect = frameRectangle; rect.Offset(ShadowOffset, ShadowOffset); g.FillRectangle(brush, rect); } } ImageAttributes imageAttributes = new ImageAttributes(); if (ImageTransColor != Color.Empty) { imageAttributes.SetColorKey(ImageTransColor, ImageTransColor, ColorAdjustType.Default); } Image image = Common.ImageLoader.LoadImage(Image); Rectangle destRect = new Rectangle((int)Math.Round(frameRectangle.X), (int)Math.Round(frameRectangle.Y), (int)Math.Round(frameRectangle.Width), (int)Math.Round(frameRectangle.Height)); if (!ImageHueColor.IsEmpty) { Color color = g.TransformHueColor(ImageHueColor); ColorMatrix colorMatrix = new ColorMatrix(); colorMatrix.Matrix00 = (float)(int)color.R / 255f; colorMatrix.Matrix11 = (float)(int)color.G / 255f; colorMatrix.Matrix22 = (float)(int)color.B / 255f; imageAttributes.SetColorMatrix(colorMatrix); } ImageSmoothingState imageSmoothingState = new ImageSmoothingState(g); imageSmoothingState.Set(); g.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, imageAttributes); imageSmoothingState.Restore(); if (ClipImage) { g.Clip = clip; } if (BorderWidth > 0 && BorderStyle != 0) { pen = new Pen(BorderColor, BorderWidth); pen.DashStyle = g.GetPenStyle(BorderStyle); pen.Alignment = PenAlignment.Center; if (ClipImage) { g.DrawPath(pen, graphicsPath); } else { g.DrawRectangle(pen, frameRectangle.X, frameRectangle.Y, frameRectangle.Width, frameRectangle.Height); } } } finally { graphicsPath?.Dispose(); pen?.Dispose(); region?.Dispose(); } }