您的位置:首页 > Web前端

C# Unsafe代码处理图像

2013-12-05 11:35 330 查看
Bitmap image = new Bitmap("c:\\images\\image.gif");
            BitmapData data = image.LockBits(new Rectangle(0, 0, image.Width, image.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
            unsafe
            {
                byte* ptr = (byte*)(data.Scan0);
                for (int i = 0; i < data.Height; i++)
                {
                    for (int j = 0; j < data.Width; j++)
                    {
                        // write the logic implementation here
                        ptr += 3;
                    }
                    ptr += data.Stride - data.Width * 3;
                }
            }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  c# 指针 bitmap