ooo-build r12500 - in trunk: . patches/dev300



Author: thorstenb
Date: Fri May  9 11:30:53 2008
New Revision: 12500
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12500&view=rev

Log:
	* patches/dev300/svg-import-basegfx-m10.diff: (almost) finished
	elliptical arc emulation via cubic beziers
	* patches/dev300/svg-import-basegfx.diff: (almost) finished
	elliptical arc emulation via cubic beziers



Modified:
   trunk/ChangeLog
   trunk/patches/dev300/svg-import-basegfx-m10.diff
   trunk/patches/dev300/svg-import-basegfx.diff

Modified: trunk/patches/dev300/svg-import-basegfx-m10.diff
==============================================================================
--- trunk/patches/dev300/svg-import-basegfx-m10.diff	(original)
+++ trunk/patches/dev300/svg-import-basegfx-m10.diff	Fri May  9 11:30:53 2008
@@ -43,9 +43,9 @@
  
  		// create 3d PolyPolygon from given 2d PolyPolygon. The given fZCoordinate is used to expand the
  		// third coordinate.
---- basegfx/source/polygon/b2dsvgpolypolygon.cxx	18 Jul 2007 11:07:24 -0000	1.7
-+++ basegfx/source/polygon/b2dsvgpolypolygon.cxx	28 Feb 2008 11:11:31 -0000
-@@ -37,7 +37,9 @@
+--- basegfx/source/polygon/b2dsvgpolypolygon.cxx	2008-04-10 21:02:54.000000000 +0200
++++ basegfx/source/polygon/b2dsvgpolypolygon.cxx	2008-05-09 00:03:56.000000000 +0200
+@@ -32,7 +32,9 @@
  #include "precompiled_basegfx.hxx"
  
  #include <basegfx/polygon/b2dpolypolygontools.hxx>
@@ -55,7 +55,7 @@
  #include <rtl/ustring.hxx>
  #include <rtl/math.hxx>
  
-@@ -74,7 +76,7 @@
+@@ -64,7 +66,7 @@
                  }
              }
  
@@ -64,7 +64,7 @@
              {
                  const sal_Unicode aChar(rStr[nPos]);
  
-@@ -151,6 +153,37 @@
+@@ -141,6 +143,37 @@
                  return true;
              }
  
@@ -102,7 +102,7 @@
              void lcl_skipNumber(sal_Int32& 				io_rPos, 
                                  const ::rtl::OUString& 	rStr, 
                                  const sal_Int32 		nLen)
-@@ -623,24 +656,169 @@
+@@ -613,24 +646,185 @@
                          break;
                      }
  
@@ -168,9 +168,9 @@
 +                                // |y1'| = |-sin phi  cos phi|  |(y1 - y2)/2|
 +                                const B2DPoint p1(nLastX, nLastY);
 +                                const B2DPoint p2(nX, nY);
-+                                B2DHomMatrix aRotate; aRotate.rotate(-fPhi*M_PI/180);
++                                B2DHomMatrix aTransform; aTransform.rotate(-fPhi*M_PI/180);
 +                                
-+                                const B2DPoint p1_prime( aRotate * B2DPoint(((p1-p2)/2.0)) );
++                                const B2DPoint p1_prime( aTransform * B2DPoint(((p1-p2)/2.0)) );
 +
 +                                //           ______________________________________       rx y1'
 +                                // |cx'|  + /  rx^2 ry^2 - rx^2 y1'^2 - ry^2 x1^2           ry
