1 /** 2 * Copyright: Copyright (C) 2018 Gabriel Gheorghe, All Rights Reserved 3 * Authors: $(Gabriel Gheorghe) 4 * License: $(LINK2 https://www.gnu.org/licenses/gpl-3.0.txt, GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007) 5 * Source: $(LINK2 https://github.com/GabyForceQ/LibertyEngine/blob/master/source/liberty/image/format/png.d) 6 * Documentation: 7 * Coverage: 8 **/ 9 module liberty.image.format.png; 10 11 import liberty.image.impl; 12 13 /** 14 * 15 **/ 16 struct PNGChunk { 17 /** 18 * 19 **/ 20 uint size; 21 22 /** 23 * 24 **/ 25 ubyte[4] type; 26 27 /** 28 * 29 **/ 30 ubyte[] data; 31 32 /** 33 * 34 **/ 35 ubyte[] crc32; 36 37 /** 38 * 39 **/ 40 void clear() { 41 if (data.ptr !is null) 42 data.destroy(); 43 44 if (crc32.ptr !is null) 45 crc32.destroy(); 46 } 47 } 48 49 /** 50 * 51 **/ 52 struct PNGHeader { 53 union { 54 struct { 55 /** 56 * 57 **/ 58 uint width; 59 60 /** 61 * 62 **/ 63 uint height; 64 65 /** 66 * 67 **/ 68 uint bitDepth; 69 70 /** 71 * 72 **/ 73 uint colorType; 74 75 /** 76 * 77 **/ 78 ubyte compressionMethod; 79 80 /** 81 * 82 **/ 83 ubyte filterMethod; 84 85 /** 86 * 87 **/ 88 ubyte interlaceMethod; 89 } 90 91 /** 92 * 93 **/ 94 ubyte[13] bytes; 95 } 96 } 97 98 /** 99 * 100 **/ 101 final class PNGImage : Image { 102 private { 103 PNGHeader header; 104 } 105 106 /** 107 * 108 **/ 109 this() {} 110 }