rt,CDC如何能得到并处理内存中已存在的像素点矩阵

解决方案 »

  1.   

    循环画上去吧
    pDC->SetPixel(point.x,point.y,RGB(0,0,0));
      

  2.   

    我需要用CDC得到像素矩阵,然后再用StretchBlt画图
      

  3.   

    // get mem
    unsigned fsize;
    fsize =if_hnd.GetLength();//
    BYTE *ScreenPtr1=0;
    ScreenPtr1=(BYTE *)new char[fsize];  //
    // read all in
    if_hnd.Read(ScreenPtr1,fsize);// 数据在这里
    // image data are in buffer
    if(if_hnd) if_hnd.Close();
    // make bitmap info
    LPBITMAPINFO pBMPinfo;
    pBMPinfo=(LPBITMAPINFO)new BYTE[sizeof(BITMAPINFOHEADER)+16*sizeof(RGBQUAD)];
    ZeroMemory(&pBMPinfo->bmiHeader,sizeof(BITMAPINFOHEADER));
    pBMPinfo->bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
    pBMPinfo->bmiHeader.biBitCount=4;
    pBMPinfo->bmiHeader.biWidth=648;
    pBMPinfo->bmiHeader.biHeight=508;
    pBMPinfo->bmiHeader.biPlanes=1;
    pBMPinfo->bmiHeader.biSizeImage=648*508/2;
    // copy colors
    for(int jj=0; jj<16; jj++)
    {// reversed !
    pBMPinfo->bmiColors[jj].rgbReserved=0;
    pBMPinfo->bmiColors[jj].rgbRed=(BYTE)(color_table[jj]  & 0x0000FF);
    pBMPinfo->bmiColors[jj].rgbGreen=(BYTE)((color_table[jj] & 0x00FF00) >> 8);
    pBMPinfo->bmiColors[jj].rgbBlue=(BYTE)((color_table[jj]   & 0xFF0000) >> 16);
    }
    // draw bmp
    pDC->SetStretchBltMode(COLORONCOLOR);
    StretchDIBits(pDC->GetSafeHdc(),0,0,wid,hei,0,0,wid,hei,
    ScreenPtr1,
    pBMPinfo,
    DIB_RGB_COLORS,SRCCOPY);
    // free
    delete pBMPinfo;
    delete [] ScreenPtr1;
    return;
      

  4.   

    怎么bitblt到memdc啊,能说的详细点吗