Discussion:
Printing dotted lines
(too old to reply)
Harriet Bazley
2018-02-03 23:42:32 UTC
Permalink
Trying to work out why Powerbase prints dotted lines to screen but not to
printer - I've managed the following attempted test case program.


The PLOT code in PROCdiagonal produces converging dotted and solid lines on
screen, but two converging solid lines when sent to the printer.
Are the PLOT codes in the range 16-23 not suitable for use in hard copy?

-------------------------------------------------------------------------

DIM area% 16
DIM transform% 16
DIM origin% 8
DIM draw_rectangle% 16
MODE 32
PROCdiagonal

handle%=OPENOUT("printer:")
IF handle%=0 THEN END

SYS "PDriver_SelectJob",handle%,"Dotted test"
area%!0=0:area%!4=0:area%!8=800:area%!12=800
transform%!0=(1<<16):transform%!4=0:transform%!8=0:transform%!12=(1<<16)
origin%!0=1024:origin%!4=1024

SYS "PDriver_GiveRectangle",1,area%,transform%,origin%,&FF000000
SYS "PDriver_DrawPage",1,draw_rectangle%,0,0
PROCdiagonal

SYS "PDriver_EndJob", handle%
CLOSE#handle%
END

DEF PROCdiagonal
MOVE 50,150
PLOT 5, 600, 600

MOVE 50,250
PLOT 21, 600, 600
ENDPROC
--
Harriet Bazley == Loyaulte me lie ==

Nothing is foolproof - to a sufficiently talented fool
n***@sprow.co.uk
2018-02-04 07:55:15 UTC
Permalink
Post by Harriet Bazley
Trying to work out why Powerbase prints dotted lines to screen but not to
printer - I've managed the following attempted test case program.
Are the PLOT codes in the range 16-23 not suitable for use in hard copy?
In the bit image driver there looks to be some prototype code
https://www.riscosopen.org/viewer/view/castle/RiscOS/Sources/Printing/Modules/PDModules/s/PDriverDP/Plot?rev=4.2;content-type=text%2Fx-cvsweb-markup#l264

however nobody ever got round to writing the PostScript equivalent
https://www.riscosopen.org/viewer/view/castle/RiscOS/Sources/Printing/Modules/PDModules/s/PDriverPS/Plot?rev=4.1.7.1;content-type=text%2Fx-cvsweb-markup#l229

and so to ensure they're both consistent, it's disabled in both
https://www.riscosopen.org/viewer/view/castle/RiscOS/Sources/Printing/Modules/PDModules/s/Core/PDriver?rev=4.10;content-type=text%2Fx-cvsweb-markup#l105

Or, in short, no - solid lines only at the moment,
Sprow.
Harriet Bazley
2018-02-04 18:03:54 UTC
Permalink
On 4 Feb 2018 as I do recall,
Post by n***@sprow.co.uk
Post by Harriet Bazley
Trying to work out why Powerbase prints dotted lines to screen but not to
printer - I've managed the following attempted test case program.
Are the PLOT codes in the range 16-23 not suitable for use in hard copy?
[snip]
Post by n***@sprow.co.uk
Or, in short, no - solid lines only at the moment,
Thanks - is there a recommended way of printing dotted lines?
(Surely commercial programs must do this sometimes?)
--
Harriet Bazley == Loyaulte me lie ==

Many are called, few are chosen. Fewer still get to do the choosing.
Rick Murray
2018-02-04 19:27:41 UTC
Permalink
Post by Harriet Bazley
Thanks - is there a recommended way of printing dotted lines?
Probably not useful but... DrawFile? Plotting pixels manually?
--
___
/__/ o __ /_
/ \ / /__ / \ (heyrick one nine seven three at yahoo dot co dot uk)
Steve Fryatt
2018-02-04 22:50:27 UTC
Permalink
On 4 Feb, Harriet Bazley wrote in message
Post by Harriet Bazley
On 4 Feb 2018 as I do recall,
Post by n***@sprow.co.uk
Post by Harriet Bazley
Trying to work out why Powerbase prints dotted lines to screen but not
to printer - I've managed the following attempted test case program.
Are the PLOT codes in the range 16-23 not suitable for use in hard copy?
[snip]
Post by n***@sprow.co.uk
Or, in short, no - solid lines only at the moment,
Thanks - is there a recommended way of printing dotted lines? (Surely
commercial programs must do this sometimes?)
The Draw module (Draw_Stroke, etc).

