本文整理匯總了C#中System.Drawing.Imaging.ImageAttributes.SetRemapTable方法的典型用法代碼示例。如果您正苦於以下問題:C# ImageAttributes.SetRemapTable方法的具體用法?C# ImageAttributes.SetRemapTable怎麽用?C# ImageAttributes.SetRemapTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Drawing.Imaging.ImageAttributes
的用法示例。
在下文中一共展示了ImageAttributes.SetRemapTable方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SetRemapTableExample
private void SetRemapTableExample(PaintEventArgs e)
{
// Create a filled, red image, and save it to Circle2.jpg.
Bitmap myBitmap = new Bitmap(50, 50);
Graphics g = Graphics.FromImage(myBitmap);
g.Clear(Color.White);
g.FillEllipse(new SolidBrush(Color.Red),
new Rectangle(0, 0, 50, 50));
myBitmap.Save("Circle2.jpg");
// Create an Image object from the Circle2.jpg file, and draw it to
// the screen.
Image myImage = Image.FromFile("Circle2.jpg");
e.Graphics.DrawImage(myImage, 20, 20);
// Create a color map.
ColorMap[] myColorMap = new ColorMap[1];
myColorMap[0] = new ColorMap();
myColorMap[0].OldColor = Color.Red;
myColorMap[0].NewColor = Color.Green;
// Create an ImageAttributes object, and then pass the
// myColorMap object to the SetRemapTable method.
ImageAttributes imageAttr = new ImageAttributes();
imageAttr.SetRemapTable(myColorMap);
// Draw the image with the remap table set.
Rectangle rect = new Rectangle(150, 20, 50, 50);
e.Graphics.DrawImage(myImage, rect, 0, 0, 50, 50,
GraphicsUnit.Pixel, imageAttr);
}