public static void RenderSimpleTextVideoClipToFile(VidkaClipTextSimple clip, VidkaProj proj, string outFilename) { Bitmap image = RenderSimpleTextVideoClip(clip, proj); // save all to one jpg file image.Save(outFilename, ImageFormat.Jpeg); image.Dispose(); }
public static Bitmap RenderSimpleTextVideoClip(VidkaClipTextSimple clip, VidkaProj proj) { Bitmap image = new Bitmap(proj.Width, proj.Height); Graphics ggg = Graphics.FromImage(image); ggg.FillRectangle(new SolidBrush(Color.FromArgb(clip.ArgbBackgroundColor)), 0, 0, proj.Width, proj.Height); var font = new Font(FontFamily.GenericSansSerif, clip.FontSize); var ssss = ggg.MeasureString(clip.Text, font); ggg.DrawString(clip.Text, font, new SolidBrush(Color.FromArgb(clip.ArgbFontColor)), (proj.Width - ssss.Width) / 2, (proj.Height - ssss.Height) / 2); ggg.Flush(); return image; }
public void SetVideoClip(VidkaClipTextSimple clip) { VClip = clip; // set all the UI txt.Text = VClip.Text; ddlFontSize.SelectedItem = VClip.FontSize.ToString(); Color clrBckground = Color.FromArgb(VClip.ArgbBackgroundColor); Color clrFont = Color.FromArgb(VClip.ArgbFontColor); pnlColor.BackColor = clrBckground; pnlColor.Invalidate(); colorDialog1.Color = clrBckground; pnlFontColor.BackColor = clrFont; pnlFontColor.Invalidate(); colorDialog2.Color = clrFont; }
public override void Run() { var imgFilename = VidkaIO.MakeUniqueFilename_AuxSimpleText(); var imgFilenameFull = VidkaIO.GetAuxillaryProjFile(Context.CurFileName, imgFilename); var newClip = new VidkaClipTextSimple() { Text = "Hello :)", ArgbBackgroundColor = Color.Black.ToArgb(), ArgbFontColor = Color.White.ToArgb(), FontSize = 20, FileName = imgFilenameFull, FileLengthSec = Settings.Default.ImageClipLengthSeconds, FileLengthFrames = Context.Proj.SecToFrame(Settings.Default.ImageClipLengthSeconds), FrameStart = 0, FrameEnd = Context.Proj.SecToFrame(Settings.Default.TextClipInitialLengthSeconds), }; VidkaIO.RebuildAuxillaryFile_SimpleText(newClip, Context.Proj, Context.MetaGenerator); Context.AddUndoableAction_insertClipAtMarkerPosition(newClip); }
public static void RebuildAuxillaryFile_SimpleText(VidkaClipTextSimple vclip, VidkaProj Proj, MetaGeneratorInOtherThread metaGenerator) { var filename = vclip.FileName; VidkaIO.MakeSureFolderExistsForFile(filename); VidkaImaging.RenderSimpleTextVideoClipToFile(vclip, Proj, filename); metaGenerator.RequestThumbsOnly(filename, true); }