Board index » delphi » Saving a simple 16 color graphics file

Saving a simple 16 color graphics file

I'm using turbo pascal 7, and i need to know how to save a 640 x 480
graphics with 16 colors. Is there a simple way i can just flush the image
straight from memory or what?

Any help would be appreciated.

Beetho...@ufrmsa2.olivetti.za

 

Re:Saving a simple 16 color graphics file


Quote
G Naude wrote:

> I'm using turbo pascal 7, and i need to know how to save a 640 x 480
> graphics with 16 colors. Is there a simple way i can just flush the
> image
> straight from memory or what?

> Any help would be appreciated.

> Beetho...@ufrmsa2.olivetti.za

If you have loaded the image in memory you could easily save the raw dat
a in a file using blockwrite. If the image is on screen use getimage and
blockwrite to do this. You'll find some info on this on my page at
http://www.xs4all.nl/~remcodek/program.html

Good luck,

Remco de Korte
Soft Machine

Re:Saving a simple 16 color graphics file


Quote
>I'm using turbo pascal 7, and i need to know how to save a 640 x 480
>graphics with 16 colors. Is there a simple way i can just flush the image
>straight from memory or what?

>Any help would be appreciated.

>Beetho...@ufrmsa2.olivetti.za

----------------------------------
You can use GetImage and PutImage procedures for some parts of the screen
(these procedures cannot get and put more than 64k images):

procedure SaveScreen; { saving the screen to file }
var f:file;
    p:pointer;
    i:byte;
    BuffSize:word;
begin
   BuffSize:=ImageSize(0,0,GetMaxX,GetMaxY div 4);
   Assign(f,'SOME.SCR'); ReWrite(f,BuffSize);
   GetMem(p,BuffSize);
   for i:=0 to 3 do
     begin
        GetImage(0,i*(GetMaxY div 4),GetMaxX,succ(i)*(GetMaxY div 4),p^);
        BlockWrite(f,p^,1);
     end;
  FreeMem(p,BuffSize);
  close(f);
end;

procedure PutScreen; { restore the screen from file }
var f:file;
    p:pointer;
    i:byte;
    BuffSize:word;
begin
   BuffSize:=ImageSize(0,0,GetMaxX,GetMaxY div 4);
   Assign(f,'SOME.SCR'); Reset(f,BuffSize);
   GetMem(p,BuffSize);
   for i:=0 to 3 do
     begin
        BlockRead(f,p^,1);
        PutImage(0,i*(GetMaxY div 4),p^,NormalPut);
     end;
  FreeMem(p,BuffSize);
  close(f);
end;
----------------------------------
Sorry for my bad English.
      Harrinn
harr...@glasnet.ru

Re:Saving a simple 16 color graphics file


Quote
G Naude wrote:

> I'm using turbo pascal 7, and i need to know how to save a 640 x 480
> graphics with 16 colors. Is there a simple way i can just flush the image
> straight from memory or what?

> Any help would be appreciated.

> Beetho...@ufrmsa2.olivetti.za

http://www.geocities.com/~franzglaser/tp.html
chapter graphics (bottom) for a full solution procedure, even
monochrome.

Please make a bookmark to your browser to the TP-links page!

Regards,
Franz Glaser
http://members.eunet.at/meg-glaser

Other Threads