第一个问题,我如何能对比两个DC的内容是否一致?
第二个问题,我想把DC和一段Byte数组互相拷贝,使用CopyMemory怎么办?我想不会是使用hDC来做罢?
想法是这样的,我想copy下来屏幕DC,然后分割成小区域,
判断哪个区域发生变化,那么把这个区域转化为二进制从网络传递出去。
第二个问题,我想把DC和一段Byte数组互相拷贝,使用CopyMemory怎么办?我想不会是使用hDC来做罢?
想法是这样的,我想copy下来屏幕DC,然后分割成小区域,
判断哪个区域发生变化,那么把这个区域转化为二进制从网络传递出去。
谢谢你的提议,
那么不知道你有没有你所说的在内存中压缩图像的函数,或者算法?
不能变成文件压,因为不断的磁盘操作会很慢。
'Paste this code into Form1
Private Type BITMAP
bmType As Long
bmWidth As Long
bmHeight As Long
bmWidthBytes As Long
bmPlanes As Integer
bmBitsPixel As Integer
bmBits As Long
End Type
Private Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
Private Declare Function GetBitmapBits Lib "gdi32" (ByVal hBitmap As Long, ByVal dwCount As Long, lpBits As Any) As Long
Private Declare Function SetBitmapBits Lib "gdi32" (ByVal hBitmap As Long, ByVal dwCount As Long, lpBits As Any) As Long
Dim PicBits() As Byte, PicInfo As BITMAP, Cnt As Long
Private Sub Command1_Click()
'KPD-Team 1999
'URL: http://www.allapi.net/
'E-Mail: [email protected]
'Get information (such as height and width) about the picturebox
GetObject Picture1.Image, Len(PicInfo), PicInfo
'reallocate storage space
ReDim PicBits(1 To PicInfo.bmWidth * PicInfo.bmHeight * 3) As Byte
'Copy the bitmapbits to the array
GetBitmapBits Picture1.Image, Ubound(PicBits), PicBits(1)
'Invert the bits
For Cnt = 1 To Ubound(PicBits)
PicBits(Cnt) = 255 - PicBits(Cnt)
Next Cnt
'Set the bits back to the picture
SetBitmapBits Picture1.Image, Ubound(PicBits), PicBits(1)
'refresh
Picture1.Refresh
End Sub
想加快速度的话就用 与设备无关的位图(dib)
jlum99(闲人)
jpeg当然可以满足我的要求,我也想用啊,可是你有好的算法吗?呵呵,发这个贴子我是一时好奇,想知道如何拷贝DC的内容到一个数组啊,
难道只是传递给copymemory它的hDC,我想不会。
所以还是要问怎么copymemory啊。
呵呵,传递图像只不过是原来的目的~
还有基于流不能与每一部分都等价,文件头部信息需要另行处理
http://expert.csdn.net/Expert/topic/2072/2072641.xml?temp=.2021143