📄 impoverlaytranformex.cs
字号:
namespace Imps.Utils
{
using System;
using System.Drawing;
public sealed class ImpOverlayTranformEx : ImpOverlayTranform
{
public ImpOverlayTranformEx(Image overlapImage, Rectangle destRectangle) : this(overlapImage, destRectangle.X, destRectangle.Y, destRectangle.Size)
{
}
public ImpOverlayTranformEx(Image overlapImage, Point postion, Size size) : this(overlapImage, postion, size.Width, size.Height)
{
}
public ImpOverlayTranformEx(Image overlapImage, Point postion, int width, int height) : this(overlapImage, postion.X, postion.Y, width, height)
{
}
public ImpOverlayTranformEx(Image overlapImage, int x, int y, Size size) : this(overlapImage, x, y, size.Width, size.Height)
{
}
public ImpOverlayTranformEx(Image overlapImage, int x, int y, int width, int height) : base(overlapImage, x, y, width, height)
{
}
public override IImage Transform(IImage image)
{
if (image == null)
{
throw new ArgumentNullException("image");
}
IImage image2 = null;
int num = base.X + base.Width;
int num2 = base.Y + base.Height;
if ((num < image.Width) && (num2 < image.Height))
{
return base.Transform(image);
}
int width = (num > image.Width) ? num : image.Width;
int height = (num2 > image.Height) ? num2 : image.Height;
try
{
image2 = (IImage) image.Clone();
using (Image image3 = image.Image)
{
using (Image image4 = new Bitmap(width, height, image3.PixelFormat))
{
using (Graphics graphics = Graphics.FromImage(image4))
{
graphics.DrawImage(image3, 0, 0, image3.Width, image3.Height);
graphics.DrawImage(base.OverlapImage, base.X, base.Y, base.Width, base.Height);
}
image2.Image = image4;
}
}
return image2;
}
catch (Exception)
{
if (image2 != null)
{
image2.Dispose();
}
return null;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -