MSDN(2001.Oct)里: mk:@MSITStore:D:\Microsoft%20Visual%20Studio\MSDN\2001OCT\1033\MultiMed.chm::/hh/multimed/avifile_8dgz.htm看看SDK里 Video for Windows这一章: DrawDib The DrawDib functions provide high performance image-drawing capabilities for device-independent bitmaps (DIBs). DrawDib functions support DIBs of 8-bit, 16-bit, 24-bit, and 32-bit image depths.DrawDib functions write directly to video memory. They do not rely on functions of the graphics device interface (GDI). About the DrawDib Functions Using DrawDib DrawDib Reference
Drawing a Display Context The following example prepares a DrawDib DC by using the DrawDibRealize function prior to displaying several images in a bitmap sequence.hdc = GetDC(hwnd); DrawDibBegin(hdd, hdc, dxDest, dyDest, lpbi, dxSrc, dySrc, NULL); DrawDibRealize(hdd, hdc, fBackground); DrawDibDraw(hdd, hdc, xDst, yDst, dxDst, dyDst, lpbi, lpBits, xSrc, ySrc, dxSrc, dySrc, DDF_SAME_DRAW|DDF_SAME_HDC); DrawDibDraw(hdd, hdc, xDst, yDst, dxDst, dyDst, lpbi, lpBits, xSrc, ySrc, dxSrc, dySrc, DDF_SAME_DRAW|DDF_SAME_HDC); DrawDibDraw(hdd, hdc, xDst, yDst, dxDst, dyDst, lpbi, lpBits, xSrc, ySrc, dxSrc, dySrc, DDF_SAME_DRAW|DDF_SAME_HDC); ReleaseDC(hwnd, hdc);
3DMan(子弹满满) :这样做就用不了MFC的SDI了,可惜.
看来你还不太清楚SDK编程 MFC的SDI、MDI等所有只是微软包装的一个框架,你只要包含sdk的库就可以进行任何SDK的编程了Windows NT/2000/XP: Included in Windows NT 3.1 and later. Windows 95/98/Me: Included in Windows 95 and later. Header: Declared in Vfw.h. Library: Use Vfw32.lib.比如在你要用的CPP前面加上 #include vfw.h 在库链接里加上Vfw32.lib 就可以用你要的所有功能了当然,你首先要装PlatForm SDK
video for windows是微软用来支持音视频捕获、解压缩的专用开发包,在DirectX未流行之前,音视频的软件开发都要依靠它,有卓越的表现。 DrawDib能进行24桢/秒 320x240像素图像(注意不是图形)的绘制,当然,其实每幅就是一张位图
// 把数组组成的点画到屏幕上去.
int i=0,j=0;
//i = pDoc->LocationX;
//j = pDoc->LocationY;
for(;j<pDoc->LocationY;j++){ // 列
for(;i<pDoc->LocationX;i++){ // 行
//==========================================================
// 因为太慢,所以用顺序执行.
//==========================================================
//for(char count=0;count<8;count++){ // 一个字节.
//if((pDoc->Pixel[i][j]>>count)&0x01) // 点还是空白的.
// pDC->SetPixel((i*8+count),j,RGB(180,40,15)); // 画点.
if(pDoc->Pixel[i][j]&0x01)
pDC->SetPixel((i*8+0),j,RGB(0,128,128));
if(pDoc->Pixel[i][j]&0x02)
pDC->SetPixel((i*8+1),j,RGB(0,128,128));
if(pDoc->Pixel[i][j]&0x04)
pDC->SetPixel((i*8+2),j,RGB(0,128,128));
if(pDoc->Pixel[i][j]&0x08)
pDC->SetPixel((i*8+3),j,RGB(0,128,128));
if(pDoc->Pixel[i][j]&0x10)
pDC->SetPixel((i*8+4),j,RGB(0,128,128));
if(pDoc->Pixel[i][j]&0x20)
pDC->SetPixel((i*8+5),j,RGB(0,128,128));
if(pDoc->Pixel[i][j]&0x40)
pDC->SetPixel((i*8+6),j,RGB(0,128,128));
if(pDoc->Pixel[i][j]&0x80)
pDC->SetPixel((i*8+7),j,RGB(0,128,128));
//}
}
i=0; // 画完一行.
}
}
//在内存画一幅800*600的图.
for(i=0;i<LocationX;i++)
for(j=0;j<LocationY;j++)
Pixel[i][j]=0xff;
先分配一块内存,直接往里面写各个象素的数据,
然后调用SetDIBitsToDevice,就ok了
CDC MemDC; // 定义一个显示设备对象
CBitmap MemBitmap; // 定义一个位图对象
怎么向MenDC内存直接写入点.不要用SetPixel(),SetPixelV()?
我现在可以用SetPixelV()向MemDC写入点,然后复制到屏幕,但还是太慢.
mk:@MSITStore:D:\Microsoft%20Visual%20Studio\MSDN\2001OCT\1033\MultiMed.chm::/hh/multimed/avifile_8dgz.htm看看SDK里 Video for Windows这一章:
DrawDib
The DrawDib functions provide high performance image-drawing capabilities for device-independent bitmaps (DIBs). DrawDib functions support DIBs of 8-bit, 16-bit, 24-bit, and 32-bit image depths.DrawDib functions write directly to video memory. They do not rely on functions of the graphics device interface (GDI). About the DrawDib Functions
Using DrawDib
DrawDib Reference
The following example prepares a DrawDib DC by using the DrawDibRealize function prior to displaying several images in a bitmap sequence.hdc = GetDC(hwnd);
DrawDibBegin(hdd, hdc, dxDest, dyDest, lpbi, dxSrc, dySrc, NULL);
DrawDibRealize(hdd, hdc, fBackground);
DrawDibDraw(hdd, hdc, xDst, yDst, dxDst, dyDst, lpbi, lpBits,
xSrc, ySrc, dxSrc, dySrc, DDF_SAME_DRAW|DDF_SAME_HDC);
DrawDibDraw(hdd, hdc, xDst, yDst, dxDst, dyDst, lpbi, lpBits,
xSrc, ySrc, dxSrc, dySrc, DDF_SAME_DRAW|DDF_SAME_HDC);
DrawDibDraw(hdd, hdc, xDst, yDst, dxDst, dyDst, lpbi, lpBits,
xSrc, ySrc, dxSrc, dySrc, DDF_SAME_DRAW|DDF_SAME_HDC);
ReleaseDC(hwnd, hdc);
MFC的SDI、MDI等所有只是微软包装的一个框架,你只要包含sdk的库就可以进行任何SDK的编程了Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Vfw.h.
Library: Use Vfw32.lib.比如在你要用的CPP前面加上 #include vfw.h
在库链接里加上Vfw32.lib
就可以用你要的所有功能了当然,你首先要装PlatForm SDK
DrawDib能进行24桢/秒 320x240像素图像(注意不是图形)的绘制,当然,其实每幅就是一张位图