Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ncar!gatech!bloom-beacon!eru!luth!sunic!mcsun!hafro!isgate!krafla!sigthor From: sigthor@rhi.hi.is (Sigthor Orn Gudmundsson) Newsgroups: comp.lang.pascal Subject: Re: VGA Graphics Message-ID: <1154@krafla.rhi.hi.is> Date: 26 Sep 89 18:45:21 GMT References: <216@uwm.edu> Reply-To: sigthor@rhi.hi.is (Sigthor Orn Gudmundsson) Organization: University of Iceland (RHI) Lines: 87 In article <216@uwm.edu> jrn@csd4.csd.uwm.edu (James Ray Norton) writes: > >I am trying to write a program using Turbo Pascal Version 5. This program is >supposed to save a graphics image (VGA 640 x 480) to the disk and later reload >the image back to the display... > >I have written a routine that will save the image (tested it by putting the >image back on the screen)...However my routine to load the image file to >the screen will not work... > >THe source code for my routines are as follows... Source deleted... I hope that you can use this small program as a help to your problem. I do not comment my code. (You will understand the code) I used blockwrite to make the code similar to yours. PROGRAM save_get_screen; { Demostration program for screen saving } USES crt,graph; VAR gd,gm:INTEGER; PROCEDURE draw_screen; { This procedure draws the image to save } BEGIN SETCOLOR(yellow); RECTANGLE (0,0,getmaxx,getmaxy); END; PROCEDURE save_screen(filename:STRING); { CODE tested on CGA,EGA,VGA: (all screenmodes) } VAR p:POINTER; size,sulta:WORD; hl:INTEGER; save_file:FILE; BEGIN ASSIGN(save_file,filename); REWRITE(save_file); size:=IMAGESIZE(0,0,getmaxx,ROUND((getmaxy+1)/7)); GETMEM(p,size); FOR hl:=1 TO 7 DO BEGIN getimage(0,ROUND((getmaxy/7)*(hl-1)),getmaxx,ROUND((getmaxy/7)*hl),p^); BLOCKWRITE(save_file,p^,size,sulta); END; freemem(p,size); close(save_file); END; PROCEDURE get_screen(filename:STRING); VAR p:POINTER; size,sulta:WORD; hl:INTEGER; get_file:FILE; BEGIN ASSIGN(get_file,filename); RESET(get_file); size:=IMAGESIZE(0,0,getmaxx,ROUND((getmaxy+1)/7)); GETMEM(p,size); FOR hl:=1 TO 7 DO BEGIN BLOCKREAD(get_file,p^,size,sulta); PUTIMAGE(0,ROUND((getmaxy/7)*(hl-1)),p^,NORMALPUT); END; freemem(p,size); close(get_file); END; BEGIN DETECTGRAPH(gd,gm); INITGRAPH(gd,gm,''); draw_screen; save_screen('temp.tmp'); get_screen('temp.tmp'); RESTORECRTMODE; END. -- This is a signature. I hope it is funny.