Click here to Skip to main content
15,888,968 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Making the Disk Defragmenter a Modal dialog Pin
Luc Pattyn3-Mar-11 7:37
sitebuilderLuc Pattyn3-Mar-11 7:37 
QuestionMac and IP address problem Pin
trioum3-Mar-11 5:14
trioum3-Mar-11 5:14 
QuestionRe: Mac and IP address problem Pin
David Crow3-Mar-11 5:33
David Crow3-Mar-11 5:33 
AnswerRe: Mac and IP address problem Pin
trioum3-Mar-11 6:11
trioum3-Mar-11 6:11 
QuestionRe: Mac and IP address problem Pin
David Crow3-Mar-11 7:25
David Crow3-Mar-11 7:25 
QuestionHow to calculate to get new pixel color by mixing the alpha value with r, g and b value Pin
Amrit Agr2-Mar-11 22:40
Amrit Agr2-Mar-11 22:40 
AnswerRe: How to calculate to get new pixel color by mixing the alpha value with r, g and b value Pin
Richard MacCutchan3-Mar-11 2:08
mveRichard MacCutchan3-Mar-11 2:08 
AnswerRe: How to calculate to get new pixel color by mixing the alpha value with r, g and b value Pin
Andrew Brock3-Mar-11 2:31
Andrew Brock3-Mar-11 2:31 
Perhaps elaborate on what you are trying to do so that we can help you better.

Also note that Bitmap pictures pad each scanline to a multiple of 4 bytes.
If your bitmaps are 32bit, then you can ignore this.
That is if your picture is 5 pixels wide, each pixel taking 3 bytes (24 bits) then each scanline would be 5 * 3 = 15bytes wide.
Since that is not a multiple of 4 some bytes (1 in this case) are added to align the next scanline.

Note: The MSDN page for BITMAP[^] says they are WORD (2 byte) aligned, but from previous experience I have found that they are DWORD (4 byte) aligned.

This means that you must iterate through bm.bmHeight, and then for each iteration of that, iterate through bm.bmWidth.

BYTE *pBitmapData = (BYTE *)XXX; //XXX is the value from CreateDIBSection
int nBytesPerPixel = bm.bmBitsPixel / 8;
for (int y = 0; y < bm.bmHeight; ++y) {
	for (int x = 0; x < bm.bmWidth; ++x) {
		COLORREF clrRef = *((COLORREF *)pBitmapData);
		//blend images somehow
		pBitmapData += nBytesPerPixel; //Simply skip to the next pixel
	}
	pBitmapData += (nBytesPerPixel * bm.bmHeight + 3) & 3; //Round up to the next DWORD.
}

GeneralRe: How to calculate to get new pixel color by mixing the alpha value with r, g and b value Pin
Amrit Agr3-Mar-11 16:59
Amrit Agr3-Mar-11 16:59 
QuestionUnicode Representation and Transformation Pin
pix_programmer2-Mar-11 21:48
pix_programmer2-Mar-11 21:48 
AnswerRe: Unicode Representation and Transformation Pin
Richard MacCutchan2-Mar-11 23:03
mveRichard MacCutchan2-Mar-11 23:03 
GeneralRe: Unicode Representation and Transformation Pin
pix_programmer3-Mar-11 0:21
pix_programmer3-Mar-11 0:21 
GeneralRe: Unicode Representation and Transformation Pin
CPallini3-Mar-11 1:51
mveCPallini3-Mar-11 1:51 
GeneralRe: Unicode Representation and Transformation Pin
Richard MacCutchan3-Mar-11 2:00
mveRichard MacCutchan3-Mar-11 2:00 
GeneralRe: Unicode Representation and Transformation Pin
CPallini3-Mar-11 2:18
mveCPallini3-Mar-11 2:18 
GeneralRe: Unicode Representation and Transformation Pin
Richard MacCutchan3-Mar-11 3:17
mveRichard MacCutchan3-Mar-11 3:17 
GeneralRe: Unicode Representation and Transformation Pin
CPallini3-Mar-11 3:28
mveCPallini3-Mar-11 3:28 
AnswerRe: Unicode Representation and Transformation Pin
Nemanja Trifunovic3-Mar-11 3:45
Nemanja Trifunovic3-Mar-11 3:45 
QuestionUnhandled exception at EndDialog. Pin
Le@rner2-Mar-11 17:29
Le@rner2-Mar-11 17:29 
AnswerRe: Unhandled exception at EndDialog. Pin
«_Superman_»2-Mar-11 20:18
professional«_Superman_»2-Mar-11 20:18 
GeneralRe: Unhandled exception at EndDialog. Pin
Le@rner2-Mar-11 20:32
Le@rner2-Mar-11 20:32 
GeneralRe: Unhandled exception at EndDialog. Pin
«_Superman_»2-Mar-11 20:35
professional«_Superman_»2-Mar-11 20:35 
GeneralRe: Unhandled exception at EndDialog. Pin
Le@rner2-Mar-11 20:35
Le@rner2-Mar-11 20:35 
GeneralRe: Unhandled exception at EndDialog. Pin
Cool_Dev2-Mar-11 21:10
Cool_Dev2-Mar-11 21:10 
GeneralRe: Unhandled exception at EndDialog. Pin
Le@rner2-Mar-11 21:18
Le@rner2-Mar-11 21:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.