private static Brush ConvertBrush(M.Brush b) { M.SolidColorBrush b2 = b as M.SolidColorBrush; if (b2 == null) return Brushes.White; return new SolidBrush(Color.FromArgb(b2.Color.A, b2.Color.R, b2.Color.G, b2.Color.B)); }
Color ConvertToSystemDrawingColor(Wpf.Color? color, Wpf.Color defaultColor) { Wpf.Color colorValue = defaultColor; if (color.HasValue) { colorValue = color.Value; } return Color.FromArgb(colorValue.A, colorValue.R, colorValue.G, colorValue.B); }
public static Icon Generate(double percent, M.Brush c0a, M.Brush c1a) { Bitmap bmp = new Bitmap(16, 16, PixelFormat.Format24bppRgb); using (Graphics g = Graphics.FromImage(bmp)) { //g.FillEllipse(Brushes.Red, 0, 0, 16, 16); // Greenscreen effect - set everything to a transparent colour // determined by what is at 0,15. g.FillRectangle(Brushes.LawnGreen, 0, 0, 16, 16); g.FillPie(ConvertBrush(c1a), 1.0f, 1.0f, 14.0f, 14.0f, 0.0f, 360.0f); g.FillPie(ConvertBrush(c0a), 1.0f, 1.0f, 14.0f, 14.0f, -90.0f, (float)(360.0f * percent)); } return Converter.BitmapToIcon(bmp); }
UInt32 GetOleColor(Wpf.Color? color, Wpf.Color defaultColor) { var convertedColor = ConvertToSystemDrawingColor(color, defaultColor); return (UInt32)ColorTranslator.ToOle(convertedColor); }
public MatrixHandler (swm.Matrix matrix) { control = matrix; }
public static Gdi.Color WpfColorToGdiColour(Wpf.Color wpfC) { return Gdi.Color.FromArgb(wpfC.A, wpfC.R, wpfC.G, wpfC.B); }
public static void Deallocate(WIC.DrawingVisual jpg) { jpg = null; }
public static void Deallocate(WIC.DrawingGroup jpg) { jpg = null; }
public static void Deallocate(WIC.RectangleGeometry rect) { rect = null; }
public static void Deallocate(WIC.GeometryDrawing geo) { geo = null; }
public static void Deallocate(WIC.DrawingImage gImg) { gImg = null; }
public static void Deallocate(WIC.DrawingBrush dBrush) { dBrush = null; }
public static void Deallocate(WIC.ImageBrush iBrush) { iBrush = null; }