/// <summary> /// Clears the color matrix. /// </summary> public void ClearColorMatrix() { colorMatrix = null; colorMatrixFlags = ColorMatrixFlag.Default; colorAdjustType = ColorAdjustType.Default; isColorMatrixSet = false; }
public void SetColorMatrix(ColorMatrix newColorMatrix, ColorMatrixFlag mode, ColorAdjustType type) { colorMatrix = newColorMatrix; colorMatrixFlags = mode; colorAdjustType = type; isColorMatrixSet = true; }
public void SetColorMatrices(ColorMatrix newColorMatrix, ColorMatrix gMatrix, ColorMatrixFlag mode, ColorAdjustType type) { clrMatrix = newColorMatrix; this.gMatrix = gMatrix; clrMatrixFlag = mode; clrAdjustType = type; }
Reset( ColorAdjustType type ) { return SetStatus(NativeMethods.GdipResetImageAttributes( nativeImageAttr, type)); }
SetToIdentity( ColorAdjustType type ) { return SetStatus(NativeMethods.GdipSetImageAttributesToIdentity( nativeImageAttr, type)); }
public GpStatus ClearNoOp( ColorAdjustType type ) { return SetStatus(GdiPlus.GdipSetImageAttributesNoOp( nativeImageAttr, type, false)); }
GpStatus ClearNoOp( ColorAdjustType type ) { return SetStatus(NativeMethods.GdipSetImageAttributesNoOp( nativeImageAttr, type, false)); }
GpStatus ClearGamma( ColorAdjustType type ) { return SetStatus(NativeMethods.GdipSetImageAttributesGamma( nativeImageAttr, type, false, 0.0f)); }
GpStatus ClearColorKey( ColorAdjustType type ) { return SetStatus(NativeMethods.GdipSetImageAttributesColorKeys( nativeImageAttr, type, false, 0, 0)); }
/// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearColorKey1"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void ClearColorKey(ColorAdjustType type) { int zero = 0; int status = SafeNativeMethods.Gdip.GdipSetImageAttributesColorKeys( new HandleRef(this, nativeImageAttributes), type, false, zero, zero); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); }
public void SetGamma(float gamma, ColorAdjustType type) { int status = Gdip.GdipSetImageAttributesGamma( new HandleRef(this, nativeImageAttributes), type, true, gamma); if (status != Gdip.Ok) { throw Gdip.StatusException(status); } }
GpStatus SetColorKey( Color colorLow, Color colorHigh, ColorAdjustType type ) { return(SetStatus(NativeMethods.GdipSetImageAttributesColorKeys( nativeImageAttr, type, true, colorLow.ToArgb(), colorHigh.ToArgb()))); }
public void ClearGamma(ColorAdjustType type) { int status = Gdip.GdipSetImageAttributesGamma( new HandleRef(this, nativeImageAttributes), type, false, 0.0f); if (status != Gdip.Ok) { throw Gdip.StatusException(status); } }
public void SetOutputChannel(ColorChannelFlag flags, ColorAdjustType type) { int status = Gdip.GdipSetImageAttributesOutputChannel( new HandleRef(this, nativeImageAttributes), type, true, flags); if (status != Gdip.Ok) { throw Gdip.StatusException(status); } }
/// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearColorMatrix1"]/*' /> /// <devdoc> /// <para> /// Clears the color adjust matrix. /// </para> /// </devdoc> public void ClearColorMatrix(ColorAdjustType type) { int status = SafeNativeMethods.Gdip.GdipSetImageAttributesColorMatrix( new HandleRef(this, nativeImageAttributes), type, false, null, null, ColorMatrixFlag.Default); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); }
/// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetColorMatrix2"]/*' /> /// <devdoc> /// <para> /// Sets the 5 X 5 color adjust matrix to the specified 'Matrix' with the /// specified 'ColorMatrixFlags'. /// </para> /// </devdoc> public void SetColorMatrix(ColorMatrix newColorMatrix, ColorMatrixFlag mode, ColorAdjustType type) { int status = SafeNativeMethods.Gdip.GdipSetImageAttributesColorMatrix( new HandleRef(this, nativeImageAttributes), type, true, newColorMatrix, null, mode); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); }
public void ClearOutputChannelColorProfile(ColorAdjustType type) { int status = Gdip.GdipSetImageAttributesOutputChannel( new HandleRef(this, nativeImageAttributes), type, false, ColorChannelFlag.ColorChannelLast); if (status != Gdip.Ok) { throw Gdip.StatusException(status); } }
public void SetThreshold(float threshold, ColorAdjustType type) { int status = Gdip.GdipSetImageAttributesThreshold( new HandleRef(this, nativeImageAttributes), type, true, threshold); if (status != Gdip.Ok) { throw Gdip.StatusException(status); } }
public GpStatus SetColorKey( Color colorLow, Color colorHigh, ColorAdjustType type ) { return SetStatus(NativeMethods.GdipSetImageAttributesColorKeys( nativeImageAttr, type, true, colorLow.ToArgb(), colorHigh.ToArgb())); }
public void ClearRemapTable(ColorAdjustType type) { int status = Gdip.GdipSetImageAttributesRemapTable( new HandleRef(this, nativeImageAttributes), type, false, 0, NativeMethods.NullHandleRef); if (status != Gdip.Ok) { throw Gdip.StatusException(status); } }
// Get the attribute information for a specific ColorAdjustType value. private AttributeInfo GetInfo(ColorAdjustType type) { AttributeInfo current = info; while(current != null) { if(current.type == type) { return current; } current = current.next; } info = new AttributeInfo(info, type); return info; }
public void SetOutputChannelColorProfile(String colorProfileFilename, ColorAdjustType type) { int status = SafeNativeMethods.Gdip.GdipSetImageAttributesOutputChannelColorProfile( new HandleRef(this, nativeImageAttributes), type, true, colorProfileFilename); if (status != SafeNativeMethods.Gdip.Ok) { throw SafeNativeMethods.Gdip.StatusException(status); } }
// Get the attribute information for a specific ColorAdjustType value. private AttributeInfo GetInfo(ColorAdjustType type) { AttributeInfo current = info; while (current != null) { if (current.type == type) { return(current); } current = current.next; } info = new AttributeInfo(info, type); return(info); }
/// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetColorKey1"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void SetColorKey(Color colorLow, Color colorHigh, ColorAdjustType type) { int lowInt = colorLow.ToArgb(); int highInt = colorHigh.ToArgb(); int status = SafeNativeMethods.Gdip.GdipSetImageAttributesColorKeys( new HandleRef(this, nativeImageAttributes), type, true, lowInt, highInt); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); }
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); } } }
public void SetColorMatrices(ColorMatrix newColorMatrix, ColorMatrix grayMatrix, ColorMatrixFlag mode, ColorAdjustType type) { int status = Gdip.GdipSetImageAttributesColorMatrix( new HandleRef(this, nativeImageAttributes), type, true, newColorMatrix, grayMatrix, mode); if (status != Gdip.Ok) { throw Gdip.StatusException(status); } }
public void SetOutputChannelColorProfile(string colorProfileFilename, ColorAdjustType type) { // Called in order to emulate exception behavior from netfx related to invalid file paths. Path.GetFullPath(colorProfileFilename); int status = Gdip.GdipSetImageAttributesOutputChannelColorProfile( new HandleRef(this, nativeImageAttributes), type, true, colorProfileFilename); if (status != Gdip.Ok) { throw Gdip.StatusException(status); } }
/// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.GetAdjustedPalette"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void GetAdjustedPalette(ColorPalette palette, ColorAdjustType type) { // does inplace adjustment IntPtr memory = palette.ConvertToMemory(); int status = SafeNativeMethods.GdipGetImageAttributesAdjustedPalette( new HandleRef(this, nativeImageAttributes), new HandleRef(null, memory), type); if (status != SafeNativeMethods.Ok) { Marshal.FreeHGlobal(memory); throw SafeNativeMethods.StatusException(status); } palette.ConvertFromMemory(memory); Marshal.FreeHGlobal(memory); }
public void GetAdjustedPalette(ColorPalette palette, ColorAdjustType type) { IntPtr handle = palette.ConvertToMemory(); try { int status = SafeNativeMethods.Gdip.GdipGetImageAttributesAdjustedPalette(new HandleRef(this, this.nativeImageAttributes), new HandleRef(null, handle), type); if (status != 0) { throw SafeNativeMethods.Gdip.StatusException(status); } palette.ConvertFromMemory(handle); } finally { if (handle != IntPtr.Zero) { Marshal.FreeHGlobal(handle); } } }
public void GetAdjustedPalette(ColorPalette palette, ColorAdjustType type) { // does inplace adjustment IntPtr memory = palette.ConvertToMemory(); try { Gdip.CheckStatus(Gdip.GdipGetImageAttributesAdjustedPalette( new HandleRef(this, nativeImageAttributes), memory, type)); palette.ConvertFromMemory(memory); } finally { if (memory != IntPtr.Zero) { Marshal.FreeHGlobal(memory); } } }
public void GetAdjustedPalette(ColorPalette palette, ColorAdjustType type) { // does inplace adjustment IntPtr memory = palette.ConvertToMemory(); try { int status = Gdip.GdipGetImageAttributesAdjustedPalette( new HandleRef(this, nativeImageAttributes), new HandleRef(null, memory), type); if (status != Gdip.Ok) { throw Gdip.StatusException(status); } palette.ConvertFromMemory(memory); } finally { if (memory != IntPtr.Zero) { Marshal.FreeHGlobal(memory); } } }
public void SetThreshold(float threshold, ColorAdjustType type) => throw new NotImplementedException();
public void ClearOutputChannelColorProfile(ColorAdjustType type) => throw new NotImplementedException();
public void SetOutputChannelColorProfile(string colorProfileFilename, ColorAdjustType type) => throw new NotImplementedException();
/// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearNoOp1"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void ClearNoOp(ColorAdjustType type) { int status = SafeNativeMethods.Gdip.GdipSetImageAttributesNoOp( new HandleRef(this, nativeImageAttributes), type, false); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); }
internal static extern GpStatus GdipResetImageAttributes(GpImageAttributes imageattr, ColorAdjustType type);
public void SetColorMatrices(ColorMatrix newColorMatrix, ColorMatrix?grayMatrix, ColorMatrixFlag mode, ColorAdjustType type) { throw new PlatformNotSupportedException(); }
public void ClearColorMatrix(ColorAdjustType type) { // FIXME }
/// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearRemapTable1"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void ClearRemapTable(ColorAdjustType type) { int status = SafeNativeMethods.Gdip.GdipSetImageAttributesRemapTable( new HandleRef(this, nativeImageAttributes), type, false, 0, NativeMethods.NullHandleRef); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); }
/// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetRemapTable1"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void SetRemapTable(ColorMap[] map, ColorAdjustType type) { int index = 0; int mapSize = map.Length; int size = 4; // Marshal.SizeOf(index.GetType()); IntPtr memory = Marshal.AllocHGlobal(checked(mapSize*size*2)); try { for (index=0; index<mapSize; index++) { Marshal.StructureToPtr(map[index].OldColor.ToArgb(), (IntPtr)((long)memory+index*size*2), false); Marshal.StructureToPtr(map[index].NewColor.ToArgb(), (IntPtr)((long)memory+index*size*2+size), false); } int status = SafeNativeMethods.Gdip.GdipSetImageAttributesRemapTable( new HandleRef(this, nativeImageAttributes), type, true, mapSize, new HandleRef(null, memory)); if (status != SafeNativeMethods.Gdip.Ok) { throw SafeNativeMethods.Gdip.StatusException(status); } } finally { Marshal.FreeHGlobal(memory); } }
/// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearOutputChannelColorProfile1"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void ClearOutputChannelColorProfile(ColorAdjustType type) { int status = SafeNativeMethods.Gdip.GdipSetImageAttributesOutputChannel( new HandleRef(this, nativeImageAttributes), type, false, ColorChannelFlag.ColorChannelLast); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); }
/// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetOutputChannelColorProfile1"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void SetOutputChannelColorProfile(String colorProfileFilename, ColorAdjustType type) { IntSecurity.DemandReadFileIO(colorProfileFilename); int status = SafeNativeMethods.Gdip.GdipSetImageAttributesOutputChannelColorProfile( new HandleRef(this, nativeImageAttributes), type, true, colorProfileFilename); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); }
/// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetOutputChannel1"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void SetOutputChannel(ColorChannelFlag flags, ColorAdjustType type) { int status = SafeNativeMethods.Gdip.GdipSetImageAttributesOutputChannel( new HandleRef(this, nativeImageAttributes), type, true, flags); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); }
/// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.ClearColorKey1"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void ClearColorKey(ColorAdjustType type) { int zero = 0; int status = SafeNativeMethods.Gdip.GdipSetImageAttributesColorKeys( new HandleRef(this, nativeImageAttributes), type, false, zero, zero); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); }
/// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetColorKey1"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void SetColorKey(Color colorLow, Color colorHigh, ColorAdjustType type) { int lowInt = colorLow.ToArgb(); int highInt = colorHigh.ToArgb(); int status = SafeNativeMethods.Gdip.GdipSetImageAttributesColorKeys( new HandleRef(this, nativeImageAttributes), type, true, lowInt, highInt); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); }
public void ClearThreshold(ColorAdjustType type) => throw new NotImplementedException();
public void GetAdjustedPalette(ColorPalette palette, ColorAdjustType type) => throw new NotImplementedException();
/// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.GetAdjustedPalette"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void GetAdjustedPalette(ColorPalette palette, ColorAdjustType type) { // does inplace adjustment IntPtr memory = palette.ConvertToMemory(); try { int status = SafeNativeMethods.Gdip.GdipGetImageAttributesAdjustedPalette( new HandleRef(this, nativeImageAttributes), new HandleRef(null, memory), type); if (status != SafeNativeMethods.Gdip.Ok) { throw SafeNativeMethods.Gdip.StatusException(status); } palette.ConvertFromMemory(memory); } finally { if(memory != IntPtr.Zero) { Marshal.FreeHGlobal(memory); } } }
/// <summary> /// Clears the gamma for the color adjust type. /// </summary> /// <param name="type">Type.</param> public void ClearGamma(ColorAdjustType type) { isGammaSet = false; }
private static Color ProcessColorMatrices (Color color, ColorMatrix colorMatrix, ColorMatrix grayMatrix, ColorMatrixFlag flags, ColorAdjustType type) { using (Bitmap bmp = new Bitmap (64, 64)) { using (Graphics gr = Graphics.FromImage (bmp)) { ImageAttributes imageAttr = new ImageAttributes (); bmp.SetPixel (0, 0, color); imageAttr.SetColorMatrices (colorMatrix, grayMatrix, flags, type); gr.DrawImage (bmp, new Rectangle (0, 0, 64, 64), 0, 0, 64, 64, GraphicsUnit.Pixel, imageAttr); return bmp.GetPixel (0, 0); } } }
internal static extern GpStatus GdipSetImageAttributesGamma(GpImageAttributes imageattr, ColorAdjustType type, bool enableFlag, float gamma);
public void ClearNoOp(ColorAdjustType type) => throw new NotImplementedException();
public void SetOutputChannel(ColorChannelFlag flags, ColorAdjustType type) => throw new NotImplementedException();
internal static extern GpStatus GdipSetImageAttributesThreshold(GpImageAttributes imageattr, ColorAdjustType type, bool enableFlag, float threshold);
internal static extern GpStatus GdipSetImageAttributesColorKeys(GpImageAttributes imageattr, ColorAdjustType type, bool enableFlag, int colorLow, int colorHigh);
/// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetColorMatrices2"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void SetColorMatrices(ColorMatrix newColorMatrix, ColorMatrix grayMatrix, ColorMatrixFlag mode, ColorAdjustType type) { int status = SafeNativeMethods.Gdip.GdipSetImageAttributesColorMatrix( new HandleRef(this, nativeImageAttributes), type, true, newColorMatrix, grayMatrix, mode); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); }
internal static extern GpStatus GdipSetImageAttributesNoOp(GpImageAttributes imageattr, ColorAdjustType type, bool enableFlag);
/// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetThreshold1"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void SetThreshold(float threshold, ColorAdjustType type) { int status = SafeNativeMethods.Gdip.GdipSetImageAttributesThreshold( new HandleRef(this, nativeImageAttributes), type, true, threshold); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); }
internal static extern GpStatus GdipSetImageAttributesToIdentity(GpImageAttributes imageattr, ColorAdjustType type);
/// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.SetGamma1"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void SetGamma(float gamma, ColorAdjustType type) { int status = SafeNativeMethods.Gdip.GdipSetImageAttributesGamma( new HandleRef(this, nativeImageAttributes), type, true, gamma); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); }