using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace Common_Base.GDI
{
/// <summary>
/// 待绘制的信息类
/// </summary>
public class TextList
{
/// <summary>
/// 信息
/// </summary>
public string Info { get; set; }
/// <summary>
/// 信息X轴坐标
/// </summary>
public float InfoX { get; set; }
/// <summary>
/// 信息Y轴坐标
/// </summary>
public float InfoY { get; set; }
/// <summary>
/// 时间
/// </summary>
public string DateTime { get; set; }
/// <summary>
/// 时间X轴坐标
/// </summary>
public float DateTimeX { get; set; }
/// <summary>
/// 时间Y轴坐标
/// </summary>
public float DateTimeY { get; set; }
/// <summary>
/// 图片X轴坐标
/// </summary>
public int PhotoX { get; set; }
/// <summary>
/// 图片Y轴坐标
/// </summary>
public int PhotoY { get; set; }
}
public class ImagesUtil
{
public Image SetImagesText(Image image, TextList textList)
{
Graphics g = Graphics.FromImage(image);
g.DrawImage(image, 0, 0, image.Width, image.Height);
Font f = new Font("Verdana", 32);
Brush b = new SolidBrush(Color.Red);
g.DrawString(textList.Info, f, b,textList.InfoX,textList.InfoY);
g.DrawString(textList.DateTime, f, b, textList.DateTimeX, textList.DateTimeY);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.Dispose();
return image;
}
public Image SetImagesPhoto(Image image, Image myImage,TextList textList)
{
Graphics g = Graphics.FromImage(image);
g.DrawImage(myImage, new Rectangle(textList.PhotoX, textList.PhotoY, myImage.Width, myImage.Height),
0,0 , myImage.Width, myImage.Height, GraphicsUnit.Pixel);
g.SmoothingMode = SmoothingMode.AntiAlias;
g.Dispose();
return image;
}
}
}