[fpc-pascal]Graph Unit

Shifted Soul snsii at yahoo.fr
Wed Feb 13 23:03:47 CET 2002


This what the help of Borland Pascal 7.0 tells :
"BitMap is an untyped parameter that must be greater than or equal to 6 plus
the amount of area defined by the region. The first two words of BitMap
store the width
and height of the region. The third word is reserved."
after these six bytes the remaining is for the bitmap.
then :

>Well, how do I allocate a bitmap?

You must use the ImageSize function and use a pointer to allocate the memory
needed like this :
program image;
uses graph;
var
  img : pointer;
  imgSize
begin
  {code for initialisation of graphic mode ...}
  imgSize:=ImageSize(100,100,200,200);
  getmem(img,imgSize);
  getImage(100,100,200,200,img);
  PutImage(300,300,img,CopyPut);
  freemem(img,imgSize);
  {other code ...}
end.

>And can I draw to it?

You can now use the pointer to draw to it or save its contents to a file (or
what you like).Example :  if you use a 16bit color mode then you have to
fill with double words your memory space which is pointed by img.

> Ciao

bye






More information about the fpc-pascal mailing list