Esempio n. 1
0
        internal ColorPalette retrieveGDIPalette()
        {
            int          bytes;
            ColorPalette ret = new ColorPalette();

            Status st = GDIPlus.GdipGetImagePaletteSize(nativeObject, out bytes);

            GDIPlus.CheckStatus(st);
            IntPtr palette_data = Marshal.AllocHGlobal(bytes);

            try {
                st = GDIPlus.GdipGetImagePalette(nativeObject, palette_data, bytes);
                GDIPlus.CheckStatus(st);
                ret.setFromGDIPalette(palette_data);
                return(ret);
            }

            finally {
                Marshal.FreeHGlobal(palette_data);
            }
        }