Author: toshok
Date: 2007-06-25 19:39:31 -0400 (Mon, 25 Jun 2007)
New Revision: 80746

Added:
   trunk/olive/class/WindowsBase/System.Windows.Media/
   trunk/olive/class/WindowsBase/System.Windows.Media/Matrix.cs
   trunk/olive/class/WindowsBase/System.Windows/Point.cs
   trunk/olive/class/WindowsBase/System.Windows/Vector.cs
Removed:
   trunk/olive/class/PresentationCore/System.Windows.Media/Matrix.cs
Modified:
   trunk/olive/class/PresentationCore/PresentationCore.dll.sources
   trunk/olive/class/WindowsBase/System.Windows/Size.cs
   trunk/olive/class/WindowsBase/WindowsBase.dll.sources
Log:
add Point/Vector, flesh out Size, and move Matrix from PresentationCore to 
WindowsBase where it belongs

Modified: trunk/olive/class/PresentationCore/PresentationCore.dll.sources
===================================================================
--- trunk/olive/class/PresentationCore/PresentationCore.dll.sources     
2007-06-25 23:35:03 UTC (rev 80745)
+++ trunk/olive/class/PresentationCore/PresentationCore.dll.sources     
2007-06-25 23:39:31 UTC (rev 80746)
@@ -45,7 +45,6 @@
 System.Windows.Media.Animation/DoubleAnimation.cs
 System.Windows.Media/Transform.cs
 System.Windows.Media/Visual.cs
-System.Windows.Media/Matrix.cs
 System.Windows.Media/GeneralTransform.cs
 System.Windows.Media/RotateTransform.cs
 

