Inheritance: ISerializable, IDisposable
Ejemplo n.º 1
0
        public void DrawImage(Point start, double width, double height, Image image, bool scale, bool masked = false)
        {
            double scaleX, scaleY;
            Point  offset;

            if (scale)
            {
                image.ScaleFactor((int)width, (int)height, out scaleX, out scaleY, out offset);
            }
            else
            {
                offset = new Point(0, 0);
                scaleX = width / image.Width;
                scaleY = height / image.Height;
            }
            CContext.Save();
            CContext.Translate(start.X + offset.X, start.Y + offset.Y);
            CContext.Scale(scaleX, scaleY);
            if (masked)
            {
                CContext.PushGroup();
                Gdk.CairoHelper.SetSourcePixbuf(CContext, image.Value, 0, 0);
                CContext.Paint();
                var src = CContext.PopGroup();
                SetColor(FillColor);
                CContext.Mask(src);
                src.Dispose();
            }
            else
            {
                Gdk.CairoHelper.SetSourcePixbuf(CContext, image.Value, 0, 0);
                CContext.Paint();
            }
            CContext.Restore();
        }
Ejemplo n.º 2
0
        public void Save(ICanvas canvas, Area area, string filename)
        {
            Image img = Copy(canvas, area);

            img.Save(filename);
            img.Dispose();
        }
Ejemplo n.º 3
0
        void HandleFieldButtonPressEvent(object o, Gtk.ButtonPressEventArgs args)
        {
            LongoMatch.Core.Common.Image background;
            Gdk.Pixbuf pix = Helpers.Misc.OpenImage(this);

            if (pix == null)
            {
                return;
            }

            background = new Image(pix);
            background.ScaleInplace(Constants.MAX_BACKGROUND_WIDTH,
                                    Constants.MAX_BACKGROUND_HEIGHT);
            if (o == fieldeventbox)
            {
                UpdateBackground(background, 0);
            }
            else if (o == hfieldeventbox)
            {
                UpdateBackground(background, 1);
            }
            else if (o == goaleventbox)
            {
                UpdateBackground(background, 2);
            }
            Edited = true;
        }
Ejemplo n.º 4
0
 public ScoreObject(ScoreButton score)
     : base(score)
 {
     ScoreButton = score;
     if (iconImage == null) {
         iconImage = Resources.LoadImage (StyleConf.ButtonScoreIcon);
     }
 }
Ejemplo n.º 5
0
        public PositionTagger(IWidget widget, ProjectLongoMatch project, List<TimelineEventLongoMatch> plays,
		                       Image background, FieldPositionType position)
            : base(widget)
        {
            Project = project;
            Background = background;
            Plays = plays;
            FieldPosition = position;
            BackgroundColor = App.Current.Style.PaletteBackground;
        }
Ejemplo n.º 6
0
 public void LoadFrame(Image frame, Project project)
 {
     this.project                = project;
     drawing                     = new FrameDrawing();
     scaleFactor                 = (double)frame.Width / 500;
     blackboard.Background       = frame;
     blackboard.Drawing          = drawing;
     savetoprojectbutton.Visible = false;
     UpdateLineWidth();
     UpdateTextSize();
 }
Ejemplo n.º 7
0
 void LoadImage(Image image, FrameDrawing drawing)
 {
     if (image == null)
     {
         DrawingsVisible = false;
         return;
     }
     blackboard.Background = image;
     blackboard.Drawing    = drawing;
     DrawingsVisible       = true;
     blackboarddrawingarea.QueueDraw();
 }
Ejemplo n.º 8
0
 public void LoadPlay(TimelineEvent play, Image frame, FrameDrawing drawing,
                      CameraConfig camConfig, Project project)
 {
     this.play                   = play;
     this.drawing                = drawing;
     this.project                = project;
     this.camConfig              = camConfig;
     scaleFactor                 = (double)frame.Width / 500;
     blackboard.Background       = frame;
     savetoprojectbutton.Visible = true;
     blackboard.Drawing          = drawing;
     blackboard.RegionOfInterest = drawing.RegionOfInterest;
 }
Ejemplo n.º 9
0
 public TimerObject(TimerButton timer)
     : base(timer)
 {
     Button = timer;
     Toggle = true;
     CurrentTime = new Time (0);
     if (iconImage == null) {
         iconImage = new Image (Path.Combine (Config.ImagesDir,
             StyleConf.ButtonTimerIcon));
     }
     if (cancelImage == null) {
         cancelImage = new Image (Path.Combine (Config.IconsDir,
             StyleConf.CancelButton));
     }
     MinWidth = StyleConf.ButtonMinWidth;
     MinHeight = iconImage.Height + StyleConf.ButtonTimerFontSize;
     cancelRect = new Rectangle ();
 }
