Esempio n. 1
0
            public bool Show(AnimData AD)
            {
                if (AD.animType == AnimOperation.AnimDraw || AD.animType == AnimOperation.AnimErase)
                {
                    int   iDivisor = AD.iParameter;
                    Point ptBoxRel = new Point();
                    ptBoxRel.X = AD.ptRelRightTop.X * AD.iStep / (AD.iTotalSteps * iDivisor);
                    ptBoxRel.Y = AD.ptRelRightTop.Y * AD.iStep / (AD.iTotalSteps * iDivisor);

                    MATRIXF matrix;
                    double  fxScale;

                    fxScale = MATRIXF.fixedDiv(AD.iTotalSteps * 3 - AD.iStep * 2, AD.iTotalSteps);
                    matrix  = MATRIXF.scaleMatrix(fxScale, fxScale) * MATRIXF.offsetMatrix(AD.ptCenter.X, AD.ptCenter.Y);

                    for (int iRow = 0; iRow < iDivisor; iRow++)
                    {
                        for (int iCol = 0; iCol < iDivisor; iCol++)
                        {
                            Point ptTileCenter = new Point();

                            ptTileCenter.X = (iRow * 2 - iDivisor + 1) * AD.ptRelRightTop.X / iDivisor;
                            ptTileCenter.Y = (iCol * 2 - iDivisor + 1) * AD.ptRelRightTop.Y / iDivisor;
                            ptTileCenter   = ptTileCenter * matrix;

                            drawBox(ptTileCenter, ptBoxRel, AD.color);
                        }        //end for
                    }            //end for
                }                //end if

                return(true);
            }    //end Show
Esempio n. 2
0
            public bool Show(AnimData AD)
            {
                if (AD.animType == AnimOperation.AnimDraw || AD.animType == AnimOperation.AnimErase)
                {
                    Point[] ptRect = new Point[4];

                    ptRect[0]   = AD.ptRelRightTop;
                    ptRect[1].X = AD.ptRelRightTop.X;
                    ptRect[1].Y = -AD.ptRelRightTop.Y;

                    int nRemainSteps = AD.iStep - AD.iTotalSteps;
                    int nRemainAngle = AD.iParameter * nRemainSteps;

                    double fxScale = MATRIXF.fixedDiv(AD.iStep, AD.iTotalSteps);
                    double fxAngle = MATRIXF.fixedDiv(nRemainAngle, AD.iTotalSteps);


                    MATRIXF matrix = MATRIXF.scaleMatrix(fxScale, fxScale) * MATRIXF.rotateMatrix(fxAngle);
                    ptRect[0] = ptRect[0] * matrix;
                    ptRect[1] = ptRect[1] * matrix;
                    ptRect[2] = MATRIXF.sum(AD.ptCenter, ptRect[0]);
                    ptRect[3] = MATRIXF.sum(AD.ptCenter, ptRect[1]);
                    ptRect[0] = MATRIXF.subtract(AD.ptCenter, ptRect[0]);
                    ptRect[1] = MATRIXF.subtract(AD.ptCenter, ptRect[1]);

                    drawPoly(ptRect, AD.color);
                }                //end if

                return(true);
            }    //end Show
Esempio n. 3
0
        public static MATRIXF scaleMatrix(double scaleX, double scaleY, Point ptOrg)
        {
            MATRIXF mRes = matrix1.Clone();

            mRes.fM11 = scaleX;
            mRes.fM22 = scaleY;
            return(offsetMatrix(-ptOrg.X, -ptOrg.X) * mRes * offsetMatrix(ptOrg.X, ptOrg.X));
        }
Esempio n. 4
0
        }        //end subtract

        public static MATRIXF offsetMatrix(int offsetX, int offsetY)
        {
            MATRIXF mRes = matrix1.Clone();

            mRes.iM31 = offsetX;
            mRes.iM32 = offsetY;
            return(mRes);
        }
Esempio n. 5
0
            public SpikeData()
            {
                for (int i = 0; i < ptTriangleEnd.Length; i++)
                {
                    ptTriangleEnd[i] = InitArray(3);
                }

                for (int i = 0; i < matrixCircle.Length; i++)
                {
                    matrixCircle[i] = new MATRIXF();
                }
            }            //end constructor
