示例#1
0
 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());
     }
 }
示例#2
0
 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());
     }
 }
示例#3
0
 public Resource(string file)
 {
     Id = Dll.image_open(file);
     if (Id == 0)
     {
         throw new Exception("error in " + file + ": " + Dll.GetError());
     }
 }
示例#4
0
        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);
        }