System.Drawing.Imaging.ImageAttributes.SetRemapTable C# (CSharp) Method

SetRemapTable() public method

public SetRemapTable ( System.Drawing.Imaging.ColorMap map ) : void
map System.Drawing.Imaging.ColorMap
return void
		public void SetRemapTable(ColorMap[] map)
		{
			SetRemapTable(map, ColorAdjustType.Default);
		}

Same methods

ImageAttributes::SetRemapTable ( System.Drawing.Imaging.ColorMap map, ColorAdjustType type ) : void

Usage Example

 internal static void RenderAlphaImage(Graphics g, Image image, Rectangle imageRect, float alpha)
 {
     using (ImageAttributes imageAttributes = new ImageAttributes())
     {
         ColorMap colorMap = new ColorMap();
         colorMap.OldColor = Color.FromArgb(0xff, 0, 0xff, 0);
         colorMap.NewColor = Color.FromArgb(0, 0, 0, 0);
         ColorMap[] remapTable = new ColorMap[] { colorMap };
         imageAttributes.SetRemapTable(remapTable, ColorAdjustType.Bitmap);
         float[][] CS_0_0001 = new float[5][];
         float[] CS_0_0002 = new float[5];
         CS_0_0002[0] = 1f;
         CS_0_0001[0] = CS_0_0002;
         float[] CS_0_0003 = new float[5];
         CS_0_0003[1] = 1f;
         CS_0_0001[1] = CS_0_0003;
         float[] CS_0_0004 = new float[5];
         CS_0_0004[2] = 1f;
         CS_0_0001[2] = CS_0_0004;
         float[] CS_0_0005 = new float[5];
         CS_0_0005[3] = alpha;
         CS_0_0001[3] = CS_0_0005;
         float[] CS_0_0006 = new float[5];
         CS_0_0006[4] = 1f;
         CS_0_0001[4] = CS_0_0006;
         float[][] colorMatrixElements = CS_0_0001;
         ColorMatrix wmColorMatrix = new ColorMatrix(colorMatrixElements);
         imageAttributes.SetColorMatrix(wmColorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
         g.DrawImage(image, imageRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, imageAttributes);
     }
 }
All Usage Examples Of System.Drawing.Imaging.ImageAttributes::SetRemapTable