Пример #1
0
            // For a derived class, it is recommended to override the event notifier rather
            // than subscribe to the event.
            protected override void OnPaint(Wimp.RedrawEventArgs e)
            {
                var local_matrix = (OS.Matrix)matrix.Clone();

                // Matrix translation is used to position the drawfile on screen within
                // the window.
                local_matrix.Translate(e.Origin.X, e.Origin.Y);
                Drawfile.Render(0, draw_file, local_matrix, ref e.Redraw.Clip, 0);

                // Technically, we should call the base method to ensure that event subscribers
                // are also notified of this event, but I don't think that's necessary in this
                // case.

                // base.OnPaint (e);
            }
Пример #2
0
            protected override void OnPaint(Wimp.RedrawEventArgs e)
            {
                IntPtr trans_table = Sprites[0].TransTable;

                // Render as is.
                OS.Move(e.Origin.X + 40, e.Origin.Y + WindowHeight - 170);
                Sprites[0].Plot(OSSpriteOp.PlotAction.OverWrite);

                // Render scaled by factor of 2.
                Sprites[0].PlotScaled(e.Origin.X + 180,
                                      e.Origin.Y + WindowHeight - 220,
                                      OSSpriteOp.PlotAction.OverWrite,
                                      new OS.ScaleFactors(2, 2, 1, 1),
                                      trans_table);

                // Render transformed using matrix.
                // Transformed sprites are not plotted at the current graphics position;
                // the matrix/destination rectangle is used to place the sprite at the
                // required position.
                // The translation has to be applied here because we don't know ahead
                // of time where the screen position is and it will change as the
                // window is moved.
                // A copy of the matrix has to be used so that the translation is applied
                // only once to the original matrix rather than multiple times.
                var local_matrix = (OS.Matrix)matrix.Clone();

                local_matrix.Translate(e.Origin.X + 480, e.Origin.Y + WindowHeight - 170);
                Sprites[0].PlotTransformed(OSSpriteOp.PlotAction.OverWrite,
                                           local_matrix,
                                           trans_table);

                // Render transformed to destination parallelogram
                var block = new OSSpriteOp.DestCoordBlock();

                block.x0 = OS.ToDrawUnits(e.Origin.X + 600);
                block.y0 = OS.ToDrawUnits(e.Origin.Y + WindowHeight - 70);
                block.x1 = OS.ToDrawUnits(e.Origin.X + 800);
                block.y1 = block.y0;
                block.x2 = block.x1 + OS.ToDrawUnits(50);
                block.y2 = OS.ToDrawUnits(e.Origin.Y + WindowHeight - 200);
                block.x3 = block.x0 + OS.ToDrawUnits(50);
                block.y3 = block.y2;
                Sprites[0].PlotTransformed(OSSpriteOp.PlotAction.OverWrite,
                                           block,
                                           trans_table);
            }