|
Search This Site: |
|
|||||||
| microsoft.public.vb.general.discussion General Visual Basic Discussion |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
#1 |
|
Join Date: Apr 2006
Age: 42
Total Posts: 1
|
Re: How image size can change using Intel Library
I resize the bitmap but when i am trying to write the buffer into a BMP
File then i found that it is totally black image only. below is the code snippet. let me know what is missing for setting the color. BYTE* pImageBuf = NULL; int nScaleHeight = -m_bmpInfo.bmiHeader.biHeight / 2; int nScaleWidth = m_bmpInfo.bmiHeader.biWidth / 2; HDC ImgDestDC = NULL; HBITMAP ImgDestBMP; long lRet; ImgDestDC = CreateCompatibleDC(NULL); ImgDestBMP = CreateCompatibleBitmap(ImgDestDC, nScaleWidth, nScaleHeight); SelectObject(ImgDestDC, ImgDestBMP); lRet = StretchDIBits(ImgDestDC, 0, 0, nScaleWidth, nScaleHeight, 0, 0, m_bmpInfo.bmiHeader.biWidth, -m_bmpInfo.bmiHeader.biHeight, buffer, &m_bmpInfo, DIB_RGB_COLORS, SRCCOPY); if (lRet == GDI_ERROR) return NULL; iBufferSize = nScaleWidth * nScaleHeight * 3; BITMAPINFO ScaleBMI; memset(&ScaleBMI, 0, sizeof(ScaleBMI)); ScaleBMI.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); ScaleBMI.bmiHeader.biWidth = nScaleWidth; ScaleBMI.bmiHeader.biHeight = -nScaleHeight; // top-down image ScaleBMI.bmiHeader.biPlanes = 1; ScaleBMI.bmiHeader.biBitCount = 24; ScaleBMI.bmiHeader.biCompression = BI_RGB; ScaleBMI.bmiHeader.biSizeImage = iBufferSize; pImageBuf = new unsigned char [iBufferSize]; lRet1 = GetDIBits(ImgDestDC, ImgDestBMP, 0, nScaleHeight, pImageBuf, &ScaleBMI, DIB_RGB_COLORS); WriteBitmapFile(pImageBuf); if (lRet == GDI_ERROR) return NULL; Parul |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Section | Replies | Last Post |
| CASIO INTRODUCES NEW 10.1 MEGAPIXEL EXILIM ZOOM | erdega79 | rec.photo.digital | 10 | 28th April 2006 11:15 PM |