From ddc6f32425335465ee562ce92fb6281acf35762f Mon Sep 17 00:00:00 2001 From: Dwedit Date: Sun, 3 Jul 2022 00:19:29 -0500 Subject: [PATCH] remove noise option from encoder options form --- JxlExample/EncoderOptionsForm2.Designer.cs | 42 +++------------------- JxlExample/EncoderOptionsForm2.cs | 18 ---------- JxlExample/EncoderOptionsForm2.resx | 4 +-- 3 files changed, 6 insertions(+), 58 deletions(-) diff --git a/JxlExample/EncoderOptionsForm2.Designer.cs b/JxlExample/EncoderOptionsForm2.Designer.cs index b3775a8..cce2e73 100644 --- a/JxlExample/EncoderOptionsForm2.Designer.cs +++ b/JxlExample/EncoderOptionsForm2.Designer.cs @@ -44,12 +44,9 @@ private void InitializeComponent() this.txtQuality = new System.Windows.Forms.TextBox(); this.lblQuality = new System.Windows.Forms.Label(); this.lblQualityHelp = new System.Windows.Forms.Label(); - this.lblNoise = new System.Windows.Forms.Label(); - this.txtNoise = new System.Windows.Forms.TextBox(); this.chkPreserveColor = new System.Windows.Forms.CheckBox(); this.cmdOK = new System.Windows.Forms.Button(); this.cmdCancel = new System.Windows.Forms.Button(); - this.lblNoiseHelp = new System.Windows.Forms.Label(); this.boxCompressionMode.SuspendLayout(); this.SuspendLayout(); // @@ -208,26 +205,10 @@ private void InitializeComponent() this.lblQualityHelp.TabIndex = 7; this.lblQualityHelp.Text = resources.GetString("lblQualityHelp.Text"); // - // lblNoise - // - this.lblNoise.AutoSize = true; - this.lblNoise.Location = new System.Drawing.Point(9, 232); - this.lblNoise.Name = "lblNoise"; - this.lblNoise.Size = new System.Drawing.Size(56, 13); - this.lblNoise.TabIndex = 11; - this.lblNoise.Text = "Add &Noise"; - // - // txtNoise - // - this.txtNoise.Location = new System.Drawing.Point(12, 248); - this.txtNoise.Name = "txtNoise"; - this.txtNoise.Size = new System.Drawing.Size(100, 20); - this.txtNoise.TabIndex = 12; - // // chkPreserveColor // this.chkPreserveColor.AutoSize = true; - this.chkPreserveColor.Location = new System.Drawing.Point(12, 278); + this.chkPreserveColor.Location = new System.Drawing.Point(12, 235); this.chkPreserveColor.Name = "chkPreserveColor"; this.chkPreserveColor.Size = new System.Drawing.Size(212, 17); this.chkPreserveColor.TabIndex = 13; @@ -237,7 +218,7 @@ private void InitializeComponent() // cmdOK // this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK; - this.cmdOK.Location = new System.Drawing.Point(338, 300); + this.cmdOK.Location = new System.Drawing.Point(338, 257); this.cmdOK.Name = "cmdOK"; this.cmdOK.Size = new System.Drawing.Size(75, 23); this.cmdOK.TabIndex = 14; @@ -248,35 +229,23 @@ private void InitializeComponent() // cmdCancel // this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.cmdCancel.Location = new System.Drawing.Point(419, 300); + this.cmdCancel.Location = new System.Drawing.Point(419, 257); this.cmdCancel.Name = "cmdCancel"; this.cmdCancel.Size = new System.Drawing.Size(75, 23); this.cmdCancel.TabIndex = 15; this.cmdCancel.Text = "Cancel"; this.cmdCancel.UseVisualStyleBackColor = true; // - // lblNoiseHelp - // - this.lblNoiseHelp.AutoSize = true; - this.lblNoiseHelp.Location = new System.Drawing.Point(144, 238); - this.lblNoiseHelp.Name = "lblNoiseHelp"; - this.lblNoiseHelp.Size = new System.Drawing.Size(252, 26); - this.lblNoiseHelp.TabIndex = 10; - this.lblNoiseHelp.Text = "Adds noise to the image.\r\n0 = no noise, 100 = some noise, 3600 = lots of noise"; - // // EncoderOptionsForm2 // this.AcceptButton = this.cmdOK; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.cmdCancel; - this.ClientSize = new System.Drawing.Size(506, 335); - this.Controls.Add(this.lblNoiseHelp); + this.ClientSize = new System.Drawing.Size(506, 292); this.Controls.Add(this.cmdCancel); this.Controls.Add(this.cmdOK); this.Controls.Add(this.chkPreserveColor); - this.Controls.Add(this.lblNoise); - this.Controls.Add(this.txtNoise); this.Controls.Add(this.lblQualityHelp); this.Controls.Add(this.lblQuality); this.Controls.Add(this.txtQuality); @@ -314,11 +283,8 @@ private void InitializeComponent() private System.Windows.Forms.TextBox txtQuality; private System.Windows.Forms.Label lblQuality; private System.Windows.Forms.Label lblQualityHelp; - private System.Windows.Forms.Label lblNoise; - private System.Windows.Forms.TextBox txtNoise; private System.Windows.Forms.CheckBox chkPreserveColor; private System.Windows.Forms.Button cmdOK; private System.Windows.Forms.Button cmdCancel; - private System.Windows.Forms.Label lblNoiseHelp; } } \ No newline at end of file diff --git a/JxlExample/EncoderOptionsForm2.cs b/JxlExample/EncoderOptionsForm2.cs index f4ad957..56a5d9f 100644 --- a/JxlExample/EncoderOptionsForm2.cs +++ b/JxlExample/EncoderOptionsForm2.cs @@ -47,18 +47,12 @@ private void SetOptions() { quality = 1; } - int noiseLevel; - if (!int.TryParse(txtNoise.Text, out noiseLevel)) - { - noiseLevel = 0; - } int keepInvisible = chkPreserveColor.Checked ? 1: 0; this.EncoderOptions.LossyMode = lossyMode; this.EncoderOptions.Quality = quality; this.EncoderOptions.Settings[JxlEncoderFrameSettingId.Effort] = effort; this.EncoderOptions.Settings[JxlEncoderFrameSettingId.DecodingSpeed] = decodeSpeed; - this.EncoderOptions.Settings[JxlEncoderFrameSettingId.PhotonNoise] = noiseLevel; this.EncoderOptions.Settings[JxlEncoderFrameSettingId.KeepInvisible] = keepInvisible; } @@ -84,16 +78,6 @@ private void ReadOptions() decodingSpeed = 0; } - int photonNoise = 0; - if (this.EncoderOptions.Settings.TryGetValue(JxlEncoderFrameSettingId.PhotonNoise, out photonNoise) && photonNoise != -1) - { - - } - else - { - photonNoise = 0; - } - int keepInvisible = 0; if (this.EncoderOptions.Settings.TryGetValue(JxlEncoderFrameSettingId.KeepInvisible, out keepInvisible) && keepInvisible != -1) { @@ -144,7 +128,6 @@ private void ReadOptions() } txtQuality.Text = Math.Round(quality, 4).ToString(); - txtNoise.Text = photonNoise.ToString(); chkPreserveColor.Checked = keepInvisible == 1; } } @@ -159,7 +142,6 @@ public EncoderOptions() this.LossyMode = JxlLossyMode.Default; this.Settings[JxlEncoderFrameSettingId.Effort] = 7; this.Settings[JxlEncoderFrameSettingId.DecodingSpeed] = 0; - this.Settings[JxlEncoderFrameSettingId.PhotonNoise] = 0; this.Settings[JxlEncoderFrameSettingId.KeepInvisible] = 1; this.Quality = 1.0f; } diff --git a/JxlExample/EncoderOptionsForm2.resx b/JxlExample/EncoderOptionsForm2.resx index f776982..edf88de 100644 --- a/JxlExample/EncoderOptionsForm2.resx +++ b/JxlExample/EncoderOptionsForm2.resx @@ -112,10 +112,10 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Sets the distance level for lossy compression