public static void SaveImage(DllImageData image, string filename, string extension, GliFormat format, int quality = 0) { if (!Dll.image_save(image.Resource.Id, filename, extension, (uint)format, quality)) { throw new Exception(Dll.GetError()); } }
public Resource(uint format, Size3 size, LayerMipmapCount lm) { Id = Dll.image_allocate(format, size.Width, size.Height, size.Depth, lm.Layers, lm.Mipmaps); if (Id == 0) { throw new Exception("error allocating image: " + Dll.GetError()); } }
public Resource(string file) { Id = Dll.image_open(file); if (Id == 0) { throw new Exception("error in " + file + ": " + Dll.GetError()); } }
public static List <GliFormat> GetExportFormats(string extension) { var ptr = Dll.get_export_formats(extension, out var nFormats); if (ptr == IntPtr.Zero) { throw new Exception(Dll.GetError()); } var rawArray = new int[nFormats]; Marshal.Copy(ptr, rawArray, 0, nFormats); var res = new List <GliFormat>(nFormats); res.AddRange(rawArray.Select(i => (GliFormat)i)); return(res); }