dotgnu-pnet-commits
[Top][All Lists]
Advanced

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

[Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing/Drawing2D AdjustableAr


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing/Drawing2D AdjustableArrowCap.cs,NONE,1.1 CombineMode.cs,NONE,1.1 CompositingMode.cs,NONE,1.1 CompositingQuality.cs,NONE,1.1 CoordinateSpace.cs,NONE,1.1 CustomLineCap.cs,NONE,1.1 DashCap.cs,NONE,1.1 DashStyle.cs,NONE,1.1 FillMode.cs,NONE,1.1 FlushIntention.cs,NONE,1.1 GraphicsContainer.cs,NONE,1.1 GraphicsPath.cs,NONE,1.1 GraphicsState.cs,NONE,1.1 HatchBrush.cs,NONE,1.1 HatchStyle.cs,NONE,1.1 InterpolationMode.cs,NONE,1.1 LineCap.cs,NONE,1.1 LineJoin.cs,NONE,1.1 LinearGradientBrush.cs,NONE,1.1 LinearGradientMode.cs,NONE,1.1 Makefile,NONE,1.1 Matrix.cs,NONE,1.1 MatrixOrder.cs,NONE,1.1 PathData.cs,NONE,1.1 PathPointType.cs,NONE,1.1 PenAlignment.cs,NONE,1.1 PenType.cs,NONE,1.1 PixelOffsetMode.cs,NONE,1.1 QualityMode.cs,NONE,1.1 RegionData.cs,NONE,1.1 SmoothingMode.cs,NONE,1.1 WarpMode.cs,NONE,1.1 WrapMode.cs,NONE,1.1
Date: Sat, 07 Jun 2003 18:41:00 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/System.Drawing/Drawing2D
In directory subversions:/tmp/cvs-serv12618/System.Drawing/Drawing2D

Added Files:
        AdjustableArrowCap.cs CombineMode.cs CompositingMode.cs 
        CompositingQuality.cs CoordinateSpace.cs CustomLineCap.cs 
        DashCap.cs DashStyle.cs FillMode.cs FlushIntention.cs 
        GraphicsContainer.cs GraphicsPath.cs GraphicsState.cs 
        HatchBrush.cs HatchStyle.cs InterpolationMode.cs LineCap.cs 
        LineJoin.cs LinearGradientBrush.cs LinearGradientMode.cs 
        Makefile Matrix.cs MatrixOrder.cs PathData.cs PathPointType.cs 
        PenAlignment.cs PenType.cs PixelOffsetMode.cs QualityMode.cs 
        RegionData.cs SmoothingMode.cs WarpMode.cs WrapMode.cs 
Log Message:


Add the "System.Drawing" and "System.Drawing.Xsharp" assemblies.


--- NEW FILE ---
/*
 * AdjustableArrowCap.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.AdjustableArrowCap" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public sealed class AdjustableArrowCap : CustomLineCap
{
        // Internal state.
        private float width;
        private float height;
        private float middleInset;
        private bool isFilled;

        // Constructors.
        public AdjustableArrowCap(float width, float height)
                        : base(null, null)
                        {
                                this.width = width;
                                this.height = height;
                                this.isFilled = true;
                        }
        public AdjustableArrowCap(float width, float height, bool isFilled)
                        : base(null, null)
                        {
                                this.width = width;
                                this.height = height;
                                this.isFilled = true;
                        }

        // Get or set this object's properties.
        public bool Filled
                        {
                                get
                                {
                                        return isFilled;
                                }
                                set
                                {
                                        isFilled = value;
                                }
                        }
        public float Height
                        {
                                get
                                {
                                        return height;
                                }
                                set
                                {
                                        height = value;
                                }
                        }
        public float MiddleInset
                        {
                                get
                                {
                                        return middleInset;
                                }
                                set
                                {
                                        middleInset = value;
                                }
                        }
        public float Width
                        {
                                get
                                {
                                        return width;
                                }
                                set
                                {
                                        width = value;
                                }
                        }

}; // class AdjustableArrowCap

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * CombineMode.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.CombineMode" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum CombineMode
{
        Replace         = 0,
        Intersect       = 1,
        Union           = 2,
        Xor                     = 3,
        Exclude         = 4,
        Complement      = 5

}; // enum CombineMode

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * CompositingMode.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.CompositingMode" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum CompositingMode
{
        SourceOver = 0,
        SourceCopy = 1

}; // enum CompositingMode

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * CompositingQuality.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.CompositingQuality" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum CompositingQuality
{
        Invalid                 = -1,
        Default                 = 0,
        HighSpeed               = 1,
        HighQuality             = 2,
        GammaCorrected  = 3,
        AssumeLinear    = 4

}; // enum CompositingQuality

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * CoordinateSpace.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.CoordinateSpace" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum CoordinateSpace
{
        World   = 0,
        Page    = 1,
        Device  = 2

}; // enum CoordinateSpace

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * CustomLineCap.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.CustomLineCap" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public class CustomLineCap : MarshalByRefObject, ICloneable, IDisposable
{
        // Internal state.
        private GraphicsPath fillPath;
        private GraphicsPath strokePath;
        private LineCap baseCap;
        private float baseInset;
        private LineJoin strokeJoin;
        private float widthScale;
        private LineCap endCap;
        private LineCap startCap;

        // Constructors.
        public CustomLineCap(GraphicsPath fillPath,
                                                 GraphicsPath strokePath)
                        : this(fillPath, strokePath, LineCap.Flat, 0.0f) {}
        public CustomLineCap(GraphicsPath fillPath,
                                                 GraphicsPath strokePath,
                                                 LineCap baseCap)
                        : this(fillPath, strokePath, baseCap, 0.0f) {}
        public CustomLineCap(GraphicsPath fillPath,
                                                 GraphicsPath strokePath,
                                                 LineCap baseCap, float 
baseInset)
                        {
                                this.fillPath = fillPath;
                                this.strokePath = strokePath;
                                this.baseCap = baseCap;
                                this.baseInset = baseInset;
                        }

        // Destructor.
        ~CustomLineCap()
                        {
                                Dispose(false);
                        }

        // Get or set this object's properties.
        public LineCap BaseCap
                        {
                                get
                                {
                                        return baseCap;
                                }
                                set
                                {
                                        baseCap = value;
                                }
                        }
        public float BaseInset
                        {
                                get
                                {
                                        return baseInset;
                                }
                                set
                                {
                                        baseInset = value;
                                }
                        }
        public LineJoin StrokeJoin
                        {
                                get
                                {
                                        return strokeJoin;
                                }
                                set
                                {
                                        strokeJoin = value;
                                }
                        }
        public float WidthScale
                        {
                                get
                                {
                                        return widthScale;
                                }
                                set
                                {
                                        widthScale = value;
                                }
                        }

        // Clone this object.
        public Object Clone()
                        {
                                return MemberwiseClone();
                        }

        // Dispose of this object.
        public void Dispose()
                        {
                                Dispose(true);
                                GC.SuppressFinalize(this);
                        }
        protected virtual void Dispose(bool disposing)
                        {
                                // Nothing to do here.
                        }

        // Get the stroke capabilities.
        public void GetStrokeCaps(out LineCap startCap, out LineCap endCap)
                        {
                                startCap = this.startCap;
                                endCap = this.endCap;
                        }

        // Set the stroke capabilities.
        public void SetStrokeCaps(LineCap startCap, LineCap endCap)
                        {
                                this.startCap = startCap;
                                this.endCap = endCap;
                        }

}; // class CustomLineCap

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * DashCap.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.DashCap" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum DashCap
{
        Flat            = 0,
        Round           = 2,
        Triangle        = 3

}; // enum DashCap

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * DashStyle.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.DashStyle" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum DashStyle
{
        Solid           = 0,
        Dash            = 1,
        Dot                     = 2,
        DashDot         = 3,
        DashDotDot      = 4,
        Custom          = 5

}; // enum DashStyle

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * FillMode.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.FillMode" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum FillMode
{
        Alternate       = 0,
        Winding         = 1

}; // enum FillMode

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * FlushIntention.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.FlushIntention" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum FlushIntention
{
        Flush   = 0,
        Sync    = 1

}; // enum FlushIntention

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * GraphicsContainer.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.GraphicsContainer" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

using System.Drawing.Text;

public sealed class GraphicsContainer : MarshalByRefObject
{
        // Internal state.
        private Graphics graphics;
        private GraphicsContainer next;
        private Region clip;
        private CompositingMode compositingMode;
        private CompositingQuality compositingQuality;
        private InterpolationMode interpolationMode;
        private float pageScale;
        private GraphicsUnit pageUnit;
        private PixelOffsetMode pixelOffsetMode;
        private Point renderingOrigin;
        private SmoothingMode smoothingMode;
        private int textContrast;
        private TextRenderingHint textRenderingHint;
        private Matrix transform;

        // Constructor, which saves away all of the important information.
        // We assume that the lock on the "graphics" object is held by the 
caller.
        internal GraphicsContainer(Graphics graphics)
                        {
                                // Push this container onto the stack.
                                this.graphics = graphics;
                                next = graphics.stackTop;
                                graphics.stackTop = this;

                                // Save the graphics state information.
                                clip = graphics.Clip;
                                if(clip != null)
                                {
                                        clip = clip.Clone();
                                }
                                compositingMode = graphics.CompositingMode;
                                compositingQuality = 
graphics.CompositingQuality;
                                interpolationMode = graphics.InterpolationMode;
                                pageScale = graphics.PageScale;
                                pageUnit = graphics.PageUnit;
                                pixelOffsetMode = graphics.PixelOffsetMode;
                                renderingOrigin = graphics.RenderingOrigin;
                                smoothingMode = graphics.SmoothingMode;
                                textContrast = graphics.TextContrast;
                                textRenderingHint = graphics.TextRenderingHint;
                                transform = Matrix.Clone(graphics.Transform);
                        }

        // Restore a graphics object back to the state of this container.
        // We assume that the lock on the "graphics" object is held by the 
caller.
        internal void Restore(Graphics graphics)
                        {
                                // Bail out if the container applies to 
something else.
                                if(graphics != this.graphics)
                                {
                                        return;
                                }

                                // Make sure that we are on the stack, and pop 
it and all
                                // of the items above it.  Bail out if not on 
the stack.
                                GraphicsContainer container = graphics.stackTop;
                                while(container != null && container != this)
                                {
                                        container = container.next;
                                }
                                if(container == null)
                                {
                                        return;
                                }
                                graphics.stackTop = next;

                                // Restore the "graphics" object to its 
previous state.
                                graphics.Clip = clip;
                                graphics.CompositingMode = compositingMode;
                                graphics.CompositingQuality = 
compositingQuality;
                                graphics.InterpolationMode = interpolationMode;
                                graphics.PageScale = pageScale;
                                graphics.PageUnit = pageUnit;
                                graphics.PixelOffsetMode = pixelOffsetMode;
                                graphics.RenderingOrigin = renderingOrigin;
                                graphics.SmoothingMode = smoothingMode;
                                graphics.TextContrast = textContrast;
                                graphics.TextRenderingHint = textRenderingHint;
                                graphics.Transform = transform;
                        }

}; // class GraphicsContainer

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * GraphicsPath.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.GraphicsPath" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
[...1120 lines suppressed...]
                                }

                // Fill this path object.
                public override void Fill(Graphics graphics, Brush brush,
                                                                  Pen penBrush, 
FillMode fillMode)
                                {
                                        graphics.FillRectangle(brush, x, y, 
width, height);
                                }

                // Clone this path object.
                public override PathObject Clone()
                                {
                                        return new RectanglePathObject(x, y, 
width, height);
                                }

        }; // class RectanglePathObject

}; // class GraphicsPath

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * GraphicsState.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.GraphicsState" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

using System.Drawing.Text;

public sealed class GraphicsState : MarshalByRefObject
{
        // Internal state.
        private GraphicsContainer container;

        // Constructor.  Call this with the context lock held.
        internal GraphicsState(Graphics graphics)
                        {
                                container = new GraphicsContainer(graphics);
                        }

        // Restore the previous settings of this state.  Call with context lock.
        internal void Restore(Graphics graphics)
                        {
                                container.Restore(graphics);
                        }

}; // class GraphicsState

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * HatchBrush.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.HatchBrush" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

using System.Drawing.Toolkit;

public sealed class HatchBrush : Brush
{
        // Internal state.
        private HatchStyle style;
        private Color foreColor;
        private Color backColor;

        // Constructors.
        public HatchBrush(HatchStyle style, Color foreColor)
                        {
                                this.style = style;
                                this.foreColor = foreColor;
                        }
        public HatchBrush(HatchStyle style, Color foreColor, Color backColor)
                        {
                                this.style = style;
                                this.foreColor = foreColor;
                                this.backColor = backColor;
                        }

        // Get the background color of this brush.
        public Color BackgroundColor
                        {
                                get
                                {
                                        return backColor;
                                }
                        }

        // Get the foreground color of this brush.
        public Color ForegroundColor
                        {
                                get
                                {
                                        return foreColor;
                                }
                        }

        // Get the style of this brush.
        public HatchStyle HatchStyle
                        {
                                get
                                {
                                        return style;
                                }
                        }

        // Clone this brush.
        public override Object Clone()
                        {
                                return new HatchBrush(style, foreColor, 
backColor);
                        }

        // Create this brush for a specific toolkit.  Inner part of 
"GetBrush()".
        internal override IToolkitBrush CreateBrush(IToolkit toolkit)
                        {
                                return toolkit.CreateHatchBrush(style, 
foreColor, backColor);
                        }

}; // class HatchBrush

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * HatchStyle.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.HatchStyle" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum HatchStyle
{
        Horizontal                              = 0,
        Vertical                                = 1,
        ForwardDiagonal                 = 2,
        BackwardDiagonal                = 3,
        Cross                                   = 4,
        LargeGrid                               = Cross,
        DiagonalCross                   = 5,
        Percent05                               = 6,
        Percent10                               = 7,
        Percent20                               = 8,
        Percent25                               = 9,
        Percent30                               = 10,
        Percent40                               = 11,
        Percent50                               = 12,
        Percent60                               = 13,
        Percent70                               = 14,
        Percent75                               = 15,
        Percent80                               = 16,
        Percent90                               = 17,
        LightDownwardDiagonal   = 18,
        LightUpwardDiagonal             = 19,
        DarkDownwardDiagonal    = 20,
        DarkUpwardDiagonal              = 21,
        WideDownwardDiagonal    = 22,
        WideUpwardDiagonal              = 23,
        LightVertical                   = 24,
        LightHorizontal                 = 25,
        NarrowVertical                  = 26,
        NarrowHorizontal                = 27,
        DarkVertical                    = 28,
        DarkHorizontal                  = 29,
        DashedDownwardDiagonal  = 30,
        DashedUpwardDiagonal    = 31,
        DashedHorizontal                = 32,
        DashedVertical                  = 33,
        SmallConfetti                   = 34,
        LargeConfetti                   = 35,
        ZigZag                                  = 36,
        Wave                                    = 37,
        DiagonalBrick                   = 38,
        HorizontalBrick                 = 39,
        Weave                                   = 40,
        Plaid                                   = 41,
        Divot                                   = 42,
        DottedGrid                              = 43,
        DottedDiamond                   = 44,
        Shingle                                 = 45,
        Trellis                                 = 46,
        Sphere                                  = 47,
        SmallGrid                               = 48,
        SmallCheckerBoard               = 49,
        LargeCheckerBoard               = 50,
        OutlinedDiamond                 = 51,
        SolidDiamond                    = 52,
        Min                                             = Horizontal,
        Max                                             = Cross

}; // enum HatchStyle

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * InterpolationMode.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.InterpolationMode" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum InterpolationMode
{
        Invalid                         = -1,
        Default                         = 0,
        Low                                     = 1,
        High                            = 2,
        Bilinear                        = 3,
        Bicubic                         = 4,
        NearestNeighbor         = 5,
        HighQualityBilinear     = 6,
        HighQualityBicubic      = 7

}; // enum InterpolationMode

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * LineCap.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.LineCap" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum LineCap
{
        Flat                    = 0x0000,
        Square                  = 0x0001,
        Round                   = 0x0002,
        Triangle                = 0x0003,
        NoAnchor                = 0x0010,
        SquareAnchor    = 0x0011,
        RoundAnchor             = 0x0012,
        DiamondAnchor   = 0x0013,
        ArrowAnchor             = 0x0014,
        AnchorMask              = 0x00F0,
        Custom                  = 0x00FF

}; // enum LineCap

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * LineJoin.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.LineJoin" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum LineJoin
{
        Miter                   = 0,
        Bevel                   = 1,
        Round                   = 2,
        MiterClipped    = 3

}; // enum LineJoin

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * LinearGradientBrush.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.LinearGradientBrush" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

using System.Drawing.Toolkit;

// Note: if the underlying toolkit does not have support for gradients,
// then this will create a solid brush with "color1" as its argument.

[TODO]
public sealed class LinearGradientBrush : Brush
{
        // Internal state.
        private RectangleF rect;
        private Color color1;
        private Color color2;
        private LinearGradientMode mode;
        private float angle;
        private bool isAngleScaleable;

        // Constructors.
        public LinearGradientBrush(Point point1, Point point2,
                                                           Color color1, Color 
color2)
                        {
                                this.rect = new RectangleF(point1.X, point1.Y,
                                                                                
   point2.X - point1.X,
                                                                                
   point2.Y - point1.Y);
                                this.color1 = color1;
                                this.color2 = color2;
                                this.mode = LinearGradientMode.Horizontal;
                                this.angle = 0.0f;
                                this.isAngleScaleable = false;
                        }
        public LinearGradientBrush(PointF point1, PointF point2,
                                                           Color color1, Color 
color2)
                        {
                                this.rect = new RectangleF(point1.X, point1.Y,
                                                                                
   point2.X - point1.X,
                                                                                
   point2.Y - point1.Y);
                                this.color1 = color1;
                                this.color2 = color2;
                                this.mode = LinearGradientMode.Horizontal;
                                this.angle = 0.0f;
                                this.isAngleScaleable = false;
                        }
        public LinearGradientBrush(Rectangle rect, Color color1, Color color2,
                                                           LinearGradientMode 
linearGradientMode)
                        {
                                this.rect = rect;
                                this.color1 = color1;
                                this.color2 = color2;
                                this.mode = linearGradientMode;
                                this.angle = 0.0f;
                                this.isAngleScaleable = false;
                        }
        public LinearGradientBrush(RectangleF rect, Color color1, Color color2,
                                                           LinearGradientMode 
linearGradientMode)
                        {
                                this.rect = rect;
                                this.color1 = color1;
                                this.color2 = color2;
                                this.mode = linearGradientMode;
                                this.angle = 0.0f;
                                this.isAngleScaleable = false;
                        }
        public LinearGradientBrush(Rectangle rect, Color color1,
                                                           Color color2, float 
angle)
                        {
                                this.rect = rect;
                                this.color1 = color1;
                                this.color2 = color2;
                                this.mode = (LinearGradientMode)(-1);
                                this.angle = angle;
                                this.isAngleScaleable = false;
                        }
        public LinearGradientBrush(RectangleF rect, Color color1,
                                                           Color color2, float 
angle)
                        {
                                this.rect = rect;
                                this.color1 = color1;
                                this.color2 = color2;
                                this.mode = (LinearGradientMode)(-1);
                                this.angle = angle;
                                this.isAngleScaleable = false;
                        }
        public LinearGradientBrush(Rectangle rect, Color color1,
                                                           Color color2, float 
angle,
                                                           bool 
isAngleScaleable)
                        {
                                this.rect = rect;
                                this.color1 = color1;
                                this.color2 = color2;
                                this.mode = (LinearGradientMode)(-1);
                                this.angle = angle;
                                this.isAngleScaleable = isAngleScaleable;
                        }
        public LinearGradientBrush(RectangleF rect, Color color1,
                                                           Color color2, float 
angle,
                                                           bool 
isAngleScaleable)
                        {
                                this.rect = rect;
                                this.color1 = color1;
                                this.color2 = color2;
                                this.mode = (LinearGradientMode)(-1);
                                this.angle = angle;
                                this.isAngleScaleable = isAngleScaleable;
                        }

        // TODO: properties and transform methods

        // Clone this brush.
        public override Object Clone()
                        {
                                if(mode != (LinearGradientMode)(-1))
                                {
                                        return new LinearGradientBrush
                                                (rect, color1, color2, mode);
                                }
                                else
                                {
                                        return new LinearGradientBrush
                                                (rect, color1, color2, angle, 
isAngleScaleable);
                                }
                        }

        // Create this brush for a specific toolkit.  Inner part of 
"GetBrush()".
        internal override IToolkitBrush CreateBrush(IToolkit toolkit)
                        {
                                IToolkitBrush brush;
                                if(mode != (LinearGradientMode)(-1))
                                {
                                        brush = 
toolkit.CreateLinearGradientBrush
                                                (rect, color1, color2, mode);
                                }
                                else
                                {
                                        brush = 
toolkit.CreateLinearGradientBrush
                                                (rect, color1, color2, angle, 
isAngleScaleable);
                                }
                                if(brush == null)
                                {
                                        // The toolkit doesn't support 
gradients, so back
                                        // off to a solid brush using "color1".
                                        brush = 
toolkit.CreateSolidBrush(color1);
                                }
                                return brush;
                        }

}; // class LinearGradientBrush

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * LinearGradientMode.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.LinearGradientMode" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum LinearGradientMode
{
        Horizontal                      = 0,
        Vertical                        = 1,
        ForwardDiagonal         = 2,
        BackwardDiagonal        = 3

}; // enum LinearGradientMode

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---

all:
        (cd ..; make)

--- NEW FILE ---
/*
 * Matrix.cs - Implementation of the "System.Drawing.Drawing2D.Matrix" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public sealed class Matrix : MarshalByRefObject, IDisposable
{
        // Internal state.
        private float m11, m12, m21, m22, dx, dy;

        // Constructors.
        public Matrix()
                        {
                                m11 = 1.0f;
                                m12 = 0.0f;
                                m21 = 0.0f;
                                m22 = 0.1f;
                                dx  = 0.0f;
                                dy  = 0.0f;
                        }
        [TODO]
        public Matrix(Rectangle rect, Point[] plgpts)
                        {
                                // TODO
                        }
        [TODO]
        public Matrix(RectangleF rect, PointF[] plgpts)
                        {
                                // TODO
                        }
        public Matrix(float m11, float m12, float m21, float m22,
                                  float dx, float dy)
                        {
                                this.m11 = m11;
                                this.m12 = m12;
                                this.m21 = m21;
                                this.m22 = m22;
                                this.dx  = dx;
                                this.dy  = dy;
                        }

        // Destructor.
        ~Matrix()
                        {
                                // Nothing to do here because there is no 
disposable state.
                        }

        // Get the elements of this matrix.
        public float[] Elements
                        {
                                get
                                {
                                        return new float[] {m11, m12, m21, m22, 
dx, dy};
                                }
                        }

        // Determine if this is the identity matrix.
        public bool IsIdentity
                        {
                                get
                                {
                                        return (m11 == 1.0f && m12 == 0.0f &&
                                                        m21 == 0.0f && m22 == 
1.0f &&
                                                        dx == 0.0f && dy == 
0.0f);
                                }
                        }

        // Determine if the matrix is invertible.
        public bool IsInvertible
                        {
                                get
                                {
                        return ((m11 * m22 - m21 * m11) != 0.0f);
                                }
                        }

        // Get the X offset value.
        public float OffsetX
                        {
                                get
                                {
                                        return dx;
                                }
                        }

        // Get the Y offset value.
        public float OffsetY
                        {
                                get
                                {
                                        return dy;
                                }
                        }

        // Dispose of this matrix.
        public void Dispose()
                        {
                                // Nothing to do here because there is no 
disposable state.
                        }

        // Determine if two matrices are equal.
        public override bool Equals(Object obj)
                        {
                                Matrix other = (obj as Matrix);
                                if(other != null)
                                {
                                        return (other.m11 == m11 && other.m12 
== m12 &&
                                                        other.m21 == m21 && 
other.m22 == m22 &&
                                                        other.dx == dx && 
other.dy == dy);
                                }
                                else
                                {
                                        return false;
                                }
                        }

        // Get a hash code for this object.
        public override int GetHashCode()
                        {
                                return (int)(m11 + m12 + m21 + m22 + dx + dy);
                        }

        // Invert this matrix.
        public void Invert()
                        {
                                float m11, m12, m21, m22, dx, dy;
                                float determinant;

                                // Compute the determinant and check it.
                                determinant = this.m11 * this.m22 - this.m21 * 
this.m11;
                                if(determinant != 0.0f)
                                {
                                        // Get the answer into temporary 
variables.
                                        m11 = this.m22 / determinant;
                                        m12 = -(this.m12 / determinant);
                                        m21 = -(this.m21 / determinant);
                                        m22 = this.m11 / determinant;
                                        dx  = (this.m12 * dy - this.m22 * dx) / 
determinant;
                                        dy  = (this.m21 * dx - this.m11 * dy) / 
determinant;

                                        // Write the temporary variables back 
to the matrix.
                                        this.m11 = m11;
                                        this.m12 = m12;
                                        this.m21 = m21;
                                        this.m22 = m22;
                                        this.dx  = dx;
                                        this.dy  = dy;
                                }
                        }

        // Multiply two matrices and write the result into this one.
        private void Multiply(Matrix matrix1, Matrix matrix2)
                        {
                                float m11, m12, m21, m22, dx, dy;

                                // Compute the result within temporary 
variables,
                                // to prevent overwriting "matrix1" or 
"matrix2",
                                // during the calculation, as either may be 
"this".
                                m11 = matrix1.m11 * matrix2.m11 +
                                          matrix1.m12 * matrix2.m21;
                                m12 = matrix1.m11 * matrix2.m12 +
                                      matrix1.m12 * matrix2.m22;
                                m21 = matrix1.m21 * matrix2.m11 +
                                          matrix1.m22 * matrix2.m21;
                                m22 = matrix1.m21 * matrix2.m12 +
                                      matrix1.m22 * matrix2.m22;
                                dx  = matrix1.dx  * matrix2.m11 +
                                      matrix1.dy  * matrix2.m21 +
                                          matrix2.dx;
                                dy  = matrix1.dx  * matrix2.m12 +
                                      matrix1.dy  * matrix2.m22 +
                                          matrix2.dy;

                                // Write the result back into the "this" object.
                                this.m11 = m11;
                                this.m12 = m12;
                                this.m21 = m21;
                                this.m22 = m22;
                                this.dx  = dx;
                                this.dy  = dy;
                        }

        // Multiply two matrices.
        public void Multiply(Matrix matrix)
                        {
                                if(matrix == null)
                                {
                                        throw new 
ArgumentNullException("matrix");
                                }
                                Multiply(matrix, this);
                        }
        public void Multiply(Matrix matrix, MatrixOrder order)
                        {
                                if(matrix == null)
                                {
                                        throw new 
ArgumentNullException("matrix");
                                }
                                if(order == MatrixOrder.Prepend)
                                {
                                        Multiply(matrix, this);
                                }
                                else
                                {
                                        Multiply(this, matrix);
                                }
                        }

        // Reset this matrix to the identity matrix.
        public void Reset()
                        {
                                m11 = 1.0f;
                                m12 = 0.0f;
                                m21 = 0.0f;
                                m22 = 0.1f;
                                dx  = 0.0f;
                                dy  = 0.0f;
                        }

        // Perform a rotation on this matrix.
        public void Rotate(float angle)
                        {
                                float m11, m12, m21, m22;

                                double radians = (angle * (Math.PI / 180.0));
                                float cos = (float)(Math.Cos(radians));
                                float sin = (float)(Math.Sin(radians));

                                m11 = cos * this.m11 + sin * this.m21;
                                m12 = cos * this.m12 + sin * this.m22;
                                m21 = cos * this.m21 - sin * this.m11;
                                m22 = cos * this.m22 - sin * this.m12;

                                this.m11 = m11;
                                this.m12 = m12;
                                this.m21 = m21;
                                this.m22 = m22;
                        }
        public void Rotate(float angle, MatrixOrder order)
                        {
                                float m11, m12, m21, m22, dx, dy;

                                double radians = (angle * (Math.PI / 180.0));
                                float cos = (float)(Math.Cos(radians));
                                float sin = (float)(Math.Sin(radians));
        
                                if(order == MatrixOrder.Prepend)
                                {
                                        m11 = cos * this.m11 + sin * this.m21;
                                        m12 = cos * this.m12 + sin * this.m22;
                                        m21 = cos * this.m21 - sin * this.m11;
                                        m22 = cos * this.m22 - sin * this.m12;

                                        this.m11 = m11;
                                        this.m12 = m12;
                                        this.m21 = m21;
                                        this.m22 = m22;
                                }
                                else
                                {
                                        m11 = this.m11 * cos - this.m12 * sin;
                                        m12 = this.m11 * sin + this.m12 * cos;
                                        m21 = this.m21 * cos - this.m22 * sin;
                                        m22 = this.m21 * sin + this.m22 * cos;
                                        dx  = this.dx  * cos - this.dy  * sin;
                                        dy  = this.dx  * sin + this.dy  * cos;

                                        this.m11 = m11;
                                        this.m12 = m12;
                                        this.m21 = m21;
                                        this.m22 = m22;
                                        this.dx  = dx;
                                        this.dy  = dy;
                                }
                        }

        // Rotate about a specific point.
        public void RotateAt(float angle, PointF point)
                        {
                                Translate(point.X, point.Y);
                                Rotate(angle);
                                Translate(-point.X, -point.Y);
                        }
        public void RotateAt(float angle, PointF point, MatrixOrder order)
                        {
                                if(order == MatrixOrder.Prepend)
                                {
                                        Translate(point.X, point.Y);
                                        Rotate(angle);
                                        Translate(-point.X, -point.Y);
                                }
                                else
                                {
                                        Translate(-point.X, -point.Y);
                                        Rotate(angle, MatrixOrder.Append);
                                        Translate(point.X, point.Y);
                                }
                        }

        // Apply a scale factor to this matrix.
        public void Scale(float scaleX, float scaleY)
                        {
                                m11 *= scaleX;
                                m12 *= scaleX;
                                m21 *= scaleY;
                                m22 *= scaleY;
                        }
        public void Scale(float scaleX, float scaleY, MatrixOrder order)
                        {
                                if(order == MatrixOrder.Prepend)
                                {
                                        m11 *= scaleX;
                                        m12 *= scaleX;
                                        m21 *= scaleY;
                                        m22 *= scaleY;
                                }
                                else
                                {
                                        m11 *= scaleX;
                                        m12 *= scaleY;
                                        m21 *= scaleX;
                                        m22 *= scaleY;
                                        dx  *= scaleX;
                                        dy  *= scaleY;
                                }
                        }

        // Apply a shear factor to this matrix.
        public void Shear(float shearX, float shearY)
                        {
                                float m11, m12, m21, m22;

                                m11 = this.m11 + this.m21 * shearY;
                                m12 = this.m12 + this.m22 * shearY;
                                m21 = this.m11 * shearX + this.m21;
                                m22 = this.m12 * shearX + this.m22;

                                this.m11 = m11;
                                this.m12 = m12;
                                this.m21 = m21;
                                this.m22 = m22;
                        }
        public void Shear(float shearX, float shearY, MatrixOrder order)
                        {
                                if(order == MatrixOrder.Prepend)
                                {
                                        float m11, m12, m21, m22;

                                        m11 = this.m11 + this.m21 * shearY;
                                        m12 = this.m12 + this.m22 * shearY;
                                        m21 = this.m11 * shearX + this.m21;
                                        m22 = this.m12 * shearX + this.m22;

                                        this.m11 = m11;
                                        this.m12 = m12;
                                        this.m21 = m21;
                                        this.m22 = m22;
                                }
                                else
                                {
                                        float m11, m12, m21, m22, dx, dy;

                                        m11 = this.m11 + this.m12 * shearX;
                                        m12 = this.m11 * shearY + this.m12;
                                        m21 = this.m21 + this.m22 * shearX;
                                        m22 = this.m21 * shearY + this.m22;
                                        dx  = this.dx  + this.dy * shearX;
                                        dy  = this.dx  * shearY + this.dy;

                                        this.m11 = m11;
                                        this.m12 = m12;
                                        this.m21 = m21;
                                        this.m22 = m22;
                                        this.dx  = dx;
                                        this.dy  = dy;
                                }
                        }

        // Transform a list of points.
        public void TransformPoints(Point[] pts)
                        {
                                if(pts == null)
                                {
                                        throw new ArgumentNullException("pts");
                                }
                                int posn;
                                float x, y;
                                for(posn = pts.Length - 1; posn >= 0; --posn)
                                {
                                        x = (float)(pts[posn].X);
                                        y = (float)(pts[posn].Y);
                                        pts[posn].X = (int)(x * m11 + y * m21 + 
dx);
                                        pts[posn].Y = (int)(x * m12 + y * m22 + 
dy);
                                }
                        }
        public void TransformPoints(PointF[] pts)
                        {
                                if(pts == null)
                                {
                                        throw new ArgumentNullException("pts");
                                }
                                int posn;
                                float x, y;
                                for(posn = pts.Length - 1; posn >= 0; --posn)
                                {
                                        x = pts[posn].X;
                                        y = pts[posn].Y;
                                        pts[posn].X = x * m11 + y * m21 + dx;
                                        pts[posn].Y = x * m12 + y * m22 + dy;
                                }
                        }

        // Transform a list of vectors.
        public void TransformVectors(Point[] pts)
                        {
                                if(pts == null)
                                {
                                        throw new ArgumentNullException("pts");
                                }
                                int posn;
                                float x, y;
                                for(posn = pts.Length - 1; posn >= 0; --posn)
                                {
                                        x = (float)(pts[posn].X);
                                        y = (float)(pts[posn].Y);
                                        pts[posn].X = (int)(x * m11 + y * m21);
                                        pts[posn].Y = (int)(x * m12 + y * m22);
                                }
                        }
        public void TransformVectors(PointF[] pts)
                        {
                                if(pts == null)
                                {
                                        throw new ArgumentNullException("pts");
                                }
                                int posn;
                                float x, y;
                                for(posn = pts.Length - 1; posn >= 0; --posn)
                                {
                                        x = pts[posn].X;
                                        y = pts[posn].Y;
                                        pts[posn].X = x * m11 + y * m21;
                                        pts[posn].Y = x * m12 + y * m22;
                                }
                        }

        // Translate the matrix.
        public void Translate(float offsetX, float offsetY)
                        {
                                dx += offsetX * m11 + offsetY * m21;
                                dy += offsetX * m12 + offsetY * m22;
                        }
        public void Translate(float offsetX, float offsetY, MatrixOrder order)
                        {
                                if(order == MatrixOrder.Prepend)
                                {
                                        dx += offsetX * m11 + offsetY * m21;
                                        dy += offsetX * m12 + offsetY * m22;
                                }
                                else
                                {
                                        dx += offsetX;
                                        dy += offsetY;
                                }
                        }

        // Clone a matrix.
        public static Matrix Clone(Matrix matrix)
                        {
                                if(matrix != null)
                                {
                                        return new Matrix(matrix.m11, 
matrix.m12,
                                                                          
matrix.m21, matrix.m22,
                                                                          
matrix.dx,  matrix.dy);
                                }
                                else
                                {
                                        return null;
                                }
                        }

        // Transform a particular point - faster version for only one point.
        internal void TransformPoint(float x, float y, out float ox, out float 
oy)
                        {
                                ox = x * m11 + y * m21 + dx;
                                oy = x * m12 + y * m22 + dy;
                        }

}; // class Matrix

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * MatrixOrder.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.MatrixOrder" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum MatrixOrder
{
        Prepend = 0,
        Append  = 1,

}; // enum MatrixOrder

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * PathData.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.PathData" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public sealed class PathData
{
        // Internal state.
        private PointF[] pts;
        private byte[] types;

        // Constructor.
        public PathData() {}

        // Get or set the path points.
        public PointF[] Points
                        {
                                get
                                {
                                        return pts;
                                }
                                set
                                {
                                        pts = value;
                                }
                        }

        // Get or set the path type values.
        public byte[] Types
                        {
                                get
                                {
                                        return types;
                                }
                                set
                                {
                                        types = value;
                                }
                        }

}; // class PathData

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * PathPointType.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.PathPointType" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum PathPointType
{
        Start                   = 0x0000,
        Line                    = 0x0001,
        Bezier                  = 0x0003,
        Bezier3                 = Bezier,
        PathTypeMask    = 0x0007,
        DashMode                = 0x0010,
        PathMarker              = 0x0020,
        CloseSubpath    = 0x0080

}; // enum PathPointType

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * PenAlignment.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.PenAlignment" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum PenAlignment
{
        Center  = 0,
        Inset   = 1,
        Outset  = 2,
        Left    = 3,
        Right   = 4

}; // enum PenAlignment

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * PenType.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.PenType" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum PenType
{
        SolidColor              = 0,
        HatchFill               = 1,
        TextureFill             = 2,
        PathGradient    = 3,
        LinearGradient  = 4

}; // enum PenType

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * PixelOffsetMode.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.PixelOffsetMode" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum PixelOffsetMode
{
        Invalid         = -1,
        Default         = 0,
        HighSpeed       = 1,
        HighQuality     = 2,
        None            = 3,
        Half            = 4

}; // enum PixelOffsetMode

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * QualityMode.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.QualityMode" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum QualityMode
{
        Invalid = -1,
        Default = 0,
        Low             = 1,
        High    = 2

}; // enum QualityMode

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * RegionData.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.RegionData" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public sealed class RegionData
{
        // Internal state.
        private byte[] data;

        // Constructor.
        internal RegionData() {}

        // Get or set the region data.
        public byte[] Data
                        {
                                get
                                {
                                        return data;
                                }
                                set
                                {
                                        data = value;
                                }
                        }

}; // class RegionData

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * SmoothingMode.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.SmoothingMode" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum SmoothingMode
{
        Invalid         = -1,
        Default         = 0,
        HighSpeed       = 1,
        HighQuality     = 2,
        None            = 3,
        AntiAlias       = 4

}; // enum SmoothingMode

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * WarpMode.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.WarpMode" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum WarpMode
{
        Perspective     = 0,
        Bilinear        = 1

}; // enum WarpMode

}; // namespace System.Drawing.Drawing2D

--- NEW FILE ---
/*
 * WrapMode.cs - Implementation of the
 *                      "System.Drawing.Drawing2D.WrapMode" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Drawing2D
{

public enum WrapMode
{
        Tile            = 0,
        TileFlipX       = 1,
        TileFlipY       = 2,
        TileFlipXY      = 3,
        Clamp           = 4

}; // enum WrapMode

}; // namespace System.Drawing.Drawing2D





reply via email to

[Prev in Thread] Current Thread [Next in Thread]