文号
t20006
阅读
4767
回复
7
收藏
4
【Binary.dll[阉割版]】源代码放出
2009/10/06
IP:广东
RF Studio 版权所有

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using Microsoft.VisualBasic;

namespace Binary
{
    public class CSunsafe
    {
        private System.Drawing.Bitmap curBitmap;

        private int[,] pic;
        private int[,,] pic1;

        public void File_Init(string sFilename)
        {
            if (sFilename != null)
            {
                curBitmap = (Bitmap)Image.FromFile(sFilename);
            }
        }

        public void BMP_Init(Bitmap BMP)
        {
            if (BMP != null)
            {
                curBitmap = BMP;
            }
        }

        public int[,,] GetRGB()
        {
            if (curBitmap != null)
            {
                Rectangle rect = new Rectangle(0, 0, curBitmap.Width, curBitmap.Height);
                System.Drawing.Imaging.BitmapData bmpData = curBitmap.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite, curBitmap.PixelFormat);
                pic = new int[bmpData.Width, bmpData.Height];
                pic1 = new int[3,bmpData.Width+1, bmpData.Height+1];
                unsafe
                {
                    byte* ptr = (byte*)(bmpData.Scan0);
                    for (int i = 0; i < bmpData.Height; i++)
                    {
                        for (int j = 0; j < bmpData.Width; j++)
                        {
                            pic1[0,j,i]=ptr[2];
                            pic1[1,j,i]=ptr[1];
                            pic1[2, j, i] = ptr[0];
                            ptr += 3;
                        }
                        ptr += bmpData.Stride - bmpData.Width * 3;
                    }
                }
                curBitmap.UnlockBits(bmpData);
                return pic1;
            }
            else
            {
                return null;
            }
        }
    }
    
}
93°作者
17年3个月前IP:未同步
155627
1楼
【示例】

        Dim r(,,) As Integer
        Dim aa As New Binary.CSunsafe
        aa.BMP_Init(PictureBox1.Image)
        r = aa.GetRGB
引用
评论
17年3个月前IP:未同步
155631
2楼
做什么用的?
引用
评论
93°作者
17年3个月前IP:未同步
155640
3楼
看函数名就明白了吧。。。 = =
引用
评论
17年3个月前IP:未同步
155653
4楼
不明白 求详解
引用
评论
17年3个月前IP:未同步
155722
5楼
将图像数据存入数组中,比GETXXX速度更快
引用
评论
16年1个月前IP:未同步
268163
6楼
这样也行..........[s:245]
引用
评论
笔记
{{note.content}}
{{n.user.username}}
{{fromNow(n.toc)}} {{n.status === noteStatus.disabled ? "已屏蔽" : ""}} {{n.status === noteStatus.unknown ? "正在审核" : ""}} {{n.status === noteStatus.deleted ? '已删除' : ''}}
  • 编辑
  • 删除
  • {{n.status === 'disabled' ? "解除屏蔽" : "屏蔽" }}
我也是有底线的