home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / mswindo / programm / misc / 4565 < prev    next >
Encoding:
Internet Message Format  |  1993-01-04  |  3.7 KB

  1. Path: sparky!uunet!spool.mu.edu!uwm.edu!cs.utexas.edu!tamsun.tamu.edu!tamsun.tamu.edu!news
  2. From: c2s4027@tamsun.tamu.edu (Cedric Sims)
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: Re: Displaying 256-Colors DIB Help Needed
  5. Date: 4 Jan 1993 08:13:03 -0600
  6. Organization: Texas A&M University, College Station, TX
  7. Lines: 79
  8. Message-ID: <1i9glfINNshe@tamsun.tamu.edu>
  9. References: <1993Jan2.095806.823@ualr.edu>
  10. NNTP-Posting-Host: tamsun.tamu.edu
  11.  
  12. In article <1993Jan2.095806.823@ualr.edu> pacheco@acs.harding.edu writes:
  13. >If anyone can help with this problem I would be very appreciative.
  14. >
  15. >I have created a 256 color bitmap in my resource file.  I am trying to
  16. >display the bitmap on the screen.  I am using the GetDIBits function
  17. >with the wUsage parameter set to DIB_RGB_COLORS to retrieve the color
  18. >information for the bitmap in order to create a logical palette (is this
  19. >the correct procedure ... ?).  However, even though the resulting
  20. >bmiColors[] array contains 256 elements, all of the entries have RGB
  21. >values of (0,0,0) except for the 20 entries reserved by the system.
  22. >
  23. >I have loaded my .EXE with a resource editor and viewed the bitmap to
  24. >confirm that it is 256 color and indeed it is.
  25. >
  26. >Any help?  This is the first time I have worked with 256 color bitmaps
  27. >and I would appreciate any information anyone has to offer.
  28. >
  29. >Thanks in advance ...
  30. >
  31. >Ron
  32. >
  33. >------------------------------------------------------------------------
  34. > Ron Pacheco \pa-chek'-oh\  |  HARDING UNIVERSITY     Searcy, Arkansas
  35. > pacheco@harding.edu    ;)  |  Dept. of Mathematics & Computer Science
  36. >------------------------------------------------------------------------
  37.  
  38. I have the same problem.  I have a 256 bitmap in a resource file. The
  39. palette contains 20 system default colors and the rest are RGB(0,0,0).
  40. What's the problem?  I am using BC++3.1. The original BMP file is
  41. included in my resource file using the following line...
  42.  
  43. #define IDB_BACKGROUND xx
  44.  
  45. IDB_BACKGROUND BITMAP "<path info>\filename.bmp"
  46.  
  47. I use MAKEINTRESOURCE and LoadBitmap to get a handle. According to the
  48. C700 Reference and the BC++ Help file, the bitmap format of a resource is
  49. the same as that in a file with the BITMAPFILEHEADER removed. 
  50.  
  51. So... (someone correct me if I'm wrong) the bitmap should be composed of...
  52.  
  53.    BITMAPINFOHEADER  +  the bitmap bits
  54.  
  55. To get to the palette I am using a pointer as such...
  56.  
  57.    LPBITMAPINFOHEADER lpbi;
  58.  
  59.    lpRGB = (LPRGBQUAD) ((LPSTR)lpbi + (UINT)lpbi->bisize);
  60.  
  61. To extract the palette, I'm using the following...
  62.  
  63.    for (i=0; i < uNumColors; i++)
  64.    {
  65.       pPal->palPalEntry[i].peRed   = lpRGB[i].rgbRed;
  66.       pPal->palPalEntry[i].peGreen = lpRGB[i].rgbGreen;
  67.       pPal->palPalEntry[i].peBlue  = lpRGB[i].rgbBlue;
  68.       pPal->palPalEntry[i].peFlags = (BYTE) 0;
  69.    }
  70.  
  71. Finally I create the palette using...
  72.  
  73.    hPalette = CreatePalette (pPal);
  74.  
  75. When I use my debugger to what the palette being transfered into
  76. the LOGPALETTE struct, the first 20 are the system palette defaults
  77. and the remaining 236 colors are RGB(0,0,0). Any suggestions? Should
  78. I store my bitmap in a RC_DATA type instead of RC_BITMAP so that I
  79. get a perfect copy of the BMP file in my resource?  The only examples
  80. I've seen for 256 BMP's are opening DIB files, NOT DIB resources. I
  81. would be very greatful for any suggestions.
  82.  
  83. Thanks,
  84. Cedrico.
  85. -------------------------------------------------------------------
  86.  Cedric J. Sims                               Texas A&M University
  87.                                          Computing Services Center
  88.  cedrics@tamu.edu                          (SELL)  Room 216 Teague
  89.  +1 409 862 4104                    College Station, Tx 77843-3142
  90. -------------------------------------------------------------------
  91.