├── PhotoEditor ├── Assets │ ├── bg1.png │ ├── StoreLogo.png │ ├── SplashScreen.scale-200.png │ ├── LockScreenLogo.scale-200.png │ ├── Square44x44Logo.scale-200.png │ ├── Wide310x150Logo.scale-200.png │ ├── Square150x150Logo.scale-200.png │ └── Square44x44Logo.targetsize-24_altform-unplated.png ├── packages.config ├── pch.cpp ├── App.idl ├── App.xaml ├── MainPage.idl ├── Package.appxmanifest ├── App.h ├── DetailPage.idl ├── Photo.idl ├── PhotoEditor.vcxproj.filters ├── Photo.cpp ├── pch.h ├── App.cpp ├── MainPage.h ├── Photo.h ├── MainPage.xaml ├── DetailPage.h ├── PhotoEditor.vcxproj ├── MainPage.cpp ├── DetailPage.cpp └── DetailPage.xaml ├── Screenshots └── PhotoEditorBanner.png ├── CONTRIBUTING.md ├── LICENSE.md ├── PhotoEditor.sln ├── .gitattributes ├── SECURITY.md ├── .gitignore └── README.md /PhotoEditor/Assets/bg1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Windows-appsample-photo-editor/HEAD/PhotoEditor/Assets/bg1.png -------------------------------------------------------------------------------- /PhotoEditor/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Windows-appsample-photo-editor/HEAD/PhotoEditor/Assets/StoreLogo.png -------------------------------------------------------------------------------- /Screenshots/PhotoEditorBanner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Windows-appsample-photo-editor/HEAD/Screenshots/PhotoEditorBanner.png -------------------------------------------------------------------------------- /PhotoEditor/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Windows-appsample-photo-editor/HEAD/PhotoEditor/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /PhotoEditor/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Windows-appsample-photo-editor/HEAD/PhotoEditor/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /PhotoEditor/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Windows-appsample-photo-editor/HEAD/PhotoEditor/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /PhotoEditor/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Windows-appsample-photo-editor/HEAD/PhotoEditor/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /PhotoEditor/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Windows-appsample-photo-editor/HEAD/PhotoEditor/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /PhotoEditor/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Windows-appsample-photo-editor/HEAD/PhotoEditor/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /PhotoEditor/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | This project welcomes contributions and suggestions. Most contributions require you to agree to a 4 | Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us 5 | the rights to use your contribution. For details, visit https://cla.microsoft.com. 6 | 7 | When you submit a pull request, a CLA-bot will automatically determine whether you need to provide 8 | a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions 9 | provided by the bot. You will only need to do this once across all repos using our CLA. 10 | 11 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 12 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or 13 | contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE -------------------------------------------------------------------------------- /PhotoEditor/pch.cpp: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------------- 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // The MIT License (MIT) 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE 23 | // --------------------------------------------------------------------------------- 24 | 25 | #include "pch.h" 26 | -------------------------------------------------------------------------------- /PhotoEditor/App.idl: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------------- 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // The MIT License (MIT) 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE 23 | // --------------------------------------------------------------------------------- 24 | 25 | namespace PhotoEditor 26 | { 27 | } -------------------------------------------------------------------------------- /PhotoEditor/App.xaml: -------------------------------------------------------------------------------- 1 | 24 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /PhotoEditor/MainPage.idl: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------------- 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // The MIT License (MIT) 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE 23 | // --------------------------------------------------------------------------------- 24 | 25 | namespace PhotoEditor 26 | { 27 | runtimeclass MainPage : Windows.UI.Xaml.Controls.Page, Windows.UI.Xaml.Data.INotifyPropertyChanged 28 | { 29 | MainPage(); 30 | Windows.Foundation.Collections.IVector Photos{ get; }; 31 | Windows.Foundation.IAsyncAction StartConnectedAnimationForBackNavigation(); 32 | } 33 | } -------------------------------------------------------------------------------- /PhotoEditor/Package.appxmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PhotoEditorCppWinRT 7 | Microsoft 8 | Assets\StoreLogo.png 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /PhotoEditor/App.h: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------------- 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // The MIT License (MIT) 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE 23 | // --------------------------------------------------------------------------------- 24 | 25 | #pragma once 26 | #include "App.xaml.g.h" 27 | 28 | namespace winrt::PhotoEditor::implementation 29 | { 30 | struct App : public AppT 31 | { 32 | App(); 33 | Windows::UI::Xaml::Controls::Frame CreateRootFrame(); 34 | 35 | void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs const&); 36 | void OnNavigationFailed(IInspectable const&, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs const&); 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /PhotoEditor/DetailPage.idl: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------------- 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // The MIT License (MIT) 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE 23 | // --------------------------------------------------------------------------------- 24 | 25 | import "Photo.idl"; 26 | 27 | namespace PhotoEditor 28 | { 29 | runtimeclass DetailPage : Windows.UI.Xaml.Controls.Page 30 | { 31 | DetailPage(); 32 | Photo Item; 33 | void ResetColorEffects(); 34 | void ResetLightEffects(); 35 | void ResetBlurEffects(); 36 | void ResetSepiaEffects(); 37 | void FitToScreen(); 38 | void ShowActualSize(); 39 | void UpdateZoomState(); 40 | void UpdateEffectBrush(String var); 41 | void ResetEffects(); 42 | } 43 | } -------------------------------------------------------------------------------- /PhotoEditor/Photo.idl: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------------- 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // The MIT License (MIT) 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE 23 | // --------------------------------------------------------------------------------- 24 | 25 | namespace PhotoEditor 26 | { 27 | runtimeclass Photo : Windows.UI.Xaml.Data.INotifyPropertyChanged 28 | { 29 | Photo(); 30 | Photo(Windows.Storage.FileProperties.ImageProperties props, Windows.Storage.StorageFile imageFile, String name, String type); 31 | Windows.Storage.StorageFile ImageFile{ get; }; 32 | Windows.Storage.FileProperties.ImageProperties ImageProperties{ get; }; 33 | String ImageName{ get; }; 34 | String ImageFileType{ get; }; 35 | String ImageDimensions{ get; }; 36 | String ImageTitle; 37 | Single Exposure; 38 | Single Temperature; 39 | Single Tint; 40 | Single Contrast; 41 | Single Saturation; 42 | Single BlurAmount; 43 | Single Intensity; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /PhotoEditor.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27130.2027 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PhotoEditor", "PhotoEditor\PhotoEditor.vcxproj", "{A7508B85-CF3D-4D77-8442-71255C16F18C}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|ARM = Debug|ARM 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|ARM = Release|ARM 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {A7508B85-CF3D-4D77-8442-71255C16F18C}.Debug|ARM.ActiveCfg = Debug|ARM 19 | {A7508B85-CF3D-4D77-8442-71255C16F18C}.Debug|ARM.Build.0 = Debug|ARM 20 | {A7508B85-CF3D-4D77-8442-71255C16F18C}.Debug|ARM.Deploy.0 = Debug|ARM 21 | {A7508B85-CF3D-4D77-8442-71255C16F18C}.Debug|x64.ActiveCfg = Debug|x64 22 | {A7508B85-CF3D-4D77-8442-71255C16F18C}.Debug|x64.Build.0 = Debug|x64 23 | {A7508B85-CF3D-4D77-8442-71255C16F18C}.Debug|x64.Deploy.0 = Debug|x64 24 | {A7508B85-CF3D-4D77-8442-71255C16F18C}.Debug|x86.ActiveCfg = Debug|Win32 25 | {A7508B85-CF3D-4D77-8442-71255C16F18C}.Debug|x86.Build.0 = Debug|Win32 26 | {A7508B85-CF3D-4D77-8442-71255C16F18C}.Debug|x86.Deploy.0 = Debug|Win32 27 | {A7508B85-CF3D-4D77-8442-71255C16F18C}.Release|ARM.ActiveCfg = Release|ARM 28 | {A7508B85-CF3D-4D77-8442-71255C16F18C}.Release|ARM.Build.0 = Release|ARM 29 | {A7508B85-CF3D-4D77-8442-71255C16F18C}.Release|ARM.Deploy.0 = Release|ARM 30 | {A7508B85-CF3D-4D77-8442-71255C16F18C}.Release|x64.ActiveCfg = Release|x64 31 | {A7508B85-CF3D-4D77-8442-71255C16F18C}.Release|x64.Build.0 = Release|x64 32 | {A7508B85-CF3D-4D77-8442-71255C16F18C}.Release|x64.Deploy.0 = Release|x64 33 | {A7508B85-CF3D-4D77-8442-71255C16F18C}.Release|x86.ActiveCfg = Release|Win32 34 | {A7508B85-CF3D-4D77-8442-71255C16F18C}.Release|x86.Build.0 = Release|Win32 35 | {A7508B85-CF3D-4D77-8442-71255C16F18C}.Release|x86.Deploy.0 = Release|Win32 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | GlobalSection(ExtensibilityGlobals) = postSolution 41 | SolutionGuid = {484FD872-8061-4A4E-9DB9-47203B841EA9} 42 | EndGlobalSection 43 | EndGlobal 44 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Security 4 | 5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). 6 | 7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. 8 | 9 | ## Reporting Security Issues 10 | 11 | **Please do not report security vulnerabilities through public GitHub issues.** 12 | 13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). 14 | 15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). 16 | 17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). 18 | 19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: 20 | 21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) 22 | * Full paths of source file(s) related to the manifestation of the issue 23 | * The location of the affected source code (tag/branch/commit or direct URL) 24 | * Any special configuration required to reproduce the issue 25 | * Step-by-step instructions to reproduce the issue 26 | * Proof-of-concept or exploit code (if possible) 27 | * Impact of the issue, including how an attacker might exploit the issue 28 | 29 | This information will help us triage your report more quickly. 30 | 31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. 32 | 33 | ## Preferred Languages 34 | 35 | We prefer all communications to be in English. 36 | 37 | ## Policy 38 | 39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). 40 | 41 | 42 | -------------------------------------------------------------------------------- /PhotoEditor/PhotoEditor.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Views 9 | 10 | 11 | Views 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Models 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | Assets 39 | 40 | 41 | Assets 42 | 43 | 44 | Assets 45 | 46 | 47 | Assets 48 | 49 | 50 | Assets 51 | 52 | 53 | Assets 54 | 55 | 56 | Assets 57 | 58 | 59 | Assets 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | {e48dc53e-40b1-40cb-970a-f89935452892} 74 | 75 | 76 | {d2d82ac2-f140-4cc1-81a6-0c9d62482085} 77 | 78 | 79 | {3bbb5a26-09fb-4f10-ad8e-92f739beaf01} 80 | 81 | 82 | -------------------------------------------------------------------------------- /PhotoEditor/Photo.cpp: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------------- 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // The MIT License (MIT) 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE 23 | // --------------------------------------------------------------------------------- 24 | 25 | #include "pch.h" 26 | #include "Photo.h" 27 | #include 28 | 29 | using namespace winrt; 30 | using namespace std; 31 | using namespace Windows::UI::Xaml; 32 | using namespace Windows::Storage; 33 | using namespace Windows::Foundation; 34 | using namespace Windows::UI::Xaml::Media::Imaging; 35 | using namespace Windows::Storage::Streams; 36 | 37 | namespace winrt::PhotoEditor::implementation 38 | { 39 | IAsyncOperation Photo::GetImageThumbnailAsync() const 40 | { 41 | auto thumbnail = co_await m_imageFile.GetThumbnailAsync(FileProperties::ThumbnailMode::PicturesView); 42 | BitmapImage bitmapImage{}; 43 | bitmapImage.SetSource(thumbnail); 44 | thumbnail.Close(); 45 | co_return bitmapImage; 46 | } 47 | 48 | IAsyncOperation Photo::GetImageSourceAsync() const 49 | { 50 | IRandomAccessStream stream{ co_await ImageFile().OpenAsync(FileAccessMode::Read) }; 51 | BitmapImage bitmap{}; 52 | bitmap.SetSource(stream); 53 | co_return bitmap; 54 | } 55 | 56 | hstring Photo::ImageDimensions() const 57 | { 58 | wstringstream stringStream; 59 | stringStream << m_imageProperties.Width() << " x " << m_imageProperties.Height(); 60 | wstring str = stringStream.str(); 61 | return static_cast(str); 62 | } 63 | 64 | void Photo::ImageTitle(hstring const& value) 65 | { 66 | if (m_imageProperties.Title() != value) 67 | { 68 | m_imageProperties.Title(value); 69 | auto ignoreResult = m_imageProperties.SavePropertiesAsync(); 70 | RaisePropertyChanged(L"ImageTitle"); 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /PhotoEditor/pch.h: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------------- 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // The MIT License (MIT) 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE 23 | // --------------------------------------------------------------------------------- 24 | 25 | #pragma once 26 | 27 | // This is required because we are using std::min and std::max, otherwise 28 | // we have a collision with min and max macros being defined elsewhere. 29 | #define NOMINMAX 30 | 31 | // This is required otherwise VSDESIGNER will have linker errors. 32 | #define _VSDESIGNER_DONT_LOAD_AS_DLL 33 | 34 | // These are required because XAML compiler assumes these are included. 35 | #include 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | #include 68 | -------------------------------------------------------------------------------- /PhotoEditor/App.cpp: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------------- 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // The MIT License (MIT) 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE 23 | // --------------------------------------------------------------------------------- 24 | 25 | #include "pch.h" 26 | 27 | #include "App.h" 28 | #include "MainPage.h" 29 | 30 | using namespace winrt; 31 | using namespace Windows::ApplicationModel::Activation; 32 | using namespace Windows::UI::Xaml; 33 | using namespace Windows::UI::Xaml::Controls; 34 | using namespace Windows::UI::Xaml::Navigation; 35 | using namespace PhotoEditor; 36 | using namespace PhotoEditor::implementation; 37 | 38 | /// 39 | /// Initializes the singleton application object. This is the first line of authored code 40 | /// executed, and as such is the logical equivalent of main() or WinMain(). 41 | /// 42 | App::App() 43 | { 44 | InitializeComponent(); 45 | 46 | #if defined _DEBUG && !defined DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION 47 | UnhandledException([this](IInspectable const&, UnhandledExceptionEventArgs const& e) 48 | { 49 | if (IsDebuggerPresent()) 50 | { 51 | auto errorMessage = e.Message(); 52 | __debugbreak(); 53 | } 54 | }); 55 | #endif 56 | } 57 | 58 | /// 59 | /// Invoked when the application is launched normally by the end user. Other entry points 60 | /// will be used such as when the application is launched to open a specific file. 61 | /// 62 | /// Details about the launch request and process. 63 | void App::OnLaunched(LaunchActivatedEventArgs const&) 64 | { 65 | Frame rootFrame = CreateRootFrame(); 66 | if (!rootFrame.Content()) 67 | { 68 | rootFrame.Navigate(xaml_typename()); 69 | } 70 | 71 | Window::Current().Activate(); 72 | } 73 | 74 | Frame App::CreateRootFrame() 75 | { 76 | Frame rootFrame{ nullptr }; 77 | auto content = Window::Current().Content(); 78 | if (content) 79 | { 80 | rootFrame = content.try_as(); 81 | } 82 | 83 | // Don't repeat app initialization when the Window already has content, 84 | // just ensure that the window is active 85 | if (!rootFrame) 86 | { 87 | // Create a Frame to act as the navigation context 88 | rootFrame = Frame(); 89 | 90 | rootFrame.NavigationFailed({ this, &App::OnNavigationFailed }); 91 | 92 | // Place the frame in the current Window 93 | Window::Current().Content(rootFrame); 94 | } 95 | 96 | return rootFrame; 97 | } 98 | 99 | /// 100 | /// Invoked when Navigation to a certain page fails 101 | /// 102 | /// The Frame that failed navigation 103 | /// Details about the navigation failure 104 | void App::OnNavigationFailed(IInspectable const&, NavigationFailedEventArgs const& e) 105 | { 106 | throw hresult_error(E_FAIL, hstring(L"Failed to load Page ") + e.SourcePageType().Name); 107 | } 108 | -------------------------------------------------------------------------------- /PhotoEditor/MainPage.h: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------------- 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // The MIT License (MIT) 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE 23 | // --------------------------------------------------------------------------------- 24 | 25 | #pragma once 26 | #include "MainPage.g.h" 27 | 28 | namespace winrt::PhotoEditor::implementation 29 | { 30 | struct MainPage : MainPageT 31 | { 32 | MainPage(); 33 | 34 | // Retreives collection of Photo objects for thumbnail view. 35 | Windows::Foundation::Collections::IVector Photos() const 36 | { 37 | return m_photos; 38 | } 39 | 40 | // Event handlers for loading and rendering images. 41 | Windows::Foundation::IAsyncAction OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs); 42 | Windows::Foundation::IAsyncAction OnContainerContentChanging(Windows::UI::Xaml::Controls::ListViewBase, Windows::UI::Xaml::Controls::ContainerContentChangingEventArgs); 43 | 44 | // Animation for navigation back from DetailPage view. 45 | Windows::Foundation::IAsyncAction StartConnectedAnimationForBackNavigation(); 46 | 47 | // Property changed notifications. 48 | event_token PropertyChanged(Windows::UI::Xaml::Data::PropertyChangedEventHandler const&); 49 | void PropertyChanged(event_token const&); 50 | 51 | // Event handler. 52 | void ImageGridView_ItemClick(Windows::Foundation::IInspectable const, Windows::UI::Xaml::Controls::ItemClickEventArgs const); 53 | 54 | private: 55 | // Functions for image loading and animation. 56 | Windows::Foundation::IAsyncAction GetItemsAsync(); 57 | Windows::UI::Composition::CompositionAnimationGroup CreateOffsetAnimation(); 58 | Windows::Foundation::IAsyncOperation LoadImageInfoAsync(Windows::Storage::StorageFile); 59 | 60 | // Backing field for Photo collection. 61 | Windows::Foundation::Collections::IVector m_photos{ nullptr }; 62 | 63 | // Field to store selected Photo for later back navigation. 64 | PhotoEditor::Photo m_persistedItem{ nullptr }; 65 | 66 | // Collection of animations for element visuals for reorder animation. 67 | Windows::UI::Composition::ImplicitAnimationCollection m_elementImplicitAnimation{ nullptr }; 68 | 69 | // Field to store page Compositor for creation of types in the Windows.UI.Composition namespace. 70 | Windows::UI::Composition::Compositor m_compositor{ nullptr }; 71 | 72 | // Event 73 | event> m_handler; 74 | 75 | // Property changed notifications. 76 | void RaisePropertyChanged(hstring const&); 77 | event m_propertyChanged; 78 | 79 | }; 80 | } 81 | 82 | namespace winrt::PhotoEditor::factory_implementation 83 | { 84 | struct MainPage : MainPageT 85 | { 86 | }; 87 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.jfm 193 | *.pfx 194 | *.publishsettings 195 | node_modules/ 196 | orleans.codegen.cs 197 | 198 | # Since there are multiple workflows, uncomment next line to ignore bower_components 199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 200 | #bower_components/ 201 | 202 | # RIA/Silverlight projects 203 | Generated_Code/ 204 | 205 | # Backup & report files from converting an old project file 206 | # to a newer Visual Studio version. Backup files are not needed, 207 | # because we have git ;-) 208 | _UpgradeReport_Files/ 209 | Backup*/ 210 | UpgradeLog*.XML 211 | UpgradeLog*.htm 212 | 213 | # SQL Server files 214 | *.mdf 215 | *.ldf 216 | 217 | # Business Intelligence projects 218 | *.rdl.data 219 | *.bim.layout 220 | *.bim_*.settings 221 | 222 | # Microsoft Fakes 223 | FakesAssemblies/ 224 | 225 | # GhostDoc plugin setting file 226 | *.GhostDoc.xml 227 | 228 | # Node.js Tools for Visual Studio 229 | .ntvs_analysis.dat 230 | 231 | # Visual Studio 6 build log 232 | *.plg 233 | 234 | # Visual Studio 6 workspace options file 235 | *.opt 236 | 237 | # Visual Studio LightSwitch build output 238 | **/*.HTMLClient/GeneratedArtifacts 239 | **/*.DesktopClient/GeneratedArtifacts 240 | **/*.DesktopClient/ModelManifest.xml 241 | **/*.Server/GeneratedArtifacts 242 | **/*.Server/ModelManifest.xml 243 | _Pvt_Extensions 244 | 245 | # Paket dependency manager 246 | .paket/paket.exe 247 | paket-files/ 248 | 249 | # FAKE - F# Make 250 | .fake/ 251 | 252 | # JetBrains Rider 253 | .idea/ 254 | *.sln.iml 255 | 256 | # CodeRush 257 | .cr/ 258 | 259 | # Python Tools for Visual Studio (PTVS) 260 | __pycache__/ 261 | *.pyc 262 | 263 | # CPP WinRT 264 | Generated Files/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | --- 2 | page_type: sample 3 | languages: 4 | - cppwinrt 5 | - cpp 6 | products: 7 | - windows 8 | - windows-uwp 9 | statusNotificationTargets: 10 | - codefirst@microsoft.com 11 | --- 12 | 13 | 16 | 17 | # Photo Editor C++/WinRT sample application 18 | 19 | The Photo Editor application is a Universal Windows Platform (UWP) sample that showcases development with the [C++/WinRT](https://docs.microsoft.com/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt) language projection. The sample application allows you to retrieve photos from the **Pictures** library, and then edit the selected image with assorted photo effects. In the sample's source code, you'll see a number of common practices—such as [data binding](https://docs.microsoft.com/windows/uwp/cpp-and-winrt-apis/binding-property), and [asynchronous actions and operations](https://docs.microsoft.com/windows/uwp/cpp-and-winrt-apis/concurrency)—performed using the C++/WinRT projection. 20 | 21 | > Note - This sample is targeted and tested for Windows 10, version 2004 (10.0; Build 19041), and Visual Studio 2019. If you prefer, you can use project properties to retarget the project(s) to Windows 10, version 1903 (10.0; Build 18362). 22 | 23 | ![PhotoEditor sample showing the image collection page, editing page, and editing controls](Screenshots/PhotoEditorBanner.png) 24 | 25 | ## Features 26 | 27 | Photo Editor primarily demonstrates: 28 | 29 | - Use of Standard C++17 syntax and libraries with Windows Runtime (WinRT) APIs. 30 | - Use of coroutines, including the use of co_await, co_return, [**IAsyncAction**](https://docs.microsoft.com/uwp/api/windows.foundation.iasyncaction), and [**IAsyncOperation<TResult>**](https://docs.microsoft.com/uwp/api/windows.foundation.iasyncoperation_tresult_). 31 | - Creation and use of custom Windows Runtime class (runtime class) projected types and implementation types. For more info about these terms, see [Consume APIs with C++/WinRT](https://docs.microsoft.com/windows/uwp/cpp-and-winrt-apis/consume-apis) and [Author APIs with C++/WinRT](https://docs.microsoft.com/windows/uwp/cpp-and-winrt-apis/author-apis). 32 | - [Event handling](https://docs.microsoft.com/windows/uwp/cpp-and-winrt-apis/handle-events), including the use of auto-revoking event tokens. 33 | - Use of the external Win2D NuGet package, and [Windows::UI::Composition](https://docs.microsoft.com/uwp/api/windows.ui.composition), for image effects. 34 | - XAML data binding, including the [{x:Bind} markup extension](https://docs.microsoft.com/windows/uwp/xaml-platform/x-bind-markup-extension). 35 | - XAML styling and UI customization, including [connected animations](https://docs.microsoft.com/windows/uwp/design/motion/connected-animation). 36 | 37 | ## Universal Windows Platform development 38 | 39 | ### Prerequisites 40 | 41 | - Windows 10. Minimum: Windows 10, version 1809 (10.0; Build 17763), also known as the Windows 10 October 2018 Update. 42 | - [Windows 10 SDK](https://developer.microsoft.com/windows/downloads/windows-10-sdk). Minimum: Windows SDK version 10.0.17763.0 (Windows 10, version 1809). 43 | - [Visual Studio 2019](https://visualstudio.microsoft.com/downloads/) (or Visual Studio 2017). You can use the free Visual Studio Community Edition to build and run Windows Universal Platform (UWP) apps. 44 | - You'll need to have a collection of images available in your local **Pictures** folder. If there are no images or photos available at that location, the app will not show anything but the background when you run it. 45 | 46 | You can optionally install the [C++/WinRT Visual Studio Extension (VSIX)](https://aka.ms/cppwinrt/vsix). When you open the project, it will install the [Microsoft.Windows.CppWinRT NuGet package](https://www.nuget.org/packages/Microsoft.Windows.CppWinRT/). 47 | 48 | To get the latest updates to Windows and the development tools, and to help shape their development, join 49 | the [Windows Insider Program](https://insider.windows.com). 50 | 51 | ## Running the sample 52 | 53 | The default project is PhotoEditor and you can Start Debugging (F5) or Start Without Debugging (Ctrl+F5) to try it out, just make sure to set the platform target appropriately. 54 | The app will run in the emulator or on physical devices. 55 | 56 | ## Code at a glance 57 | 58 | If you're just interested in code snippets for certain areas, and don't want to browse or run the full sample, 59 | check out the following files. 60 | 61 | A custom runtime class that represents a photo. 62 | * [Photo.idl](PhotoEditor/Photo.idl) 63 | * [Photo.h](PhotoEditor/Photo.h) 64 | * [Photo.cpp](PhotoEditor/Photo.cpp) 65 | 66 | The first page that loads the photos from the Pictures Library and displays a tiled thumbnail view. 67 | * [MainPage.xaml](PhotoEditor/MainPage.xaml) 68 | * [MainPage.idl](PhotoEditor/MainPage.idl) 69 | * [MainPage.h](PhotoEditor/MainPage.h) 70 | * [MainPage.cpp](PhotoEditor/MainPage.cpp) 71 | 72 | Tapping a photo from the MainPage thumbnail view will take you to the photo editor page, where Win2D effects are toggled, set, and chained together. 73 | * [DetailPage.xaml](PhotoEditor/DetailPage.xaml) 74 | * [DetailPage.idl](PhotoEditor/DetailPage.idl) 75 | * [DetailPage.h](PhotoEditor/DetailPage.h) 76 | * [DetailPage.cpp](PhotoEditor/DetailPage.cpp) 77 | 78 | ## Related C++/WinRT documentation and blogs. 79 | * [C++/WinRT UWP conceptual documentation](https://docs.microsoft.com/windows/uwp/cpp-and-winrt-apis/) 80 | * [C++/WinRT base.h reference documentation](https://docs.microsoft.com/uwp/cpp-ref-for-winrt/winrt) 81 | * [ModernCpp blog](https://moderncpp.com/) 82 | 83 | ## Related XAML documentation and code samples. 84 | * [Controls and patterns for UWP apps](https://docs.microsoft.com/windows/uwp/controls-and-patterns/index) 85 | * [Layout for UWP apps](https://docs.microsoft.com/windows/uwp/layout/) 86 | * [Data binding in depth](https://docs.microsoft.com/windows/uwp/data-binding/data-binding-in-depth) 87 | * [UWP style guide](https://docs.microsoft.com/windows/uwp/style/) 88 | * [Visual layer](https://docs.microsoft.com/windows/uwp/composition/visual-layer) 89 | * [ListView and GridView data virtualization](https://docs.microsoft.com/windows/uwp/debug-test-perf/listview-and-gridview-data-optimization) 90 | * [Data virtualization sample](https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/XamlDataVirtualization) 91 | 92 | ## External libraries used in this sample 93 | 94 | * [Win2D](https://github.com/Microsoft/Win2D) 95 | 96 | ## Changing the project's target platform version 97 | 98 | If you build the project on a given target platform version (`TargetPlatformVersion` in the project file), and then you retarget and rebuild, you may see this error message in Visual Studio: "error MIDL2003: [msg]redefinition [context]: ". If you do, then here are some options to resolve the issue. 99 | 100 | - Sometimes, the resolution is as simple as deleting the file `\Windows-appsample-photo-editor\PhotoEditor\\XamlMetaDataProvider.idl`, and rebuilding. 101 | - If that doesn't clear the issue, then you can try deleting all temporary/generated folders and files, and rebuilding. 102 | - If you haven't made changes, then you can alternatively re-clone the repo, re-target, and build. 103 | -------------------------------------------------------------------------------- /PhotoEditor/Photo.h: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------------- 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // The MIT License (MIT) 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE 23 | // --------------------------------------------------------------------------------- 24 | 25 | #pragma once 26 | 27 | #include "Photo.g.h" 28 | 29 | namespace winrt::PhotoEditor::implementation 30 | { 31 | struct Photo : PhotoT 32 | { 33 | Photo() = default; 34 | 35 | Photo(Windows::Storage::FileProperties::ImageProperties const& props, 36 | Windows::Storage::StorageFile const& imageFile, 37 | hstring const& name, 38 | hstring const& type) : 39 | m_imageProperties(props), 40 | m_imageName(name), 41 | m_imageFileType(type), 42 | m_imageFile(imageFile) 43 | { 44 | } 45 | 46 | // Gets the thumbnail of current image file (m_imageFile). 47 | Windows::Foundation::IAsyncOperation GetImageThumbnailAsync() const; 48 | 49 | // Gets the full image of the current image file (m_imageFile). 50 | Windows::Foundation::IAsyncOperation GetImageSourceAsync() const; 51 | 52 | // File and information properties. 53 | Windows::Storage::StorageFile ImageFile() const 54 | { 55 | return m_imageFile; 56 | } 57 | 58 | Windows::Storage::FileProperties::ImageProperties ImageProperties() const 59 | { 60 | return m_imageProperties; 61 | } 62 | 63 | hstring ImageName() const 64 | { 65 | return m_imageName; 66 | } 67 | 68 | hstring ImageFileType() const 69 | { 70 | return m_imageFileType; 71 | } 72 | 73 | // Gets or sets the image title. 74 | hstring ImageTitle() const 75 | { 76 | return m_imageProperties.Title() == L"" ? m_imageName : m_imageProperties.Title(); 77 | } 78 | 79 | void ImageTitle(hstring const& value); 80 | 81 | hstring ImageDimensions() const; 82 | 83 | // Exposure property for light effect. 84 | float Exposure() const 85 | { 86 | return m_exposure; 87 | } 88 | 89 | void Exposure(float value) 90 | { 91 | UpdateValue(L"Exposure", m_exposure, value); 92 | } 93 | 94 | // Temperature property for color effect. 95 | float Temperature() const 96 | { 97 | return m_temperature; 98 | } 99 | 100 | void Temperature(float value) 101 | { 102 | UpdateValue(L"Temperature", m_temperature, value); 103 | } 104 | 105 | // Tint property for tint and contrast effect. 106 | float Tint() const 107 | { 108 | return m_tint; 109 | } 110 | 111 | void Tint(float value) 112 | { 113 | UpdateValue(L"Tint", m_tint, value); 114 | } 115 | 116 | // Contrast property for tin and contrast effect. 117 | float Contrast() const 118 | { 119 | return m_contrast; 120 | } 121 | 122 | void Contrast(float value) 123 | { 124 | UpdateValue(L"Contrast", m_contrast, value); 125 | } 126 | 127 | // Satruration property for saturation effect. 128 | float Saturation() const 129 | { 130 | return m_saturation; 131 | } 132 | 133 | void Saturation(float value) 134 | { 135 | UpdateValue(L"Saturation", m_saturation, value); 136 | } 137 | 138 | // Blur amount for Gaussian blur effect. 139 | float BlurAmount() const 140 | { 141 | return m_blur; 142 | } 143 | 144 | void BlurAmount(float value) 145 | { 146 | UpdateValue(L"BlurAmount", m_blur, value); 147 | } 148 | 149 | // Intensity for sepia effect. 150 | float Intensity() const 151 | { 152 | return m_sepiaIntensity; 153 | } 154 | 155 | void Intensity(float value) 156 | { 157 | UpdateValue(L"Intensity", m_sepiaIntensity, value); 158 | } 159 | 160 | // Property changed notifications. 161 | event_token PropertyChanged(Windows::UI::Xaml::Data::PropertyChangedEventHandler const& value) 162 | { 163 | return m_propertyChanged.add(value); 164 | } 165 | 166 | void PropertyChanged(event_token const& token) 167 | { 168 | m_propertyChanged.remove(token); 169 | } 170 | 171 | private: 172 | // File and information fields. 173 | Windows::Storage::FileProperties::ImageProperties m_imageProperties{ nullptr }; 174 | Windows::Storage::StorageFile m_imageFile{ nullptr }; 175 | hstring m_imageName; 176 | hstring m_imageFileType; 177 | hstring m_imageTitle; 178 | 179 | // Fields for image effects. 180 | float m_exposure{ 0 }; 181 | float m_temperature{ 0 }; 182 | float m_tint{ 0 }; 183 | float m_contrast{ 0 }; 184 | float m_saturation{ 1 }; 185 | float m_blur{ 0 }; 186 | float m_sepiaIntensity{ .5f }; 187 | 188 | // Size field for image tile size on MainPage. 189 | double m_size{ 250 }; 190 | 191 | // Property changed notification. 192 | event m_propertyChanged; 193 | 194 | template 195 | void UpdateValue(hstring const& propertyName, T & var, T value) 196 | { 197 | if (var != value) 198 | { 199 | var = value; 200 | RaisePropertyChanged(propertyName); 201 | } 202 | } 203 | 204 | void RaisePropertyChanged(hstring const& propertyName) 205 | { 206 | m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs(propertyName)); 207 | } 208 | }; 209 | } 210 | 211 | namespace winrt::PhotoEditor::factory_implementation 212 | { 213 | struct Photo : PhotoT 214 | { 215 | }; 216 | } -------------------------------------------------------------------------------- /PhotoEditor/MainPage.xaml: -------------------------------------------------------------------------------- 1 | 24 | 25 | 35 | 36 | 37 | 38 | 4 39 | 4 40 | 16 41 | 42 | 43 | 45 | 46 | 47 | 49 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 67 | 68 | 70 | 72 | 75 | 76 | 77 | 79 | 82 | 84 | 87 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 45 | 46 | 54 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 452 | 453 | 459 | 465 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 |