Esempio n. 6
0
        }        //end rotateMatrix

        public static MATRIXF rotateMatrix(double angle, Point ptOrg)
        {
            MATRIXF mRes = matrix1.Clone();

            double dAngle = (angle / 65536.0) * 3.141592654 / 180.0;
            double fCos   = (double)(65536.0 * Math.Cos(dAngle));
            double fSin   = (double)(65536.0 * Math.Sin(dAngle));

            mRes.fM11 = fCos;
            mRes.fM21 = -fSin;
            mRes.fM12 = fSin;
            mRes.fM22 = fCos;

            return(offsetMatrix(-ptOrg.X, -ptOrg.X) * mRes * offsetMatrix(ptOrg.X, ptOrg.X));
        } //end rotateMatrix
Esempio n. 7
0
        }        //end operator *

        public static MATRIXF operator *(MATRIXF m1, MATRIXF m2)
        {
            MATRIXF mtRes = new MATRIXF();

            mtRes.fM11 = fixedMul(m1.fM11, m2.fM11) + fixedMul(m1.fM12, m2.fM21);
            mtRes.fM12 = fixedMul(m1.fM11, m2.fM12) + fixedMul(m1.fM12, m2.fM22);
            mtRes.iM13 = 0;
            mtRes.fM21 = fixedMul(m1.fM21, m2.fM11) + fixedMul(m1.fM22, m2.fM21);
            mtRes.fM22 = fixedMul(m1.fM21, m2.fM12) + fixedMul(m1.fM22, m2.fM22);
            mtRes.iM23 = 0;
            mtRes.iM31 = fixedMul(m1.iM31, m2.fM11) + fixedMul(m1.iM32, m2.fM21) + m2.iM31;
            mtRes.iM32 = fixedMul(m1.iM31, m2.fM12) + fixedMul(m1.iM32, m2.fM22) + m2.iM32;
            mtRes.iM33 = 1;

            return(mtRes);
        }        //end operator *
Esempio n. 8
0
        public MATRIXF Clone()
        {
            MATRIXF mtRes = new MATRIXF();

            mtRes.fM11 = fM11;
            mtRes.fM12 = fM12;
            mtRes.iM13 = iM13;
            mtRes.fM21 = fM21;
            mtRes.fM22 = fM22;
            mtRes.iM23 = iM23;
            mtRes.iM31 = iM31;
            mtRes.iM32 = iM32;
            mtRes.iM33 = iM33;

            return(mtRes);
        }        //end Clone
Esempio n. 9
0
        }        //end operator *

        public static MATRIXF mix(MATRIXF matrix1, MATRIXF matrix2, double fMix)
        {
            MATRIXF mtRes = new MATRIXF();

            mtRes.fM11 = fixedMul(matrix1.fM11, fMix) + fixedMul(matrix2.fM11, fixed1 - fMix);
            mtRes.fM12 = fixedMul(matrix1.fM12, fMix) + fixedMul(matrix2.fM12, fixed1 - fMix);
            mtRes.iM13 = fixedMul(matrix1.iM13, fMix) + fixedMul(matrix2.iM13, fixed1 - fMix);
            mtRes.fM21 = fixedMul(matrix1.fM21, fMix) + fixedMul(matrix2.fM21, fixed1 - fMix);
            mtRes.fM22 = fixedMul(matrix1.fM22, fMix) + fixedMul(matrix2.fM22, fixed1 - fMix);
            mtRes.iM23 = fixedMul(matrix1.iM23, fMix) + fixedMul(matrix2.iM23, fixed1 - fMix);
            mtRes.iM31 = fixedMul(matrix1.iM31, fMix) + fixedMul(matrix2.iM31, fixed1 - fMix);
            mtRes.iM32 = fixedMul(matrix1.iM32, fMix) + fixedMul(matrix2.iM32, fixed1 - fMix);
            mtRes.iM33 = fixedMul(matrix1.iM33, fMix) + fixedMul(matrix2.iM33, fixed1 - fMix);

            return(mtRes);
        }
