home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / pascal / 7426 < prev    next >
Encoding:
Internet Message Format  |  1992-12-13  |  1.5 KB

  1. Path: sparky!uunet!ornl!utkcs2!darwin.sura.net!spool.mu.edu!yale.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!fuug!compart!jarmo.aho
  2. From: jarmo.aho@compart.fi (Jarmo Aho) 
  3. Newsgroups: comp.lang.pascal
  4. Subject: getimage
  5. Message-ID: <4161.1250.uupcb@compart.fi>
  6. Date: 12 Dec 92 10:55:00 GMT
  7. Distribution: world
  8. Organization: ComPart BBS, Helsinki-Finland, +358 0 506 3329 (14 lines V.32bis)
  9. Reply-To: jarmo.aho@compart.fi (Jarmo Aho) 
  10. Lines: 26
  11.  
  12.  
  13. DJ>        I am busy with a small game woith some simple graphics.
  14. DJ>        I found out what the format is of a (TP) getimage BMP but I don't
  15. DJ>        know what the meaning is of the last word. Could anyone tell me ?
  16.  
  17.  
  18.   If yoy are talking about 16 color mode, then that last word is
  19.   meaningless. I have found that ImageSize doesn't compute imagesize
  20.   quite correctly. It gives two bytes (that last word) too much.
  21.   That is not very serious, but in 256 color graphics mode it's
  22.   worse. For example ImageSize(0,0,30,30) gives 998. Correct value
  23.   is 965.
  24.  
  25.   This should work:
  26.  
  27.   function ImageSize(x1, y1, x2, y2 : integer) : longint;
  28.   begin
  29.     if GetMaxColor = 255 then
  30.       ImageSize := longint(Abs(x2-x1)+1) * longint(Abs(y2-y1)+1) + 4
  31.     else if GetMaxColor = 15 then
  32.       ImageSize := ( ( (Abs(x2-x1)+1) + 7) shr 3) * 4 * (Abs(y2-y1)+1) + 4
  33.     else
  34.       ImageSize := Graph.ImageSize(x1,y1,x2,y2);
  35.   end;
  36.  
  37.                                                                                                   
  38.