Groups > Borland > Turbo Pascal > Re: Save graphics to disk file




Save graphics to disk file

Save graphics to disk file
Sun, 05 Nov 2006 18:59:26 -050
I have some old Turbo Pascal 4.5 for DOS programs.  Part of the outputs are XY
plots of the results of the program.  I have a GraphPrn.pas unit that prints
the graphics to a DOS dot matrix printer.  The original unit .pas source code
was given to me.  Is there any way I can modify the unit source code to save
the graphics to a disk file so that it can be opened and printed to a windows
printer?  I do not have a windows version of Turbo Pascal.

I haven't written any code for more than 10 years so any help will be very much
appreciated.

Chuck
Post Reply
Re: Save graphics to disk file
Mon, 06 Nov 2006 20:01:50 -050
On Tue, 7 Nov 2006 00:23:22 +0100, "Matt Claessen"
<nospam@forget.it> wrote:

Matt
>
>GraphPrn does not ring any bells, it is probably written in house.
>The code you need will also depend on the graphics mode that is used.
>In the distant past, I have adapted a screendump routine from Borland's 
>Graphix Toolbox
>to make it dump a VGA graphics screen (640x480, 16 colors) to among others a

>PCX file.
>PCX files can be printed running Windows, e.g. with IrfanView.
>If you can use it, I will gladly post the code.
>
>There is no TP 4.5, you will probably have one of 4.0 5.0 or 5.5, all for 
>DOS.
>
>regards, Matt 
>
Thanks for the reply.  You are correct, my TP is version 5.0.
It has been a very long time but it is very possible that GraphPrn is a name I
used.  It contains 2 procedures and 2 functions that I did not write.

Procedure Hardcopy ( Gmode : Integer );
Procedure AssignLST( Port : Byte );
Function LSTNoFunction( Var F : TextRec ) : Integer;
Function LSTOutPutToPrinter( Var F : TextRec ) : Integer;

Procedure AssignLST( Port : Byte );
Begin
With TextRec(LST) do
Handel                   := $FFF0;
Mode                      := fmOutput;
Bufsize                    := SizeOf (Buffer);
BufPtr                      := @Buffer;
BufPos                     := 0; 
OpenFunc                := @LSTNoFunction;
InOutFunc                := @LSTOutPutToPrinter;
FlushFunc                := @LSTOutPutToPrinter;
CloseFunc                := @LSTOutPutToPrinter;
UserData[1]              := Port - 1;
End;

Begin
AssignLST( 1 );
End;

I suspect the [1] is LPT1 port.
Could the   AssignLST  be changed to a BMP ( or PCX ) file on the hard drive?
I never was much of a programmer and never wrote programs for any one but
myself..  All the programs I wrote were long integration routines to simply
crunch the numbers.  I have modified one program to output the text portion to
a text file.  It works fine.

Yes I would like to have your VGA screen dump to a pcx file.
Post Reply
Re: Save graphics to disk file
Mon, 06 Nov 2006 21:41:10 +010
Hello,

I don't know TP 4.x well but I assume the app. uses the unit Graph and
the BGI drivers?

If you need export functionality to Windows you should use the BMP
format. Some units for that can be found in SWAG which can be found at
www.gdsoft.com (or .ord?). They might work for you.

Greetings

Post Reply
Re: Save graphics to disk file
Tue, 7 Nov 2006 00:23:22 +0100
Hi,

"Chuck" <libbeyc@schoollink.net> wrote in message 
news:svtsk29jaqu97v9n3ts8gj769cufsdja6m@4ax.com...
>I have some old Turbo Pascal 4.5 for DOS programs.  Part of the outputs are

>XY
> plots of the results of the program.  I have a GraphPrn.pas unit that 
> prints
> the graphics to a DOS dot matrix printer.  The original unit .pas source 
> code
> was given to me.  Is there any way I can modify the unit source code to 
> save
> the graphics to a disk file so that it can be opened and printed to a 
> windows
> printer?  I do not have a windows version of Turbo Pascal.

GraphPrn does not ring any bells, it is probably written in house.
The code you need will also depend on the graphics mode that is used.
In the distant past, I have adapted a screendump routine from Borland's 
Graphix Toolbox
to make it dump a VGA graphics screen (640x480, 16 colors) to among others a 
PCX file.
PCX files can be printed running Windows, e.g. with IrfanView.
If you can use it, I will gladly post the code.

There is no TP 4.5, you will probably have one of 4.0 5.0 or 5.5, all for 
DOS.

regards, Matt 

Post Reply
Re: Save graphics to disk file
Tue, 07 Nov 2006 11:05:18 -050
On Tue, 7 Nov 2006 13:28:28 +0100, "Matt Claessen"
<nospam@forget.it> wrote:

Matt,

Thanks for the code.

I made a new Unit  and copied the code into it.

It failed to compile.  Only one error.
base_vga   in 2 lines   MEM[base_vga:scanline*80];   
was Unknown Identifier.

Chuck
--

>
>"Chuck" <libbeyc@schoollink.net> wrote in message 
>news:jhkvk2pv0jfr896iu5v4h99qtv507f4b9b@4ax.com...
>> On Tue, 7 Nov 2006 00:23:22 +0100, "Matt Claessen"
<nospam@forget.it> 
>> wrote:
>>
>> Yes I would like to have your VGA screen dump to a pcx file.
>>
>Ok, here is the procedure. Comments and some variables are in Dutch, but 
>you'll get it.
>
Post Reply
<< Previous 1 2 3 Next >>
( Page 1 of 3 )
about | contact