Example #1
0
 public void TransformPoints(ITransformMatrix <DoubleComponent> transform)
 {
     foreach (Figure <TPoint, TViewBounds> figure in _figures)
     {
         figure.TransformPoints(transform);
     }
 }
Example #2
0
        public static Matrix Convert(this ITransformMatrix transform)
        {
            var result = new Matrix(transform.Elements[0],
                                    transform.Elements[1], transform.Elements[2], transform.Elements[3],
                                    transform.Elements[4], transform.Elements[5]);

            return(result);
        }
        public ITransformMatrix Mul(ITransformMatrix otherMatrix)
        {
            if (!(otherMatrix is Matrix4x4 other4x4))
            {
                throw new ArgumentException($"Multiplication is only supported with matching type of '{nameof(Matrix4x4)}'.");
            }

            return(this * other4x4);
        }
        public IModelTransform AddScale(float x, float y, float z)
        {
            var newScale = new Matrix4x4();

            newScale.SetScale(new Vector3(x, y, z));
            _mScale = _mScale.Mul(newScale);
            RebuildTransform();
            return(this);
        }
        public IModelTransform AddRotation(float xDeg, float yDeg, float zDeg)
        {
            var newRotation = new Matrix4x4();

            newRotation.SetRotation(new Vector3(xDeg, yDeg, zDeg));
            _mRotate = _mRotate.Mul(newRotation);
            RebuildTransform();
            return(this);
        }
        public IModelTransform AddTranslation(float x, float y, float z)
        {
            var newTranslation = new Matrix4x4();

            newTranslation.SetTranslation(new Vector3(x, y, z));
            _mTranslate = _mTranslate.Mul(newTranslation);
            RebuildTransform();
            return(this);
        }
        public ModelMatrixTransform(Func <ITransformMatrix> matrixFactory)
        {
            _newMatrix = matrixFactory ?? throw new ArgumentNullException(nameof(matrixFactory));

            {   // Init matrices
                _mTranslate = _newMatrix();
                _mRotate    = _newMatrix();
                _mScale     = _newMatrix();
                RebuildTransform();
            }
        }
		public IBrush LoadLinearBrush(AGS.API.Color[] linearColors, IBlend blend, IColorBlend interpolationColors, 
			ITransformMatrix transform, AGS.API.WrapMode wrapMode, bool gammaCorrection)
		{
			LinearGradientBrush g = new LinearGradientBrush (new System.Drawing.Point (), new System.Drawing.Point (), 
				System.Drawing.Color.White, System.Drawing.Color.White);
			g.Blend = blend.Convert();
			g.GammaCorrection = gammaCorrection;
			g.InterpolationColors = interpolationColors.Convert();
			g.LinearColors = linearColors.Convert();
			g.Transform = transform.Convert();
			g.WrapMode = wrapMode.Convert();
			return new DesktopBrush(g);
		}
        public IBrush LoadLinearBrush(Color[] linearColors, IBlend blend, IColorBlend interpolationColors,
                                      ITransformMatrix transform, WrapMode wrapMode, bool gammaCorrection)
        {
            LinearGradientBrush g = new LinearGradientBrush(new System.Drawing.Point(), new System.Drawing.Point(),
                                                            System.Drawing.Color.White, System.Drawing.Color.White);

            g.Blend               = blend.Convert();
            g.GammaCorrection     = gammaCorrection;
            g.InterpolationColors = interpolationColors.Convert();
            g.LinearColors        = linearColors.Convert();
            g.Transform           = transform.Convert();
            g.WrapMode            = wrapMode.Convert();
            return(new DesktopBrush(g));
        }
		public IBrush LoadPathsGradientBrush(AGS.API.Color centerColor, AGS.API.PointF centerPoint, 
					IBlend blend, AGS.API.PointF focusScales, AGS.API.Color[] surroundColors, 
					IColorBlend interpolationColors, ITransformMatrix transform, AGS.API.WrapMode wrapMode)
		{
			PathGradientBrush g = new PathGradientBrush (new System.Drawing.Point[]{ });
			g.Blend = blend.Convert();
			g.CenterColor = centerColor.Convert();
			g.CenterPoint = centerPoint.Convert();
			g.FocusScales = focusScales.Convert();
			g.SurroundColors = surroundColors.Convert();
			g.InterpolationColors = interpolationColors.Convert();
			g.Transform = transform.Convert();
			g.WrapMode = wrapMode.Convert();
			return new DesktopBrush(g);
		}
