Amiga.org

Amiga computer related discussion => Amiga Software Issues and Discussion => Topic started by: Gilloo on February 12, 2009, 09:49:53 AM

Title: printer.device + dump a rastport using ped_Render
Post by: Gilloo on February 12, 2009, 09:49:53 AM
Hi all
I search a "printer.device" source code or a same kind program which use directly the ped_Render function.

I try to simulate it, opening the printer.device and sending rows using ped_Render, as the DUMPRP command does, but I have problem with the write function: the render works, it goes into the driver code, converting rows in compressed PCL codes but the output won't work. (what I forgot to do?)

I need only to understand how it works, not to be a turboprint concurent :-)

Thanks in advance.
Title: Re: printer.device + dump a rastport using ped_Render
Post by: Gilloo on February 26, 2009, 10:57:54 AM
Yipee! I found what's wrong.
It need to use opt nostackcheck at compile time.

LONG t_width ;
LONG t_height ;
LONG t_currentrow ;

LONG (*oldrender)(LONG, LONG, LONG, LONG) = NULL ;
LONG __saveds PRender(LONG ct, LONG x, LONG y, LONG state)
{
switch (state)
{
case 0 : t_width=x; t_height=y; break ;
case 1 : t_currentrow = y; break ;
}
if (oldrender != NULL) return oldrender(ct, x, y, state) ;
return 0 ;
}

Open the printer.device, get PD and PED structs.
oldrender = PED->ped_Render ;
PED->ped_Render = PRender ;

Do the dumpraster.
Now you can see the progress work on t_currentrow, and compare it with t_height to make a progress bar for example. there is no way to see the progress in iorequest.

PED->ped_Render = oldrender ;

Close the device.

idem with PWrite(), PBothReady(), you can print directly in a file without the use of CMD.

The more advanced thing is to render 24 bits lines directly by calling PRender()...