예제 #1
0
	public Affine()
	{
		fMatrix = new XFORM();

		// Start out with identity matrix
		Reset();
	}
예제 #2
0
        public GDI32Transform()
        {
            fMatrix = new XFORM();
            fTransformMatrix = new float3x3();

            // Start out with identity matrix
            SetToIdentity();
        }
예제 #3
0
파일: XFORM.cs 프로젝트: Wiladams/NewTOAPIA
		public XFORM(XFORM a)
		{
			eM11 = a.eM11;
			eM12 = a.eM12;
			eM21 = a.eM21;
			eM22 = a.eM22;
			eDx = a.eDx;
			eDy = a.eDy;
		}
예제 #4
0
	// Copy transform if valid
	public bool SetTransform(XFORM xm)
	{
		if (xm.eM11 * xm.eM22 == xm.eM12 * xm.eM21)
			return false;

		fMatrix = xm;

		return true;
	}
예제 #5
0
 public static void Pack(BufferChunk chunk, XFORM aTrans)
 {
     chunk += aTrans.eDx;
     chunk += aTrans.eDy;
     chunk += aTrans.eM11;
     chunk += aTrans.eM12;
     chunk += aTrans.eM21;
     chunk += aTrans.eM22;
 }
예제 #6
0
파일: XFORM.cs 프로젝트: ARLM-Attic/toapi
 public XFORM(XFORM a)
 {
     eM11 = a.eM11;
     eM12 = a.eM12;
     eM21 = a.eM21;
     eM22 = a.eM22;
     eDx  = a.eDx;
     eDy  = a.eDy;
 }
예제 #7
0
	// transform = transform * b
	public bool Combine(XFORM b)
	{
		if (b.eM11 * b.eM22 == b.eM12 * b.eM21)
			return false;

		XFORM a = new XFORM(fMatrix);

		// 11 12   11 12
		// 21 22   21 22
		fMatrix.eM11 = a.eM11 * b.eM11 + a.eM12 * b.eM21;
		fMatrix.eM12 = a.eM11 * b.eM12 + a.eM12 * b.eM22;
		fMatrix.eM21 = a.eM21 * b.eM11 + a.eM22 * b.eM21;
		fMatrix.eM22 = a.eM21 * b.eM12 + a.eM22 * b.eM22;
		fMatrix.eDx = a.eDx * b.eM11 + a.eDy * b.eM21 + b.eDx;
		fMatrix.eDy = a.eDx * b.eM12 + a.eDy * b.eM22 + b.eDy;

		return true;
	}
예제 #8
0
	// transform = 1 / transform
	//  M = A * x + B 
	//  Inv(M) = Inv(A) * x - Inv(A) * B
	public bool Invert()
	{
		float det = fMatrix.eM11 * fMatrix.eM22 - fMatrix.eM21 * fMatrix.eM12;

		if (det == 0)
			return false;

		XFORM old = new XFORM(fMatrix);

		fMatrix.eM11 = old.eM22 / det;
		fMatrix.eM12 = -old.eM12 / det;
		fMatrix.eM21 = -old.eM21 / det;
		fMatrix.eM22 = old.eM11 / det;

		fMatrix.eDx = -(fMatrix.eM11 * old.eDx + fMatrix.eM21 * old.eDy);
		fMatrix.eDy = -(fMatrix.eM12 * old.eDx + fMatrix.eM22 * old.eDy);

		return true;
	}
예제 #9
0
 public static extern bool SetWorldTransform([In] SafeHandle hdc, ref TOAPI.Types.XFORM lpXform);
예제 #10
0
        public bool Rotate(float angle, float x0, float y0)
        {
            float3 unity = new float3(new float2(x0, y0));
            unity.Unit();
            fTransformMatrix = float3x3.Rotate(angle, unity);

            XFORM xm = new XFORM();

            Translate(-x0, -y0);	// make (x0,y0) the origin

            double rad = angle * (Math.PI / 180);

            xm.eM11 = (float)Math.Cos(rad);
            xm.eM12 = (float)Math.Sin(rad);
            xm.eM21 = -xm.eM12;
            xm.eM22 = xm.eM11;
            xm.eDx = 0;
            xm.eDy = 0;

            Combine(xm);			// rotate
            Translate(x0, y0);		// move origin back

            return true;
        }
예제 #11
0
 void Pack(BufferChunk chunk, XFORM aTrans)
 {
     //chunk += aTrans.eDx;
     //chunk += aTrans.eDy;
     //chunk += aTrans.eM11;
     //chunk += aTrans.eM12;
     //chunk += aTrans.eM21;
     //chunk += aTrans.eM22;
 }
예제 #12
0
	public bool Rotate(float angle, float x0, float y0)
	{
		XFORM xm = new XFORM();

		Translate(-x0, -y0);	// make (x0,y0) the origin

		double rad = angle * (3.14159265359 / 180);

		xm.eM11 = (float)Math.Cos(rad);
		xm.eM12 = (float)Math.Sin(rad);
		xm.eM21 = -xm.eM12;
		xm.eM22 = xm.eM11;
		xm.eDx = 0;
		xm.eDy = 0;

		Combine(xm);			// rotate
		Translate(x0, y0);		// move origin back

		return true;
	}
예제 #13
0
        private Transform2D GetWorldTransform()
        {
            XFORM aTransform = new XFORM();
            bool result = GDI32.GetWorldTransform(this, out aTransform);

            Transform2D trans = new Transform2D();
            trans.SetTransform(aTransform);

            return trans;
        }
예제 #14
0
    private  bool SetWorldTransform(XFORM aTransform)
    {
        bool result = GDI32.SetWorldTransform(HDC, ref aTransform);

        return result;
    }
예제 #15
0
    private XFORM GetWorldTransform()
    {
        XFORM aTransform = new XFORM();
        bool result = GDI32.GetWorldTransform(HDC, out aTransform);

        return aTransform;
    }
예제 #16
0
 static extern bool ModifyWorldTransform([In] SafeHandle hdc, [In] TOAPI.Types.XFORM lpXform,
                                         uint iMode);
예제 #17
0
    //public XFORM WorldTransform
    //{
    //    get { return GetWorldTransform(); }

    //    set { SetWorldTransform(value); }
    //}

    //private XFORM GetWorldTransform()
    //{
    //    XFORM aTransform = new XFORM();
    //    bool result = GDI32.GetWorldTransform(DeviceContext, out aTransform);

    //    return aTransform;
    //}

    public override void SetWorldTransform(XFORM aTransform)
    {
        BufferChunk chunk = new BufferChunk(1024);
        chunk += GDI32.EMR_SETWORLDTRANSFORM;
        Pack(chunk, aTransform);

        PackCommand(chunk);
    }
예제 #18
0
 public static extern bool GetWorldTransform([In] SafeHandle hdc, [Out] out TOAPI.Types.XFORM lpXform);