Exemple #1
0
 protected virtual void OnPaint(Wimp.RedrawEventArgs e)
 {
     if (Paint != null)
     {
         Paint(this, e);
     }
 }
Exemple #2
0
    // These are C# 'event' handlers.
    public void redraw_main_window(object sender, Wimp.RedrawEventArgs e)
    {
        ColourTrans.SetGCOL(ColourTrans.FullRed, OS.GCOLAction.Replace_FG);
        OS.PlotCircleFill(e.Origin.X + 1000, e.Origin.Y + 1000, 400);
        ColourTrans.SetGCOL(ColourTrans.FullGreen, OS.GCOLAction.Replace_FG);
        OS.PlotLine(e.Origin.X, e.Origin.Y, e.Origin.X + 2000, e.Origin.Y + 2000);
        ColourTrans.SetGCOL(ColourTrans.FullBlue, OS.GCOLAction.Replace_FG);
        OS.PlotLine(e.Origin.X, e.Origin.Y + 2000, e.Origin.X + 2000, e.Origin.Y);

        ColourTrans.SetFontColours(ColourTrans.White, ColourTrans.FullBlue, 7);
        main_font.Paint("CSharp string",
                        Font.PlotType.OSUnits,
                        e.Origin.X + 100,
                        e.Origin.Y + 1000,
                        0);          // Length ignored (paint whole string) if bit 7 of flags not set


        ColourTrans.SetFontColours(ColourTrans.White, ColourTrans.Black, 7);
        main_font.Paint("CSharp string rotated",
                        0,          // Coords are in millipoints
                        (e.Origin.X + 1000) * 400,
                        (e.Origin.Y + 1000) * 400,
                        matrix,
                        0);          // Length ignored (paint whole string) if bit 7 of flags not set
    }
Exemple #3
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);
            }
Exemple #4
0
            protected virtual void OnRedraw(Wimp.RedrawEventArgs e)
            {
                // Start the redraw. Given the window handle, the OS fills in RedrawWimpBlock
                // with details of what needs redrawing.
                int more = Wimp.RedrawWindow(ref e.Redraw);

                // The origin of the window only needs to be calculated once before entering
                // the redraw loop.
                e.Origin = WimpWindow.GetOrigin(ref e.Redraw.Visible,
                                                ref e.Redraw.Scroll);
                while (more != 0)
                {
                    OnPaint(e);
                    more = Wimp.GetRectangle(ref e.Redraw);
                }
            }
Exemple #5
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);
            }
Exemple #6
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)
            {
                if (ColourSetBy == ColourSetter.Dialogue)
                {
                    ColourTrans.SetFontColours(ColourTrans.White, font_palette_colour, 7);
                }
                else if (ColourSetBy == ColourSetter.Menu)
                {
                    Wimp.SetFontColours((int)OS.DesktopColour.White, (int)font_wimp_colour);
                }
                font.Paint(Text,
                           Font.PlotType.OSUnits,
                           e.Origin.X + 10,
                           e.Origin.Y - 100,
                           0);                  // Length ignored (paint whole string) if bit 7 of flags not set

                // 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);
            }