本文整理汇总了C#中System.Drawing.Imaging.ImageAttributes.ClearRemapTable方法的典型用法代码示例。如果您正苦于以下问题:C# ImageAttributes.ClearRemapTable方法的具体用法?C# ImageAttributes.ClearRemapTable怎么用?C# ImageAttributes.ClearRemapTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Imaging.ImageAttributes
的用法示例。
在下文中一共展示了ImageAttributes.ClearRemapTable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToWaterMark
//.........这里部分代码省略.........
graphics.DrawString(this.WaterMarkText, font, new SolidBrush(Color.FromArgb(0x99, 0, 0, 0)), new PointF(x + 1f, y + 1f), format);
graphics.DrawString(this.WaterMarkText, font, new SolidBrush(Color.FromArgb(this.Diaphaneity, 0xff, 0xff, 0xff)), new PointF(x, y), format);
format.Dispose();
}
}
catch (Exception exception1)
{
exception = exception1;
this.message = exception.Message;
}
finally
{
graphics.Dispose();
}
if ((this.WaterMarkImagePath == null) || (this.WaterMarkImagePath.Trim() == string.Empty))
{
random = new Random();
str3 = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + "_" + random.Next().ToString() + sExt;
string str4 = HttpContext.Current.Server.MapPath("~/" + str);
image.Save(str4 + @"\" + str3);
helper.DeleteFile(HttpContext.Current.Server.MapPath("~/" + this.SourceImagePath));
if (str.Substring(0, 1) == "/")
{
str = str.Substring(1, str.Length - 1);
}
this.filePath = str + "/" + str3;
return true;
}
Image image2 = Image.FromFile(HttpContext.Current.Server.MapPath("~/" + this.WaterMarkImagePath));
int num8 = image2.Width;
int num9 = image2.Height;
if ((width < num8) || (height < (num9 * 2)))
{
random = new Random();
str3 = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + "_" + random.Next().ToString() + sExt;
image.Save(HttpContext.Current.Server.MapPath("~/" + str) + @"\" + str3);
helper.DeleteFile(HttpContext.Current.Server.MapPath("~/" + this.SourceImagePath));
if (str.Substring(0, 1) == "/")
{
str = str.Substring(1, str.Length - 1);
}
this.filePath = str + "/" + str3;
return true;
}
Bitmap bitmap2 = new Bitmap(image);
image.Dispose();
bitmap2.SetResolution(horizontalResolution, verticalResolution);
Graphics graphics2 = Graphics.FromImage(bitmap2);
ImageAttributes imageAttr = new ImageAttributes();
ColorMap map = new ColorMap();
map.OldColor = Color.FromArgb(0xff, 0, 0xff, 0);
map.NewColor = Color.FromArgb(0, 0, 0, 0);
imageAttr.SetRemapTable(new ColorMap[] { map }, ColorAdjustType.Bitmap);
float[][] newColorMatrix = new float[5][];
float[] numArray3 = new float[5];
numArray3[0] = 1f;
newColorMatrix[0] = numArray3;
numArray3 = new float[5];
numArray3[1] = 1f;
newColorMatrix[1] = numArray3;
numArray3 = new float[5];
numArray3[2] = 1f;
newColorMatrix[2] = numArray3;
numArray3 = new float[5];
numArray3[3] = this.ImageDeaphaneity;
newColorMatrix[3] = numArray3;
numArray3 = new float[5];
numArray3[4] = 1f;
newColorMatrix[4] = numArray3;
imageAttr.SetColorMatrix(new ColorMatrix(newColorMatrix), ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
this.GetWaterMarkXY(out num10, out num11, width, height, num8, num9);
graphics2.DrawImage(image2, new Rectangle(num10, num11, num8, num9), 0, 0, num8, num9, GraphicsUnit.Pixel, imageAttr);
imageAttr.ClearColorMatrix();
imageAttr.ClearRemapTable();
image2.Dispose();
graphics2.Dispose();
try
{
random = new Random();
str3 = "YXShop" + DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + "_" + random.Next().ToString() + sExt;
bitmap2.Save(HttpContext.Current.Server.MapPath("~/" + str) + @"\" + str3);
helper.DeleteFile(HttpContext.Current.Server.MapPath("~/" + this.SourceImagePath));
if (str.Substring(0, 1) == "/")
{
str = str.Substring(1, str.Length - 1);
}
this.filePath = str + "/" + str3;
return true;
}
catch (Exception exception2)
{
exception = exception2;
this.message = exception.Message;
}
finally
{
bitmap2.Dispose();
}
return false;
}
示例2: UpdateImageAttributes
private void UpdateImageAttributes()
{
GdiHelpers.DisposeObject(ref imageAttribs);
imageAttribs = GdiHelpers.GetImageAttributes(ImageLayoutMode.Fit, isPreview);
imageAttribs.ClearRemapTable();
// As long as we cannot set/unset the color (available in next version), we map every color...
//if (ReplaceColor != Color.Empty) {
colorReplaceMap.OldColor = ReplaceColor;
colorReplaceMap.NewColor = FillStyle.BaseColorStyle.Color;
ColorMap[] colorMap = { colorReplaceMap };
imageAttribs.SetRemapTable(colorMap);
//}
}