GraSetAttrString set angle problem

This forum is for eXpress++ general support.
Post Reply
Message
Author
Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

GraSetAttrString set angle problem

#1 Post by Victorio »

Hi,

I need draw text to screen with other angles.
But when I set angle with function GraSetAttrString( oPS,aAtribs ) where aAtribs[GRA_AS_ANGLE]= different point as {1,0} {0,1}, {-1,0} , {-1,-1} where this is angles 0, 90, 180,270 degrees,
text not rotate correctly, still write vertical.

When I test it with numbers multiple for example with 10, angles is good, but interesting is, that text which is in 0, 90 ,180 , 270 has size font without change, but other angles has enlargered font.

here is example attached

I do not know whats wrong, if something about font settings, or function GraSetAttrString xbase++ not correct
Attachments
textangles.gif
textangles.gif (38.06 KiB) Viewed 5924 times

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: GraSetAttrString set angle problem

#2 Post by Eugene Lutsenko »

Maybe this increase in the font size when turning at different angles is purely visual, but the number of pixels is correct? To test this hypothesis, we need to make the same number of pixels for X and y. To make the pixels square. And I would make a 4K image so that you don't see steps on sloping straight lines.

Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: GraSetAttrString set angle problem

#3 Post by Victorio »

Hi Eugene,

Can be , that problem is x/y resolution,

But when I try other system with GraRotate

Code: Select all

PUBLIC amatrix
oFont := XbpFont():new(oPS):create()
oFont:configure( fontnt )
GraSetFont( oPS, oFont )
aMatrix  := GraInitMatrix()
for i=0 to 360 step 15
	testtext:="TEST TEST TEST - "+str(i)			// zadefinovanie textu
	nSegment := graSegOpen(oPs)		// otvorenie grafického segmentu
	GraStringAt( oPS, {(vwb/2)+45,(vwb/2)+45}, testtext )	// prvotné vykreslenie textu
	msgbox("1")
	GraSegClose(oPS)			// zatvorenie segmentu
						// rotácia segmentu
*	GraRotate( oPS, aMatrix, i,{(vwb/2)+45,(vwb/2)+45}, GRA_TRANSFORM_ADD )
*	GraRotate( oPS, aMatrix, 15,{(vwb/2)+45,(vwb/2)+45}, GRA_TRANSFORM_ADD )
	GraRotate( oPS, aMatrix, i,{(vwb/2)+45,(vwb/2)+45}, GRA_TRANSFORM_REPLACE )
*	GraRotate( oPS, aMatrix, 15,{(vwb/2)+45,(vwb/2)+45}, GRA_TRANSFORM_REPLACE )

	GraSegDraw(oPS, nSegment, aMatrix)	// vykreslenie segmentu
	GraSegDestroy( oPS, nSegment )		// zrušenie segmentu
	msgbox("2")
next

Here rotating with correct angle is ok, but also when angle is other that 0, text is bigger than default.

Here also I do not know how delete text on his first position before rotating ? This causes that text is always twice.
Also rotating text can be problem in digital cadastral maps where are many texts can be thousands and rotating can cause long delay when zooming, or pan draw.

Better way will be default solution with solition like this :
[code]
aAtribs[GRA_AS_BOX]:={40,20}
		GraSetAttrString( oPS,aAtribs )
		GraStringAt(oPS,{(vwb/2)+45,(vwb/2)+45},"-----"+str(dx)+","+str(dy) )
but here I have problem with angles between 0-90

[/code]

As you can see when rotate text, then first text in 0 angle is smaller than other text in angles.
Attachments
rotatetext.gif
rotatetext.gif (17.7 KiB) Viewed 5896 times

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: GraSetAttrString set angle problem

#4 Post by Eugene Lutsenko »

Yes, because the letter "T" rotates on the inner circle, the error of calculations and visualization is clearly visible. Make a graphic file on which this is drawn 4096 by 4096 pixels (jpg). This minimizes the visualization error

Post Reply