In fact, the PRM states (p 3-564) that "you should use calls to the Draw
module to print object-oriented graphics such as rectangles. This is
preferable to using VDU and PLOT sequences."

Very possibly for exactly this reason...
--
Steve Fryatt - Leeds, England

http://www.stevefryatt.org.uk/
Martin Wuerthner
2018-02-08 11:06:51 UTC
Permalink
Post by Steve Fryatt
On 4 Feb, Harriet Bazley wrote in message
Post by Harriet Bazley
On 4 Feb 2018 as I do recall,
Post by n***@sprow.co.uk
Post by Harriet Bazley
Trying to work out why Powerbase prints dotted lines to screen but
not to printer - I've managed the following attempted test case
program.
Are the PLOT codes in the range 16-23 not suitable for use in hard copy?
[snip]
Post by n***@sprow.co.uk
Or, in short, no - solid lines only at the moment,
Thanks - is there a recommended way of printing dotted lines? (Surely
commercial programs must do this sometimes?)
The Draw module (Draw_Stroke, etc).
In fact, the PRM states (p 3-564) that "you should use calls to the Draw
module to print object-oriented graphics such as rectangles. This is
preferable to using VDU and PLOT sequences."
In addition to this generic advice, there is detailed information about each
individual PLOT code in the table headed "Treatment of character sequences"
in the WrchV section. Not surprisingly, on p 3-583 it states for PLOT
25,16-31: "Processed: plots solid line (use Draw_Stroke to get dotted
lines)". So, this is documented behaviour, not just an accident of the
current implementation. Various PLOT codes (e.g., line fill and rectangle
copy) are even faulted.
--
Martin Wuerthner MW Software http://www.mw-software.com/

------- RISC OS Software for Design, Printing and Publishing --------
Harriet Bazley
2018-02-09 01:15:35 UTC
Permalink
On 4 Feb 2018 as I do recall,
Post by Steve Fryatt
On 4 Feb, Harriet Bazley wrote in message
Post by Harriet Bazley
On 4 Feb 2018 as I do recall,
Post by n***@sprow.co.uk
Post by Harriet Bazley
Trying to work out why Powerbase prints dotted lines to screen but not
to printer - I've managed the following attempted test case program.
Are the PLOT codes in the range 16-23 not suitable for use in hard copy?
[snip]
Post by n***@sprow.co.uk
Or, in short, no - solid lines only at the moment,
Thanks - is there a recommended way of printing dotted lines? (Surely
commercial programs must do this sometimes?)
The Draw module (Draw_Stroke, etc).
Substituting the following code

DEF PROChrule(x%,y%,plot%)
SYS "Wimp_SetColour",rulewimpcol%
MOVE x%,y%
CASE plot% OF
WHEN 1:PLOT plot%,LenLineP%,0
WHEN 17:
draw%!200=0:REM offset of first dash
draw%!204=1:REM number of on/off elements in pattern
draw%!208=70:REM length of first (and only) element
REM set up draw path block
!draw%=2:REM Start of path, i.e. move to x,y
draw%!4=x%*256:REM draw units are 1/256 of OS units
draw%!8=y%*256
draw%!12=8:REM Draw line
draw%!16=draw%!4+(LenLineP%*256):REM absolute x value
draw%!20=draw%!8:REM no change in y
draw%!24=0: REM end of path
SYS "Draw_Stroke",draw%,0,0,0,0,0,draw%+200
ENDCASE
ENDPROC

for the PLOT 17 commands produces what looks like dashed lines on the
screen, but what looks like solid lines when printing to paper/PDF. Redraw
on the PDF is also *incredibly* slow (as is screen redraw under emulation on
Windows, apparently). If I zoom right in on the PDF I get what looks like
incredibly fine dots giving the impression of a solid line.

What is a sensible set of values for the 'dash pattern' block in order to
give the impression of a dotted line, and would it help if I could get
Draw_Stroke to produce something other than the default 'thin' line?
(Apparently you need to set up start and end cap information to alter the
line thickness....)
--
Harriet Bazley == Loyaulte me lie ==

