New FWH 19.09

User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: New FWH 19.09

Post by nageswaragunupudi »

In FWH1906, this is the syntax of RoundBox:

Code: Select all

METHOD RoundBox( nRow, nCol, nBottom, nRight, nWidth, nHeight, oPen, nBGColor )
 
There was a serious bug in the method. Row was treated as Col and Col was treated as Row. Same way Bottom was treated as Right and Right was treated as Bottom. So the box was drawn at a place and shape different than what is specified.

Let us see an example:

Code: Select all

#include "fivewin.ch"

function Main()

   local oPrn

   PRINT oPrn PREVIEW
   PAGE

   oPrn:Box(       500, 1000, 1500, 4000 )
   oPrn:RoundBox( 1600, 1000, 2600, 4000, 400, 400 )

   ENDPAGE
   ENDPRINT

return nil
 
What do we expect?
A wide rectangle on the top and a wide round rectangle of the same size at the bottom of the first rectangle. This is how we expect the boxes to be drawn and FWH1909 draws the boxes correctly like this as intended and expected:
Image

But FWH1906 draws it totally wrong like this:
Image

This was a serious bug that needs to be fixed sometime or other and is fixed in FWH1909.
In addition, the roundbox syntax is made consistent across windows, printer and pdf.

We regret the inconvenience caused to you in the process of fixing the bug. We request you to cooperate.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: New FWH 19.09

Post by Silvio.Falconi »

It is easy to box in this way but due to direct and personal experience when in the past I had to do the graphic part of the orders with lines and boxes I always had problems if the user changed printer because the lines moved: I have to set a box so that the same box is for all printers?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
byte-one
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria
Contact:

Re: New FWH 19.09

Post by byte-one »

Mr. Rao, you are right! My last version was 1812. Now is the same for all operations.

The underlaying problem is function roundbox(..). There are still
Row was treated as Col and Col was treated as Row. Same way Bottom was treated as Right and Right was treated as Bottom.
But a other thing is the pen in oPrint:box() and oPrint:roundbox(). I make a pen with "DEFINE PEN oPen1 WIDTH max(1,(max(oPrn:nHorzRes(),oPrn:nVertRes())/1800))" with exact pixels. In the METHOD ParamPen(..) you use

Code: Select all

 
  case cType == "O" .AND. anoPen:IsKindOf( "TPEN" )
      if anoPen:oDevice == nil .or. !anoPen:oDevice:IsKindOf( "TPRINTER" )
         aPen  := { anoPen:nColor, anoPen:nWidth }
      else
         hPen  := anoPen:hPen
      endif
...
...
…

hPen  := CreatePen( PS_SOLID, aPen[ 2 ] * ::nLogPixelX() / 72, aPen[ 1 ] )

and calculate a new pen-width bigger as in the DEFINE PEN...
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: New FWH 19.09

Post by nageswaragunupudi »

Mr. Günther,
Mr. Rao, you are right! My last version was 1812. Now is the same for all operations.

The underlaying problem is function roundbox(..). There are still
This is fixed in FWH1909. Now the syntax and functionality is consistent not only with the Box() method of TPrinter, but also is consistent with methods RoundBox() of Window and Pdf also. We required this consistent syntax and functionality across all devices for futher development of graphic functionality.

Thanks for understanding and we highly appreciate your cooperation.
I make a pen with "DEFINE PEN oPen1 WIDTH max(1,(max(oPrn:nHorzRes(),oPrn:nVertRes())/1800))"
Instead please use

Code: Select all

DEFINE PEN oPen WIDTH nWidth OF oPrn  // FWH1909
 
This will accurately translate the width to the printer scale.

We will greatly appreciate you to cooperate and support these changes.
Regards

G. N. Rao.
Hyderabad, India
User avatar
byte-one
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria
Contact:

Re: New FWH 19.09

Post by byte-one »

Mr. Rao, what is the "nWidth" to make a pen with for example 1mm thickness
DEFINE PEN oPen WIDTH ?? OF oPrn // FWH1909
Thank you!
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: New FWH 19.09

Post by ukoenig »

Günther,

the pen-calculation-factor ( GdiPlus )

//New( nTrans, nRed, nGreen, nBlue, nSize, lRound, lAlign )
//nRed := nRGBRed( nColor )
//nGreen := nRGBGreen( nColor )
//nBlue := nRGBBlue( nColor )

oPen := Pen():New( 255, 0, 0, 255 , 8, .T.) will show a 3 mm pen
1 mm = 2.834645669

regards
Uwe :D
Last edited by ukoenig on Wed Oct 23, 2019 2:46 pm, edited 5 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
byte-one
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria
Contact:

Re: New FWH 19.09

Post by byte-one »

Uwe, thanks. For now in my actual programs i will change the parameter "oPen" in :box and :roundbox to "oPen:hPen"
Regards,
Günther
---------------------------------
office@byte-one.com
Post Reply