Ejemplo n.º 10
0
        public Image Copy(ICanvas canvas, Area area)
        {
            Image  img;
            Pixmap pm;

            global::Cairo.Context ctx;

            pm              = new Pixmap(null, (int)area.Width, (int)area.Height, 24);
            ctx             = Gdk.CairoHelper.Create(pm);
            disableScalling = true;
            using (CairoContext c = new CairoContext(ctx)) {
                ctx.Translate(-area.Start.X, -area.Start.Y);
                canvas.Draw(c, null);
            }
            disableScalling = false;
            img             = new Image(Pixbuf.FromDrawable(pm, Colormap.System, 0, 0, 0, 0,
                                                            (int)area.Width, (int)area.Height));
            return(img);
        }
Ejemplo n.º 11
0
 void UpdateBackground(Image background, int index)
 {
     if (index == 0)
     {
         template.FieldBackground = background;
         fieldimage.Pixbuf        = background.Scale(50, 50).Value;
     }
     else if (index == 1)
     {
         template.HalfFieldBackground = background;
         hfieldimage.Pixbuf           = background.Scale(50, 50).Value;
     }
     else if (index == 2)
     {
         template.GoalBackground = background;
         goalimage.Pixbuf        = background.Scale(50, 50).Value;
     }
     Edited = true;
 }
Ejemplo n.º 12
0
        public void DrawingTool(Image image, TimelineEvent play, FrameDrawing drawing,
                                CameraConfig camConfig, Project project)
        {
            DrawingTool dialog = new DrawingTool(mainWindow);

            dialog.TransientFor = mainWindow;

            Log.Information("Drawing tool");
            if (play == null)
            {
                dialog.LoadFrame(image, project);
            }
            else
            {
                dialog.LoadPlay(play, image, drawing, camConfig, project);
            }
            dialog.Show();
            dialog.Run();
            dialog.Destroy();
        }
Ejemplo n.º 13
0
        void HandleShieldButtonPressEvent(object o, ButtonPressEventArgs args)
        {
            Image  shield;
            Pixbuf pix = Helpers.Misc.OpenImage(this);

            if (pix == null)
            {
                return;
            }

            shield = new Image(pix);
            if (shield != null)
            {
                shield.ScaleInplace(Constants.MAX_SHIELD_ICON_SIZE,
                                    Constants.MAX_SHIELD_ICON_SIZE);
                template.Shield    = shield;
                shieldimage.Pixbuf = shield.Scale(SHIELD_SIZE, SHIELD_SIZE).Value;
                Edited             = true;
            }
        }
Ejemplo n.º 14
0
        void HandlePlayerButtonPressEvent(object o, ButtonPressEventArgs args)
        {
            Image  player;
            Pixbuf pix = Helpers.Misc.OpenImage(this);

            if (pix == null)
            {
                return;
            }

            player = new Image(pix);
            player.ScaleInplace(Constants.MAX_PLAYER_ICON_SIZE,
                                Constants.MAX_PLAYER_ICON_SIZE);
            if (player != null && loadedPlayer != null)
            {
                playerimage.Pixbuf = player.Value;
                loadedPlayer.Photo = player;
                teamtagger.Reload();
                Edited = true;
            }
        }
Ejemplo n.º 15
0
 public void LoadTeams(SportsTeam homeTeam, SportsTeam awayTeam, Image background)
 {
     tagger.LoadTeams (homeTeam, awayTeam, background);
     widget?.ReDraw ();
 }
Ejemplo n.º 16
0
 public void LoadFrame(Image frame, Project project)
 {
     this.project = project;
     drawing = new FrameDrawing ();
     scaleFactor = (double)frame.Width / 500;
     blackboard.Background = frame;
     blackboard.Drawing = drawing;
     savetoprojectbutton.Visible = false;
     UpdateLineWidth ();
     UpdateTextSize ();
 }
Ejemplo n.º 17
0
 public void DrawImage(Image image)
 {
     Gdk.CairoHelper.SetSourcePixbuf(CContext, image.Value, 0, 0);
     CContext.Paint();
 }
Ejemplo n.º 18
0
        public void LoadTeams(Image backgroundImg, int[] homeF, int[] awayF,
		                       List<SportsPlayerObject> homeT, List<SportsPlayerObject> awayT,
		                       int size, int nteams)
        {
            background = backgroundImg;
            homeFormation = homeF;
            awayFormation = awayF;
            HomePlayingPlayers = homeT;
            AwayPlayingPlayers = awayT;
            playerSize = size;
            NTeams = nteams;
            Update ();
        }
Ejemplo n.º 19
0
        public void LoadPlay(TimelineEvent play, Image frame, FrameDrawing drawing,
		                      CameraConfig camConfig, Project project)
        {
            this.play = play;
            this.drawing = drawing;
            this.project = project;
            this.camConfig = camConfig;
            scaleFactor = (double)frame.Width / 500;
            blackboard.Background = frame;
            savetoprojectbutton.Visible = true;
            blackboard.Drawing = drawing;
            blackboard.RegionOfInterest = drawing.RegionOfInterest;
        }
