#if NET40 || NET461
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Apewer.Surface
{
///
public static class Extensions
{
/// 保存为 PNG 文件。
public static byte[] SaveAsPng(this Image argThis, bool argDisposeImage = false)
{
return ImageUtility.SaveAsBytes(argThis, ImageFormat.Png, argDisposeImage);
}
/// 保存为 JPEG 文件。
public static byte[] SaveAsJpeg(this Image argThis, bool argDisposeImage = false)
{
return ImageUtility.SaveAsBytes(argThis, ImageFormat.Jpeg, argDisposeImage);
}
///
public static void BeginInvoke(this Control control, Action action)
{
if (action == null) return;
control.BeginInvoke(action as Delegate);
}
///
public static void Invoke(this Control control, Action action)
{
if (action == null) return;
control.Invoke(action as Delegate);
}
}
}
#endif