Exemple #1
0
        public void SetColorMatrices(ColorMatrix newColorMatrix, ColorMatrix grayMatrix, ColorMatrixFlag mode, ColorAdjustType type)
        {
            Status status;
            IntPtr cm = ColorMatrix.Alloc(newColorMatrix);

            try
            {
                if (grayMatrix == null)
                {
                    status = GDIPlus.GdipSetImageAttributesColorMatrix(nativeImageAttr, type, true, cm,
                                                                       IntPtr.Zero, mode);
                }
                else
                {
                    IntPtr gm = ColorMatrix.Alloc(grayMatrix);
                    try
                    {
                        status = GDIPlus.GdipSetImageAttributesColorMatrix(nativeImageAttr, type, true,
                                                                           cm, gm, mode);
                    }
                    finally
                    {
                        ColorMatrix.Free(gm);
                    }
                }
            }
            finally
            {
                ColorMatrix.Free(cm);
            }
            GDIPlus.CheckStatus(status);
        }
Exemple #2
0
        public void SetColorMatrix(ColorMatrix newColorMatrix, ColorMatrixFlag mode, ColorAdjustType type)
        {
            IntPtr cm = ColorMatrix.Alloc(newColorMatrix);

            try {
                Status status = GDIPlus.GdipSetImageAttributesColorMatrix(nativeImageAttr,
                                                                          type, true, cm, IntPtr.Zero, mode);
                GDIPlus.CheckStatus(status);
            }
            finally {
                ColorMatrix.Free(cm);
            }
        }