陋室铭
永远也不要停下学习的脚步(大道至简至易)

 

 

                #region 给透明的png图片加入白色底色
                Image Image = Image.FromFile("路径");
                Bitmap pbitmap = new Bitmap(Image);
                Graphics g2 = Graphics.FromImage(Image);
                GraphicsPath gp = new GraphicsPath(); //新建图像路径来存储透明的点

                for (int x = 0; x < 60; x++)
                {
                    for (int y = 0; y < 60; y++)
                    {

                        Color c = pbitmap.GetPixel(x, y);

                        if (c.A == 0)
                        {
                            gp.AddRectangle(new Rectangle(x, y, 1, 1));//添加点到路径
                            g2.DrawPath(Pens.White, gp);
                        }
                        else
                        {

                        }
                    }
                }
                #endregion

 

posted on 2020-04-13 12:21  宏宇  阅读(2725)  评论(0编辑  收藏  举报