Ejemplo n.º 20
0
        void HandleShieldButtonPressEvent(object o, ButtonPressEventArgs args)
        {
            Image shield;
            Pixbuf pix = Helpers.Misc.OpenImage (this);

            if (pix == null) {
                return;
            }

            shield = new Image (pix);
            if (shield != null) {
                shield.ScaleInplace (Constants.MAX_SHIELD_ICON_SIZE,
                    Constants.MAX_SHIELD_ICON_SIZE);
                template.Shield = shield;
                shieldimage.Pixbuf = shield.Scale (SHIELD_SIZE, SHIELD_SIZE).Value;
                Edited = true;
            }
        }
Ejemplo n.º 21
0
 void LoadImage(Image image, FrameDrawing drawing)
 {
     if (image == null) {
         DrawingsVisible = false;
         return;
     }
     blackboard.Background = image;
     blackboard.Drawing = drawing;
     DrawingsVisible = true;
     blackboarddrawingarea.QueueDraw ();
 }
Ejemplo n.º 22
0
        public void SetCursorForTool(DrawTool tool)
        {
            string cursorStr = null;

            Gdk.Cursor cursor = null;

            switch (tool)
            {
            case DrawTool.Line:
                cursorStr = "arrow";
                break;

            case DrawTool.Cross:
                cursorStr = "cross";
                break;

            case DrawTool.Text:
                cursorStr = "text";
                break;

            case DrawTool.Counter:
                cursorStr = "number";
                break;

            case DrawTool.Ellipse:
            case DrawTool.CircleArea:
                cursorStr = "ellipse";
                break;

            case DrawTool.Rectangle:
            case DrawTool.RectangleArea:
                cursorStr = "rect";
                break;

            case DrawTool.Angle:
                cursorStr = "angle";
                break;

            case DrawTool.Pen:
                cursorStr = "freehand";
                break;

            case DrawTool.Eraser:
                cursorStr = "eraser";
                break;

            case DrawTool.Player:
                cursorStr = "player";
                break;

            case DrawTool.Zoom:
                cursorStr = "zoom";
                break;

            case DrawTool.CanMove:
                cursorStr = "hand_opened";
                break;

            case DrawTool.Move:
                cursorStr = "hand_closed";
                break;

            case DrawTool.Selection:
                cursorStr = "hand_select";
                break;

            default:
                cursor = null;
                break;
            }
            if (cursorStr == null)
            {
                widget.GdkWindow.Cursor = cursor;
            }
            else
            {
                Image  img = Image.LoadFromFile(Path.Combine(Config.ImagesDir, "cursors", cursorStr));
                Cursor c   = new Cursor(widget.Display, img.Value, 0, 0);
                widget.GdkWindow.Cursor = c;
            }
        }
Ejemplo n.º 23
0
        void HandleFieldButtonPressEvent(object o, Gtk.ButtonPressEventArgs args)
        {
            LongoMatch.Core.Common.Image background;
            Gdk.Pixbuf pix = Helpers.Misc.OpenImage (this);

            if (pix == null) {
                return;
            }

            background = new Image (pix);
            background.ScaleInplace (Constants.MAX_BACKGROUND_WIDTH,
                Constants.MAX_BACKGROUND_HEIGHT);
            if (o == fieldeventbox) {
                UpdateBackground (background, 0);
            } else if (o == hfieldeventbox) {
                UpdateBackground (background, 1);
            } else if (o == goaleventbox) {
                UpdateBackground (background, 2);
            }
            Edited = true;
        }
Ejemplo n.º 24
0
 void UpdateBackground(Image background, int index)
 {
     if (index == 0) {
         template.FieldBackground = background;
         fieldimage.Pixbuf = background.Scale (50, 50).Value;
     } else if (index == 1) {
         template.HalfFieldBackground = background;
         hfieldimage.Pixbuf = background.Scale (50, 50).Value;
     } else if (index == 2) {
         template.GoalBackground = background;
         goalimage.Pixbuf = background.Scale (50, 50).Value;
     }
     Edited = true;
 }
Ejemplo n.º 25
0
        public ISurface CreateSurface(string filename, bool warnOnDispose = true)
        {
            Image img = Image.LoadFromFile(filename);

            return(CreateSurface(img.Width, img.Height, img, warnOnDispose));
        }
Ejemplo n.º 26
0
        void HandlePlayerButtonPressEvent(object o, ButtonPressEventArgs args)
        {
            Image player;
            Pixbuf pix = Helpers.Misc.OpenImage (this);

            if (pix == null) {
                return;
            }

            player = new Image (pix);
            player.ScaleInplace (Constants.MAX_PLAYER_ICON_SIZE,
                Constants.MAX_PLAYER_ICON_SIZE);
            if (player != null && loadedPlayer != null) {
                playerimage.Pixbuf = player.Value;
                loadedPlayer.Photo = player;
                teamtagger.Reload ();
                Edited = true;
            }
        }
Ejemplo n.º 27
0
 public ISurface CreateSurface(int width, int height, Image image = null, bool warnOnDispose = true)
 {
     return(new Surface(width, height, image, warnOnDispose));
 }