-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added drag-n-drop support for Convert and Scale tabs, improved previewer
- Loading branch information
N00MKRAD
committed
Jul 28, 2020
1 parent
240ab44
commit 719894e
Showing
16 changed files
with
204 additions
and
40 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
|
||
namespace MagickUtils | ||
{ | ||
using IF = Program.ImageFormat; | ||
|
||
class ConvertTabHelper | ||
{ | ||
public static void ConvertFileList (string[] files, ComboBox qualityCombox, ComboBox qualityMaxCombox, IF selectedFormat, CheckBox delSrcCbox) | ||
{ | ||
int qMin = int.Parse(qualityCombox.Text.Trim()); | ||
int qMax = qMin; | ||
if(!string.IsNullOrWhiteSpace(qualityMaxCombox.Text.Trim())) | ||
qMax = int.Parse(qualityMaxCombox.Text.Trim()); | ||
|
||
foreach(string file in files) | ||
{ | ||
Program.Print("Convert Dragndrop: " + file); | ||
if(!IOUtils.IsPathDirectory(file)) | ||
{ | ||
if(selectedFormat == IF.JPG) | ||
ConvertUtils.ConvertToJpegRandomQuality(file, qMin, qMax, delSrcCbox.Checked); | ||
|
||
if(selectedFormat == IF.PNG) | ||
ConvertUtils.ConvertToPng(file, qMin, delSrcCbox.Checked); | ||
|
||
if(selectedFormat == IF.DDS) | ||
{ | ||
if(FormatOptions.ddsUseCrunch) ConvertUtilsUI.ConvertDirToDdsCrunch(qMin, qMax, delSrcCbox.Checked); | ||
else ConvertUtils.ConvertToDds(file, delSrcCbox.Checked); | ||
} | ||
|
||
if(selectedFormat == IF.TGA) | ||
ConvertUtils.ConvertToTga(file, delSrcCbox.Checked); | ||
|
||
if(selectedFormat == IF.WEBP) | ||
ConvertUtils.ConvertToWebp(file, qMin, delSrcCbox.Checked); | ||
|
||
if(selectedFormat == IF.J2K) | ||
ConvertUtils.ConvertToJpeg2000(file, qMin, delSrcCbox.Checked); | ||
|
||
if(selectedFormat == IF.FLIF) | ||
FlifInterface.EncodeImage(file, qMin, delSrcCbox.Checked); | ||
} | ||
} | ||
} | ||
|
||
public static void ConvertUsingPath (ComboBox qualityCombox, ComboBox qualityMaxCombox, IF selectedFormat, CheckBox delSrcCbox) | ||
{ | ||
int qMin = int.Parse(qualityCombox.Text.Trim()); | ||
int qMax = qMin; | ||
if(!string.IsNullOrWhiteSpace(qualityMaxCombox.Text.Trim())) | ||
qMax = int.Parse(qualityMaxCombox.Text.Trim()); | ||
|
||
if(selectedFormat == IF.JPG) | ||
ConvertUtilsUI.ConvertDirToJpeg(qMin, qMax, delSrcCbox.Checked); | ||
|
||
if(selectedFormat == IF.PNG) | ||
ConvertUtilsUI.ConvertDirToPng(qMin, delSrcCbox.Checked); | ||
|
||
if(selectedFormat == IF.DDS) | ||
{ | ||
if(FormatOptions.ddsUseCrunch) ConvertUtilsUI.ConvertDirToDdsCrunch(qMin, qMax, delSrcCbox.Checked); | ||
else ConvertUtilsUI.ConvertDirToDds(delSrcCbox.Checked); | ||
} | ||
|
||
if(selectedFormat == IF.TGA) | ||
ConvertUtilsUI.ConvertDirToTga(delSrcCbox.Checked); | ||
|
||
if(selectedFormat == IF.WEBP) | ||
ConvertUtilsUI.ConvertDirToWebp(qMin, delSrcCbox.Checked); | ||
|
||
if(selectedFormat == IF.J2K) | ||
ConvertUtilsUI.ConvertDirToJpeg2000(qMin, delSrcCbox.Checked); | ||
|
||
if(selectedFormat == IF.FLIF) | ||
ConvertUtilsUI.ConvertDirToFlif(qMin, delSrcCbox.Checked); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
|
||
namespace MagickUtils | ||
{ | ||
class ScaleTabHelper | ||
{ | ||
public static void ScaleUsingPath (ComboBox minScaleCombox, ComboBox maxScaleCombox, ComboBox filterModeCombox) | ||
{ | ||
int sMin = int.Parse(minScaleCombox.Text); | ||
int sMax = sMin; | ||
if(!string.IsNullOrWhiteSpace(maxScaleCombox.Text.Trim())) | ||
sMax = int.Parse(maxScaleCombox.Text); | ||
int filterMode = filterModeCombox.SelectedIndex; | ||
ScaleUtilsUI.ScaleDir(sMin, sMax, filterMode); | ||
} | ||
|
||
public static void ScaleFileList (string[] files, ComboBox minScaleCombox, ComboBox maxScaleCombox, ComboBox filterModeCombox) | ||
{ | ||
int sMin = int.Parse(minScaleCombox.Text); | ||
int sMax = sMin; | ||
if(!string.IsNullOrWhiteSpace(maxScaleCombox.Text.Trim())) | ||
sMax = int.Parse(maxScaleCombox.Text); | ||
int filterMode = filterModeCombox.SelectedIndex; | ||
|
||
foreach(string file in files) | ||
{ | ||
ScaleUtils.Scale(file, sMin, sMax, filterMode); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
72d791692f1ddb3a3c0435f36a6c41aa32ffe65a | ||
bdc25d94445612a77604be9b2c17d54738aec9cc |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.