Scale() private method

private Scale ( Gdk.Pixbuf pix, int maxWidth, int maxHeight ) : Gdk.Pixbuf
pix Gdk.Pixbuf
maxWidth int
maxHeight int
return Gdk.Pixbuf
コード例 #1
0
ファイル: DashboardWidget.cs プロジェクト: kuggaa/longomatch
 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;
 }
コード例 #2
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;
            }
        }
コード例 #3
0
ファイル: TestImage.cs プロジェクト: GNOME/longomatch
        public void TestScale()
        {
            Image img2 = img.Scale (20, 20);
            Assert.AreNotSame (img, img2);
            Assert.AreEqual (img2.Width, 20);
            Assert.AreEqual (img2.Height, 20);

            img = img.Scale (20, 30);
            Assert.AreEqual (img.Width, 20);
            Assert.AreEqual (img.Height, 20);
            img = img.Scale (25, 20);
            Assert.AreEqual (img.Width, 20);
            Assert.AreEqual (img.Height, 20);

            img.ScaleInplace ();
            Assert.AreEqual (img.Width, Constants.MAX_THUMBNAIL_SIZE);
            Assert.AreEqual (img.Height, Constants.MAX_THUMBNAIL_SIZE);
        }
コード例 #4
0
ファイル: DashboardWidget.cs プロジェクト: GNOME/longomatch
 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;
 }
コード例 #5
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;
            }
        }