Exemple #1
0
        public Gdk.Pixbuf CompositeColorSimple(int dest_width, int dest_height, Gdk.InterpType interp_type, int overall_alpha, int check_size, uint color1, uint color2)
        {
            IntPtr raw_ret = gdk_pixbuf_composite_color_simple(Handle, dest_width, dest_height, (int)interp_type, overall_alpha, check_size, color1, color2);

            Gdk.Pixbuf ret = (Gdk.Pixbuf)GLib.Object.GetObject(raw_ret, true);
            return(ret);
        }
Exemple #2
0
        public Gdk.Pixbuf ScaleSimple(int dest_width, int dest_height, Gdk.InterpType interp_type)
        {
            IntPtr raw_ret = gdk_pixbuf_scale_simple(Handle, dest_width, dest_height, (int)interp_type);

            Gdk.Pixbuf ret = (Gdk.Pixbuf)GLib.Object.GetObject(raw_ret, true);
            return(ret);
        }
Exemple #3
0
        private void UpdateValues(bool relative, int x, int y, Gdk.InterpType mode)
        {
            this.relative = relative;
            this.x        = x;
            this.y        = y;
            this.mode     = mode;

            _block.Invalidate();
        }
Exemple #4
0
        public Gdk.Pixbuf GetPixbuf(Size maxSize, Gdk.InterpType interpolation = Gdk.InterpType.Bilinear)
        {
            Gdk.Pixbuf pixbuf = Pixbuf;
            if (pixbuf.Width > maxSize.Width && pixbuf.Height > maxSize.Height)
            {
                if (!sizes.TryGetValue(maxSize, out pixbuf))
                {
                    pixbuf         = Pixbuf.ScaleSimple(maxSize.Width, maxSize.Height, interpolation);
                    sizes[maxSize] = pixbuf;
                }
            }

            return(pixbuf);
        }
Exemple #5
0
        public Gdk.Pixbuf GetPixbuf(Size maxSize, Gdk.InterpType interpolation = Gdk.InterpType.Bilinear, bool shrink = false)
        {
            Gdk.Pixbuf pixbuf = Control;
            if (pixbuf.Width > maxSize.Width && pixbuf.Height > maxSize.Height ||
                (shrink && (maxSize.Width < pixbuf.Width || maxSize.Height < pixbuf.Height)))
            {
                if (!sizes.TryGetValue(maxSize, out pixbuf))
                {
                    pixbuf         = Control.ScaleSimple(maxSize.Width, maxSize.Height, interpolation);
                    sizes[maxSize] = pixbuf;
                }
            }

            return(pixbuf);
        }
Exemple #6
0
        public ResizeSetup(bool relative, int x, int y, Gdk.InterpType mode, Callback c)
        {
            this.mode = mode;
            this.c    = c;

            Glade.XML gxml = new Glade.XML(Assembly.GetExecutingAssembly(), "ResizeSetup.glade", "ResizeSetupWindow", null);
            gxml.BindFields(this);

            ResizeSetupWindow.DeleteEvent += CloseWindow;
            CloseButton.Clicked           += CloseWindow;

            if (relative)
            {
                RelativeButton.Active = true;
                rx = x;
                ry = y;
                ax = 128;
                ay = 128;
                SetupRelative();
            }
            else
            {
                AbsoluteButton.Active = true;
                ax = x;
                ay = y;
                rx = 50;
                ry = 50;
                SetupAbsolute();
            }

            if (mode == Gdk.InterpType.Nearest)
            {
                NearestButton.Active = true;
            }
            else if (mode == Gdk.InterpType.Tiles)
            {
                TilesButton.Active = true;
            }
            else if (mode == Gdk.InterpType.Bilinear)
            {
                BilinearButton.Active = true;
            }
            else
            {
                HyperButton.Active = true;
            }

            NearestButton.Clicked += delegate(object o, EventArgs args)
            {
                mode = Gdk.InterpType.Nearest;
                UpdateValues();
            };
            TilesButton.Clicked += delegate(object o, EventArgs args)
            {
                mode = Gdk.InterpType.Tiles;
                UpdateValues();
            };
            BilinearButton.Clicked += delegate(object o, EventArgs args)
            {
                mode = Gdk.InterpType.Bilinear;
                UpdateValues();
            };
            HyperButton.Clicked += delegate(object o, EventArgs args)
            {
                mode = Gdk.InterpType.Hyper;
                UpdateValues();
            };

            ResizeSetupWindow.ShowAll();
        }
Exemple #7
0
 public static Gdk.Pixbuf ToGdk(this Image image, Size maxSize, Gdk.InterpType interpolation = Gdk.InterpType.Bilinear, bool shrink = false)
 {
     return((image?.Handler as IGtkPixbuf)?.GetPixbuf(maxSize, interpolation, shrink));
 }
Exemple #8
0
 public void Scale(Gdk.Pixbuf dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, Gdk.InterpType interp_type)
 {
     gdk_pixbuf_scale(Handle, dest == null ? IntPtr.Zero : dest.Handle, dest_x, dest_y, dest_width, dest_height, offset_x, offset_y, scale_x, scale_y, (int)interp_type);
 }
Exemple #9
0
 public void CompositeColor(Gdk.Pixbuf dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, Gdk.InterpType interp_type, int overall_alpha, int check_x, int check_y, int check_size, uint color1, uint color2)
 {
     gdk_pixbuf_composite_color(Handle, dest == null ? IntPtr.Zero : dest.Handle, dest_x, dest_y, dest_width, dest_height, offset_x, offset_y, scale_x, scale_y, (int)interp_type, overall_alpha, check_x, check_y, check_size, color1, color2);
 }
Exemple #10
0
 public void Composite(Gdk.Pixbuf dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, Gdk.InterpType interp_type, int overall_alpha)
 {
     gdk_pixbuf_composite(Handle, dest == null ? IntPtr.Zero : dest.Handle, dest_x, dest_y, dest_width, dest_height, offset_x, offset_y, scale_x, scale_y, (int)interp_type, overall_alpha);
 }