Re: setPenWidth( Printer, 2 )

new topic     » goto parent     » topic index » view thread      » older message » newer message

Kondor Attila wrote:
> 
> 
> It is possible to draw line in Printer.
> -- drawRectangle( Printer, 0, x1, y1, x2, y2 ) 
> -- drawLine( Printer, x1, y1, x2, y2 )
> 
> The default width is 1 dot.
> I'd like 2 or 3 dot width sometimes.
> If I do  setPenWidth( Printer, 3 ), the line width
> remain 1 dot.
> 
> How can I make it?

On modern printers, the difference between a one dot 
and a three dot line is too small to see. For example 
on the printer I have, there are approximately 23.6 
pixels per millimeter and thus the difference 
between 1 and 3 dots is about 0.08 millimeters. 

Here is some sample code for you to get the sizes for
your printer...

    sequence lPrinterDef
    atom lPDC
    atom lAspectX, lAspectY
    atom lResX, lResY
    atom lPixelsPerMillX
    atom lPixelsPerMillY

    lPrinterDef = getPrinter()
    lPDC = getDC(Printer)
    
    lAspectX = w32Func(xGetDeviceCaps, {lPDC, HORZSIZE})
    lAspectY = w32Func(xGetDeviceCaps, {lPDC, VERTSIZE})
    lResX = w32Func(xGetDeviceCaps, {lPDC, HORZRES})
    lResY = w32Func(xGetDeviceCaps, {lPDC, VERTRES})

    lPixelsPerMillX = lResX / lAspectX
    lPixelsPerMilY = lResY / lAspectY

so then you workout how wide you want your lines and
do the math. 

For example if you wish to have 0.5 millimeter thick
horizontal lines you would do this....

  lPenSize = floor(0.5 * lPixelsPerMillX)

On my system, this means that I'd have a pen size of
  floor(0.5 * 4800 / 203) ==> 11
to get a half-mill horizontal line.

-- 
Derek

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu