static void DrawBrush(Widget widget, InputSource source,
                              double x, double y, double pressure)
        {
            Gdk.GC gc;
            switch (source)
            {
            case InputSource.Mouse:
                gc = widget.Style.BlackGC;
                break;

            case InputSource.Pen:
                gc = widget.Style.BlackGC;
                break;

            case InputSource.Eraser:
                gc = widget.Style.WhiteGC;
                break;

            default:
                gc = widget.Style.BlackGC;
                break;
            }

            Gdk.Rectangle update_rect = new Gdk.Rectangle();
            update_rect.X      = (int)(x - 10.0d * pressure);
            update_rect.Y      = (int)(y - 10.0d * pressure);
            update_rect.Width  = (int)(20.0d * pressure);
            update_rect.Height = (int)(20.0d * pressure);

            pixmap.DrawRectangle(gc, true,
                                 update_rect.X, update_rect.Y,
                                 update_rect.Width, update_rect.Height);
            darea.QueueDrawArea(update_rect.X, update_rect.Y,
                                update_rect.Width, update_rect.Height);
        }
Exemplo n.º 2
0
        static void DrawBrush(double x, double y, bool black)
        {
            Gdk.Rectangle update_rect = new Gdk.Rectangle();
            update_rect.X      = (int)x - 5;
            update_rect.Y      = (int)y - 5;
            update_rect.Width  = 10;
            update_rect.Height = 10;

            pixmap.DrawRectangle(black ? darea.Style.BlackGC : darea.Style.WhiteGC, true,
                                 update_rect.X, update_rect.Y,
                                 update_rect.Width, update_rect.Height);
            darea.QueueDrawArea(update_rect.X, update_rect.Y,
                                update_rect.Width, update_rect.Height);
        }