Esempio n. 10
0
            public bool Show(AnimData AD)
            {
                switch (AD.animType)
                {
                case AnimOperation.AnimInit:
                    AD.effect.Buffer = MATRIXF.rotateMatrix(MATRIXF.fixed1 * 72, AD.ptCenter);
                    break;

                case AnimOperation.AnimDraw:
                case AnimOperation.AnimErase:
                {
                    Point ptBoxRel = new Point();

                    ptBoxRel.X = AD.ptRelRightTop.X * AD.iStep / AD.iTotalSteps;
                    ptBoxRel.Y = AD.ptRelRightTop.Y * AD.iStep / AD.iTotalSteps;

                    MATRIXF matrix;
                    double  fxScale;

                    fxScale = MATRIXF.fixedDiv((AD.iTotalSteps - AD.iStep) * 4, AD.iTotalSteps * 3);
                    matrix  = MATRIXF.offsetMatrix(AD.ptRelRightTop.X, AD.ptRelRightTop.Y) *
                              MATRIXF.scaleMatrix(fxScale, fxScale, AD.ptCenter) *
                              MATRIXF.rotateMatrix(MATRIXF.fixedDiv(AD.iParameter * AD.iStep, AD.iTotalSteps), AD.ptCenter);

                    Point ptBoxCenter;
                    ptBoxCenter = AD.ptCenter * matrix;

                    for (int iLoop = 0; iLoop < 5; iLoop++)
                    {
                        drawBox(ptBoxCenter, ptBoxRel, AD.color);
                        ptBoxCenter = ptBoxCenter * (MATRIXF)AD.effect.Buffer;
                    }                                    //end for

                    break;
                }                //end case
                }                //end switch

                return(true);
            }    //end Show
Esempio n. 11
0
            public bool Show(AnimData AD)
            {
                FWData fw = ((FWData)AD.effect.Buffer);

                switch (AD.animType)
                {
                case AnimOperation.AnimInit:
                {
                    Point[] ptCenter     = fw.ptCenter;
                    Point   ptRectCenter = new Point();


                    ptRectCenter.X = AD.ptCenter.X;
                    ptRectCenter.Y = AD.ptCenter.Y + (AD.ptRelRightTop.X + AD.ptRelRightTop.Y) * 5 / 3;

                    for (int idx = 0; idx < FWData.NRECT; idx++)
                    {
                        MATRIXF matrix = MATRIXF.rotateMatrix(idx * (360 * MATRIXF.fixed1 / FWData.NRECT), AD.ptCenter);
                        ptCenter[idx] = ptRectCenter * matrix;
                    }                                    //end for

                    break;
                }                                //end case

                case AnimOperation.AnimDraw:
                case AnimOperation.AnimErase:
                {
                    Point ptTemp = new Point();

                    double fixedFactor = MATRIXF.fixedDiv(AD.iStep, AD.iTotalSteps);

                    MATRIXF matrix;

                    Point[] ptRect = new Point[4];
                    Point[] ptTmp  = new Point[4];

                    ptRect[0].X = ptRect[3].X = -AD.ptRelRightTop.X;
                    ptRect[1].X = ptRect[2].X = AD.ptRelRightTop.X;
                    ptRect[0].Y = ptRect[1].Y = AD.ptRelRightTop.Y;
                    ptRect[2].Y = ptRect[3].Y = -AD.ptRelRightTop.Y;

                    for (int idx = 0; idx < FWData.NRECT; idx++)
                    {
                        matrix = MATRIXF.scaleMatrix(fixedFactor, fixedFactor) *
                                 MATRIXF.rotateMatrix((MATRIXF.fixed1 - fixedFactor) * AD.iParameter);

                        ptTemp = MATRIXF.mix(AD.ptCenter, fw.ptCenter[idx], fixedFactor);
                        matrix = matrix * MATRIXF.offsetMatrix(ptTemp.X, ptTemp.Y);

                        for (int iAngle = 0; iAngle < 4; iAngle++)
                        {
                            ptTmp[iAngle] = ptRect[iAngle] * matrix;
                        }

                        drawPoly(ptTmp, AD.color);
                    }                                    //end for

                    break;
                }                //end case
                }                //end switch

                return(true);
            }    //end Show
