Пример #1
0
        public static IntPtr Load(string filename, ref int x, ref int y, ref int n, int req_comp)
        {
            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Win32Windows:
            case PlatformID.Win32NT:
            case PlatformID.Win32S:
                if (Environment.Is64BitProcess)
                {
                    return(Win64.stbi_load(filename, ref x, ref y, ref n, req_comp));
                }
                else
                {
                    return(Win32.stbi_load(filename, ref x, ref y, ref n, req_comp));
                }

            default:
                if (Directory.Exists("/Library") &&
                    Directory.Exists("/System"))
                {
                    return(OSX.stbi_load(filename, ref x, ref y, ref n, req_comp));
                }
                if (Environment.Is64BitProcess)
                {
                    return(Linux64.stbi_load(filename, ref x, ref y, ref n, req_comp));
                }
                else
                {
                    return(Linux32.stbi_load(filename, ref x, ref y, ref n, req_comp));
                }
            }
        }
Пример #2
0
        public static void Free(IntPtr data)
        {
            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Win32Windows:
            case PlatformID.Win32NT:
            case PlatformID.Win32S:
                if (Environment.Is64BitProcess)
                {
                    Win64.stbi_image_free(data);
                }
                else
                {
                    Win32.stbi_image_free(data);
                }
                break;

            default:
                if (Directory.Exists("/Library") &&
                    Directory.Exists("/System"))
                {
                    OSX.stbi_image_free(data);
                }
                else if (Environment.Is64BitProcess)
                {
                    Linux64.stbi_image_free(data);
                }
                else
                {
                    Linux32.stbi_image_free(data);
                }
                break;
            }
        }