diff --git a/Catalog.sln b/Catalog.sln index 9e1b1a9..8bf525d 100644 --- a/Catalog.sln +++ b/Catalog.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.26403.3 MinimumVisualStudioVersion = 10.0.40219.1 Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ImageCatalog 2", "imagecatalog\ImageCatalog 2.vbproj", "{8D3AA2B0-8F06-4A61-9CAD-B920EB1A8E9C}" EndProject @@ -13,7 +13,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPFCatalog", "WPFCatalog\WP EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CatalogVbLib", "CatalogVbLib\CatalogVbLib.vbproj", "{44465926-240D-473F-90B8-786BA4384406}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaddoLibrary.WPF.NET46", "MaddoLibrary\MaddoLibrary.WPF.NET46\MaddoLibrary.WPF.NET46.csproj", "{73DA19D7-196D-4B16-B610-93250978A607}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{A3D50937-74F6-4DC8-8D89-B534B484C0F9}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -39,48 +39,44 @@ Global {8D3AA2B0-8F06-4A61-9CAD-B920EB1A8E9C}.Release|x86.Build.0 = Release|x86 {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Debug|x64.ActiveCfg = Debug|Any CPU + {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Debug|x64.ActiveCfg = Debug|x64 + {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Debug|x64.Build.0 = Debug|x64 {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Debug|x86.ActiveCfg = Debug|Any CPU {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Release|Any CPU.ActiveCfg = Release|Any CPU {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Release|Any CPU.Build.0 = Release|Any CPU - {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Release|x64.ActiveCfg = Release|Any CPU + {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Release|x64.ActiveCfg = Release|x64 + {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Release|x64.Build.0 = Release|x64 {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Release|x86.ActiveCfg = Release|Any CPU {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Debug|x64.ActiveCfg = Debug|Any CPU + {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Debug|x64.ActiveCfg = Debug|x64 + {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Debug|x64.Build.0 = Debug|x64 {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Debug|x86.ActiveCfg = Debug|Any CPU {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Release|Any CPU.ActiveCfg = Release|Any CPU {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Release|Any CPU.Build.0 = Release|Any CPU - {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Release|x64.ActiveCfg = Release|Any CPU + {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Release|x64.ActiveCfg = Release|x64 + {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Release|x64.Build.0 = Release|x64 {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Release|x86.ActiveCfg = Release|Any CPU {638DE501-CECA-4744-B293-7AE93CAEEB01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {638DE501-CECA-4744-B293-7AE93CAEEB01}.Debug|Any CPU.Build.0 = Debug|Any CPU - {638DE501-CECA-4744-B293-7AE93CAEEB01}.Debug|x64.ActiveCfg = Debug|Any CPU + {638DE501-CECA-4744-B293-7AE93CAEEB01}.Debug|x64.ActiveCfg = Debug|x64 + {638DE501-CECA-4744-B293-7AE93CAEEB01}.Debug|x64.Build.0 = Debug|x64 {638DE501-CECA-4744-B293-7AE93CAEEB01}.Debug|x86.ActiveCfg = Debug|Any CPU {638DE501-CECA-4744-B293-7AE93CAEEB01}.Release|Any CPU.ActiveCfg = Release|Any CPU {638DE501-CECA-4744-B293-7AE93CAEEB01}.Release|Any CPU.Build.0 = Release|Any CPU - {638DE501-CECA-4744-B293-7AE93CAEEB01}.Release|x64.ActiveCfg = Release|Any CPU + {638DE501-CECA-4744-B293-7AE93CAEEB01}.Release|x64.ActiveCfg = Release|x64 + {638DE501-CECA-4744-B293-7AE93CAEEB01}.Release|x64.Build.0 = Release|x64 {638DE501-CECA-4744-B293-7AE93CAEEB01}.Release|x86.ActiveCfg = Release|Any CPU {44465926-240D-473F-90B8-786BA4384406}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {44465926-240D-473F-90B8-786BA4384406}.Debug|Any CPU.Build.0 = Debug|Any CPU - {44465926-240D-473F-90B8-786BA4384406}.Debug|x64.ActiveCfg = Debug|Any CPU + {44465926-240D-473F-90B8-786BA4384406}.Debug|x64.ActiveCfg = Debug|x64 + {44465926-240D-473F-90B8-786BA4384406}.Debug|x64.Build.0 = Debug|x64 {44465926-240D-473F-90B8-786BA4384406}.Debug|x86.ActiveCfg = Debug|Any CPU {44465926-240D-473F-90B8-786BA4384406}.Release|Any CPU.ActiveCfg = Release|Any CPU {44465926-240D-473F-90B8-786BA4384406}.Release|Any CPU.Build.0 = Release|Any CPU - {44465926-240D-473F-90B8-786BA4384406}.Release|x64.ActiveCfg = Release|Any CPU + {44465926-240D-473F-90B8-786BA4384406}.Release|x64.ActiveCfg = Release|x64 + {44465926-240D-473F-90B8-786BA4384406}.Release|x64.Build.0 = Release|x64 {44465926-240D-473F-90B8-786BA4384406}.Release|x86.ActiveCfg = Release|Any CPU - {73DA19D7-196D-4B16-B610-93250978A607}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {73DA19D7-196D-4B16-B610-93250978A607}.Debug|Any CPU.Build.0 = Debug|Any CPU - {73DA19D7-196D-4B16-B610-93250978A607}.Debug|x64.ActiveCfg = Debug|Any CPU - {73DA19D7-196D-4B16-B610-93250978A607}.Debug|x64.Build.0 = Debug|Any CPU - {73DA19D7-196D-4B16-B610-93250978A607}.Debug|x86.ActiveCfg = Debug|Any CPU - {73DA19D7-196D-4B16-B610-93250978A607}.Debug|x86.Build.0 = Debug|Any CPU - {73DA19D7-196D-4B16-B610-93250978A607}.Release|Any CPU.ActiveCfg = Release|Any CPU - {73DA19D7-196D-4B16-B610-93250978A607}.Release|Any CPU.Build.0 = Release|Any CPU - {73DA19D7-196D-4B16-B610-93250978A607}.Release|x64.ActiveCfg = Release|Any CPU - {73DA19D7-196D-4B16-B610-93250978A607}.Release|x64.Build.0 = Release|Any CPU - {73DA19D7-196D-4B16-B610-93250978A607}.Release|x86.ActiveCfg = Release|Any CPU - {73DA19D7-196D-4B16-B610-93250978A607}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CatalogLib/CatalogLib.csproj b/CatalogLib/CatalogLib.csproj index 97c3989..b7c81ff 100644 --- a/CatalogLib/CatalogLib.csproj +++ b/CatalogLib/CatalogLib.csproj @@ -34,18 +34,30 @@ prompt 4 + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + prompt + MinimumRecommendedRules.ruleset + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + - ..\packages\ImageSharp.1.0.0-alpha3-00005\lib\netstandard1.3\ImageSharp.dll + ..\packages\ImageSharp.1.0.0-alpha6-00049\lib\netstandard1.3\ImageSharp.dll - ..\packages\ImageSharp.Drawing.1.0.0-alpha3-00005\lib\netstandard1.1\ImageSharp.Drawing.dll - - - ..\packages\ImageSharp.Drawing.Paths.1.0.0-alpha2-00107\lib\net45\ImageSharp.Drawing.Paths.dll - - - ..\packages\ImageSharp.Drawing.Text.1.0.0-alpha2-00003\lib\net45\ImageSharp.Drawing.Text.dll + ..\packages\ImageSharp.Drawing.1.0.0-alpha6-00010\lib\netstandard1.1\ImageSharp.Drawing.dll ..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll @@ -55,10 +67,10 @@ True - ..\packages\SixLabors.Fonts.0.1.0-alpha0002\lib\netstandard1.3\SixLabors.Fonts.dll + ..\packages\SixLabors.Fonts.0.1.0-alpha0008\lib\netstandard1.3\SixLabors.Fonts.dll - ..\packages\SixLabors.Shapes.0.1.0-alpha0008\lib\netstandard1.1\SixLabors.Shapes.dll + ..\packages\SixLabors.Shapes.0.1.0-alpha0011\lib\netstandard1.1\SixLabors.Shapes.dll diff --git a/CatalogLib/ImgSharpCreator.cs b/CatalogLib/ImgSharpCreator.cs index 96a59c8..527cb74 100644 --- a/CatalogLib/ImgSharpCreator.cs +++ b/CatalogLib/ImgSharpCreator.cs @@ -1,19 +1,33 @@ using System; using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; using System.IO; using System.Linq; +using System.Numerics; using System.Text; using System.Threading.Tasks; using ImageSharp; +using SixLabors.Fonts; +using Color = ImageSharp.Color; +using Font = SixLabors.Fonts.Font; +using FontFamily = SixLabors.Fonts.FontFamily; +using FontStyle = SixLabors.Fonts.FontStyle; +using Image = ImageSharp.Image; namespace CatalogLib { public class ImgSharpCreator : IImageProcessor { + private FileInfo _currentFile; public void Start(FileInfo workFile) { - using (Image image = new Image(workFile.FullName)) + _currentFile = workFile; + + + + using (Image image = Image.Load(workFile.FullName)/* new Image(workFile.FullName)*/) { if (PicSettings.Instance.UsaRotazioneAutomatica) { @@ -68,16 +82,52 @@ namespace CatalogLib } + if (PicSettings.Instance.EnableText) + { + SetExtraText(image); + } + //JpegDecoder j = new JpegDecoder(); + var va = Vector.IsHardwareAccelerated; + + image.Resize(PicSettings.Instance.FotoLarghezza, PicSettings.Instance.FotoAltezza); + //image.Resize(2240, 2240); + //var fff = FontCollection.SystemFonts.Find(PicSettings.Instance.NomeFont); + //var font = new Font(fff, (float)PicSettings.Instance.DimensioneFont, FontStyle.Regular); + //image.DrawText("sssssssssssssssssssssssssssssssssssssssssssssss", font, Color.Black, new Vector2(200, 200)); image.Save(Path.Combine(PicSettings.Instance.DirectoryDestinazione, workFile.Name)); //image.Resize(200, 200).Save(""); } } - private void SetExtraText(ref Image image) + private void SetExtraText(Image image) { - //if () + if (string.IsNullOrWhiteSpace(PicSettings.Instance.TestoApplicareOrizzontale)) + { + Debug.WriteLine($"{_currentFile.Name} No text"); + return; + } + var fff = FontCollection.SystemFonts.Find(PicSettings.Instance.NomeFont); + //var fff = FontCollection.SystemFonts.Find("Segoe Print"); + + var font = new Font(fff, (float)PicSettings.Instance.DimensioneFont, FontStyle.Regular); + //var font = new Font(fff, 8f, FontStyle.Regular); + + + Color c = Color.FromHex(PicSettings.Instance.ColoreTestoRGB); + //image.DrawText(PicSettings.Instance.TestoApplicareOrizzontale, font, Color.Black, ) + image.DrawText(PicSettings.Instance.TestoApplicareOrizzontale, font, Color.Black, new Vector2(200, 200)); + //image.DrawText("sssssssssssssssssssssssssssssssssssssssssssssss", font, Color.Black, new Vector2(200, 200)); + + + //double hr = image.MetaData.HorizontalResolution; + //double vr = image.MetaData.HorizontalResolution; + //image.MetaData.HorizontalResolution = 72; + //image.MetaData.VerticalResolution = 72; + //image.DrawText("sssssssssssssssssssssssssssssssssssssssssssssss", font, Color.Black, new Vector2(200, 200)); + //image.MetaData.HorizontalResolution = hr; + //image.MetaData.VerticalResolution = hr; } } } diff --git a/CatalogLib/PicSettings.cs b/CatalogLib/PicSettings.cs index af92f44..144d601 100644 --- a/CatalogLib/PicSettings.cs +++ b/CatalogLib/PicSettings.cs @@ -142,7 +142,7 @@ namespace CatalogLib // setdouble default } - return (T)_settingsDict[key]; + return (T)_settingsDict[key]; } @@ -302,7 +302,7 @@ namespace CatalogLib public bool GeneraleRotazioneAutomatica { - get { return GetBool("GeneraleRotazioneAutomatica"); } + get { return GetBool("GeneraleRotazioneAutomatica", true); } set { SetBool("GeneraleRotazioneAutomatica", value); } } @@ -378,7 +378,7 @@ namespace CatalogLib set { SetString("FotoSuffisso", value); } } - + public bool EnableThumbnails { get { return GetBool("EnableThumbnails", false); } @@ -410,6 +410,28 @@ namespace CatalogLib set { SetDouble("dimensioneFont", value); } } + public string TestoApplicareOrizzontale + { + get + { + return Get("TestoApplicareOrizzontale", ""); + } + set + { + Set("TestoApplicareOrizzontale", value); + } + } + + public string ColoreTestoRGB + { + get { return GetString("coloreTestoRGB", "#000000"); } + set + { + Set("coloreTestoRGB", value); + + } + } + #endregion diff --git a/CatalogLib/packages.config b/CatalogLib/packages.config index 0c0fd12..f61b9a4 100644 --- a/CatalogLib/packages.config +++ b/CatalogLib/packages.config @@ -1,15 +1,13 @@  - - - - + + - - + + diff --git a/CatalogVbLib/CatalogVbLib.vbproj b/CatalogVbLib/CatalogVbLib.vbproj index 638fdd4..efab3b3 100644 --- a/CatalogVbLib/CatalogVbLib.vbproj +++ b/CatalogVbLib/CatalogVbLib.vbproj @@ -46,6 +46,27 @@ On + + true + true + true + bin\x64\Debug\ + CatalogVbLib.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + full + x64 + MinimumRecommendedRules.ruleset + + + true + bin\x64\Release\ + CatalogVbLib.xml + true + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + pdbonly + x64 + MinimumRecommendedRules.ruleset + diff --git a/ImageCatalogCS/ImageCatalog 3.csproj b/ImageCatalogCS/ImageCatalog 3.csproj index e134fca..993bc20 100644 --- a/ImageCatalogCS/ImageCatalog 3.csproj +++ b/ImageCatalogCS/ImageCatalog 3.csproj @@ -35,6 +35,26 @@ prompt 4 + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + prompt + MinimumRecommendedRules.ruleset + true + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + true + diff --git a/WPFCatalog/App.config b/WPFCatalog/App.config index 433728a..fecd1c7 100644 --- a/WPFCatalog/App.config +++ b/WPFCatalog/App.config @@ -4,6 +4,7 @@ + diff --git a/WPFCatalog/App.xaml b/WPFCatalog/App.xaml index b17e4a8..9388e68 100644 --- a/WPFCatalog/App.xaml +++ b/WPFCatalog/App.xaml @@ -1,5 +1,20 @@ - - - + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WPFCatalog/Controls/GeneralSettingsControl.xaml b/WPFCatalog/Controls/GeneralSettingsControl.xaml new file mode 100644 index 0000000..9f511c8 --- /dev/null +++ b/WPFCatalog/Controls/GeneralSettingsControl.xaml @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WPFCatalog/Controls/GeneralSettingsControl.xaml.cs b/WPFCatalog/Controls/GeneralSettingsControl.xaml.cs new file mode 100644 index 0000000..af3e0aa --- /dev/null +++ b/WPFCatalog/Controls/GeneralSettingsControl.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace WPFCatalog.Controls +{ + /// + /// Interaction logic for GeneralSettingsControl.xaml + /// + public partial class GeneralSettingsControl : UserControl + { + public GeneralSettingsControl() + { + InitializeComponent(); + } + } +} diff --git a/WPFCatalog/Controls/TextSettingsControl.xaml b/WPFCatalog/Controls/TextSettingsControl.xaml new file mode 100644 index 0000000..27566c6 --- /dev/null +++ b/WPFCatalog/Controls/TextSettingsControl.xaml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WPFCatalog/Controls/TextSettingsControl.xaml.cs b/WPFCatalog/Controls/TextSettingsControl.xaml.cs new file mode 100644 index 0000000..2c29c51 --- /dev/null +++ b/WPFCatalog/Controls/TextSettingsControl.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace WPFCatalog.Controls +{ + /// + /// Interaction logic for TextSettingsControl.xaml + /// + public partial class TextSettingsControl : UserControl + { + public TextSettingsControl() + { + InitializeComponent(); + } + } +} diff --git a/WPFCatalog/Converters/MaddoColorConverter.cs b/WPFCatalog/Converters/MaddoColorConverter.cs index d26a440..2248484 100644 --- a/WPFCatalog/Converters/MaddoColorConverter.cs +++ b/WPFCatalog/Converters/MaddoColorConverter.cs @@ -14,7 +14,7 @@ namespace WPFCatalog { public class MaddoColorConverter : IValueConverter { - private DependencyObject _dummy = new DependencyObject(); + private static readonly DependencyObject _dummy = new DependencyObject(); public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/WPFCatalog/MainWindow.xaml b/WPFCatalog/MainWindow.xaml index d13b68f..e9fb26c 100644 --- a/WPFCatalog/MainWindow.xaml +++ b/WPFCatalog/MainWindow.xaml @@ -1,10 +1,14 @@ - - - + - - - - - - - - - + + + + + + + + + + - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - + + + + - - - - + + - + + + + + + + + + + + - + + + + + - - - + + + + + + + + + + + + + + + + + + + + +