DDSPixelFormat.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #region License
  2. // Copyright 2015-2016 Kastellanos Nikolaos
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. #endregion
  16. using System;
  17. namespace nkast.Aether.Content.Pipeline
  18. {
  19. internal struct DDSPixelFormat
  20. {
  21. public Int32 Size;
  22. public PF_Flags Flags;
  23. public PF_FourCC FourCC;
  24. public Int32 RGBBitCount;
  25. public Int32 RBitMask;
  26. public Int32 GBitMask;
  27. public Int32 BBitMask;
  28. public Int32 ABitMask;
  29. public DDSPixelFormat(System.IO.BinaryReader reader)
  30. {
  31. Size = reader.ReadInt32();
  32. Flags = (PF_Flags)reader.ReadInt32();
  33. FourCC = (PF_FourCC)reader.ReadInt32();
  34. RGBBitCount = reader.ReadInt32();
  35. RBitMask = reader.ReadInt32();
  36. GBitMask = reader.ReadInt32();
  37. BBitMask = reader.ReadInt32();
  38. ABitMask = reader.ReadInt32();
  39. }
  40. }
  41. internal enum PF_Flags : int
  42. {
  43. ALPHAPIXELS = 0x00001,
  44. ALPHA = 0x00002,
  45. FOURCC = 0x00004,
  46. RGB = 0x00040,
  47. YUV = 0x00200,
  48. LUMINANCE = 0x20000,
  49. }
  50. internal enum PF_FourCC : int
  51. {
  52. DXT1 = 0x31545844,
  53. DXT2 = 0x32545844,
  54. DXT3 = 0x33545844,
  55. DXT4 = 0x34545844,
  56. DXT5 = 0x35545844,
  57. DX10 = 0x30315844,
  58. }
  59. }