SetColorMatrices() public method

public SetColorMatrices ( System.Drawing.Imaging.ColorMatrix newColorMatrix, System.Drawing.Imaging.ColorMatrix gMatrix ) : void
newColorMatrix System.Drawing.Imaging.ColorMatrix
gMatrix System.Drawing.Imaging.ColorMatrix
return void
Esempio n. 1
0
		public void SetColorMatrices_InvalidFlags ()
		{
			using (ImageAttributes ia = new ImageAttributes ()) {
				ia.SetColorMatrices (global_color_matrix, global_color_matrix, (ColorMatrixFlag) Int32.MinValue);
			}
		}
Esempio n. 2
0
		public void SetColorMatrices_InvalidType ()
		{
			using (ImageAttributes ia = new ImageAttributes ()) {
				ia.SetColorMatrices (global_color_matrix, global_color_matrix, ColorMatrixFlag.Default, (ColorAdjustType) Int32.MinValue);
			}
		}
Esempio n. 3
0
		public void SetColorMatrices_ColorMatrix_ColorMatrix ()
		{
			using (ImageAttributes ia = new ImageAttributes ()) {
				ia.SetColorMatrices (global_color_matrix, global_color_matrix);
				ia.SetColorMatrices (global_color_matrix, global_color_matrix, ColorMatrixFlag.Default);
				ia.SetColorMatrices (global_color_matrix, global_color_matrix, ColorMatrixFlag.SkipGrays);
				ia.SetColorMatrices (global_color_matrix, global_color_matrix, ColorMatrixFlag.AltGrays);
			}
		}
Esempio n. 4
0
		public void SetColorMatrices_ColorMatrix_Null_AltGrays ()
		{
			using (ImageAttributes ia = new ImageAttributes ()) {
				ia.SetColorMatrices (global_color_matrix, null, ColorMatrixFlag.AltGrays);
			}
		}
Esempio n. 5
0
		public void SetColorMatrices_Null_ColorMatrix ()
		{
			using (ImageAttributes ia = new ImageAttributes ()) {
				ia.SetColorMatrices (null, global_color_matrix);
			}
		}
Esempio n. 6
0
		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);
				}
			}
		}
Esempio n. 7
0
           new float[] {-0.5f, -0.5f, .8f, 0, 1}}; // three translations of 0.2

        #endregion Fields

        #region Methods

        public static void AddColourizer(ImageAttributes toia, Color usecolor)
        {
            ColorMatrix grayscaler = GrayScale();
            toia.SetColorMatrices(GetColourizer(usecolor), grayscaler);
        }