home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / os2 / programm / 7847 < prev    next >
Encoding:
Text File  |  1993-01-21  |  2.4 KB  |  58 lines

  1. Newsgroups: comp.os.os2.programmer
  2. Path: sparky!uunet!spool.mu.edu!yale.edu!ira.uka.de!scsing.switch.ch!bernina!neptune!rofische
  3. From: rofische@iiic.ethz.ch (Roman Fischer)
  4. Subject: Problem: Nasty Bitmaps
  5. Message-ID: <1993Jan21.083211.3396@neptune.inf.ethz.ch>
  6. Originator: rofische@a13
  7. Sender: news@neptune.inf.ethz.ch (Mr News)
  8. Nntp-Posting-Host: a13
  9. Organization: Dept. Informatik, Swiss Federal Institute of Technology (ETH)
  10. Date: Thu, 21 Jan 1993 08:32:11 GMT
  11. Lines: 45
  12.  
  13. Hi PM-Programmers,
  14.  
  15. we are currently writting a game running under PM. The basic idea consists of
  16. two players simutaneiously fighting against a set of evil monsters. So we need
  17. lots (~20) of small bitmaps that move around the screen (window).
  18. The bitmaps were created with IconEdit and are loaded with GpiLoadBitmap. Since
  19. we need 4 versions of every monster (looking to the left, right, up and down),
  20. we need to "turn" the bitmaps. Because we don't want to change 4 bitmaps if
  21. we decide to change the look of a ghost, we decided to turn them "by software"
  22. at program-startup. So far no problem.
  23.  
  24. So we load the bitmaps and put them into a presentation space (associated to a
  25. appropriate dev.context). Still no problems, they look just great!
  26.  
  27. But now, when reading them into a buffer to perform the turning-act (using
  28. GpiQueryBitmapBits), we noticed a strange behaviour:
  29.  
  30. The original size of the bitmaps is 20x20 pixels. When loading, we resize them
  31. to 36x36 pixels. Now, when reading the data into the buffer, the x-dimension
  32. is 40 !!!!
  33.  
  34. This means: a. GpiQueryBitmapInfo returns a cx value of 36 (as expected).
  35.                But a short look at the data received from GpiQueryBitmapBits
  36.                shows, that every scan-line consists of 40 pixels (20 bytes).
  37.                
  38.             b. You cannot use cx to calculate the offset of a pixel.
  39.                To calculate the correct offset, you need to know the number
  40.                of bytes per scan-line.
  41.  
  42.             c. If you don't know the original size of the bitmap, you cannot
  43.                tell the correct way to address a pixel within that bitmap !!
  44.  
  45. Now:
  46. a. Did we miss an important part in any doc ? 
  47. b. Number of bytes per scan-line, any idea?
  48.  
  49.  
  50. Please post any responses, comments or ideas here or send email to
  51. mhof@iiic.ethz.ch or rofische@.iiic.ethz.ch.
  52.  
  53. Regards              Roman
  54. -- 
  55. ----------------------------------------------
  56. INTERNET: rofische@iiic.ethz.ch
  57. ----------------------------------------------
  58.