Click here to Skip to main content
15,915,600 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionhow to get the device id of a pocket pc Pin
reyd_todo4-Jun-07 5:54
reyd_todo4-Jun-07 5:54 
QuestionHandling of multiple threads Pin
zudroj4-Jun-07 4:02
zudroj4-Jun-07 4:02 
AnswerRe: Handling of multiple threads Pin
Mark Salsbery4-Jun-07 4:35
Mark Salsbery4-Jun-07 4:35 
GeneralRe: Handling of multiple threads Pin
zudroj4-Jun-07 21:20
zudroj4-Jun-07 21:20 
GeneralRe: Handling of multiple threads Pin
Mark Salsbery5-Jun-07 4:26
Mark Salsbery5-Jun-07 4:26 
GeneralRe: Handling of multiple threads Pin
zudroj5-Jun-07 21:36
zudroj5-Jun-07 21:36 
AnswerRe: Handling of multiple threads Pin
CPallini4-Jun-07 5:05
mveCPallini4-Jun-07 5:05 
QuestionCreating a color table Pin
TheDelChop4-Jun-07 2:50
TheDelChop4-Jun-07 2:50 
Hi guys,

I am trying to use the Win32 API to fill a bitmap, using the function GetDIBBits(). My source bitmap is a 32-bit image, but I am hoping to create a 4-bit destination bitmap. I am of the understanding that this requires me to create a color table, and keep it in a BITMAPINFO structure. Does anybody see a problem with this snippet of code?

<br />
pbmi = (PBITMAPINFO) LocalAlloc(LPTR,sizeof(BITMAPINFO));<br />
      <br />
      // Initialize the fields in the BITMAPINFO structure.<br />
<br />
      pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER) + 16*sizeof(long);<br />
      pbmi->bmiHeader.biWidth = bmp.bmWidth;<br />
      pbmi->bmiHeader.biHeight = bmp.bmHeight;<br />
      pbmi->bmiHeader.biPlanes = bmp.bmPlanes;<br />
      pbmi->bmiHeader.biBitCount = 4;<br />
<br />
      pbmi->bmiHeader.biCompression = BI_RGB;<br />
      <br />
      if (pbmi->bmiHeader.biSizeImage == 0)<br />
        pbmi->bmiHeader.biSizeImage = WIDTHBYTES((DWORD)pbmi->bmiHeader.biWidth *                                                             <br />
         pbmi->bmiHeader.biBitCount) * pbmi->bmiHeader.biHeight;<br />
      <br />
      pbmi->bmiHeader.biClrImportant = 0;<br />
          <br />
      for(i = 0; i<16; i++)<br />
      {<br />
        pbmi->bmiColors[i].rgbRed = 0;<br />
        pbmi->bmiColors[i].rgbBlue = 0;<br />
        pbmi->bmiColors[i].rgbGreen = 0;<br />
        pbmi->bmiColors[i].rgbReserved = 0;<br />
      }<br />
<br />
      // Bright Red<br />
      pbmi->bmiColors[1].rgbRed = 255;<br />
<br />
      // Red<br />
      pbmi->bmiColors[2].rgbRed = 128;<br />
<br />
      // Bright Green<br />
      pbmi->bmiColors[3].rgbGreen = 255;<br />
<br />
      // Green<br />
      pbmi->bmiColors[4].rgbGreen = 128;<br />
<br />
      // Bright Blue<br />
      pbmi->bmiColors[5].rgbBlue = 255;<br />
<br />
      // Blue<br />
      pbmi->bmiColors[6].rgbBlue = 128;<br />
<br />
      //Yellow<br />
      pbmi->bmiColors[7].rgbRed = 255;<br />
      pbmi->bmiColors[7].rgbGreen = 255;<br />
<br />
      //Brown<br />
      pbmi->bmiColors[8].rgbRed = 128;<br />
      pbmi->bmiColors[8].rgbGreen = 128;<br />
