public override void WriteXml(XmlWriter writer) { TypeConverter boolConverter = TypeDescriptor.GetConverter(typeof(bool)); base.WriteXml(writer); writer.WriteElementString("CaptureTop", CaptureTop.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("CaptureLeft", CaptureLeft.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("CaptureWidth", CaptureWidth.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("CaptureHeight", CaptureHeight.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("UpdateFrequency", ReplicationsPerSecond.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("ReplicateOnStart", boolConverter.ConvertToInvariantString(ReplicatesOnProfileStart)); writer.WriteElementString("BlankOnStop", boolConverter.ConvertToInvariantString(BlankOnStop)); }
/// <summary> /// Creates the process arguments. /// </summary> /// <returns>The string that represents the process arguments.</returns> public virtual string CreateProcessArguments() { var sb = new StringBuilder(); sb.Append("-o -"); // output to standard output as opposed to a file. sb.Append($" -t {(CaptureTimeoutMilliseconds < 0 ? "0" : CaptureTimeoutMilliseconds.ToString(Ci))}"); // Basic Width and height if (CaptureWidth > 0 && CaptureHeight > 0) { sb.Append($" -w {CaptureWidth.ToString(Ci)}"); sb.Append($" -h {CaptureHeight.ToString(Ci)}"); } // Display Preview if (CaptureDisplayPreview) { if (CaptureDisplayPreviewInFullScreen) { sb.Append(" -f"); } if (CaptureDisplayPreviewOpacity != byte.MaxValue) { sb.Append($" -op {CaptureDisplayPreviewOpacity.ToString(Ci)}"); } } else { sb.Append(" -n"); // no preview } // Picture Settings if (ImageSharpness != 0) { sb.Append($" -sh {ImageSharpness.Clamp(-100, 100).ToString(Ci)}"); } if (ImageContrast != 0) { sb.Append($" -co {ImageContrast.Clamp(-100, 100).ToString(Ci)}"); } if (ImageBrightness != 50) { sb.Append($" -br {ImageBrightness.Clamp(0, 100).ToString(Ci)}"); } if (ImageSaturation != 0) { sb.Append($" -sa {ImageSaturation.Clamp(-100, 100).ToString(Ci)}"); } if (ImageIso >= 100) { sb.Append($" -ISO {ImageIso.Clamp(100, 800).ToString(Ci)}"); } if (CaptureVideoStabilizationEnabled) { sb.Append(" -vs"); } if (CaptureExposureCompensation != 0) { sb.Append($" -ev {CaptureExposureCompensation.Clamp(-10, 10).ToString(Ci)}"); } if (CaptureExposure != CameraExposureMode.Auto) { sb.Append($" -ex {CaptureExposure.ToString().ToLowerInvariant()}"); } if (CaptureWhiteBalanceControl != CameraWhiteBalanceMode.Auto) { sb.Append($" -awb {CaptureWhiteBalanceControl.ToString().ToLowerInvariant()}"); } if (ImageEffect != CameraImageEffect.None) { sb.Append($" -ifx {ImageEffect.ToString().ToLowerInvariant()}"); } if (ImageColorEffectU >= 0 && ImageColorEffectV >= 0) { sb.Append( $" -cfx {ImageColorEffectU.Clamp(0, 255).ToString(Ci)}:{ImageColorEffectV.Clamp(0, 255).ToString(Ci)}"); } if (CaptureMeteringMode != CameraMeteringMode.Average) { sb.Append($" -mm {CaptureMeteringMode.ToString().ToLowerInvariant()}"); } if (ImageRotation != CameraImageRotation.None) { sb.Append($" -rot {((int)ImageRotation).ToString(Ci)}"); } if (ImageFlipHorizontally) { sb.Append(" -hf"); } if (ImageFlipVertically) { sb.Append(" -vf"); } if (CaptureSensorRoi.IsDefault == false) { sb.Append($" -roi {CaptureSensorRoi}"); } if (CaptureShutterSpeedMicroseconds > 0) { sb.Append($" -ss {CaptureShutterSpeedMicroseconds.Clamp(0, 6000000).ToString(Ci)}"); } if (CaptureDynamicRangeCompensation != CameraDynamicRangeCompensation.Off) { sb.Append($" -drc {CaptureDynamicRangeCompensation.ToString().ToLowerInvariant()}"); } if (CaptureWhiteBalanceControl == CameraWhiteBalanceMode.Off && (CaptureWhiteBalanceGainBlue != 0M || CaptureWhiteBalanceGainRed != 0M)) { sb.Append($" -awbg {CaptureWhiteBalanceGainBlue.ToString(Ci)},{CaptureWhiteBalanceGainRed.ToString(Ci)}"); } if (ImageAnnotationFontSize > 0) { sb.Append($" -ae {ImageAnnotationFontSize.Clamp(6, 160).ToString(Ci)}"); sb.Append($",{(ImageAnnotationFontColor == null ? "0xff" : ImageAnnotationFontColor.ToYuvHex(true))}"); if (ImageAnnotationBackground != null) { ImageAnnotations |= CameraAnnotation.SolidBackground; sb.Append($",{ImageAnnotationBackground.ToYuvHex(true)}"); } } if (ImageAnnotations != CameraAnnotation.None) { sb.Append($" -a {((int)ImageAnnotations).ToString(Ci)}"); } if (string.IsNullOrWhiteSpace(ImageAnnotationsText) == false) { sb.Append($" -a \"{ImageAnnotationsText.Replace("\"", "'")}\""); } return(sb.ToString()); }
private void buttonAuto_Click(object sender, EventArgs e) { numericTextBoxW.Text = CaptureWidth.ToString(); numericTextBoxH.Text = CaptureHeight.ToString(); }