Do not underestimate the power of the Force.
Matthew Phillips
2018-02-09 08:20:48 UTC
Permalink
Post by Harriet Bazley
On 4 Feb 2018 as I do recall,
Post by Steve Fryatt
On 4 Feb, Harriet Bazley wrote in message
Post by Harriet Bazley
On 4 Feb 2018 as I do recall,
Post by n***@sprow.co.uk
Post by Harriet Bazley
Trying to work out why Powerbase prints dotted lines to screen but
not to printer - I've managed the following attempted test case
program.
Are the PLOT codes in the range 16-23 not suitable for use in hard copy?
[snip]
Post by n***@sprow.co.uk
Or, in short, no - solid lines only at the moment,
Thanks - is there a recommended way of printing dotted lines? (Surely
commercial programs must do this sometimes?)
The Draw module (Draw_Stroke, etc).
Substituting the following code
DEF PROChrule(x%,y%,plot%)
SYS "Wimp_SetColour",rulewimpcol%
MOVE x%,y%
CASE plot% OF
WHEN 1:PLOT plot%,LenLineP%,0
draw%!200=0:REM offset of first dash
draw%!204=1:REM number of on/off elements in pattern
draw%!208=70:REM length of first (and only) element
REM set up draw path block
!draw%=2:REM Start of path, i.e. move to x,y
draw%!4=x%*256:REM draw units are 1/256 of OS units
draw%!8=y%*256
draw%!12=8:REM Draw line
draw%!16=draw%!4+(LenLineP%*256):REM absolute x value
draw%!20=draw%!8:REM no change in y
draw%!24=0: REM end of path
SYS "Draw_Stroke",draw%,0,0,0,0,0,draw%+200
ENDCASE
ENDPROC
for the PLOT 17 commands produces what looks like dashed lines on the
screen, but what looks like solid lines when printing to paper/PDF.
Redraw on the PDF is also *incredibly* slow (as is screen redraw under
emulation on Windows, apparently). If I zoom right in on the PDF I get
what looks like incredibly fine dots giving the impression of a solid line.
What is a sensible set of values for the 'dash pattern' block in order to
give the impression of a dotted line, and would it help if I could get
Draw_Stroke to produce something other than the default 'thin' line?
(Apparently you need to set up start and end cap information to alter the
line thickness....)
Thin lines can cause a few issues. It's not that hard to set up start and end
cap information. If you choose a bevelled or rounded join style, rather than
mitred, then all the rest of the bytes in the join/cap block can be zero,
giving you butt ends to the lines and no faffing about with mitre limits and
so on. The StrongHelp manual says that if mitres and triangles are not used,
the block need only be 4 bytes long.

The start and end caps apply to each section of a dashed line (RiscOSM makes
use of this for arrows along one-way streets) so if you set up the block as
follows you would have rounded start/end to everything:

draw%?100=1:REM rounded joins
draw%?101=1:REM rounded start
draw%?102=1:REM rounded end
draw%?103=0:REM reserved

If you want a dotted line, try this dash block:

draw%!200=0
draw%!204=2
draw%!208=&200:REM Makes a fairly small blob - adjust in tandem with width
draw%!212=&1000:REM distance between blobs - adjust as you wish

A line width of &500 corresponds to a setting of 2 in Draw's line width
styles.

Hope that helps!
--
Matthew Phillips
Durham
Harriet Bazley
2018-02-09 14:52:09 UTC
Permalink
On 9 Feb 2018 as I do recall,
Matthew Phillips wrote:

[snip]
Post by Matthew Phillips
The start and end caps apply to each section of a dashed line (RiscOSM makes
use of this for arrows along one-way streets) so if you set up the block as
draw%?100=1:REM rounded joins
draw%?101=1:REM rounded start
draw%?102=1:REM rounded end
draw%?103=0:REM reserved
draw%!200=0
draw%!204=2
draw%!208=&200:REM Makes a fairly small blob - adjust in tandem with width
draw%!212=&1000:REM distance between blobs - adjust as you wish
A line width of &500 corresponds to a setting of 2 in Draw's line width
styles.
Thanks, that helps a lot. The values I was using were far too small!
--
Harriet Bazley == Loyaulte me lie ==

St George for England - St Pancras for Scotland
Loading...