AV out: add option to pad (instead of stretch) with the video resize output

This commit is contained in:
goyuken 2014-02-07 02:28:07 +00:00
parent 4875831fb9
commit 036dcd8f32
3 changed files with 213 additions and 188 deletions

View File

@ -42,6 +42,7 @@
this.label4 = new System.Windows.Forms.Label();
this.buttonAuto = new System.Windows.Forms.Button();
this.panelSizeSelect = new System.Windows.Forms.Panel();
this.checkBoxPad = new System.Windows.Forms.CheckBox();
this.tableLayoutPanel4.SuspendLayout();
this.panelSizeSelect.SuspendLayout();
this.SuspendLayout();
@ -180,6 +181,7 @@
// panelSizeSelect
//
this.panelSizeSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.panelSizeSelect.Controls.Add(this.checkBoxPad);
this.panelSizeSelect.Controls.Add(this.label4);
this.panelSizeSelect.Controls.Add(this.buttonAuto);
this.panelSizeSelect.Controls.Add(this.numericTextBoxW);
@ -187,9 +189,19 @@
this.panelSizeSelect.Controls.Add(this.label3);
this.panelSizeSelect.Location = new System.Drawing.Point(347, 35);
this.panelSizeSelect.Name = "panelSizeSelect";
this.panelSizeSelect.Size = new System.Drawing.Size(162, 83);
this.panelSizeSelect.Size = new System.Drawing.Size(162, 105);
this.panelSizeSelect.TabIndex = 15;
//
// checkBoxPad
//
this.checkBoxPad.AutoSize = true;
this.checkBoxPad.Location = new System.Drawing.Point(0, 71);
this.checkBoxPad.Name = "checkBoxPad";
this.checkBoxPad.Size = new System.Drawing.Size(45, 17);
this.checkBoxPad.TabIndex = 15;
this.checkBoxPad.Text = "Pad";
this.checkBoxPad.UseVisualStyleBackColor = true;
//
// VideoWriterChooserForm
//
this.AcceptButton = this.buttonOK;
@ -231,5 +243,6 @@
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button buttonAuto;
private System.Windows.Forms.Panel panelSizeSelect;
private System.Windows.Forms.CheckBox checkBoxPad;
}
}

View File

@ -27,7 +27,7 @@ namespace BizHawk.Client.EmuHawk
/// <param name="list">list of IVideoWriters to choose from</param>
/// <param name="owner">parent window</param>
/// <returns>user choice, or null on Cancel\Close\invalid</returns>
public static IVideoWriter DoVideoWriterChoserDlg(IEnumerable<IVideoWriter> list, IWin32Window owner, out int resizew, out int resizeh)
public static IVideoWriter DoVideoWriterChoserDlg(IEnumerable<IVideoWriter> list, IWin32Window owner, out int resizew, out int resizeh, out bool pad)
{
VideoWriterChooserForm dlg = new VideoWriterChooserForm();
@ -67,6 +67,9 @@ namespace BizHawk.Client.EmuHawk
resizew = -1;
resizeh = -1;
}
pad = dlg.checkBoxPad.Checked;
dlg.Dispose();
return ret;
}

View File

@ -967,6 +967,7 @@ namespace BizHawk.Client.EmuHawk
private long _soundRemainder; // audio timekeeping for video dumping
private int _avwriterResizew;
private int _avwriterResizeh;
private bool _avwriterpad;
private bool _exit;
private bool _runloopFrameProgress;
@ -2477,7 +2478,7 @@ namespace BizHawk.Client.EmuHawk
}
else
{
aw = VideoWriterChooserForm.DoVideoWriterChoserDlg(video_writers, GlobalWin.MainForm, out _avwriterResizew, out _avwriterResizeh);
aw = VideoWriterChooserForm.DoVideoWriterChoserDlg(video_writers, GlobalWin.MainForm, out _avwriterResizew, out _avwriterResizeh, out _avwriterpad);
}
foreach (var w in video_writers)
@ -2667,9 +2668,17 @@ namespace BizHawk.Client.EmuHawk
var bmpout = new Bitmap(_avwriterResizew, _avwriterResizeh, PixelFormat.Format32bppArgb);
using (var g = Graphics.FromImage(bmpout))
{
if (_avwriterpad)
{
g.Clear(Color.FromArgb(Global.Emulator.VideoProvider.BackgroundColor));
g.DrawImageUnscaled(bmpin, (bmpout.Width - bmpin.Width) / 2, (bmpout.Height - bmpin.Height) / 2);
}
else
{
g.DrawImage(bmpin, new Rectangle(0, 0, bmpout.Width, bmpout.Height));
}
}
bmpin.Dispose();
output = new BmpVideoProvder(bmpout);