Exemple #1
0
        public static void WithAntialiasMode(this ID2D1DeviceContext context, D2D1_ANTIALIAS_MODE mode, Action action)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }

            var old = context.GetAntialiasMode();

            try
            {
                context.SetAntialiasMode(mode);
                action();
            }
            finally
            {
                context.SetAntialiasMode(old);
            }
        }