├── .gitignore ├── .gitmodules ├── LICENSE.md ├── Ntreev.Library.Psd.AssemblyInfo ├── AssemblyInfo.cs ├── Ntreev.Library.Psd.AssemblyInfo.projitems └── Ntreev.Library.Psd.AssemblyInfo.shproj ├── Ntreev.Library.Psd.Sharing ├── Ntreev.Library.Psd.Sharing.projitems └── Ntreev.Library.Psd.Sharing.shproj ├── Ntreev.Library.Psd ├── AdditionalLayerInformation.cs ├── BlendMode.cs ├── Channel.cs ├── ChannelType.cs ├── ColorMode.cs ├── ColorSpace.cs ├── CompressionType.cs ├── DescriptorStructure.cs ├── EmbeddedLayer.cs ├── Extensions.cs ├── FileHeaderSection.cs ├── IChannel.cs ├── IImageSource.cs ├── ILinkedLayer.cs ├── IProperties.cs ├── IPropertiesExtension.cs ├── IPsdLayer.cs ├── InternalDocument.cs ├── InvalidFormatException.cs ├── LayerBlendingRanges.cs ├── LayerExtraRecords.cs ├── LayerFlags.cs ├── LayerMask.cs ├── LayerRecords.cs ├── LayerandMaskInformationSection.cs ├── LazyProperties.cs ├── LazyValueReader.cs ├── LinkedLayer.cs ├── Ntreev.Library.Psd.csproj ├── PSDReader.cs ├── PathResolver.cs ├── Properties.cs ├── PsdDocument.cs ├── PsdLayer.cs ├── PsdResolver.cs ├── PsdUtility.cs ├── RangeStream.cs ├── Readers │ ├── ColorModeDataSectionReader.cs │ ├── EmptyResourceReader.cs │ ├── FileHeaderSectionReader.cs │ ├── ImageDataSectionReader.cs │ ├── ImageResources │ │ ├── Reader_GridAndGuides.cs │ │ ├── Reader_ResolutionInfo.cs │ │ ├── Reader_SlicesInfo.cs │ │ └── Reader_VersionInfo.cs │ ├── ImageResourcesSectionReader.cs │ ├── LayerAndMaskInformation │ │ ├── ChannelsReader.cs │ │ ├── DocumentResourceReader.cs │ │ ├── EmbeddedLayerReader.cs │ │ ├── GlobalLayerMaskInfoReader.cs │ │ ├── LayerBlendingRangesReader.cs │ │ ├── LayerExtraRecordsReader.cs │ │ ├── LayerInfoReader.cs │ │ ├── LayerMaskReader.cs │ │ ├── LayerRecordsReader.cs │ │ ├── LayerResourceReader.cs │ │ ├── LinkedDocumentReader.cs │ │ ├── LinkedDocumnetFileHeaderReader.cs │ │ └── LinkedLayerReader.cs │ ├── LayerAndMaskInformationSectionReader.cs │ ├── LayerResources │ │ ├── Reader_PlLd.cs │ │ ├── Reader_SoLE.cs │ │ ├── Reader_SoLd.cs │ │ ├── Reader_TySh.cs │ │ ├── Reader_fxrp.cs │ │ ├── Reader_iOpa.cs │ │ ├── Reader_lfx2.cs │ │ ├── Reader_lnk2.cs │ │ ├── Reader_lnk3.cs │ │ ├── Reader_lnkD.cs │ │ ├── Reader_lnkE.cs │ │ ├── Reader_lnsr.cs │ │ ├── Reader_lrFX.cs │ │ ├── Reader_lsct.cs │ │ ├── Reader_lsdk.cs │ │ ├── Reader_luni.cs │ │ ├── Reader_lyid.cs │ │ ├── Reader_lyvr.cs │ │ └── Reader_shmd.cs │ ├── ReaderCollector.cs │ └── ResourceReaderBase.cs ├── ResourceIDAttribute.cs ├── SectionType.cs ├── Structures │ ├── BaseStructure.cs │ ├── StructureAlias.cs │ ├── StructureClass.cs │ ├── StructureEngineData.cs │ ├── StructureEnumerate.cs │ ├── StructureEnumerateReference.cs │ ├── StructureList.cs │ ├── StructureObjectArray.cs │ ├── StructureOffset.cs │ ├── StructureProperty.cs │ ├── StructureReader.cs │ ├── StructureReference.cs │ ├── StructureUnitFloat.cs │ └── StructureUnknownOSType.cs ├── UnitType.cs └── ValueReader.cs ├── Ntreev.Library.PsdViewer ├── App.config ├── App.xaml ├── App.xaml.cs ├── AppBootstrapper.cs ├── Controls │ ├── CellTemplateSelector.cs │ ├── TreeListView.xaml │ └── TreeListView.xaml.cs ├── Converters │ ├── BooleanToVisibilityConverter.cs │ └── LevelToIndentConverter.cs ├── Dialogs │ ├── ViewModels │ │ └── PreviewViewModel.cs │ └── Views │ │ ├── PreviewView.xaml │ │ └── PreviewView.xaml.cs ├── IShell.cs ├── Images │ ├── export.png │ ├── image_layer.png │ ├── linked_layer.png │ └── ps.png ├── LayerExtension.cs ├── Ntreev.Library.PsdViewer.csproj ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── ShellView.xaml ├── ShellView.xaml.cs ├── ShellViewModel.cs ├── ViewModels │ ├── LayerItemViewModel.cs │ ├── LinkedLayerItemViewModel.cs │ ├── PSDItemViewModel.cs │ └── PropertiesItemViewModel.cs └── packages.config ├── Psd.sln ├── Psd.sln.licenseheader ├── README.md ├── gen-ver.bat ├── gen-ver.ps1 ├── packages └── repositories.config └── version.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # git ignore file 2 | bin/ 3 | obj/ 4 | Debug/ 5 | Release/ 6 | packages/ 7 | *.suo 8 | /.vs 9 | *.bat 10 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NtreevSoft/psd-parser/5866c373d98707d3cbe9fe0616011698b98c85a0/.gitmodules -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2015 Ntreev Soft co., Ltd. 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. 22 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd.AssemblyInfo/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | #if DEBUG 3 | [assembly: AssemblyConfiguration("Debug")] 4 | #else 5 | [assembly: AssemblyConfiguration("Release")] 6 | #endif 7 | [assembly: AssemblyCompany("NtreevSoft")] 8 | [assembly: AssemblyCopyright("Copyright © Ntreev Soft 2015")] 9 | [assembly: AssemblyTrademark("")] 10 | [assembly: AssemblyCulture("")] 11 | [assembly: AssemblyVersion("1.1.18306.1005")] 12 | [assembly: AssemblyFileVersion("")] 13 | [assembly: AssemblyInformationalVersion("")] 14 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd.AssemblyInfo/Ntreev.Library.Psd.AssemblyInfo.projitems: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | 720fdfec-6e43-4663-b378-35ddc17034e0 7 | 8 | 9 | Ntreev.Library.Psd.AssemblyInfo 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd.AssemblyInfo/Ntreev.Library.Psd.AssemblyInfo.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 720fdfec-6e43-4663-b378-35ddc17034e0 5 | 14.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd.Sharing/Ntreev.Library.Psd.Sharing.projitems: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | 0627dfd8-b163-4d2f-830f-3cc6ee70265b 7 | 8 | 9 | Ntreev.Library.Psd.Sharing 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd.Sharing/Ntreev.Library.Psd.Sharing.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 0627dfd8-b163-4d2f-830f-3cc6ee70265b 5 | 14.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/AdditionalLayerInformation.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | class AdditionalLayerInformation 26 | { 27 | public LinkedLayer[] LinkedLayers 28 | { 29 | get; 30 | set; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/BlendMode.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Text; 21 | 22 | namespace Ntreev.Library.Psd 23 | { 24 | public enum BlendMode 25 | { 26 | PassThrough, 27 | 28 | Normal, 29 | 30 | Dissolve, 31 | 32 | Darken, 33 | 34 | Multiply, 35 | 36 | ColorBurn, 37 | 38 | LinearBurn, 39 | 40 | DarkerColor, 41 | 42 | Lighten, 43 | 44 | Screen, 45 | 46 | ColorDodge, 47 | 48 | LinearDodge, 49 | 50 | LighterColor, 51 | 52 | Overlay, 53 | 54 | SoftLight, 55 | 56 | HardLight, 57 | 58 | VividLight, 59 | 60 | LinearLight, 61 | 62 | PinLight, 63 | 64 | HardMix, 65 | 66 | Difference, 67 | 68 | Exclusion, 69 | 70 | Subtract, 71 | 72 | Divide, 73 | 74 | Hue, 75 | 76 | Saturation, 77 | 78 | Color, 79 | 80 | Luminosity, 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/ChannelType.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | public enum ChannelType 26 | { 27 | Alpha = -1, 28 | 29 | Red = 0, 30 | 31 | Green = 1, 32 | 33 | Blue = 2, 34 | 35 | Mask = -2, 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/ColorMode.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | public enum ColorMode 26 | { 27 | Bitmap = 0, 28 | 29 | CMYK = 4, 30 | 31 | DUOTONE = 8, 32 | 33 | GrayScale = 1, 34 | 35 | Indexed = 2, 36 | 37 | LAB = 9, 38 | 39 | MultiChannel = 7, 40 | 41 | RGB = 3 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/ColorSpace.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | public enum ColorSpace 26 | { 27 | ANPA = 0xbb8, 28 | 29 | CMYK = 2, 30 | 31 | DIC = 11, 32 | 33 | FOCOLTONE = 4, 34 | 35 | GRAYSCALE = 8, 36 | 37 | HKS = 10, 38 | 39 | HSB = 1, 40 | 41 | LAB = 7, 42 | 43 | PANTONE = 3, 44 | 45 | RGB = 0, 46 | 47 | TOYO = 6, 48 | 49 | TRUMATCH = 5 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/CompressionType.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | public enum CompressionType 26 | { 27 | Raw = 0, 28 | 29 | RLE = 1, 30 | 31 | Zip = 2, 32 | 33 | ZipPrediction = 3, 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/DescriptorStructure.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using Ntreev.Library.Psd.Structures; 19 | using System; 20 | using System.Collections; 21 | using System.Collections.Generic; 22 | using System.IO; 23 | 24 | namespace Ntreev.Library.Psd 25 | { 26 | class DescriptorStructure : Properties 27 | { 28 | private readonly int version; 29 | 30 | public DescriptorStructure(PsdReader reader) 31 | : this(reader, true) 32 | { 33 | 34 | } 35 | 36 | public DescriptorStructure(PsdReader reader, bool hasVersion) 37 | { 38 | if (hasVersion == true) 39 | { 40 | this.version = reader.ReadInt32(); 41 | } 42 | 43 | this.Add("Name", reader.ReadString()); 44 | this.Add("ClassID", reader.ReadKey()); 45 | 46 | int count = reader.ReadInt32(); 47 | for (int i = 0; i < count; i++) 48 | { 49 | string key = reader.ReadKey(); 50 | string osType = reader.ReadType(); 51 | if (key == "EngineData") 52 | { 53 | this.Add(key.Trim(), new StructureEngineData(reader)); 54 | } 55 | else 56 | { 57 | object value = StructureReader.Read(osType, reader); 58 | this.Add(key.Trim(), value); 59 | } 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/EmbeddedLayer.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using Ntreev.Library.Psd.Readers.LayerAndMaskInformation; 19 | using System; 20 | using System.Collections.Generic; 21 | using System.IO; 22 | using System.Linq; 23 | using System.Text; 24 | 25 | namespace Ntreev.Library.Psd 26 | { 27 | class EmbeddedLayer : ILinkedLayer 28 | { 29 | private readonly Guid id; 30 | private readonly PsdResolver resolver; 31 | private readonly Uri absoluteUri; 32 | private PsdDocument document; 33 | private readonly int width; 34 | private readonly int height; 35 | 36 | public EmbeddedLayer(Guid id, PsdResolver resolver, Uri absoluteUri) 37 | { 38 | this.id = id; 39 | this.resolver = resolver; 40 | this.absoluteUri = absoluteUri; 41 | 42 | if (File.Exists(this.absoluteUri.LocalPath) == true) 43 | { 44 | var header = FileHeaderSection.FromFile(this.absoluteUri.LocalPath); 45 | this.width = header.Width; 46 | this.height = header.Height; 47 | } 48 | } 49 | 50 | public PsdDocument Document 51 | { 52 | get 53 | { 54 | if (this.document == null) 55 | { 56 | this.document = this.resolver.GetDocument(this.absoluteUri); 57 | } 58 | return this.document; 59 | } 60 | } 61 | 62 | public Uri AbsoluteUri 63 | { 64 | get { return this.absoluteUri; } 65 | } 66 | 67 | public bool HasDocument 68 | { 69 | get { return File.Exists(this.absoluteUri.LocalPath); } 70 | } 71 | 72 | public Guid ID 73 | { 74 | get { return this.id; } 75 | } 76 | 77 | public string Name 78 | { 79 | get { return this.absoluteUri.LocalPath; } 80 | } 81 | 82 | public int Width 83 | { 84 | get { return this.width; } 85 | } 86 | 87 | public int Height 88 | { 89 | get { return this.height; } 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Extensions.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | public static class Extensions 26 | { 27 | public static byte[] MergeChannels(this IImageSource imageSource) 28 | { 29 | IChannel[] channels = imageSource.Channels; 30 | 31 | int length = channels.Length; 32 | int num2 = channels[0].Data.Length; 33 | 34 | byte[] buffer = new byte[(imageSource.Width * imageSource.Height) * length]; 35 | int num3 = 0; 36 | for (int i = 0; i < num2; i++) 37 | { 38 | for (int j = channels.Length - 1; j >= 0; j--) 39 | { 40 | buffer[num3++] = channels[j].Data[i]; 41 | } 42 | } 43 | return buffer; 44 | } 45 | 46 | public static IEnumerable Descendants(this IPsdLayer layer) 47 | { 48 | return Descendants(layer, item => true); 49 | } 50 | 51 | public static IEnumerable Descendants(this IPsdLayer layer, Func filter) 52 | { 53 | foreach (var item in layer.Childs) 54 | { 55 | if (filter(item) == false) 56 | continue; 57 | 58 | yield return item; 59 | 60 | foreach (var child in item.Descendants(filter)) 61 | { 62 | yield return child; 63 | } 64 | } 65 | } 66 | 67 | internal static IEnumerable Descendants(this PsdLayer layer) 68 | { 69 | yield return layer; 70 | 71 | foreach (var item in layer.Childs) 72 | { 73 | foreach (var child in item.Descendants()) 74 | { 75 | yield return child; 76 | } 77 | } 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/FileHeaderSection.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using Ntreev.Library.Psd.Readers; 19 | using System; 20 | using System.IO; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | public struct FileHeaderSection 26 | { 27 | public int Depth 28 | { 29 | get; 30 | set; 31 | } 32 | 33 | public int NumberOfChannels 34 | { 35 | get; 36 | set; 37 | } 38 | 39 | public ColorMode ColorMode 40 | { 41 | get; 42 | set; 43 | } 44 | 45 | public int Height 46 | { 47 | get; 48 | set; 49 | } 50 | 51 | public int Width 52 | { 53 | get; 54 | set; 55 | } 56 | 57 | public static FileHeaderSection FromFile(string filename) 58 | { 59 | using (FileStream stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read)) 60 | using (PsdReader reader = new PsdReader(stream, new PathResolver(), new Uri(Path.GetDirectoryName(filename)))) 61 | { 62 | reader.ReadDocumentHeader(); 63 | return FileHeaderSectionReader.Read(reader); 64 | } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/IChannel.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | public interface IChannel 26 | { 27 | byte[] Data 28 | { 29 | get; 30 | } 31 | 32 | ChannelType Type 33 | { 34 | get; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/IImageSource.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | public interface IImageSource 26 | { 27 | int Width { get; } 28 | 29 | int Height { get; } 30 | 31 | int Depth { get; } 32 | 33 | IChannel[] Channels { get; } 34 | 35 | float Opacity { get; } 36 | 37 | bool HasImage { get; } 38 | 39 | bool HasMask { get; } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/ILinkedLayer.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | public interface ILinkedLayer 26 | { 27 | PsdDocument Document 28 | { 29 | get; 30 | } 31 | 32 | Uri AbsoluteUri 33 | { 34 | get; 35 | } 36 | 37 | bool HasDocument 38 | { 39 | get; 40 | } 41 | 42 | Guid ID 43 | { 44 | get; 45 | } 46 | 47 | string Name 48 | { 49 | get; 50 | } 51 | 52 | int Width 53 | { 54 | get; 55 | } 56 | 57 | int Height 58 | { 59 | get; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/IProperties.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Text; 21 | 22 | namespace Ntreev.Library.Psd 23 | { 24 | public interface IProperties : IEnumerable> 25 | { 26 | bool Contains(string property); 27 | 28 | object this[string property] 29 | { 30 | get; 31 | } 32 | 33 | int Count { get; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/IPsdLayer.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | public interface IPsdLayer : IImageSource 26 | { 27 | BlendMode BlendMode { get; } 28 | 29 | IPsdLayer[] Childs { get; } 30 | 31 | bool IsClipping { get; } 32 | 33 | ILinkedLayer LinkedLayer { get; } 34 | 35 | string Name { get; } 36 | 37 | IPsdLayer Parent { get; } 38 | 39 | IProperties Resources { get; } 40 | 41 | PsdDocument Document { get; } 42 | 43 | int Left { get; } 44 | 45 | int Top { get; } 46 | 47 | int Right { get; } 48 | 49 | int Bottom { get; } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/InternalDocument.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | class InternalDocument : PsdDocument 26 | { 27 | public InternalDocument() 28 | { 29 | 30 | } 31 | 32 | protected override void OnDisposed(EventArgs e) 33 | { 34 | throw new Exception(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/InvalidFormatException.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | class InvalidFormatException : Exception 26 | { 27 | public InvalidFormatException() 28 | : base("Invalid PSD file") 29 | { 30 | 31 | } 32 | 33 | public InvalidFormatException(string message) 34 | : base(message) 35 | { 36 | 37 | } 38 | 39 | public InvalidFormatException(string format, params object[] args) 40 | : base(string.Format(format, args)) 41 | { 42 | 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/LayerBlendingRanges.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | class LayerBlendingRanges 26 | { 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/LayerExtraRecords.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using Ntreev.Library.Psd.Readers.LayerAndMaskInformation; 19 | using System; 20 | using System.Collections.Generic; 21 | using System.Linq; 22 | using System.Text; 23 | 24 | namespace Ntreev.Library.Psd 25 | { 26 | class LayerExtraRecords 27 | { 28 | private readonly LayerMaskReader layerMask; 29 | private readonly LayerBlendingRangesReader blendingRanges; 30 | private readonly LayerResourceReader resources; 31 | private readonly string name; 32 | private SectionType sectionType; 33 | private Guid placedID; 34 | 35 | public LayerExtraRecords(LayerMaskReader layerMask, LayerBlendingRangesReader blendingRanges, LayerResourceReader resources, string name) 36 | { 37 | this.layerMask = layerMask; 38 | this.blendingRanges = blendingRanges; 39 | this.resources = resources; 40 | this.name = name; 41 | 42 | this.resources.TryGetValue(ref this.name, "luni.Name"); 43 | this.resources.TryGetValue(ref this.sectionType, "lsct.SectionType"); 44 | 45 | if (this.resources.Contains("SoLd.Idnt") == true) 46 | this.placedID = this.resources.ToGuid("SoLd.Idnt"); 47 | else if (this.resources.Contains("SoLE.Idnt") == true) 48 | this.placedID = this.resources.ToGuid("SoLE.Idnt"); 49 | } 50 | 51 | public SectionType SectionType 52 | { 53 | get { return this.sectionType; } 54 | } 55 | 56 | public Guid PlacedID 57 | { 58 | get { return this.placedID; } 59 | } 60 | 61 | public string Name 62 | { 63 | get { return this.name; } 64 | } 65 | 66 | public LayerMask Mask 67 | { 68 | get { return this.layerMask.Value; } 69 | } 70 | 71 | public object BlendingRanges 72 | { 73 | get { return this.blendingRanges.Value; } 74 | } 75 | 76 | public IProperties Resources 77 | { 78 | get { return this.resources.Value; } 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/LayerFlags.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | [Flags] 26 | public enum LayerFlags 27 | { 28 | Transparency = 1, 29 | 30 | Visible = 2, 31 | 32 | Obsolete = 4, 33 | 34 | Unknown0 = 8, // 1 for Photoshop 5.0 and later, tells if bit 4 has useful information; 35 | 36 | Unknown1 = 16, // pixel data irrelevant to appearance of document 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/LayerMask.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | class LayerMask 26 | { 27 | public int Left { get; set; } 28 | 29 | public int Top { get; set; } 30 | 31 | public int Right { get; set; } 32 | 33 | public int Bottom { get; set; } 34 | 35 | public byte Color { get; set; } 36 | 37 | public byte Flag { get; set; } 38 | 39 | public int Width 40 | { 41 | get { return this.Right - this.Left; } 42 | } 43 | 44 | public int Height 45 | { 46 | get { return this.Bottom - this.Top; } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/LayerandMaskInformationSection.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using Ntreev.Library.Psd.Readers; 19 | using Ntreev.Library.Psd.Readers.LayerAndMaskInformation; 20 | using System; 21 | using System.Collections.Generic; 22 | using System.Linq; 23 | using System.Text; 24 | 25 | namespace Ntreev.Library.Psd 26 | { 27 | class LayerAndMaskInformationSection 28 | { 29 | private readonly LayerInfoReader layerInfo; 30 | private readonly GlobalLayerMaskInfoReader globalLayerMask; 31 | private readonly IProperties documentResources; 32 | 33 | private ILinkedLayer[] linkedLayers; 34 | 35 | public LayerAndMaskInformationSection(LayerInfoReader layerInfo, GlobalLayerMaskInfoReader globalLayerMask, IProperties documentResources) 36 | { 37 | this.layerInfo = layerInfo; 38 | this.globalLayerMask = globalLayerMask; 39 | this.documentResources = documentResources; 40 | } 41 | 42 | public PsdLayer[] Layers 43 | { 44 | get { return this.layerInfo.Value; } 45 | } 46 | 47 | public ILinkedLayer[] LinkedLayers 48 | { 49 | get 50 | { 51 | if (this.linkedLayers == null) 52 | { 53 | List list = new List(); 54 | string[] ids = { "lnk2", "lnk3", "lnkD", "lnkE", }; 55 | 56 | foreach (var item in ids) 57 | { 58 | if (this.documentResources.Contains(item)) 59 | { 60 | var items = this.documentResources.ToValue(item, "Items"); 61 | list.AddRange(items); 62 | } 63 | } 64 | this.linkedLayers = list.ToArray(); 65 | } 66 | return this.linkedLayers; 67 | } 68 | } 69 | 70 | public IProperties Resources 71 | { 72 | get { return this.documentResources; } 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/LazyProperties.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | abstract class LazyProperties : LazyValueReader, IProperties 26 | { 27 | protected LazyProperties(PsdReader reader, object userData) 28 | : base(reader, userData) 29 | { 30 | 31 | } 32 | 33 | protected LazyProperties(PsdReader reader, long length, object userData) 34 | : base(reader, length, userData) 35 | { 36 | 37 | } 38 | 39 | public bool Contains(string property) 40 | { 41 | return this.Value.Contains(property); 42 | } 43 | 44 | public object this[string property] 45 | { 46 | get { return this.Value[property]; } 47 | } 48 | 49 | public int Count 50 | { 51 | get { return this.Value.Count; } 52 | } 53 | 54 | #region IProperties 55 | 56 | IEnumerator> IEnumerable>.GetEnumerator() 57 | { 58 | return (this.Value as IProperties).GetEnumerator(); 59 | } 60 | 61 | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() 62 | { 63 | return (this.Value as IProperties).GetEnumerator(); 64 | } 65 | 66 | #endregion 67 | } 68 | } -------------------------------------------------------------------------------- /Ntreev.Library.Psd/LazyValueReader.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | abstract class LazyValueReader : ValueReader 26 | { 27 | protected LazyValueReader(PsdReader reader, object userData) 28 | : base(reader, true, userData) 29 | { 30 | 31 | } 32 | 33 | protected LazyValueReader(PsdReader reader, long length, object userData) 34 | : base(reader, length, userData) 35 | { 36 | 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Ntreev.Library.Psd/LinkedLayer.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using Ntreev.Library.Psd.Readers.LayerAndMaskInformation; 19 | using System; 20 | using System.Collections.Generic; 21 | using System.IO; 22 | using System.Linq; 23 | using System.Text; 24 | 25 | namespace Ntreev.Library.Psd 26 | { 27 | class LinkedLayer : ILinkedLayer 28 | { 29 | private readonly string name; 30 | private readonly Guid id; 31 | private readonly LinkedDocumentReader documentReader; 32 | private readonly LinkedDocumnetFileHeaderReader fileHeaderReader; 33 | 34 | public LinkedLayer(string name, Guid id, LinkedDocumentReader documentReader, LinkedDocumnetFileHeaderReader fileHeaderReader) 35 | { 36 | this.name = name; 37 | this.id = id; 38 | this.documentReader = documentReader; 39 | this.fileHeaderReader = fileHeaderReader; 40 | } 41 | 42 | public PsdDocument Document 43 | { 44 | get 45 | { 46 | if (this.documentReader == null) 47 | return null; 48 | return this.documentReader.Value; 49 | } 50 | } 51 | 52 | public Uri AbsoluteUri 53 | { 54 | get { return null; } 55 | } 56 | 57 | public bool HasDocument 58 | { 59 | get { return this.documentReader != null; } 60 | } 61 | 62 | public Guid ID 63 | { 64 | get { return this.id; } 65 | } 66 | 67 | public string Name 68 | { 69 | get { return this.name; } 70 | } 71 | 72 | public int Width 73 | { 74 | get { return this.fileHeaderReader.Value.Width; } 75 | } 76 | 77 | public int Height 78 | { 79 | get { return this.fileHeaderReader.Value.Height; } 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Ntreev.Library.Psd.csproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NtreevSoft/psd-parser/5866c373d98707d3cbe9fe0616011698b98c85a0/Ntreev.Library.Psd/Ntreev.Library.Psd.csproj -------------------------------------------------------------------------------- /Ntreev.Library.Psd/PathResolver.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.IO; 21 | using System.Linq; 22 | using System.Text; 23 | 24 | namespace Ntreev.Library.Psd 25 | { 26 | public class PathResolver : PsdResolver 27 | { 28 | private readonly Dictionary uriToDocuments = new Dictionary(); 29 | 30 | public override PsdDocument GetDocument(Uri absoluteUri) 31 | { 32 | string filename = absoluteUri.LocalPath; 33 | if (File.Exists(filename) == false) 34 | throw new FileNotFoundException(string.Format("{0} 파일을 찾을 수 없습니다.", filename), filename); 35 | 36 | if (uriToDocuments.ContainsKey(absoluteUri) == false) 37 | { 38 | PsdDocument document = PsdDocument.Create(filename); 39 | uriToDocuments.Add(absoluteUri, document); 40 | } 41 | 42 | return uriToDocuments[absoluteUri]; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/PsdResolver.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.IO; 21 | using System.Linq; 22 | using System.Text; 23 | 24 | namespace Ntreev.Library.Psd 25 | { 26 | public abstract class PsdResolver 27 | { 28 | public abstract PsdDocument GetDocument(Uri absoluteUri); 29 | 30 | public virtual Uri ResolveUri(Uri baseUri, string relativeUri) 31 | { 32 | if ((baseUri == null) || (!baseUri.IsAbsoluteUri && (baseUri.OriginalString.Length == 0))) 33 | { 34 | Uri uri = new Uri(relativeUri, UriKind.RelativeOrAbsolute); 35 | if (!uri.IsAbsoluteUri && (uri.OriginalString.Length > 0)) 36 | { 37 | uri = new Uri(Path.GetFullPath(relativeUri)); 38 | } 39 | return uri; 40 | } 41 | if ((relativeUri == null) || (relativeUri.Length == 0)) 42 | { 43 | return baseUri; 44 | } 45 | if (!baseUri.IsAbsoluteUri) 46 | { 47 | throw new NotSupportedException("PSD_RelativeUriNotSupported"); 48 | } 49 | return new Uri(baseUri, relativeUri); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/ColorModeDataSectionReader.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers 24 | { 25 | class ColorModeDataSectionReader : LazyValueReader 26 | { 27 | public ColorModeDataSectionReader(PsdReader reader) 28 | : base(reader, null) 29 | { 30 | 31 | } 32 | 33 | protected override long OnLengthGet(PsdReader reader) 34 | { 35 | return reader.ReadInt32(); 36 | } 37 | 38 | protected override void ReadValue(PsdReader reader, object userData, out byte[] value) 39 | { 40 | if (this.Length > 0) 41 | { 42 | value = reader.ReadBytes((int)this.Length); 43 | } 44 | else 45 | { 46 | value = new byte[] { }; 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/EmptyResourceReader.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers 24 | { 25 | class EmptyResourceReader : ResourceReaderBase 26 | { 27 | public EmptyResourceReader(PsdReader reader, long length) 28 | : base(reader, length) 29 | { 30 | 31 | } 32 | 33 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 34 | { 35 | value = new Properties(); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/FileHeaderSectionReader.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers 24 | { 25 | class FileHeaderSectionReader : ValueReader 26 | { 27 | public FileHeaderSectionReader(PsdReader reader) 28 | : base(reader, false, null) 29 | { 30 | 31 | } 32 | 33 | public static FileHeaderSection Read(PsdReader reader) 34 | { 35 | FileHeaderSectionReader instance = new FileHeaderSectionReader(reader); 36 | return instance.Value; 37 | } 38 | 39 | protected override void ReadValue(PsdReader reader, object userData, out FileHeaderSection value) 40 | { 41 | value = new FileHeaderSection(); 42 | 43 | value.NumberOfChannels = reader.ReadInt16(); 44 | value.Height = reader.ReadInt32(); 45 | value.Width = reader.ReadInt32(); 46 | value.Depth = reader.ReadInt16(); 47 | value.ColorMode = reader.ReadColorMode(); 48 | 49 | if (value.Depth != 8) 50 | { 51 | throw new NotSupportedException("only support 8 Bit Channel"); 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/ImageResources/Reader_GridAndGuides.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.ImageResources 24 | { 25 | [ResourceID("1032", DisplayName = "GridAndGuides")] 26 | class Reader_GridAndGuides : ResourceReaderBase 27 | { 28 | public Reader_GridAndGuides(PsdReader reader, long length) 29 | : base(reader, length) 30 | { 31 | 32 | } 33 | 34 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 35 | { 36 | Properties props = new Properties(); 37 | 38 | int version = reader.ReadInt32(); 39 | 40 | if (version != 1) 41 | throw new InvalidFormatException(); 42 | 43 | props["HorizontalGrid"] = reader.ReadInt32(); 44 | props["VerticalGrid"] = reader.ReadInt32(); 45 | 46 | int guideCount = reader.ReadInt32(); 47 | 48 | List hg = new List(); 49 | List vg = new List(); 50 | 51 | for (int i = 0; i < guideCount; i++) 52 | { 53 | int n = reader.ReadInt32(); 54 | byte t = reader.ReadByte(); 55 | 56 | if (t == 0) 57 | vg.Add(n); 58 | else 59 | hg.Add(n); 60 | } 61 | 62 | props["HorizontalGuides"] = hg.ToArray(); 63 | props["VerticalGuides"] = vg.ToArray(); 64 | 65 | value = props; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/ImageResources/Reader_ResolutionInfo.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.IO; 21 | 22 | namespace Ntreev.Library.Psd.Readers.ImageResources 23 | { 24 | [ResourceID("1005", DisplayName = "Resolution")] 25 | class Reader_ResolutionInfo : ResourceReaderBase 26 | { 27 | public Reader_ResolutionInfo(PsdReader reader, long length) 28 | : base(reader, length) 29 | { 30 | 31 | } 32 | 33 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 34 | { 35 | Properties props = new Properties(6); 36 | 37 | props["HorizontalRes"] = reader.ReadInt16(); 38 | props["HorizontalResUnit"] = reader.ReadInt32(); 39 | props["WidthUnit"] = reader.ReadInt16(); 40 | props["VerticalRes"] = reader.ReadInt16(); 41 | props["VerticalResUnit"] = reader.ReadInt32(); 42 | props["HeightUnit"] = reader.ReadInt16(); 43 | 44 | value = props; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/ImageResources/Reader_VersionInfo.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.ImageResources 24 | { 25 | [ResourceID("1057", DisplayName = "Version")] 26 | class Reader_VersionInfo : ResourceReaderBase 27 | { 28 | public Reader_VersionInfo(PsdReader reader, long length) 29 | : base(reader, length) 30 | { 31 | 32 | } 33 | 34 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 35 | { 36 | Properties props = new Properties(5); 37 | 38 | props["Version"] = reader.ReadInt32(); 39 | props["HasCompatibilityImage"] = reader.ReadBoolean(); 40 | props["WriterName"] = reader.ReadString(); 41 | props["ReaderName"] = reader.ReadString(); 42 | props["FileVersion"] = reader.ReadInt32(); 43 | 44 | value = props; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/ImageResourcesSectionReader.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using Ntreev.Library.Psd.Readers; 19 | using Ntreev.Library.Psd.Readers.ImageResources; 20 | using System; 21 | using System.Collections.Generic; 22 | using System.ComponentModel; 23 | using System.Linq; 24 | using System.Text; 25 | 26 | namespace Ntreev.Library.Psd.Readers 27 | { 28 | class ImageResourcesSectionReader : LazyProperties 29 | { 30 | public ImageResourcesSectionReader(PsdReader reader) 31 | : base(reader, null) 32 | { 33 | 34 | } 35 | 36 | protected override long OnLengthGet(PsdReader reader) 37 | { 38 | return reader.ReadInt32(); 39 | } 40 | 41 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 42 | { 43 | Properties props = new Properties(); 44 | 45 | while(reader.Position < this.EndPosition) 46 | { 47 | reader.ValidateSignature(); 48 | 49 | string resourceID = reader.ReadInt16().ToString(); 50 | string name = reader.ReadPascalString(2); 51 | long length = reader.ReadInt32(); 52 | length += (length % 2); 53 | 54 | ResourceReaderBase resourceReader = ReaderCollector.CreateReader(resourceID, reader, length); 55 | string resourceName = ReaderCollector.GetDisplayName(resourceID); 56 | 57 | props[resourceName] = resourceReader; 58 | } 59 | 60 | value = props; 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerAndMaskInformation/ChannelsReader.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.IO; 21 | using System.Linq; 22 | using System.Text; 23 | 24 | namespace Ntreev.Library.Psd.Readers.LayerAndMaskInformation 25 | { 26 | class ChannelsReader : LazyValueReader 27 | { 28 | public ChannelsReader(PsdReader reader, long length, PsdLayer layer) 29 | : base(reader, length, layer) 30 | { 31 | 32 | } 33 | 34 | protected override void ReadValue(PsdReader reader, object userData, out Channel[] value) 35 | { 36 | PsdLayer layer = userData as PsdLayer; 37 | LayerRecords records = layer.Records; 38 | 39 | using (MemoryStream stream = new MemoryStream(reader.ReadBytes((int)this.Length))) 40 | using (PsdReader r = new PsdReader(stream, reader.Resolver, reader.Uri)) 41 | { 42 | r.Version = reader.Version; 43 | this.ReadValue(r, layer.Depth, records.Channels); 44 | } 45 | 46 | value = records.Channels; 47 | } 48 | 49 | private void ReadValue(PsdReader reader, int depth, Channel[] channels) 50 | { 51 | foreach (var item in channels) 52 | { 53 | CompressionType compressionType = reader.ReadCompressionType(); 54 | item.ReadHeader(reader, compressionType); 55 | item.Read(reader, depth, compressionType); 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerAndMaskInformation/DocumentResourceReader.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.IO; 21 | using System.Linq; 22 | 23 | namespace Ntreev.Library.Psd.Readers.LayerAndMaskInformation 24 | { 25 | class DocumentResourceReader : LazyProperties 26 | { 27 | private static string[] doubleTypeKeys = { "LMsk", "Lr16", "Lr32", "Layr", "Mt16", "Mt32", "Mtrn", "Alph", "FMsk", "lnk2", "FEid", "FXid", "PxSD", "lnkE", "extd", }; 28 | 29 | public DocumentResourceReader(PsdReader reader, long length) 30 | : base(reader, length, null) 31 | { 32 | 33 | } 34 | 35 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 36 | { 37 | Properties props = new Properties(); 38 | 39 | while (reader.Position < this.EndPosition) 40 | { 41 | reader.ValidateSignature(true); 42 | string resourceID = reader.ReadType(); 43 | long length = this.ReadLength(reader, resourceID); 44 | 45 | ResourceReaderBase resourceReader = ReaderCollector.CreateReader(resourceID, reader, length); 46 | string resourceName = ReaderCollector.GetDisplayName(resourceID); 47 | 48 | props[resourceName] = resourceReader; 49 | } 50 | 51 | value = props; 52 | } 53 | 54 | private long ReadLength(PsdReader reader, string resourceID) 55 | { 56 | long length = 0; 57 | if (doubleTypeKeys.Contains(resourceID) && reader.Version == 2) 58 | { 59 | length = reader.ReadInt64(); 60 | } 61 | else if(reader.Version == 2) 62 | { 63 | length = reader.ReadInt64(); 64 | } 65 | else 66 | { 67 | length = reader.ReadInt32(); 68 | } 69 | 70 | return (length + 3) & (~3); 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerAndMaskInformation/GlobalLayerMaskInfoReader.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.IO; 21 | using System.Linq; 22 | using System.Text; 23 | 24 | namespace Ntreev.Library.Psd.Readers.LayerAndMaskInformation 25 | { 26 | class GlobalLayerMaskInfoReader : ValueReader 27 | { 28 | public GlobalLayerMaskInfoReader(PsdReader reader) 29 | : base(reader, true, null) 30 | { 31 | 32 | } 33 | 34 | protected override long OnLengthGet(PsdReader reader) 35 | { 36 | return reader.ReadInt32(); 37 | } 38 | 39 | protected override void ReadValue(PsdReader reader, object userData, out object value) 40 | { 41 | value = new object(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerAndMaskInformation/LayerBlendingRangesReader.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.LayerAndMaskInformation 24 | { 25 | class LayerBlendingRangesReader : ValueReader 26 | { 27 | private LayerBlendingRangesReader(PsdReader reader) 28 | : base(reader, true, null) 29 | { 30 | 31 | } 32 | 33 | public static LayerBlendingRanges Read(PsdReader reader) 34 | { 35 | LayerBlendingRangesReader instance = new LayerBlendingRangesReader(reader); 36 | return instance.Value; 37 | } 38 | 39 | protected override long OnLengthGet(PsdReader reader) 40 | { 41 | return reader.ReadInt32(); 42 | } 43 | 44 | protected override void ReadValue(PsdReader reader, object userData, out LayerBlendingRanges value) 45 | { 46 | value = new LayerBlendingRanges(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerAndMaskInformation/LayerExtraRecordsReader.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.LayerAndMaskInformation 24 | { 25 | class LayerExtraRecordsReader : ValueReader 26 | { 27 | private LayerExtraRecordsReader(PsdReader reader, LayerRecords records) 28 | : base(reader, true, records) 29 | { 30 | 31 | } 32 | 33 | public static LayerRecords Read(PsdReader reader, LayerRecords records) 34 | { 35 | LayerExtraRecordsReader instance = new LayerExtraRecordsReader(reader, records); 36 | return instance.Value; 37 | } 38 | 39 | protected override long OnLengthGet(PsdReader reader) 40 | { 41 | return reader.ReadUInt32(); 42 | } 43 | 44 | protected override void ReadValue(PsdReader reader, object userData, out LayerRecords value) 45 | { 46 | LayerRecords records = userData as LayerRecords; 47 | LayerMask mask = LayerMaskReader.Read(reader); 48 | LayerBlendingRanges blendingRanges = LayerBlendingRangesReader.Read(reader); 49 | string name = reader.ReadPascalString(4); 50 | IProperties resources = new LayerResourceReader(reader, this.EndPosition - reader.Position); 51 | 52 | records.SetExtraRecords(mask, blendingRanges, resources, name); 53 | 54 | value = records; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerAndMaskInformation/LayerMaskReader.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.LayerAndMaskInformation 24 | { 25 | class LayerMaskReader : ValueReader 26 | { 27 | private LayerMaskReader(PsdReader reader) 28 | : base(reader, true, null) 29 | { 30 | 31 | } 32 | 33 | public static LayerMask Read(PsdReader reader) 34 | { 35 | LayerMaskReader instance = new LayerMaskReader(reader); 36 | return instance.Value; 37 | } 38 | 39 | protected override long OnLengthGet(PsdReader reader) 40 | { 41 | return reader.ReadInt32(); 42 | } 43 | 44 | protected override void ReadValue(PsdReader reader, object userData, out LayerMask value) 45 | { 46 | LayerMask mask = new LayerMask(); 47 | mask.Top = reader.ReadInt32(); 48 | mask.Left = reader.ReadInt32(); 49 | mask.Bottom = reader.ReadInt32(); 50 | mask.Right = reader.ReadInt32(); 51 | mask.Color = reader.ReadByte(); 52 | mask.Flag = reader.ReadByte(); 53 | 54 | value = mask; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerAndMaskInformation/LayerRecordsReader.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.LayerAndMaskInformation 24 | { 25 | class LayerRecordsReader : ValueReader 26 | { 27 | private LayerRecordsReader(PsdReader reader) 28 | : base(reader, false, null) 29 | { 30 | 31 | } 32 | 33 | public static LayerRecords Read(PsdReader reader) 34 | { 35 | LayerRecordsReader instance = new LayerRecordsReader(reader); 36 | return instance.Value; 37 | } 38 | 39 | protected override void ReadValue(PsdReader reader, object userData, out LayerRecords value) 40 | { 41 | LayerRecords records = new LayerRecords(); 42 | 43 | records.Top = reader.ReadInt32(); 44 | records.Left = reader.ReadInt32(); 45 | records.Bottom = reader.ReadInt32(); 46 | records.Right = reader.ReadInt32(); 47 | records.ValidateSize(); 48 | 49 | int channelCount = reader.ReadUInt16(); 50 | 51 | records.ChannelCount = channelCount; 52 | 53 | for (int i = 0; i < channelCount; i++) 54 | { 55 | records.Channels[i].Type = reader.ReadChannelType(); 56 | records.Channels[i].Size = reader.ReadLength(); 57 | records.Channels[i].Width = records.Width; 58 | records.Channels[i].Height = records.Height; 59 | } 60 | 61 | reader.ValidateSignature(); 62 | 63 | records.BlendMode = reader.ReadBlendMode(); 64 | records.Opacity = reader.ReadByte(); 65 | records.Clipping = reader.ReadBoolean(); 66 | records.Flags = reader.ReadLayerFlags(); 67 | records.Filter = reader.ReadByte(); 68 | 69 | value = records; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerAndMaskInformation/LayerResourceReader.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using Ntreev.Library.Psd.Readers; 19 | using Ntreev.Library.Psd.Readers.LayerResources; 20 | using System; 21 | using System.Collections.Generic; 22 | using System.ComponentModel; 23 | using System.IO; 24 | using System.Linq; 25 | using System.Reflection; 26 | 27 | namespace Ntreev.Library.Psd.Readers.LayerAndMaskInformation 28 | { 29 | class LayerResourceReader : LazyProperties 30 | { 31 | public LayerResourceReader(PsdReader reader, long length) 32 | : base(reader, length, null) 33 | { 34 | 35 | } 36 | 37 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 38 | { 39 | Properties props = new Properties(); 40 | 41 | while (reader.Position < this.EndPosition) 42 | { 43 | reader.ValidateSignature(); 44 | string resourceID = reader.ReadType(); 45 | long length = reader.ReadInt32(); 46 | length += length % 2; 47 | 48 | ResourceReaderBase resourceReader = ReaderCollector.CreateReader(resourceID, reader, length); 49 | string resourceName = ReaderCollector.GetDisplayName(resourceID); 50 | 51 | props[resourceName] = resourceReader; 52 | } 53 | 54 | value = props; 55 | } 56 | } 57 | } 58 | 59 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerAndMaskInformation/LinkedDocumentReader.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.IO; 21 | using System.Linq; 22 | using System.Text; 23 | 24 | namespace Ntreev.Library.Psd.Readers.LayerAndMaskInformation 25 | { 26 | class LinkedDocumentReader : LazyValueReader 27 | { 28 | public LinkedDocumentReader(PsdReader reader, long length) 29 | : base(reader, length, null) 30 | { 31 | 32 | } 33 | 34 | protected override void ReadValue(PsdReader reader, object userData, out PsdDocument value) 35 | { 36 | if (this.IsDocument(reader) == true) 37 | { 38 | using (Stream stream = new RangeStream(reader.Stream, reader.Position, this.Length)) 39 | { 40 | PsdDocument document = new InternalDocument(); 41 | document.Read(stream, reader.Resolver, reader.Uri); 42 | value = document; 43 | } 44 | } 45 | else 46 | { 47 | value = null; 48 | } 49 | } 50 | 51 | private bool IsDocument(PsdReader reader) 52 | { 53 | long position = reader.Position; 54 | try 55 | { 56 | return reader.ReadType() == "8BPS"; 57 | } 58 | finally 59 | { 60 | reader.Position = position; 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerAndMaskInformation/LinkedDocumnetFileHeaderReader.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.IO; 21 | using System.Linq; 22 | using System.Text; 23 | 24 | namespace Ntreev.Library.Psd.Readers.LayerAndMaskInformation 25 | { 26 | class LinkedDocumnetFileHeaderReader : LazyValueReader 27 | { 28 | public LinkedDocumnetFileHeaderReader(PsdReader reader, long length) 29 | : base(reader, length, null) 30 | { 31 | 32 | } 33 | 34 | protected override void ReadValue(PsdReader reader, object userData, out FileHeaderSection value) 35 | { 36 | if (this.IsDocument(reader) == true) 37 | { 38 | using (Stream stream = new RangeStream(reader.Stream, reader.Position, this.Length)) 39 | using (PsdReader r = new PsdReader(stream, reader.Resolver, reader.Uri)) 40 | { 41 | r.ReadDocumentHeader(); 42 | value = FileHeaderSectionReader.Read(r); 43 | } 44 | } 45 | else 46 | { 47 | value = new FileHeaderSection(); 48 | } 49 | } 50 | 51 | private bool IsDocument(PsdReader reader) 52 | { 53 | long position = reader.Position; 54 | try 55 | { 56 | return reader.ReadType() == "8BPS"; 57 | } 58 | finally 59 | { 60 | reader.Position = position; 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerAndMaskInformationSectionReader.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using Ntreev.Library.Psd.Readers.LayerAndMaskInformation; 19 | using System; 20 | using System.Collections.Generic; 21 | using System.IO; 22 | using System.Linq; 23 | 24 | namespace Ntreev.Library.Psd.Readers 25 | { 26 | class LayerAndMaskInformationSectionReader : LazyValueReader 27 | { 28 | public LayerAndMaskInformationSectionReader(PsdReader reader, PsdDocument document) 29 | : base(reader, document) 30 | { 31 | 32 | } 33 | 34 | protected override void ReadValue(PsdReader reader, object userData, out LayerAndMaskInformationSection value) 35 | { 36 | PsdDocument document = userData as PsdDocument; 37 | 38 | LayerInfoReader layerInfo = new LayerInfoReader(reader, document); 39 | 40 | if (reader.Position + 4 >= this.EndPosition) 41 | { 42 | value = new LayerAndMaskInformationSection(layerInfo, null, new Properties()); 43 | } 44 | else 45 | { 46 | GlobalLayerMaskInfoReader globalLayerMask = new GlobalLayerMaskInfoReader(reader); 47 | DocumentResourceReader documentResource = new DocumentResourceReader(reader, this.EndPosition - reader.Position); 48 | 49 | value = new LayerAndMaskInformationSection(layerInfo, globalLayerMask, documentResource); 50 | } 51 | } 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerResources/Reader_PlLd.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.LayerResources 24 | { 25 | [ResourceID("PlLd")] 26 | class Reader_PlLd : ResourceReaderBase 27 | { 28 | public Reader_PlLd(PsdReader reader, long length) 29 | : base(reader, length) 30 | { 31 | 32 | } 33 | 34 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 35 | { 36 | Properties props = new Properties(); 37 | 38 | reader.ValidateType("plcL", "LayerResource PlLd"); 39 | props["Version"] = reader.ReadInt32(); 40 | props["UniqueID"] = reader.ReadPascalString(1); 41 | props["PageNumbers"] = reader.ReadInt32(); 42 | props["Pages"] = reader.ReadInt32(); 43 | props["AntiAlias"] = reader.ReadInt32(); 44 | props["LayerType"] = reader.ReadInt32(); 45 | props["Transformation"] = reader.ReadDoubles(8); 46 | reader.ValidateInt32(0, "WarpVersion"); 47 | props["Warp"] = new DescriptorStructure(reader); 48 | 49 | value = props; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerResources/Reader_SoLE.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.LayerResources 24 | { 25 | [ResourceID("SoLE")] 26 | class Reader_SoLE : Reader_SoLd 27 | { 28 | public Reader_SoLE(PsdReader reader, long length) 29 | : base(reader, length) 30 | { 31 | 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerResources/Reader_SoLd.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.LayerResources 24 | { 25 | [ResourceID("SoLd")] 26 | class Reader_SoLd : ResourceReaderBase 27 | { 28 | public Reader_SoLd(PsdReader reader, long length) 29 | : base(reader, length) 30 | { 31 | 32 | } 33 | 34 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 35 | { 36 | reader.ValidateType("soLD", "SoLd ID"); 37 | reader.ValidateInt32(4, "SoLd Version"); 38 | value = new DescriptorStructure(reader, true); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerResources/Reader_TySh.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.LayerResources 24 | { 25 | [ResourceID("TySh")] 26 | class Reader_TySh : ResourceReaderBase 27 | { 28 | public Reader_TySh(PsdReader reader, long length) 29 | : base(reader, length) 30 | { 31 | 32 | } 33 | 34 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 35 | { 36 | Properties props = new Properties(7); 37 | 38 | reader.ValidateInt16(1, "Typetool Version"); 39 | props["Transforms"] = reader.ReadDoubles(6); 40 | props["TextVersion"] = reader.ReadInt16(); 41 | props["Text"] = new DescriptorStructure(reader); 42 | props["WarpVersion"] = reader.ReadInt16(); 43 | props["Warp"] = new DescriptorStructure(reader); 44 | props["Bounds"] = reader.ReadDoubles(2); 45 | 46 | value = props; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerResources/Reader_fxrp.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.LayerResources 24 | { 25 | [ResourceID("fxrp")] 26 | class Reader_fxrp : ResourceReaderBase 27 | { 28 | public Reader_fxrp(PsdReader reader, long length) 29 | : base(reader, length) 30 | { 31 | 32 | } 33 | 34 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 35 | { 36 | Properties props = new Properties(); 37 | props["RefernecePoint"] = reader.ReadDoubles(2); 38 | value = props; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerResources/Reader_iOpa.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.LayerResources 24 | { 25 | [ResourceID("iOpa")] 26 | class Reader_iOpa : ResourceReaderBase 27 | { 28 | public Reader_iOpa(PsdReader reader, long length) 29 | : base(reader, length) 30 | { 31 | 32 | } 33 | 34 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 35 | { 36 | Properties props = new Properties(); 37 | props["Opacity"] = reader.ReadByte(); 38 | value = props; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerResources/Reader_lfx2.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.LayerResources 24 | { 25 | [ResourceID("lfx2")] 26 | class Reader_lfx2 : ResourceReaderBase 27 | { 28 | public Reader_lfx2(PsdReader reader, long length) 29 | : base(reader, length) 30 | { 31 | 32 | } 33 | 34 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 35 | { 36 | reader.ValidateInt32(0, "lfx2 Version"); 37 | value = new DescriptorStructure(reader, true); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerResources/Reader_lnk2.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using Ntreev.Library.Psd.Readers.LayerAndMaskInformation; 19 | using System; 20 | using System.Collections.Generic; 21 | using System.Linq; 22 | using System.Text; 23 | 24 | namespace Ntreev.Library.Psd.Readers.LayerResources 25 | { 26 | [ResourceID("lnk2")] 27 | class Reader_lnk2 : Reader_lnkD 28 | { 29 | public Reader_lnk2(PsdReader reader, long length) 30 | : base(reader, length) 31 | { 32 | 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerResources/Reader_lnk3.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using Ntreev.Library.Psd.Readers.LayerAndMaskInformation; 19 | using System; 20 | using System.Collections.Generic; 21 | using System.Linq; 22 | using System.Text; 23 | 24 | namespace Ntreev.Library.Psd.Readers.LayerResources 25 | { 26 | [ResourceID("lnk3")] 27 | class Reader_lnk3 : Reader_lnkD 28 | { 29 | public Reader_lnk3(PsdReader reader, long length) 30 | : base(reader, length) 31 | { 32 | 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerResources/Reader_lnkD.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using Ntreev.Library.Psd.Readers.LayerAndMaskInformation; 19 | using System; 20 | using System.Collections.Generic; 21 | using System.Linq; 22 | using System.Text; 23 | 24 | namespace Ntreev.Library.Psd.Readers.LayerResources 25 | { 26 | [ResourceID("lnkD")] 27 | class Reader_lnkD : ResourceReaderBase 28 | { 29 | public Reader_lnkD(PsdReader reader, long length) 30 | : base(reader, length) 31 | { 32 | 33 | } 34 | 35 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 36 | { 37 | Properties props = new Properties(); 38 | List linkedLayers = new List(); 39 | while (reader.Position < this.EndPosition) 40 | { 41 | LinkedLayerReader r = new LinkedLayerReader(reader); 42 | linkedLayers.Add(r.Value); 43 | } 44 | 45 | props["Items"] = linkedLayers.ToArray(); 46 | value = props; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerResources/Reader_lnkE.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using Ntreev.Library.Psd.Readers.LayerAndMaskInformation; 19 | using System; 20 | using System.Collections.Generic; 21 | using System.Linq; 22 | using System.Text; 23 | 24 | namespace Ntreev.Library.Psd.Readers.LayerResources 25 | { 26 | [ResourceID("lnkE")] 27 | class Reader_lnkE : ResourceReaderBase 28 | { 29 | public Reader_lnkE(PsdReader reader, long length) 30 | : base(reader, length) 31 | { 32 | 33 | } 34 | 35 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 36 | { 37 | Properties props = new Properties(); 38 | List linkedLayers = new List(); 39 | while (reader.Position < this.EndPosition) 40 | { 41 | EmbeddedLayerReader r = new EmbeddedLayerReader(reader); 42 | linkedLayers.Add(r.Value); 43 | } 44 | 45 | props["Items"] = linkedLayers.ToArray(); 46 | value = props; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerResources/Reader_lnsr.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.LayerResources 24 | { 25 | [ResourceID("lnsr")] 26 | class Reader_lnsr : ResourceReaderBase 27 | { 28 | public Reader_lnsr(PsdReader reader, long length) 29 | : base(reader, length) 30 | { 31 | 32 | } 33 | 34 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 35 | { 36 | Properties props = new Properties(); 37 | props["Name"] = reader.ReadAscii(4); 38 | value = props; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerResources/Reader_lrFX.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.LayerResources 24 | { 25 | [ResourceID("lrFX")] 26 | class Reader_lrFX : ResourceReaderBase 27 | { 28 | public Reader_lrFX(PsdReader reader, long length) 29 | : base(reader, length) 30 | { 31 | 32 | } 33 | 34 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 35 | { 36 | value = new Properties(); 37 | 38 | short version = reader.ReadInt16(); 39 | int count = reader.ReadInt16(); 40 | 41 | for (int i = 0; i < count; i++) 42 | { 43 | string _8bim = reader.ReadAscii(4); 44 | string effectType = reader.ReadAscii(4); 45 | int size = reader.ReadInt32(); 46 | long p = reader.Position; 47 | 48 | switch (effectType) 49 | { 50 | case "dsdw": 51 | { 52 | //ShadowInfo.Parse(reader); 53 | } 54 | break; 55 | case "sofi": 56 | { 57 | //this.solidFillInfo = SolidFillInfo.Parse(reader); 58 | } 59 | break; 60 | } 61 | 62 | reader.Position = p + size; 63 | } 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerResources/Reader_lsct.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.LayerResources 24 | { 25 | [ResourceID("lsct")] 26 | class Reader_lsct : ResourceReaderBase 27 | { 28 | public Reader_lsct(PsdReader reader, long length) 29 | : base(reader, length) 30 | { 31 | 32 | } 33 | 34 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 35 | { 36 | Properties props = new Properties(); 37 | props["SectionType"] = (SectionType)reader.ReadInt32(); 38 | value = props; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerResources/Reader_lsdk.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.LayerResources 24 | { 25 | [ResourceID("lsdk")] 26 | class Reader_lsdk : ResourceReaderBase 27 | { 28 | public Reader_lsdk(PsdReader reader, long length) 29 | : base(reader, length) 30 | { 31 | 32 | } 33 | 34 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 35 | { 36 | Properties props = new Properties(); 37 | props["SectionType"] = reader.ReadInt32(); 38 | value = props; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerResources/Reader_luni.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.LayerResources 24 | { 25 | [ResourceID("luni")] 26 | class Reader_luni : ResourceReaderBase 27 | { 28 | public Reader_luni(PsdReader reader, long length) 29 | : base(reader, length) 30 | { 31 | 32 | } 33 | 34 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 35 | { 36 | Properties props = new Properties(); 37 | props["Name"] = reader.ReadString(); 38 | value = props; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerResources/Reader_lyid.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.LayerResources 24 | { 25 | [ResourceID("lyid")] 26 | class Reader_lyid : ResourceReaderBase 27 | { 28 | public Reader_lyid(PsdReader reader, long length) 29 | : base(reader, length) 30 | { 31 | 32 | } 33 | 34 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 35 | { 36 | Properties props = new Properties(); 37 | props["ID"] = reader.ReadInt32(); 38 | value = props; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerResources/Reader_lyvr.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.LayerResources 24 | { 25 | [ResourceID("lyvr")] 26 | class Reader_lyvr : ResourceReaderBase 27 | { 28 | public Reader_lyvr(PsdReader reader, long length) 29 | : base(reader, length) 30 | { 31 | 32 | } 33 | 34 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 35 | { 36 | Properties props = new Properties(); 37 | props["Version"] = reader.ReadInt32(); 38 | value = props; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/LayerResources/Reader_shmd.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers.LayerResources 24 | { 25 | [ResourceID("shmd")] 26 | class Reader_shmd : ResourceReaderBase 27 | { 28 | public Reader_shmd(PsdReader reader, long length) 29 | : base(reader, length) 30 | { 31 | 32 | } 33 | 34 | protected override void ReadValue(PsdReader reader, object userData, out IProperties value) 35 | { 36 | Properties props = new Properties(); 37 | 38 | int count = reader.ReadInt32(); 39 | 40 | List dss = new List(); 41 | 42 | for (int i = 0; i < count; i++) 43 | { 44 | string s = reader.ReadAscii(4); 45 | string k = reader.ReadAscii(4); 46 | var c = reader.ReadByte(); 47 | var p = reader.ReadBytes(3); 48 | var l = reader.ReadInt32(); 49 | var p2 = reader.Position; 50 | var ds = new DescriptorStructure(reader); 51 | dss.Add(ds); 52 | reader.Position = p2 + l; 53 | } 54 | 55 | props["Items"] = dss; 56 | 57 | value = props; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Readers/ResourceReaderBase.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Readers 24 | { 25 | abstract class ResourceReaderBase : LazyProperties 26 | { 27 | public ResourceReaderBase(PsdReader reader, long length) 28 | : base(reader, length, null) 29 | { 30 | 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/ResourceIDAttribute.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | [AttributeUsage(AttributeTargets.Class)] 26 | class ResourceIDAttribute : Attribute 27 | { 28 | private readonly string resourceID; 29 | private string displayName; 30 | 31 | public ResourceIDAttribute(string resourceID) 32 | { 33 | this.resourceID = resourceID; 34 | } 35 | 36 | public string ID 37 | { 38 | get { return this.resourceID; } 39 | } 40 | 41 | public string DisplayName 42 | { 43 | get 44 | { 45 | if (string.IsNullOrEmpty(this.displayName) == true) 46 | return this.resourceID; 47 | return this.displayName; 48 | } 49 | set 50 | { 51 | this.displayName = value; 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/SectionType.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | enum SectionType 26 | { 27 | Normal, 28 | 29 | Opend = 1, 30 | 31 | Closed = 2, 32 | 33 | Divider = 3, 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Structures/BaseStructure.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Structures 24 | { 25 | class BaseStructure : Properties 26 | { 27 | public BaseStructure(PsdReader reader) 28 | { 29 | List items = new List(); 30 | int count = reader.ReadInt32(); 31 | for (int i = 0; i < count; i++) 32 | { 33 | string type = reader.ReadType(); 34 | object value = StructureReader.Read(type, reader); 35 | items.Add(value); 36 | } 37 | this.Add("Items", items.ToArray()); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Structures/StructureAlias.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Structures 24 | { 25 | class StructureAlias : Properties 26 | { 27 | public StructureAlias(PsdReader reader) 28 | { 29 | int length = reader.ReadInt32(); 30 | this.Add("Alias", reader.ReadAscii(length)); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Structures/StructureClass.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Structures 24 | { 25 | class StructureClass : Properties 26 | { 27 | public StructureClass() 28 | : base(2) 29 | { 30 | 31 | } 32 | 33 | public StructureClass(PsdReader reader) 34 | { 35 | this.Add("Name", reader.ReadString()); 36 | this.Add("ClassID", reader.ReadKey()); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Structures/StructureEnumerate.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Structures 24 | { 25 | class StructureEnumerate : Properties 26 | { 27 | public StructureEnumerate() 28 | : base(2) 29 | { 30 | 31 | } 32 | 33 | public StructureEnumerate(PsdReader reader) 34 | { 35 | this.Add("Type", reader.ReadKey()); 36 | this.Add("Value", reader.ReadKey()); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Structures/StructureEnumerateReference.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Structures 24 | { 25 | class StructureEnumerateReference : Properties 26 | { 27 | public StructureEnumerateReference() 28 | : base(4) 29 | { 30 | 31 | } 32 | 33 | public StructureEnumerateReference(PsdReader reader) 34 | { 35 | this.Add("Name", reader.ReadString()); 36 | this.Add("ClassID", reader.ReadKey()); 37 | this.Add("TypeID", reader.ReadKey()); 38 | this.Add("EnumID", reader.ReadKey()); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Structures/StructureList.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Structures 24 | { 25 | class StructureList : BaseStructure 26 | { 27 | public StructureList(PsdReader reader) 28 | : base(reader) 29 | { 30 | 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Structures/StructureObjectArray.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Structures 24 | { 25 | class StructureObjectArray : Properties 26 | { 27 | public StructureObjectArray(PsdReader reader) 28 | { 29 | int version = reader.ReadInt32(); 30 | this.Add("Name", reader.ReadString()); 31 | this.Add("ClassID", reader.ReadKey()); 32 | 33 | int count = reader.ReadInt32(); 34 | 35 | List items = new List(); 36 | 37 | for (int i = 0; i < count; i++) 38 | { 39 | Properties props = new Properties(); 40 | props.Add("Type1", reader.ReadKey()); 41 | props.Add("EnumName", reader.ReadType()); 42 | 43 | 44 | props.Add("Type2", PsdUtility.ToUnitType(reader.ReadType())); 45 | int d4 = reader.ReadInt32(); 46 | props.Add("Values", reader.ReadDoubles(d4)); 47 | 48 | items.Add(props); 49 | } 50 | this.Add("items", items.ToArray()); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Structures/StructureOffset.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Structures 24 | { 25 | class StructureOffset : Properties 26 | { 27 | public StructureOffset() 28 | : base(4) 29 | { 30 | 31 | } 32 | 33 | public StructureOffset(PsdReader reader) 34 | { 35 | this.Add("Name", reader.ReadString()); 36 | this.Add("ClassID", reader.ReadKey()); 37 | this.Add("Offset", reader.ReadInt32()); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Structures/StructureProperty.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Structures 24 | { 25 | class StructureProperty : Properties 26 | { 27 | public StructureProperty() 28 | : base(3) 29 | { 30 | 31 | } 32 | 33 | public StructureProperty(PsdReader reader) 34 | { 35 | this.Add("Name", reader.ReadString()); 36 | this.Add("ClassID", reader.ReadKey()); 37 | this.Add("KeyID", reader.ReadKey()); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Structures/StructureReference.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Structures 24 | { 25 | class StructureReference : BaseStructure 26 | { 27 | public StructureReference(PsdReader reader) 28 | : base(reader) 29 | { 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Structures/StructureUnitFloat.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Structures 24 | { 25 | class StructureUnitFloat : Properties 26 | { 27 | public StructureUnitFloat() 28 | : base(2) 29 | { 30 | 31 | } 32 | 33 | public StructureUnitFloat(PsdReader reader) 34 | { 35 | string type = reader.ReadType(); 36 | 37 | this.Add("Type", PsdUtility.ToUnitType(type)); 38 | this.Add("Value", reader.ReadDouble()); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/Structures/StructureUnknownOSType.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd.Structures 24 | { 25 | class StructureUnknownOSType : Properties 26 | { 27 | public StructureUnknownOSType(string value) 28 | { 29 | this.Add("Value", value); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Ntreev.Library.Psd/UnitType.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | 23 | namespace Ntreev.Library.Psd 24 | { 25 | public enum UnitType 26 | { 27 | 28 | /// 29 | /// angle: base degrees 30 | /// 31 | Angle, 32 | 33 | /// 34 | /// density: base per inch 35 | /// 36 | Density, 37 | 38 | /// 39 | /// distance: base 72ppi 40 | /// 41 | Distance, 42 | 43 | /// 44 | /// none: coerced. 45 | /// 46 | None, 47 | 48 | /// 49 | /// percent: unit value 50 | /// 51 | Percent, 52 | 53 | /// 54 | /// pixels: tagged unit value 55 | /// 56 | Pixels, 57 | 58 | /// 59 | /// points: tagged unit value 60 | /// 61 | Points, 62 | 63 | /// 64 | /// : tagged unit value 65 | /// 66 | Millimeters, 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/App.config: -------------------------------------------------------------------------------- 1 |  2 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/App.xaml: -------------------------------------------------------------------------------- 1 |  19 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/App.xaml.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Configuration; 21 | using System.Data; 22 | using System.Linq; 23 | using System.Threading.Tasks; 24 | using System.Windows; 25 | 26 | namespace Ntreev.Library.PsdViewer 27 | { 28 | /// 29 | /// App.xaml에 대한 상호 작용 논리 30 | /// 31 | public partial class App : Application 32 | { 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/AppBootstrapper.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using Caliburn.Micro; 21 | using Ntreev.ModernUI.Framework; 22 | 23 | namespace Ntreev.Library.PsdViewer 24 | { 25 | public class AppBootstrapper : AppBootstrapper 26 | { 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/Controls/CellTemplateSelector.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | using System.Threading.Tasks; 23 | using System.Windows; 24 | using System.Windows.Controls; 25 | 26 | namespace Ntreev.Library.PsdViewer.Controls 27 | { 28 | class CellTemplateSelector : DataTemplateSelector 29 | { 30 | public override DataTemplate SelectTemplate(object item, DependencyObject container) 31 | { 32 | if (container is FrameworkElement fe) 33 | { 34 | if (fe.TryFindResource(item.GetType()) is DataTemplate tempalte) 35 | { 36 | return tempalte; 37 | } 38 | } 39 | return base.SelectTemplate(item, container); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/Converters/LevelToIndentConverter.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Windows.Controls; 20 | using System.Windows; 21 | using System.Windows.Data; 22 | using System.Globalization; 23 | 24 | 25 | namespace Ntreev.Library.PsdViewer.Converters 26 | { 27 | /// 28 | /// Convert Level to left margin 29 | /// Pass a prarameter if you want a unit length other than 19.0. 30 | /// 31 | public class LevelToIndentConverter : IValueConverter 32 | { 33 | public object Convert(object o, Type type, object parameter, CultureInfo culture) 34 | { 35 | return new Thickness((int)o * c_IndentSize, 0, 0, 0); 36 | } 37 | 38 | public object ConvertBack(object o, Type type, object parameter, CultureInfo culture) 39 | { 40 | throw new NotSupportedException(); 41 | } 42 | 43 | private const double c_IndentSize = 19.0; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/Dialogs/ViewModels/PreviewViewModel.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using Ntreev.Library.Psd; 19 | using Ntreev.ModernUI.Framework; 20 | using System; 21 | using System.Collections.Generic; 22 | using System.Linq; 23 | using System.Text; 24 | using System.Threading.Tasks; 25 | using System.Windows.Media.Imaging; 26 | 27 | namespace Ntreev.Library.PsdViewer.Dialogs.ViewModels 28 | { 29 | class PreviewViewModel : ModalDialogBase 30 | { 31 | private readonly IPsdLayer layer; 32 | private readonly BitmapSource source; 33 | 34 | public PreviewViewModel(IPsdLayer layer) 35 | { 36 | this.layer = layer; 37 | this.source = layer.GetBitmap(); 38 | this.DisplayName = layer.Name; 39 | } 40 | 41 | public BitmapSource Source 42 | { 43 | get { return this.source; } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/Dialogs/Views/PreviewView.xaml: -------------------------------------------------------------------------------- 1 |  19 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/Dialogs/Views/PreviewView.xaml.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | using System.Text; 22 | using System.Threading.Tasks; 23 | using System.Windows; 24 | using System.Windows.Controls; 25 | using System.Windows.Data; 26 | using System.Windows.Documents; 27 | using System.Windows.Input; 28 | using System.Windows.Media; 29 | using System.Windows.Media.Imaging; 30 | using System.Windows.Navigation; 31 | using System.Windows.Shapes; 32 | 33 | namespace Ntreev.Library.PsdViewer.Dialogs.Views 34 | { 35 | /// 36 | /// PreviewView.xaml에 대한 상호 작용 논리 37 | /// 38 | public partial class PreviewView : UserControl 39 | { 40 | public PreviewView() 41 | { 42 | InitializeComponent(); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/IShell.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | namespace Ntreev.Library.PsdViewer 19 | { 20 | public interface IShell { } 21 | } -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/Images/export.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NtreevSoft/psd-parser/5866c373d98707d3cbe9fe0616011698b98c85a0/Ntreev.Library.PsdViewer/Images/export.png -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/Images/image_layer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NtreevSoft/psd-parser/5866c373d98707d3cbe9fe0616011698b98c85a0/Ntreev.Library.PsdViewer/Images/image_layer.png -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/Images/linked_layer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NtreevSoft/psd-parser/5866c373d98707d3cbe9fe0616011698b98c85a0/Ntreev.Library.PsdViewer/Images/linked_layer.png -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/Images/ps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NtreevSoft/psd-parser/5866c373d98707d3cbe9fe0616011698b98c85a0/Ntreev.Library.PsdViewer/Images/ps.png -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using System.Reflection; 19 | using System.Resources; 20 | using System.Runtime.CompilerServices; 21 | using System.Runtime.InteropServices; 22 | using System.Windows; 23 | 24 | // 어셈블리의 일반 정보는 다음 특성 집합을 통해 제어됩니다. 25 | // 어셈블리와 관련된 정보를 수정하려면 26 | // 이 특성 값을 변경하십시오. 27 | [assembly: AssemblyTitle("Ntreev.Library.PsdViewer")] 28 | [assembly: AssemblyDescription("")] 29 | [assembly: AssemblyProduct("Ntreev.Library.PsdViewer")] 30 | 31 | // ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에 32 | // 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면 33 | // 해당 형식에 대해 ComVisible 특성을 true로 설정하십시오. 34 | [assembly: ComVisible(false)] 35 | 36 | //지역화 가능 응용 프로그램 빌드를 시작하려면 37 | //.csproj 파일에서 내에 CultureYouAreCodingWith를 38 | //설정하십시오. 예를 들어 소스 파일에서 영어(미국)를 39 | //사용하는 경우 를 en-US로 설정합니다. 그런 다음 아래 40 | //NeutralResourceLanguage 특성의 주석 처리를 제거합니다. 아래 줄의 "en-US"를 업데이트하여 41 | //프로젝트 파일의 UICulture 설정과 일치시킵니다. 42 | 43 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 44 | 45 | 46 | [assembly: ThemeInfo( 47 | ResourceDictionaryLocation.None, //테마별 리소스 사전의 위치 48 | //(페이지 또는 응용 프로그램 리소스 사전에 49 | // 리소스가 없는 경우에 사용됨) 50 | ResourceDictionaryLocation.SourceAssembly //제네릭 리소스 사전의 위치 51 | //(페이지, 응용 프로그램 또는 모든 테마별 리소스 사전에 52 | // 리소스가 없는 경우에 사용됨) 53 | )] 54 | -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 이 코드는 도구를 사용하여 생성되었습니다. 4 | // 런타임 버전:4.0.30319.34209 5 | // 6 | // 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면 7 | // 이러한 변경 내용이 손실됩니다. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Ntreev.Library.PsdViewer.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다. 17 | /// 18 | // 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder 19 | // 클래스에서 자동으로 생성되었습니다. 20 | // 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 ResGen을 21 | // 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Ntreev.Library.PsdViewer.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대한 현재 스레드의 CurrentUICulture 51 | /// 속성을 재정의합니다. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34014 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Ntreev.Library.PsdViewer.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/ShellView.xaml.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using FirstFloor.ModernUI.Windows.Controls; 19 | using MahApps.Metro.Controls; 20 | using Ntreev.ModernUI.Framework.Controls; 21 | using System; 22 | using System.Collections.Generic; 23 | using System.IO; 24 | using System.Linq; 25 | using System.Text; 26 | using System.Threading.Tasks; 27 | using System.Windows; 28 | 29 | namespace Ntreev.Library.PsdViewer 30 | { 31 | partial class ShellView : ModernWindow 32 | { 33 | public ShellView() 34 | { 35 | this.InitializeComponent(); 36 | } 37 | 38 | protected override void OnDragOver(DragEventArgs e) 39 | { 40 | base.OnDragOver(e); 41 | 42 | if (e.Data.GetDataPresent(DataFormats.FileDrop) == true) 43 | { 44 | var files = e.Data.GetData(DataFormats.FileDrop) as string[]; 45 | if (files.Length == 1 && files.First() is string path && Path.GetExtension(path) == ".psd") 46 | { 47 | e.Effects = DragDropEffects.Copy; 48 | e.Handled = true; 49 | return; 50 | } 51 | } 52 | e.Effects = DragDropEffects.None; 53 | e.Handled = true; 54 | } 55 | 56 | protected override void OnDrop(DragEventArgs e) 57 | { 58 | base.OnDrop(e); 59 | if (e.Data.GetDataPresent(DataFormats.FileDrop) == true) 60 | { 61 | var files = e.Data.GetData(DataFormats.FileDrop) as string[]; 62 | var filename = files.First(); 63 | var command = DragDropUtility.GetDropCommand(this); 64 | if (command != null && command.CanExecute(filename) == true) 65 | { 66 | command.Execute(filename); 67 | } 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/ViewModels/LinkedLayerItemViewModel.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using Ntreev.Library.Psd; 19 | using Ntreev.ModernUI.Framework.ViewModels; 20 | using System; 21 | using System.Collections.Generic; 22 | using System.IO; 23 | using System.Linq; 24 | using System.Text; 25 | using System.Text.RegularExpressions; 26 | using System.Threading.Tasks; 27 | using System.Windows.Media; 28 | using System.Windows.Media.Imaging; 29 | 30 | namespace Ntreev.Library.PsdViewer.ViewModels 31 | { 32 | class LinkedLayerItemViewModel : TreeViewItemViewModel 33 | { 34 | private readonly ILinkedLayer linkedLayer; 35 | 36 | public LinkedLayerItemViewModel(ILinkedLayer linkedLayer, PSDItemViewModel parent) 37 | { 38 | this.linkedLayer = linkedLayer; 39 | this.Items.Add(new PSDItemViewModel(linkedLayer.Document)); 40 | } 41 | 42 | public override string DisplayName 43 | { 44 | get 45 | { 46 | return string.Format("LinkedLayer({0})", this.linkedLayer.Name); 47 | } 48 | } 49 | 50 | public ILinkedLayer LinkedLayer 51 | { 52 | get { return this.linkedLayer; } 53 | } 54 | 55 | public object Value => null; 56 | 57 | public string Type => null; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/ViewModels/PSDItemViewModel.cs: -------------------------------------------------------------------------------- 1 | //Released under the MIT License. 2 | // 3 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 6 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 7 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | //persons to whom the Software is furnished to do so, subject to the following conditions: 9 | // 10 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 11 | //Software. 12 | // 13 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 14 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | using Ntreev.Library.Psd; 19 | using Ntreev.ModernUI.Framework.ViewModels; 20 | using System; 21 | using System.Collections.Generic; 22 | using System.IO; 23 | using System.Linq; 24 | using System.Text; 25 | using System.Text.RegularExpressions; 26 | using System.Threading.Tasks; 27 | using System.Windows.Media.Imaging; 28 | 29 | namespace Ntreev.Library.PsdViewer.ViewModels 30 | { 31 | class PSDItemViewModel : TreeViewItemViewModel 32 | { 33 | private readonly PsdDocument document; 34 | 35 | public PSDItemViewModel(PsdDocument document) 36 | { 37 | this.document = document; 38 | 39 | this.Items.Add(new PropertiesItemViewModel("Resources", document.Resources, this)); 40 | this.Items.Add(new PropertiesItemViewModel("ImageResources", document.ImageResources, this)); 41 | 42 | foreach (var item in document.Childs) 43 | { 44 | this.Items.Add(new LayerItemViewModel(item, this)); 45 | } 46 | } 47 | 48 | public override string DisplayName 49 | { 50 | get { return "Document"; } 51 | } 52 | 53 | public PsdDocument Document 54 | { 55 | get { return this.document; } 56 | } 57 | 58 | public object Value => null; 59 | 60 | public string Type => null; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Ntreev.Library.PsdViewer/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Psd.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27428.2002 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ntreev.Library.Psd", "Ntreev.Library.Psd\Ntreev.Library.Psd.csproj", "{2A3BAD6E-CEB1-432B-87E2-0581E36067E7}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ntreev.Library.PsdViewer", "Ntreev.Library.PsdViewer\Ntreev.Library.PsdViewer.csproj", "{EEB86F6C-6EBA-4892-BC87-282DC667EC10}" 9 | EndProject 10 | Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Ntreev.Library.Psd.AssemblyInfo", "Ntreev.Library.Psd.AssemblyInfo\Ntreev.Library.Psd.AssemblyInfo.shproj", "{720FDFEC-6E43-4663-B378-35DDC17034E0}" 11 | EndProject 12 | Global 13 | GlobalSection(SharedMSBuildProjectFiles) = preSolution 14 | Ntreev.Library.Psd.AssemblyInfo\Ntreev.Library.Psd.AssemblyInfo.projitems*{2a3bad6e-ceb1-432b-87e2-0581e36067e7}*SharedItemsImports = 4 15 | Ntreev.Library.Psd.AssemblyInfo\Ntreev.Library.Psd.AssemblyInfo.projitems*{720fdfec-6e43-4663-b378-35ddc17034e0}*SharedItemsImports = 13 16 | Ntreev.Library.Psd.AssemblyInfo\Ntreev.Library.Psd.AssemblyInfo.projitems*{eeb86f6c-6eba-4892-bc87-282dc667ec10}*SharedItemsImports = 4 17 | EndGlobalSection 18 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 19 | Debug|Any CPU = Debug|Any CPU 20 | Release_Unity|Any CPU = Release_Unity|Any CPU 21 | Release|Any CPU = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 24 | {2A3BAD6E-CEB1-432B-87E2-0581E36067E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {2A3BAD6E-CEB1-432B-87E2-0581E36067E7}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {2A3BAD6E-CEB1-432B-87E2-0581E36067E7}.Release_Unity|Any CPU.ActiveCfg = Release|Any CPU 27 | {2A3BAD6E-CEB1-432B-87E2-0581E36067E7}.Release_Unity|Any CPU.Build.0 = Release|Any CPU 28 | {2A3BAD6E-CEB1-432B-87E2-0581E36067E7}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {2A3BAD6E-CEB1-432B-87E2-0581E36067E7}.Release|Any CPU.Build.0 = Release|Any CPU 30 | {EEB86F6C-6EBA-4892-BC87-282DC667EC10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 31 | {EEB86F6C-6EBA-4892-BC87-282DC667EC10}.Debug|Any CPU.Build.0 = Debug|Any CPU 32 | {EEB86F6C-6EBA-4892-BC87-282DC667EC10}.Release_Unity|Any CPU.ActiveCfg = Release|Any CPU 33 | {EEB86F6C-6EBA-4892-BC87-282DC667EC10}.Release|Any CPU.ActiveCfg = Release|Any CPU 34 | {EEB86F6C-6EBA-4892-BC87-282DC667EC10}.Release|Any CPU.Build.0 = Release|Any CPU 35 | EndGlobalSection 36 | GlobalSection(SolutionProperties) = preSolution 37 | HideSolutionNode = FALSE 38 | EndGlobalSection 39 | GlobalSection(ExtensibilityGlobals) = postSolution 40 | SolutionGuid = {19BBF3C1-BAEA-4DEA-A450-0C7B4BE81DFB} 41 | EndGlobalSection 42 | EndGlobal 43 | -------------------------------------------------------------------------------- /Psd.sln.licenseheader: -------------------------------------------------------------------------------- 1 | extensions: designer.cs generated.cs 2 | extensions: .cs .cpp .h 3 | //Released under the MIT License. 4 | // 5 | //Copyright (c) 2015 Ntreev Soft co., Ltd. 6 | // 7 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 8 | //documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 9 | //rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 10 | //persons to whom the Software is furnished to do so, subject to the following conditions: 11 | // 12 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 13 | //Software. 14 | // 15 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 16 | //WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 17 | //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 18 | //OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | 20 | extensions: .xaml 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ntreev Photoshop Document Parser for .Net 2 | [![NuGet version (psd-parser)](https://img.shields.io/nuget/v/psd-parser.svg)](https://www.nuget.org/packages/psd-parser/) 3 | 4 | ## Developer 5 | 6 | 7 | s2quake@ntreev.com 8 | 9 | ## Summary 10 | 11 | 포토샵 파일을 분석해 필요한 정보를 사용할 수 있는 .net 용 라이브러리입니다. 12 | .Net framework 3.5 기반으로 제작되었으며 Unity3D에서도 제약없이 사용이 가능합니다. 13 | 라이브러리는 어도비에서 제공하는 포토샵 파일 포맷 정보 기반으로 제작되었습니다. 14 | http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/ 15 | Image Resource IDs와 Additional Layer Information 부분은 종류가 워낙 많아서 16 | 필요한 부분을 제외하고는 파싱 작업을 하지않았습니다. 17 | 18 | 라이브러리에서 제공하는 PsdViewer는 정보만 볼 수 있는 간단한 프로그램입니다. 19 | 레이어의 그림내용을 보여주지는 않습니다. 20 | 21 | 작업의 목표는 쉬운 사용법, 모든 정보 추출, 빠른 속도입니다. 22 | 23 | ## Development Environment 24 | 25 | - Microsoft Visual Studio Professional 2017 26 | - C# 7.0 27 | - .NET Framework 4.5 28 | 29 | old version has moved to branch 1.0 30 | 31 | ## Test Environment 32 | 33 | Photoshop CC 34 | 35 | ## Usage 36 | 37 | SourceCode: 38 | 39 | using (PsdDocument document = PsdDocument.Create(filename)) 40 | { 41 | foreach (var item in document.Childs) 42 | { 43 | Console.WriteLine("LayerName : " + item.Name); 44 | } 45 | } 46 | 47 | ## License 48 | 49 | Ntreev Photoshop Document Parser for .Net 50 | 51 | Released under the MIT License. 52 | 53 | Copyright (c) 2015 Ntreev Soft co., Ltd. 54 | 55 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 56 | documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 57 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 58 | persons to whom the Software is furnished to do so, subject to the following conditions: 59 | 60 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 61 | Software. 62 | 63 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 64 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 65 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 66 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /gen-ver.bat: -------------------------------------------------------------------------------- 1 | powershell -executionpolicy remotesigned -File gen-ver.ps1 -------------------------------------------------------------------------------- /gen-ver.ps1: -------------------------------------------------------------------------------- 1 | $majorVersion=1 2 | $minorVersion=1 3 | $version="$majorVersion.$minorVersion"+"."+(Get-Date -Format yy)+(Get-Date).DayOfYear+"."+(Get-Date -Format HHmm) 4 | $csproj="Ntreev.Library.Psd\Ntreev.Library.Psd.csproj" 5 | $assemblyInfo = "Ntreev.Library.Psd.AssemblyInfo\AssemblyInfo.cs" 6 | Set-Content version.txt $version 7 | (Get-Content $csproj) -replace "()(.*)()", "`${1}$version`$3" -replace "()(.*)()", "`${1}$version`$3" -replace "()(.*)()", "`${1}$majorVersion.$minorVersion.0.0`$3" | Set-Content $csproj 8 | (Get-Content $assemblyInfo) -replace "(AssemblyVersion[(]`").+(`"[)]])", "`${1}$version`$2" -replace "(AssemblyFileVersion[(]`").+(`"[)]])", "`${1}$fileVersion`$2" -replace "(AssemblyInformationalVersion[(]`").+(`"[)]])", "`${1}$fileVersion`$2" | Set-Content $assemblyInfo -------------------------------------------------------------------------------- /packages/repositories.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /version.txt: -------------------------------------------------------------------------------- 1 | 1.1.18306.1005 2 | --------------------------------------------------------------------------------