🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
2 messages
2 total messages Started by Eyyub Volkan �ektimur Thu, 21 Jun 2007 12:16
ExtCreatePen & PS_GEOMETRIC & PS_USERSTYLE unit problem
#1710
Author: Eyyub Volkan �ektimur
Date: Thu, 21 Jun 2007 12:16
42 lines
2852 bytes
Hi,

i'm using "ExtCreatePen" to create dashed pen style with >1 line width. as 
you know to create >1 width pens , we should create geometric (PS_GEOMETRIC) 
pen. To create manual styles/patterns i'm including PS_USERSTYLE also. Then 
i'm defining the pattern;
------------------------------------------------------
DWORD penFlags=PS_GEOMETRIC | PS_USERSTYLE | PS_ENDCAP_FLAT | PS_JOIN_BEVEL;
LOGBRUSH lb;
DWORD userStyles[2]={30,40};    // 30unit line, 40unit space, .......

 lb.lbStyle=BS_SOLID;
 lb.lbColor=clBlack;
 lb.lbHatch=HS_CROSS;

 Canvas->Pen->Handle=ExtCreatePen(penFlags,3,&lb,2,userStyles);
------------------------------------------------------
the dash definition is 30 pixel line 40 pixel space (are they really 
pixel?). In MSDN it says the unit is logical for pattern defines. I've tried 
it on several printers and realized that for most of them this information 
is correct. Except on one printer, it does not draw 30 pixels (when 
converted to mm. -600dpi- 30pixel makes ~1.27mm). let's talk with mm. after 
now.
According to pattern define values (30,40);
printer A draws 1.27 mm on paper for 30pixel, printer B draws 12.7mm for 30 
pixel. Obviously there is a multiplier for printer B but i couldn't find 
that.

as i said MSDN claims that pattern is in logical unit as like MoveTo,LineTo 
winapi methods. I've tried to draw 30pixel length lines and 40pixel spaces, 
and measured that they are 1.27mm,1.69mm space. When i've tried to create 
pen with 30,40 pattern and draw a line, the output was 12.7mm line 16.9mm 
space on printer B. on printer A they were all same and 1.27mm/1.69mm.

It seems like there should be a multiplier for LINE STYLE DEFINITIONS only.
i queried the map mode but it was MM_TEXT for all priners.

the question is; what is the UNIT for patterns to define pen styles ? and is 
there any multiplier for it ? thanks for helping...
_______________________
Eyyub Volkan �ektimur
Proya Software Inc.
Re: ExtCreatePen & PS_GEOMETRIC & PS_USERSTYLE unit problem
#1712
Author: Bob Gonder
Date: Thu, 21 Jun 2007 16:53
23 lines
1741 bytes
Eyyub Volkan �ektimur wrote:

>DWORD userStyles[2]={30,40};    // 30unit line, 40unit space, .......

>the question is; what is the UNIT for patterns to define pen styles ? and is 
>there any multiplier for it ? thanks for helping...

Logical (pixel) Units

Check both printers using GetDeviceCaps() for this value:
LOGPIXELSX	Number of pixels per logical inch along the screen
width.

I think you will find Pixels per mm == LOGPIXELSX / 25.4

So you would want to adjust userStyles[2] according to LOGPIXELSX
or if you are drawing vertical dashed lines, you would want to set it
by LOGPIXELSY as it might be different.

You seem to want close to a 3mm dash, so
	ppmm = (LOGPIXELSX * 3 * 10) / 254;
	userStyles[0] = (ppmm * 3) / 7;
	userStyles[1] = (ppmm * 4) / 7;
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads