AlphaChannelNames.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Photoshop PSD FileType Plugin for Paint.NET
  4. // http://psdplugin.codeplex.com/
  5. //
  6. // This software is provided under the MIT License:
  7. // Copyright (c) 2006-2007 Frank Blumenberg
  8. // Copyright (c) 2010-2013 Tao Yue
  9. //
  10. // See LICENSE.txt for complete licensing and attribution information.
  11. //
  12. /////////////////////////////////////////////////////////////////////////////////
  13. using System;
  14. using System.Collections.Generic;
  15. namespace PhotoshopFile
  16. {
  17. /// <summary>
  18. /// The names of the alpha channels
  19. /// </summary>
  20. internal class AlphaChannelNames : ImageResource
  21. {
  22. public override ResourceID ID
  23. {
  24. get { return ResourceID.AlphaChannelNames; }
  25. }
  26. private List<string> channelNames = new List<string>();
  27. public List<string> ChannelNames
  28. {
  29. get { return channelNames; }
  30. }
  31. public AlphaChannelNames() : base(String.Empty)
  32. {
  33. }
  34. public AlphaChannelNames(PsdBinaryReader reader, string name, int resourceDataLength)
  35. : base(name)
  36. {
  37. var endPosition = reader.BaseStream.Position + resourceDataLength;
  38. // Alpha channel names are Pascal strings, with no padding in-between.
  39. while (reader.BaseStream.Position < endPosition)
  40. {
  41. var channelName = reader.ReadPascalString(1);
  42. ChannelNames.Add(channelName);
  43. }
  44. }
  45. }
  46. }