当前位置: 首页>>代码示例>>C#>>正文


C# ImageAttributes.ClearRemapTable方法代码示例

本文整理汇总了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;
 }
开发者ID:qq358292363,项目名称:showShop,代码行数:101,代码来源:UploadProcesedImages.cs

示例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);
            //}
        }
开发者ID:LudovicT,项目名称:NShape,代码行数:14,代码来源:ImageBasedShape.cs


注:本文中的System.Drawing.Imaging.ImageAttributes.ClearRemapTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。