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 void storeGDIPalette(ColorPalette palette)
	{
		if (palette == null) {
			throw new ArgumentNullException("palette");
		}
		IntPtr palette_data = palette.getGDIPalette();
		if (palette_data == IntPtr.Zero) {
			return;
		}

		try {
			Status st = GDIPlus.GdipSetImagePalette (nativeObject, palette_data);
			GDIPlus.CheckStatus (st);
		}

		finally {
			Marshal.FreeHGlobal(palette_data);
		}
	}