Click here to Skip to main content
15,887,746 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CString format and numbers Pin
David Crow14-Sep-05 9:28
David Crow14-Sep-05 9:28 
GeneralRe: CString format and numbers Pin
mcgahanfl14-Sep-05 10:23
mcgahanfl14-Sep-05 10:23 
QuestionProblem with windows hook and window classes Pin
Alexander M.,14-Sep-05 8:07
Alexander M.,14-Sep-05 8:07 
QuestionCreating a Bitmap (with a palette) from Data Pin
Nick Usechak14-Sep-05 6:44
Nick Usechak14-Sep-05 6:44 
AnswerClarification Pin
Nick Usechak14-Sep-05 6:51
Nick Usechak14-Sep-05 6:51 
AnswerRe: Creating a Bitmap (with a palette) from Data Pin
Chris Losinger14-Sep-05 7:27
professionalChris Losinger14-Sep-05 7:27 
GeneralRe: Creating a Bitmap (with a palette) from Data Pin
Nick Usechak14-Sep-05 9:49
Nick Usechak14-Sep-05 9:49 
GeneralRe: Creating a Bitmap (with a palette) from Data Pin
Chris Losinger14-Sep-05 9:53
professionalChris Losinger14-Sep-05 9:53 
Nick Usechak wrote:
changed bmH.biSize = sizeof(BITMAPINFOHEADER

no, not like that, like this:

BYTE *pDIBHeader = new BYTE[sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256];
BITMAPINFOHEADER *pBMIH = (BITMAPINFOHEADER *)pDIBHeader;
pBMIH ->biSize = sizeof(BITMAPINFOHEAER);
 
 etc..
 
RGBQUAD *pPal = (RGBQUAD *)(pDIBHeader + sizeof(BITMAPINFOHEADER));
for (int i=0; i < 256; i++)
{
  pPal[i].rgbRed = pPal[i].rgbGreen = pPal[i].rggBlue = i; 
}

StretchDIBits(... pDIBHeader, surface,...);


ie. make the palette and the BMIH contiguous in memory by allocating them together. biSize should always be the size of the BITMAPINFOHEADER struct itself (or one of the newer variants, which are all bigger than the original).

Nick Usechak wrote:
By the way thanks for the tip about this only working for an even multiple of 4, otherwise I would have been perplexed about that next.
Is there any easy workaround for that?


there's no workaround. that's simply how windows expects image data: bottom-up, DWORD-padded (ie. multiple of 4 bytes per row) and BGR order for 24 or 32 bit data.


Cleek | Image Toolkits | Thumbnail maker


-- modified at 15:56 Wednesday 14th September, 2005
GeneralRe: Creating a Bitmap (with a palette) from Data Pin
Nick Usechak14-Sep-05 13:14
Nick Usechak14-Sep-05 13:14 
AnswerRe: Creating a Bitmap (with a palette) from Data Pin
Mircea Puiu14-Sep-05 7:35
Mircea Puiu14-Sep-05 7:35 
AnswerRe: Creating a Bitmap (with a palette) from Data Pin
normanS14-Sep-05 19:41
normanS14-Sep-05 19:41 
QuestionWin32 Api CreateProcess( ) &lt;-- Making me crazy Pin
Nitefall206014-Sep-05 5:51
Nitefall206014-Sep-05 5:51 
AnswerRe: Win32 Api CreateProcess( ) &lt;-- Making me crazy Pin
David Crow14-Sep-05 6:31
David Crow14-Sep-05 6:31 
GeneralRe: Win32 Api CreateProcess( ) &lt;-- Making me crazy Pin
Nitefall206014-Sep-05 7:19
Nitefall206014-Sep-05 7:19 
GeneralRe: Win32 Api CreateProcess( ) &lt;-- Making me crazy Pin
David Crow14-Sep-05 8:26
David Crow14-Sep-05 8:26 
AnswerRe: Win32 Api CreateProcess( ) &lt;-- Making me crazy Pin
ky_rerun14-Sep-05 16:01
ky_rerun14-Sep-05 16:01 
GeneralRe: Win32 Api CreateProcess( ) &lt;-- Making me crazy Pin
David Crow15-Sep-05 3:13
David Crow15-Sep-05 3:13 
AnswerRe: Win32 Api CreateProcess( ) &lt;-- Making me crazy Pin
Ravi Bhavnani14-Sep-05 6:43
professionalRavi Bhavnani14-Sep-05 6:43 
AnswerRe: Win32 Api CreateProcess( ) &lt;-- Making me crazy Pin
charlieg14-Sep-05 12:01
charlieg14-Sep-05 12:01 
QuestionMANIPULATING(insert,update,delete) MS SQL VIEWS Pin
Anonymous14-Sep-05 5:40
Anonymous14-Sep-05 5:40 
QuestionRemote PC Shutdown Pin
Anonymous14-Sep-05 4:57
Anonymous14-Sep-05 4:57 
QuestionJavaScript Access Pin
namespaceuser14-Sep-05 4:55
namespaceuser14-Sep-05 4:55 
AnswerRe: JavaScript Access Pin
Alexander M.,14-Sep-05 9:09
Alexander M.,14-Sep-05 9:09 
GeneralRe: JavaScript Access Pin
namespaceuser14-Sep-05 11:00
namespaceuser14-Sep-05 11:00 
QuestionMenu in MDI Child Window Pin
Bruce Pataki14-Sep-05 4:10
Bruce Pataki14-Sep-05 4:10 

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.