Example #1
0
        public void GetAdjustedPalette(ColorPalette palette, ColorAdjustType type)
        {
            IntPtr colorPalette = palette.getGDIPalette();

            try {
                Status status = GDIPlus.GdipGetImageAttributesAdjustedPalette(nativeImageAttr, colorPalette, type);
                GDIPlus.CheckStatus(status);
                palette.setFromGDIPalette(colorPalette);
            } finally {
                if (colorPalette != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(colorPalette);
                }
            }
        }
Example #2
0
		public void GetAdjustedPalette (ColorPalette palette, ColorAdjustType type)
		{
			IntPtr colorPalette = palette.getGDIPalette ();
			try {
				Status status = GDIPlus.GdipGetImageAttributesAdjustedPalette (nativeImageAttr, colorPalette, type);
				GDIPlus.CheckStatus (status);
	    			palette.setFromGDIPalette (colorPalette);
			} finally {
				if (colorPalette != IntPtr.Zero)
					Marshal.FreeHGlobal (colorPalette);
			}
		}
Example #3
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);
		}
	}