home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / mswindo / programm / misc / 5436 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  2.0 KB

  1. Path: sparky!uunet!ug.eds.com!ug.eds.com!mackintosh
  2. Newsgroups: comp.os.ms-windows.programmer.misc
  3. Subject: Bitmaps and palettes 
  4. Message-ID: <1993Jan26.120129.2836@ug.eds.com>
  5. From: mackintosh@ug.eds.com (Alasdair Mackintosh)
  6. Date: 26 Jan 93 12:01:29 PDT
  7. Reply-To: mackintosh@ug.eds.com (Alasdair Mackintosh)
  8. Distribution: world
  9. Organization: EDS Unigraphics, Cypress CA
  10. Nntp-Posting-Host: 134.244.49.167
  11. Lines: 43
  12.  
  13.  
  14.  
  15.   I'm trying to use AnimatePalette to change the colours on the  screen. I've 
  16.   got a dialog that allows you to edit the colours in the logical palette, and 
  17.   this works fine with the colours that I've drawn, but it doesn't work with
  18.   a bitmap.
  19.  
  20.   Here's what I've done (using TC++ and OWL):
  21.  
  22.   1) Create a logical palette.
  23.  
  24.   2) When I set up my main window, I create a memory display context (using
  25.      CreateCompatibleDC), create a bitmap, and select it into the memory
  26.      display context. (This memory DC has the same number of bits-per-pixel
  27.      and color planes as the original screen DC.)
  28.  
  29.   3) I draw onto the screen DC using SetPixel, and also using FillRectangle.
  30.      In each case, I use PALETTEINDEX to get a COLORREF value for drawing with.
  31.  
  32.   4) I also draw onto the bitmap (via the memory DC) using exactly the same 
  33.      function calls. I then transfer the bitmap onto the screen using BitBlt.
  34.  
  35.   5) My Paint member function does this as well (ie draws onto the bitmap,
  36.      and draws onto the screen.)
  37.  
  38.  
  39.   When I run my dialog, (which calls AnimatePalette to change the colours) the
  40.   rectangels/pixels that I've drawn directly onto the screen change colour. But,
  41.   the stuff that was drawn onto the bitmap doesn't change.
  42.  
  43.   Any ideas?
  44.  
  45.   P.S. I don't have the code in front of me - I may have mispelled some of the
  46.   function names.
  47.  
  48.  
  49.  
  50. --
  51. ===============================================================================
  52. Alasdair Mackintosh                             mackintosh@ug.eds.com
  53. Unigraphics Division                            (714) 952-5698
  54. Electronic Data Systems                         10824 Hope St, Cypress CA
  55.  
  56.