Welcome, Guest. Please login or register.

Author Topic: printer.device + dump a rastport using ped_Render  (Read 945 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline GillooTopic starter

  • Full Member
  • ***
  • Join Date: Apr 2006
  • Posts: 124
printer.device + dump a rastport using ped_Render
« 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.
 

Offline GillooTopic starter

  • Full Member
  • ***
  • Join Date: Apr 2006
  • Posts: 124
Re: printer.device + dump a rastport using ped_Render
« Reply #1 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()...