1 module dlibwebp.api; 2 3 import impl = dlibwebp.impl; 4 5 import dlib.image; 6 import dlib.core.compound; 7 import dlib.core.stream; 8 9 10 11 class WEBPLoadException: ImageLoadException { 12 this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) { 13 super(msg, file, line, next); 14 } 15 } 16 17 18 /++ 19 + Throws: WEBPLoadException. 20 +/ 21 SuperImage loadWEBP(string filename) { 22 return impl.loadWEBP(filename); 23 } 24 25 /++ 26 + Throws: WEBPLoadException. 27 +/ 28 SuperImage loadWEBP(InputStream input) { 29 return impl.loadWEBP(input); 30 } 31 32 /++ 33 + Throws: WEBPLoadException. 34 +/ 35 SuperImage loadWEBP(in ubyte[] webp) { 36 return impl.loadWEBP(webp); 37 } 38 39 40 41 /++ 42 + Throws: WEBPLoadException. 43 +/ 44 void saveWEBP(SuperImage img, int quality, string filename) { 45 return impl.saveWEBP(img, quality, filename); 46 } 47 48 /++ 49 + Throws: WEBPLoadException. 50 +/ 51 void saveLosslessWEBP(SuperImage img, string filename) { 52 return impl.saveLosslessWEBP(img, filename); 53 } 54 55 /++ 56 + Returns: `false` and an error message on failure. 57 +/ 58 Compound!(bool, string) saveWEBP(SuperImage img, int quality, OutputStream output) { 59 return impl.saveWEBP(img, quality, output); 60 } 61 62 /++ 63 + Returns: `false` and an error message on failure. 64 +/ 65 Compound!(bool, string) saveLosslessWEBP(SuperImage img, OutputStream output) { 66 return impl.saveLosslessWEBP(img, output); 67 } 68 69 70 /++ 71 + Throws: WEBPLoadException. 72 +/ 73 ubyte[] saveWEBPToArray(SuperImage img, int quality) { 74 return impl.saveWEBPToArray(img, quality); 75 } 76 77 /++ 78 + Throws: WEBPLoadException. 79 +/ 80 ubyte[] saveLosslessWEBPToArray(SuperImage img) { 81 return impl.saveLosslessWEBPToArray(img); 82 } 83 84