private void toImg(int YeNum)
{
string[] text={"啊啊啊啊啊啊啊啊","吱吱吱吱吱吱吱吱"};
float fontSize = 10.0f;
filePath = "Assets/Book-Page Curl/Example/sprites/base0.png";
System.Drawing.Image image = System.Drawing.Image.FromFile(filePath);
Bitmap bitmap = new Bitmap(image, image.Width, image.Height);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap);
System.Drawing.Font font = new System.Drawing.Font("楷体", fontSize, System.Drawing.FontStyle.Bold);
for (int i = 0; i < text.Length; i++)
g.DrawString(text[i], font, Brushes.Black, 10, (i + 1) * (fontSize + 10f));
string path = "Assets/Book-Page Curl/Example/sprites/page" + YeNum + ".png";
bitmap.Save(path, System.Drawing.Imaging.ImageFormat.Png);
g.Dispose();
bitmap.Dispose();
image.Dispose();
}
unity 将string类型的文字打印到图片上
最新推荐文章于 2024-04-13 15:00:00 发布