Esempio n. 12
0
            public bool Show(AnimData AD)
            {
                SpikeData sd = ((SpikeData)AD.effect.Buffer);

                switch (AD.animType)
                {
                case AnimOperation.AnimInit:
                {
                    int xLeft   = AD.rcWnd.Left;
                    int xRight  = AD.rcWnd.Right;
                    int yTop    = AD.rcWnd.Bottom;
                    int yBottom = AD.rcWnd.Top;

                    for (int idx = 0; idx < 16; idx++)
                    {
                        Point[] pTriangle = sd.ptTriangleEnd[idx];

                        pTriangle[0] = AD.ptCenter;

                        if (idx < 4)
                        {
                            pTriangle[1].X = pTriangle[2].Y = yTop;
                            pTriangle[1].X = (xLeft * (4 - idx) + xRight * idx) / 4;
                            pTriangle[2].X = (xLeft * (3 - idx) + xRight * (idx + 1)) / 4;
                        }
                        else if (idx < 8)
                        {
                            pTriangle[1].X = pTriangle[2].X = xRight;
                            pTriangle[1].Y = (yTop * (8 - idx) + yBottom * (idx - 4)) / 4;
                            pTriangle[2].Y = (yTop * (7 - idx) + yBottom * (idx - 3)) / 4;
                        }
                        else if (idx < 12)
                        {
                            pTriangle[1].Y = pTriangle[2].Y = yBottom;
                            pTriangle[1].X = (xRight * (12 - idx) + xLeft * (idx - 8)) / 4;
                            pTriangle[2].X = (xRight * (11 - idx) + xLeft * (idx - 7)) / 4;
                        }
                        else
                        {
                            pTriangle[1].X = pTriangle[2].X = xLeft;
                            pTriangle[1].Y = (yBottom * (16 - idx) + yTop * (idx - 12)) / 4;
                            pTriangle[2].Y = (yBottom * (15 - idx) + yTop * (idx - 11)) / 4;
                        }

                        sd.ptEndCenter[idx].X = (pTriangle[0].X + pTriangle[1].X + pTriangle[2].X) / 3;
                        sd.ptEndCenter[idx].Y = (pTriangle[0].Y + pTriangle[1].Y + pTriangle[2].Y) / 3;
                    }

                    Point ptTrgCenter = new Point();

                    ptTrgCenter.X = AD.ptCenter.X;

                    ptTrgCenter.Y = AD.ptCenter.Y + (AD.ptRelRightTop.X + AD.ptRelRightTop.Y) * 4 / 5;

                    for (int idx = 0; idx < 16; idx++)
                    {
                        MATRIXF matrix;

                        matrix = MATRIXF.rotateMatrix((33 * MATRIXF.fixed1) + (-22 * MATRIXF.fixed1) * idx, AD.ptCenter);
                        sd.ptTriangleCenter[idx] = ptTrgCenter * matrix;
                        Point ptTemp = MATRIXF.subtract(sd.ptTriangleCenter[idx], sd.ptEndCenter[idx]);
                        sd.matrixCircle[idx] = MATRIXF.offsetMatrix(ptTemp.X, ptTemp.Y);
                    }

                    break;
                }                                //end case

                case AnimOperation.AnimDraw:
                case AnimOperation.AnimErase:
                {
                    Point[] ptTriangle = new Point[3];

                    double  fixedFactor;
                    MATRIXF matrix;
                    double  fxScale;

                    fxScale = MATRIXF.fixedDiv(AD.iStep, AD.iTotalSteps);

                    if (AD.iStep < AD.iTotalSteps / 2)
                    {
                        fixedFactor = (MATRIXF.fixed1 - MATRIXF.fixedDiv(AD.iStep * 2, AD.iTotalSteps)) * AD.iParameter;
                        for (int idx = 0; idx < 16; idx++)
                        {
                            matrix = MATRIXF.scaleMatrix(fxScale, fxScale, sd.ptEndCenter[idx]) *
                                     MATRIXF.rotateMatrix(fixedFactor, sd.ptEndCenter[idx]);

                            matrix = matrix * sd.matrixCircle[idx];

                            for (int iAngle = 0; iAngle < 3; iAngle++)
                            {
                                ptTriangle[iAngle] = sd.ptTriangleEnd[idx][iAngle] * matrix;
                            }

                            drawPoly(ptTriangle, AD.color);
                        }
                    }
                    else
                    {
                        fixedFactor = MATRIXF.fixedDiv(AD.iStep * 2 - AD.iTotalSteps, AD.iTotalSteps);
                        for (int idx = 0; idx < 16; idx++)
                        {
                            matrix  = MATRIXF.scaleMatrix(fxScale, fxScale, sd.ptEndCenter[idx]);
                            matrix *= MATRIXF.mix(MATRIXF.matrix1, sd.matrixCircle[idx], fixedFactor);

                            for (int iAngle = 0; iAngle < 3; iAngle++)
                            {
                                ptTriangle[iAngle] = sd.ptTriangleEnd[idx][iAngle] * matrix;
                            }

                            drawPoly(ptTriangle, AD.color);
                        }
                    }
                    break;
                }                //end case
                }                //end switch

                return(true);
            }    //end show