Example #1
0
        void FlyAGraphic(IGraphPort graphPort, GDIDIBSection srcPixelBuffer, Rectangle startFrame, GDIDIBSection dstPixelBuffer, Rectangle endFrame, int steps)
        {
            double xIncrement = (float)(endFrame.X - startFrame.X) / steps;
            double yIncrement = (float)(endFrame.Y - startFrame.Y) / steps;

            Rectangle lastFrame = startFrame;
            int startX = startFrame.X;
            int startY = startFrame.Y;
            int x;
            int y;

            for (int i = 0; i < steps; i++)
            {
                // Draw a section of the destination pixel buffer to 
                // cover where the graphic was sitting before it draws
                // itself in the new location.
                if (i > 0)
                {
                    graphPort.AlphaBlend(lastFrame.X, lastFrame.Y, srcPixelBuffer.Width, srcPixelBuffer.Height, dstPixelBuffer,
                        lastFrame.X, lastFrame.Y, srcPixelBuffer.Width, srcPixelBuffer.Height, 255);
                }

                x = (int)Math.Floor((double)startX + (i * xIncrement) + 0.5);
                y = (int)Math.Floor((double)startY + (i * yIncrement) + 0.5);


                //aGraphic.MoveTo(x, y);
                
                //DrawEvent devent = new DrawEvent(graphPort, Frame);
                //aGraphic.Draw(devent);
                graphPort.PixBlt(srcPixelBuffer, x, y);
                //graphPort.AlphaBlend(x, y, srcPixelBuffer.Width, srcPixelBuffer.Height, srcPixelBuffer,
                //    0, 0, srcPixelBuffer.Width, srcPixelBuffer.Height, 127);

                lastFrame = new Rectangle(x, y, srcPixelBuffer.Width, srcPixelBuffer.Height);
            }

            //aGraphic.MoveTo(endFrame.X, endFrame.Y);
            graphPort.PixBlt(srcPixelBuffer, endFrame.X, endFrame.Y);

        }