基本上,我在我们的一个应用程序中使用了它:我们想在一个视频帧上叠加一个播放图标:
Image playbutton;try{ playbutton = Image.FromFile();}catch (Exception ex){ return;}Image frame;try{ frame = Image.FromFile();}catch (Exception ex){ return;}using (frame){ using (var bitmap = new Bitmap(width, height)) { using (var canvas = Graphics.FromImage(bitmap)) { canvas.InterpolationMode = InterpolationMode.HighQualityBicubic; canvas.DrawImage(frame, new Rectangle(0, 0, width, height), new Rectangle(0, 0, frame.Width, frame.Height), GraphicsUnit.Pixel); canvas.DrawImage(playbutton, (bitmap.Width / 2) - (playbutton.Width / 2), (bitmap.Height / 2) - (playbutton.Height / 2)); canvas.Save(); } try { bitmap.Save(, System.Drawing.Imaging.ImageFormat.Jpeg); } catch (Exception ex) { } }}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)