Popular Usenet Groups

Your one stop shop for all your most popular usenet groups in one place


Categories
Sports Science, Electronics & Maths Hobbies & Recreation
Religion TV & Media Computing - Programming
Music Cycling & Motorsports Computing - General
Photography Computing - Linux Computing - Apple Mac
Others Return to Home Page Register for extra features


Search This Site:

Go Back   Popular Usenet Groups > Computing - Progamming > microsoft.public.vb.general.discussion

microsoft.public.vb.general.discussion General Visual Basic Discussion


 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 25th April 2006, 01:20 PM   #1
jain
 
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

jain is offline   Reply With Quote
 

Bookmarks


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

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


All times are GMT. The time now is 07:59 AM.


Powered by vBulletin® Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.