Example #11
0
        internal void TransformPoints(ITransformMatrix <DoubleComponent> transform)
        {
            for (Int32 i = 0; i < _points.Count; i++)
            {
                TPoint point = _points[i];

                DoubleComponent[] pointComponents = point.Components;
                Array.Resize(ref pointComponents, pointComponents.Length + 1);
                pointComponents[pointComponents.Length - 1] = 1;
                transform.TransformVector(pointComponents);
                Array.Resize(ref pointComponents, pointComponents.Length - 1);
                point.Components = pointComponents;
                _points[i]       = point;
            }
        }
        public IBrush LoadPathsGradientBrush(Color centerColor, PointF centerPoint,
                                             IBlend blend, PointF focusScales, Color[] surroundColors,
                                             IColorBlend interpolationColors, ITransformMatrix transform, WrapMode wrapMode)
        {
            PathGradientBrush g = new PathGradientBrush(new System.Drawing.Point[] { });

            g.Blend               = blend.Convert();
            g.CenterColor         = centerColor.Convert();
            g.CenterPoint         = centerPoint.Convert();
            g.FocusScales         = focusScales.Convert();
            g.SurroundColors      = surroundColors.Convert();
            g.InterpolationColors = interpolationColors.Convert();
            g.Transform           = transform.Convert();
            g.WrapMode            = wrapMode.Convert();
            return(new DesktopBrush(g));
        }
Example #13
0
 public IBrush LoadLinearBrush(AGS.API.Color[] linearColors, IBlend blend, IColorBlend interpolationColors, ITransformMatrix transform, WrapMode wrapMode, bool gammaCorrection)
 {
     throw new NotImplementedException();
 }
 protected void RebuildTransform()
 {
     _mVertexTransform = _mTranslate.Mul(_mRotate.Mul(_mScale));
     _mNormalTransform = _mVertexTransform.Invert().Transpose();
 }
Example #15
0
        ///// <summary>
        ///// Creates a <see cref="Geometry"/> based on a Well-Known Text String
        ///// </summary>
        ///// <param name="wkt">Well-Known Text</param>
        ///// <returns></returns>
        //public static Geometry FromText(String wkt)
        //{
        //    return GeometryFromWkt.Parse(wkt);
        //}

        ///// <summary>
        ///// Creates a <see cref="Geometry"/> based on a Well-Known Binary Byte array
        ///// </summary>
        ///// <param name="wkb">Well-Known Binary</param>
        ///// <returns></returns>
        //public static Geometry FromWkb(Byte[] wkb)
        //{
        //    return GeometryFromWkb.Parse(wkb);
        //}

        #region IVertexStream<Point,DoubleComponent> Members

        public abstract IEnumerable <Point> GetVertexes(ITransformMatrix <DoubleComponent> transform);
Example #16
0
 public override IEnumerable <Point> GetVertexes(ITransformMatrix <DoubleComponent> transform)
 {
     throw new NotImplementedException();
 }
		public IBrush LoadLinearBrush(AGS.API.Color[] linearColors, IBlend blend, IColorBlend interpolationColors, ITransformMatrix transform, WrapMode wrapMode, bool gammaCorrection)
		{
			throw new NotImplementedException();
		}
		public IBrush LoadPathsGradientBrush(AGS.API.Color centerColor, AGS.API.PointF centerPoint, IBlend blend, AGS.API.PointF focusScales, AGS.API.Color[] surroundColors, IColorBlend interpolationColors, ITransformMatrix transform, WrapMode wrapMode)
		{
			throw new NotImplementedException();
		}
Example #19
0
 public IBrush LoadPathsGradientBrush(AGS.API.Color centerColor, AGS.API.PointF centerPoint, IBlend blend, AGS.API.PointF focusScales, AGS.API.Color[] surroundColors, IColorBlend interpolationColors, ITransformMatrix transform, WrapMode wrapMode)
 {
     throw new NotImplementedException();
 }
Example #20
0
 public override IEnumerable<Point> GetVertexes(ITransformMatrix<DoubleComponent> transform)
 {
     throw new NotImplementedException();
 }