Deleted: trunk/olive/class/PresentationCore/System.Windows.Media/Matrix.cs
===================================================================
--- trunk/olive/class/PresentationCore/System.Windows.Media/Matrix.cs   
2007-06-25 23:35:03 UTC (rev 80745)
+++ trunk/olive/class/PresentationCore/System.Windows.Media/Matrix.cs   
2007-06-25 23:39:31 UTC (rev 80746)
@@ -1,303 +0,0 @@
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
-//
-// Authors:
-//     Chris Toshok ([EMAIL PROTECTED])
-//
-
-using System;
-using System.ComponentModel;
-using System.Windows.Threading;
-
-namespace System.Windows.Media {
-
-       [SerializableAttribute] 
-       //[TypeConverterAttribute(typeof(MatrixConverter))] 
-       public struct Matrix : IFormattable {
-               public Matrix (double m11,
-                              double m12,
-                              double m21,
-                              double m22,
-                              double offsetX,
-                              double offsetY)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public void Append (Matrix matrix)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public bool Equals (Matrix value)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public override bool Equals (object o)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public static bool Equals (Matrix matrix1,
-                                          Matrix matrix2)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public override int GetHashCode ()
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public void Invert ()
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public static Matrix Multiply (Matrix trans1,
-                                              Matrix trans2)
-               {
-                       throw new NotImplementedException ();
-               }
-
-
-               public static bool operator == (Matrix matrix1,
-                                               Matrix matrix2)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public static bool operator != (Matrix matrix1,
-                                               Matrix matrix2)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public static Matrix operator * (Matrix trans1,
-                                                Matrix trans2)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public static Matrix Parse (string source)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public void Prepend (Matrix matrix)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public void Rotate (double angle)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public void RotateAt (double angle,
-                                     double centerX,
-                                     double centerY)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public void RotateAtPrepend (double angle,
-                                            double centerX,
-                                            double centerY)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public void RotatePrepend (double angle)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public void Scale (double scaleX,
-                                  double scaleY)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public void ScaleAt (double scaleX,
-                                    double scaleY,
-                                    double centerX,
-                                    double centerY)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public void ScaleAtPrepend (double scaleX,
-                                           double scaleY,
-                                           double centerX,
-                                           double centerY)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public void ScalePrepend (double scaleX,
-                                         double scaleY)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public void SetIdentity ()
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public void Skew (double skewX,
-                                 double skewY)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public void SkewPrepend (double skewX,
-                                        double skewY)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               string IFormattable.ToString (string format,
-                                             IFormatProvider provider)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public override string ToString ()
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public string ToString (IFormatProvider provider)
-               {
-                       throw new NotImplementedException ();
-               }
-
-#if waiting
-               public Point Transform (Point point)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public void Transform (Point[] points)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public Vector Transform (Vector vector)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public void Transform (Vector[] vectors)
-               {
-                       throw new NotImplementedException ();
-               }
-#endif
-               public void Translate (double offsetX,
-                                      double offsetY)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public void TranslatePrepend (double offsetX,
-                                             double offsetY)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public double Determinant {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               public bool HasInverse {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               public static Matrix Identity {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               public bool IsIdentity {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               public double M11 { 
-                       get {
-                               throw new NotImplementedException ();
-                       }
-                       set {
-                               throw new NotImplementedException ();
-                       }
-               }
-               public double M12 { 
-                       get {
-                               throw new NotImplementedException ();
-                       }
-                       set {
-                               throw new NotImplementedException ();
-                       }
-               }
-               public double M21 { 
-                       get {
-                               throw new NotImplementedException ();
-                       }
-                       set {
-                               throw new NotImplementedException ();
-                       }
-               }
-               public double M22 { 
-                       get {
-                               throw new NotImplementedException ();
-                       }
-                       set {
-                               throw new NotImplementedException ();
-                       }
-               }
-               public double OffsetX { 
-                       get {
-                               throw new NotImplementedException ();
-                       }
-                       set {
-                               throw new NotImplementedException ();
-                       }
-               }
-               public double OffsetY { 
-                       get {
-                               throw new NotImplementedException ();
-                       }
-                       set {
-                               throw new NotImplementedException ();
-                       }
-               }
-       }
-
-}

Added: trunk/olive/class/WindowsBase/System.Windows/Point.cs
===================================================================
--- trunk/olive/class/WindowsBase/System.Windows/Point.cs       2007-06-25 
23:35:03 UTC (rev 80745)
+++ trunk/olive/class/WindowsBase/System.Windows/Point.cs       2007-06-25 
23:39:31 UTC (rev 80746)
@@ -0,0 +1,143 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok ([EMAIL PROTECTED])
+//
+
+using System;
+
+using System.Windows.Media;
+
+namespace System.Windows {
+
+       public struct Point : IFormattable
+       {
+               public Point (double x, double y)
+               {
+                       this.x = x;
+                       this.y = y;
+               }
+
+               public double X {
+                       get { return x; }
+                       set { x = value; }
+               }
+
+               public double Y {
+                       get { return y; }
+                       set { y = value; }
+               }
+
+               public override bool Equals (object o)
+               {
+                       if (!(o is Point))
+                               return false;
+                       return Equals ((Point)o);
+               }
+
+               public bool Equals (Point value)
+               {
+                       return x == value.X && y == value.Y;
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+
+               public void Offset (double offsetX, double offsetY)
+               {
+                       x += offsetX;
+                       y += offsetY;
+               }
+
+               public static Point Add (Point point, Vector vector)
+               {
+                       return new Point (point.X + vector.X, point.Y + 
vector.Y);
+               }
+
+               public static Point Multiply (Point point, Matrix matrix)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static Vector Subtract (Point point1, Point point2)
+               {
+                       return new Vector (point1.X - point2.X, point1.Y - 
point2.Y);
+               }
+
+               public static Point Subtract (Point point, Vector vector)
+               {
+                       return new Point (point.X - vector.X, point.Y - 
vector.Y);
+               }
+
+               /* operators */
+               public static Vector operator -(Point point1, Point point2)
+               {
+                       return Subtract (point1, point2);
+               }
+
+               public static Point operator -(Point point, Vector vector)
+               {
+                       return Subtract (point, vector);
+               }
+
+               public static bool operator != (Point point1, Point point2)
+               {
+                       return !point1.Equals(point2);
+               }
+
+               public static Point operator * (Point point, Matrix matrix)
+               {
+                       return Multiply (point, matrix);
+               }
+
+               public static Point operator + (Point point, Vector vector)
+               {
+                       return Add (point, vector);
+               }
+
+               public static bool operator == (Point point1, Point point2)
+               {
+                       return point1.Equals(point2);
+               }
+
+               public static explicit operator Size (Point point)
+               {
+                       return new Size (point.X, point.Y);
+               }
+
+               public static explicit operator Vector (Point point)
+               {
+                       return new Vector (point.X, point.Y);
+               }
+
+               string IFormattable.ToString (string format, IFormatProvider 
formatProvider)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               double x;
+               double y;
+       }
+}

Modified: trunk/olive/class/WindowsBase/System.Windows/Size.cs
===================================================================
--- trunk/olive/class/WindowsBase/System.Windows/Size.cs        2007-06-25 
23:35:03 UTC (rev 80745)
+++ trunk/olive/class/WindowsBase/System.Windows/Size.cs        2007-06-25 
23:39:31 UTC (rev 80746)
@@ -34,14 +34,77 @@
        {
                public Size (double width, double height)
                {
+                       this.width = width;
+                       this.height = height;
                }
 
-               public static Size Empty {
-                       get { return new Size (0, 0); }
+               public bool Equals (Size value)
+               {
+                       return width == value.Width && height == value.Height;
                }
+               
+               public override bool Equals (object o)
+               {
+                       if (!(o is Size))
+                               return false;
 
+                       return Equals ((Size)o);
+               }
+
+               public static bool Equals (Size size1, Size size2)
+               {
+                       return size1.Equals (size2);
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+
                string IFormattable.ToString(string format, IFormatProvider 
formatProvider) {
                        throw new NotImplementedException ();
                }
+
+               public bool IsEmpty {
+                       get { return width == 0.0 && height == 0.0; }
+               }
+
+               public double Height {
+                       get { return height; }
+                       set { height = value; }
+               }
+
+               public double Width {
+                       get { return width; }
+                       set { width = value; }
+               }
+
+               public static Size Empty {
+                       get { return new Size (0, 0); }
+               }
+
+               /* operators */
+               public static explicit operator Point (Size size)
+               {
+                       return new Point (size.Width, size.Height);
+               }
+
+               public static explicit operator Vector (Size size)
+               {
+                       return new Vector (size.Width, size.Height);
+               }
+
+               public static bool operator ==(Size size1, Size size2)
+               {
+                       return size1.Equals (size2);
+               }
+
+               public static bool operator !=(Size size1, Size size2)
+               {
+                       return !size1.Equals (size2);
+               }
+
+               double width;
+               double height;
        }
 }

Added: trunk/olive/class/WindowsBase/System.Windows/Vector.cs
===================================================================
--- trunk/olive/class/WindowsBase/System.Windows/Vector.cs      2007-06-25 
23:35:03 UTC (rev 80745)
+++ trunk/olive/class/WindowsBase/System.Windows/Vector.cs      2007-06-25 
23:39:31 UTC (rev 80746)
@@ -0,0 +1,224 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Chris Toshok ([EMAIL PROTECTED])
+//
+
+using System;
+
+using System.Windows.Media;
+
+namespace System.Windows {
+
+       public struct Vector : IFormattable
+       {
+               public Vector (double x, double y)
+               {
+                       this.x = x;
+                       this.y = y;
+               }
+
+               public bool Equals (Vector value)
+               {
+                       return x == value.X && y == value.Y;
+               }
+
+               public override bool Equals (object o)
+               {
+                       if (!(o is Vector))
+                               return false;
+
+                       return Equals ((Vector)o);
+               }
+
+               public override int GetHashCode ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               string IFormattable.ToString(string format, IFormatProvider 
formatProvider) {
+                       throw new NotImplementedException ();
+               }
+
+               public static bool Equals (Vector vector1, Vector vector2)
+               {
+                       return vector1.Equals (vector2);
+               }
+
+               public static Point Add (Vector vector, Point point)
+               {
+                       return new Point (vector.X + point.X, vector.Y + 
point.Y);
+               }
+
+               public static Vector Add (Vector vector1, Vector vector2)
+               {
+                       return new Vector (vector1.X + vector2.X,
+                                          vector1.Y + vector2.Y);
+               }
+
+               public static double AngleBetween (Vector vector1, Vector 
vector2)
+               {
+                       double cos_theta = (vector1.X * vector2.X + vector1.Y * 
vector2.Y) / (vector1.Length * vector2.Length);
+
+                       return Math.Acos (cos_theta);
+               }
+
+               public static double CrossProduct (Vector vector1, Vector 
vector2)
+               {
+                       return vector1.X * vector2.Y - vector1.Y * vector2.X;
+               }
+
+               public static double Determinant (Vector vector1, Vector 
vector2)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static Vector Divide (Vector vector, double scalar)
+               {
+                       return new Vector (vector.X / scalar, vector.Y / 
scalar);
+               }
+
+               public static double Multiply (Vector vector1, Vector vector2)
+               {
+                       return vector1.X * vector2.X + vector1.Y * vector2.Y;
+               }
+
+               public static Vector Multiply (Vector vector, Matrix matrix)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static Vector Multiply (double scalar, Vector vector)
+               {
+                       return new Vector (scalar * vector.X, scalar * 
vector.Y);
+               }
+
+               public static Vector Multiply (Vector vector, double scalar)
+               {
+                       return new Vector (scalar * vector.X, scalar * 
vector.Y);
+               }
+
+               public Vector Negate ()
+               {
+                       return new Vector (-x, -y);
+               }
+
+               public Vector Normalize ()
+               {
+                       if (LengthSquared == 1)
+                               return new Vector (x, y);
+
+                       return Divide (this, Length);
+               }
+
+               public static Vector Subtract (Vector vector1, Vector vector2)
+               {
+                       return new Vector (vector1.X - vector2.X, vector1.Y - 
vector2.Y);
+               }
+
+               public double Length {
+                       get { return Math.Sqrt (LengthSquared); }
+               }
+
+               public double LengthSquared {
+                       get { return x * x + y + y; }
+               }
+
+               public double X {
+                       get { return x; }
+               }
+
+               public double Y {
+                       get { return y; }
+               }
+
+               /* operators */
+               public static explicit operator Point (Vector vector)
+               {
+                       return new Point (vector.X, vector.Y);
+               }
+
+               public static explicit operator Size (Vector vector)
+               {
+                       return new Size (vector.X, vector.Y);
+               }
+
+               public static Vector operator - (Vector vector1, Vector vector2)
+               {
+                       return Subtract (vector1, vector2);
+               }
+
+               public static Vector operator - (Vector vector)
+               {
+                       return vector.Negate ();
+               }
+
+               public static bool operator != (Vector vector1, Vector vector2)
+               {
+                       return !Equals (vector1, vector2);
+               }
+
+               public static bool operator == (Vector vector1, Vector vector2)
+               {
+                       return Equals (vector1, vector2);
+               }
+
+               public static double operator * (Vector vector1, Vector vector2)
+               {
+                       return Multiply (vector1, vector2);
+               }
+
+               public static Vector operator * (Vector vector, Matrix matrix)
+               {
+                       return Multiply (vector, matrix);
+               }
+
+               public static Vector operator * (double scalar, Vector vector)
+               {
+                       return Multiply (scalar, vector);
+               }
+
+               public static Vector operator * (Vector vector, double scalar)
+               {
+                       return Multiply (vector, scalar);
+               }
+
+               public static Vector operator / (Vector vector, double scalar)
+               {
+                       return Divide (vector, scalar);
+               }
+
+               public static Point operator + (Vector vector, Point point)
+               {
+                       return Add (vector, point);
+               }
+
+               public static Vector operator + (Vector vector1, Vector vector2)
+               {
+                       return Add (vector1, vector2);
+               }
+
+               double x;
+               double y;
+       }
+
+}

Copied: trunk/olive/class/WindowsBase/System.Windows.Media/Matrix.cs (from rev 
80734, trunk/olive/class/PresentationCore/System.Windows.Media/Matrix.cs)

Modified: trunk/olive/class/WindowsBase/WindowsBase.dll.sources
===================================================================
--- trunk/olive/class/WindowsBase/WindowsBase.dll.sources       2007-06-25 
23:35:03 UTC (rev 80745)
+++ trunk/olive/class/WindowsBase/WindowsBase.dll.sources       2007-06-25 
23:39:31 UTC (rev 80746)
@@ -7,8 +7,11 @@
 System.Windows/DependencyPropertyKey.cs
 System.Windows/LocalValueEntry.cs
 System.Windows/LocalValueEnumerator.cs
+System.Windows/Point.cs
 System.Windows/PropertyMetadata.cs
 System.Windows/Size.cs
+System.Windows/Vector.cs
+System.Windows.Media/Matrix.cs
 System.Windows.Threading/Dispatcher.cs
 System.Windows.Threading/DispatcherFrame.cs
 System.Windows.Threading/DispatcherObject.cs

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to