@@ -192,7 +192,7 @@
 +                                    // with s=fRX/fRY)
 +                                    const double fRatio(fRX/fRY);
 +                                    const double fRadicant2(
-+                                        p1_prime.getY()*p1_prime.getY() - 
++                                        p1_prime.getY()*p1_prime.getY() +
 +                                        p1_prime.getX()*p1_prime.getX()/(fRatio*fRatio));
 +                                    if( fRadicant2 < 0.0 )
 +                                    {
@@ -211,6 +211,19 @@
 +                                }
 +                                else
 +                                {
++                                    // todo:   <path d="M200,100 h 50 
++                                    // a25,50 20 0,0 50,-25 l 50,-25"
++                                    // fill="none" stroke="green" stroke-width="5"  />
++                                    //
++                                    // sweep flag not considered right for e.g. 
++                                    // <path d="M0,400 l 50,-25 
++                                    // a25,25 -30 0,1 50,-25 l 50,-25 
++                                    // a25,50 -30 0,1 50,-25 l 50,-25 
++                                    // a25,75 -30 0,1 50,-25 l 50,-25 
++                                    // a25,100 -30 0,1 50,-25 l 50,-25"
++                                    // fill="none" stroke="red" stroke-width="5"  />
++
++
 +                                    const double fFactor(
 +                                        (bLargeArcFlag==bSweepFlag) ? -1.0 : 1.0 *
 +                                        sqrt((fRX*fRX*fRY*fRY - fRX*fRX*p1_prime.getY()*p1_prime.getY() - fRY*fRY*p1_prime.getX()*p1_prime.getX())/
@@ -222,12 +235,6 @@
 +                                        -fFactor*fRY*p1_prime.getX()/fRX);
 +                                }
 +
-+                                // |cx|   | cos phi  -sin phi |  | cx' |    (x1+x2)/2
-+                                // |cy| = | sin phi   cos phi |  | cy' | +  (y1+y2)/2 
-+                                aRotate.identity(); aRotate.rotate(fPhi*M_PI/180);
-+                                const B2DPoint aCenter( aRotate * aCenter_prime + 
-+                                                        (p1+p2)/2.0);
-+                                
 +                                //              +           u - v 
 +                                // angle(u,v) =  arccos( ------------ )     (take the sign of (ux vy - uy vx))
 +                                //              -        ||u|| ||v||
@@ -263,11 +270,20 @@
 +
 +                                // finally, create bezier polygon from this
 +                                B2DPolygon aSegment(
-+                                    tools::createPolygonFromEllipseSegment( 
-+                                        aCenter,
-+                                        fRX,fRY,
++                                    tools::createPolygonFromUnitEllipseSegment( 
 +                                        fTheta1, fTheta2 ));
 +
++                                // transform ellipse by rotation & move to final center
++                                aTransform.identity(); 
++                                aTransform.scale(fRX,fRY);
++                                aTransform.translate(aCenter_prime.getX(),
++                                                     aCenter_prime.getY());
++                                aTransform.rotate(fPhi*M_PI/180);
++                                const B2DPoint aOffset((p1+p2)/2.0);
++                                aTransform.translate(aOffset.getX(),
++                                                     aOffset.getY());
++                                aSegment.transform(aTransform);
++                                
 +                                // createPolygonFromEllipseSegment()
 +                                // always creates arcs that are
 +                                // positively oriented - flip polygon
@@ -283,7 +299,7 @@
                          }
                          break;
                      }
-@@ -665,6 +843,32 @@
+@@ -655,6 +849,32 @@
              return true;
          }
  