<br />
      //Bright Magenta<br />
      pbmi->bmiColors[9].rgbRed = 255;<br />
      pbmi->bmiColors[9].rgbBlue = 255;<br />
<br />
      //Magenta<br />
      pbmi->bmiColors[10].rgbRed = 128;<br />
      pbmi->bmiColors[10].rgbBlue = 128;<br />
<br />
      //Bright Cyan<br />
      pbmi->bmiColors[11].rgbGreen = 255;<br />
      pbmi->bmiColors[11].rgbBlue = 255;<br />
<br />
      //Cyan<br />
      pbmi->bmiColors[12].rgbGreen = 128;<br />
      pbmi->bmiColors[12].rgbBlue = 128;<br />
<br />
      //Gray<br />
      pbmi->bmiColors[13].rgbRed = 0;<br />
      pbmi->bmiColors[13].rgbGreen = 128;<br />
      pbmi->bmiColors[13].rgbBlue = 0;<br />
<br />
      //Bright Gray<br />
      pbmi->bmiColors[14].rgbRed = 192;<br />
      pbmi->bmiColors[14].rgbGreen = 192;<br />
      pbmi->bmiColors[14].rgbBlue = 192;<br />
<br />
      //White<br />
      pbmi->bmiColors[15].rgbRed = 255;<br />
      pbmi->bmiColors[15].rgbGreen = 255;<br />
      pbmi->bmiColors[15].rgbBlue = 255;<br />


Am I missing something here?

Thanks
AnswerRe: Creating a color table Pin
CPallini4-Jun-07 3:57
mveCPallini4-Jun-07 3:57 
QuestionSpecific editing of a CString Pin
jasn Smith4-Jun-07 2:50
jasn Smith4-Jun-07 2:50 
AnswerRe: Specific editing of a CString Pin
_AnsHUMAN_ 4-Jun-07 3:10
_AnsHUMAN_ 4-Jun-07 3:10 
AnswerRe: Specific editing of a CString Pin
David Crow4-Jun-07 3:29
David Crow4-Jun-07 3:29 
QuestionFont Size Displays [modified] Pin
_AnsHUMAN_ 4-Jun-07 2:48
_AnsHUMAN_ 4-Jun-07 2:48 
AnswerRe: Font Size Displays Pin
Arman S.4-Jun-07 3:15
Arman S.4-Jun-07 3:15 
GeneralRe: Font Size Displays [modified] Pin
_AnsHUMAN_ 4-Jun-07 3:24
_AnsHUMAN_ 4-Jun-07 3:24 
AnswerRe: Font Size Displays Pin
Mark Salsbery4-Jun-07 4:47
Mark Salsbery4-Jun-07 4:47 
Questionsubclassing an activex control in mfc [modified] Pin
dkmr4-Jun-07 2:27
dkmr4-Jun-07 2:27 
AnswerRe: subclassing an activex control in mfc Pin
Naveen4-Jun-07 15:54
Naveen4-Jun-07 15:54 
Questionhow to make an indicator Pin
bigphish4-Jun-07 2:14
bigphish4-Jun-07 2:14 
AnswerRe: how to make an indicator Pin
David Crow4-Jun-07 3:32
David Crow4-Jun-07 3:32 
GeneralRe: how to make an indicator Pin
vivekphlp4-Jun-07 23:38
vivekphlp4-Jun-07 23:38 
GeneralRe: how to make an indicator Pin
David Crow5-Jun-07 2:37
David Crow5-Jun-07 2:37 
GeneralRe: how to make an indicator Pin
vivekphlp5-Jun-07 18:31
vivekphlp5-Jun-07 18:31 
QuestionAdding a new image (img tag) to the document in Internet Explorer Pin
ajitatif angajetor4-Jun-07 1:30
ajitatif angajetor4-Jun-07 1:30 
QuestionHow to align toolbars? Pin
Anurag Gandhi4-Jun-07 1:13
professionalAnurag Gandhi4-Jun-07 1:13 

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.