@@ -316,7 +332,7 @@
          ::rtl::OUString exportToSvgD(
  			const B2DPolyPolygon& rPolyPolygon,
  			bool bUseRelativeCoordinates, 
-@@ -678,13 +882,23 @@
+@@ -668,13 +888,23 @@
              {
                  const B2DPolygon aPolygon(rPolyPolygon.getB2DPolygon(i));
                  const sal_uInt32 nPointCount(aPolygon.count());
@@ -342,7 +358,7 @@
  
                      if(0 == j)
                      {
-@@ -697,16 +911,18 @@
+@@ -687,16 +917,18 @@
                      else
                      {
  						// handle edge from j-1 to j
@@ -368,7 +384,7 @@
  							bool bIsQuadraticBezier(false);
  
  							if(bDetectQuadraticBeziers)
-@@ -798,7 +1014,13 @@
+@@ -788,7 +1020,13 @@
                          }
                          else
                          {

Modified: trunk/patches/dev300/svg-import-basegfx.diff
==============================================================================
--- trunk/patches/dev300/svg-import-basegfx.diff	(original)
+++ trunk/patches/dev300/svg-import-basegfx.diff	Fri May  9 11:30:53 2008
@@ -45,7 +45,7 @@
  		// third coordinate.
 
 --- basegfx/source/polygon/b2dsvgpolypolygon.cxx	24 Apr 2008 15:07:05 -0000	1.9
-+++ basegfx/source/polygon/b2dsvgpolypolygon.cxx	6 May 2008 11:01:43 -0000
++++ basegfx/source/polygon/b2dsvgpolypolygon.cxx	9 May 2008 11:08:22 -0000
 @@ -33,7 +33,9 @@
  
  #include <basegfx/polygon/b2dpolygontools.hxx>
@@ -103,7 +103,7 @@
              void lcl_skipNumber(sal_Int32& 				io_rPos, 
                                  const ::rtl::OUString& 	rStr, 
                                  const sal_Int32 		nLen)
-@@ -621,24 +654,169 @@ namespace basegfx
+@@ -621,24 +654,185 @@ namespace basegfx
                          break;
                      }
  
@@ -169,9 +169,9 @@
 +                                // |y1'| = |-sin phi  cos phi|  |(y1 - y2)/2|
 +                                const B2DPoint p1(nLastX, nLastY);
 +                                const B2DPoint p2(nX, nY);
-+                                B2DHomMatrix aRotate; aRotate.rotate(-fPhi*M_PI/180);
++                                B2DHomMatrix aTransform; aTransform.rotate(-fPhi*M_PI/180);
 +                                
-+                                const B2DPoint p1_prime( aRotate * B2DPoint(((p1-p2)/2.0)) );
++                                const B2DPoint p1_prime( aTransform * B2DPoint(((p1-p2)/2.0)) );
 +
 +                                //           ______________________________________       rx y1'
 +                                // |cx'|  + /  rx^2 ry^2 - rx^2 y1'^2 - ry^2 x1^2           ry
@@ -193,7 +193,7 @@
 +                                    // with s=fRX/fRY)
 +                                    const double fRatio(fRX/fRY);
 +                                    const double fRadicant2(
-+                                        p1_prime.getY()*p1_prime.getY() - 
++                                        p1_prime.getY()*p1_prime.getY() +
 +                                        p1_prime.getX()*p1_prime.getX()/(fRatio*fRatio));
 +                                    if( fRadicant2 < 0.0 )
 +                                    {
@@ -212,6 +212,19 @@
 +                                }
 +                                else
 +                                {
++                                    // todo:   <path d="M200,100 h 50 
++                                    // a25,50 20 0,0 50,-25 l 50,-25"
++                                    // fill="none" stroke="green" stroke-width="5"  />
++                                    //
++                                    // sweep flag not considered right for e.g. 
++                                    // <path d="M0,400 l 50,-25 
++                                    // a25,25 -30 0,1 50,-25 l 50,-25 
++                                    // a25,50 -30 0,1 50,-25 l 50,-25 
++                                    // a25,75 -30 0,1 50,-25 l 50,-25 
++                                    // a25,100 -30 0,1 50,-25 l 50,-25"
++                                    // fill="none" stroke="red" stroke-width="5"  />
++
++
 +                                    const double fFactor(
 +                                        (bLargeArcFlag==bSweepFlag) ? -1.0 : 1.0 *
 +                                        sqrt((fRX*fRX*fRY*fRY - fRX*fRX*p1_prime.getY()*p1_prime.getY() - fRY*fRY*p1_prime.getX()*p1_prime.getX())/
@@ -223,12 +236,6 @@
 +                                        -fFactor*fRY*p1_prime.getX()/fRX);
 +                                }
 +
-+                                // |cx|   | cos phi  -sin phi |  | cx' |    (x1+x2)/2
-+                                // |cy| = | sin phi   cos phi |  | cy' | +  (y1+y2)/2 
-+                                aRotate.identity(); aRotate.rotate(fPhi*M_PI/180);
-+                                const B2DPoint aCenter( aRotate * aCenter_prime + 
-+                                                        (p1+p2)/2.0);
-+                                
 +                                //              +           u - v 
 +                                // angle(u,v) =  arccos( ------------ )     (take the sign of (ux vy - uy vx))
 +                                //              -        ||u|| ||v||
@@ -264,11 +271,20 @@
 +
 +                                // finally, create bezier polygon from this
 +                                B2DPolygon aSegment(
-+                                    tools::createPolygonFromEllipseSegment( 
-+                                        aCenter,
-+                                        fRX,fRY,
++                                    tools::createPolygonFromUnitEllipseSegment( 
 +                                        fTheta1, fTheta2 ));
 +
++                                // transform ellipse by rotation & move to final center
++                                aTransform.identity(); 
++                                aTransform.scale(fRX,fRY);
++                                aTransform.translate(aCenter_prime.getX(),
++                                                     aCenter_prime.getY());
++                                aTransform.rotate(fPhi*M_PI/180);
++                                const B2DPoint aOffset((p1+p2)/2.0);
++                                aTransform.translate(aOffset.getX(),
++                                                     aOffset.getY());
++                                aSegment.transform(aTransform);
++                                
 +                                // createPolygonFromEllipseSegment()
 +                                // always creates arcs that are
 +                                // positively oriented - flip polygon
@@ -284,7 +300,7 @@
                          }
                          break;
                      }
-@@ -667,6 +845,32 @@ namespace basegfx
+@@ -667,7 +861,33 @@ namespace basegfx
              return true;
          }
  



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]