Esempio n. 1
0
        public void GenerateRegion(Bitmap bitmap, Rectangle rect)
        {
            if (doc.Image != null)
            {
                //g.InterpolationMode = Loader.Quality;
                Rectangle         source = rect;
                Eto.Drawing.Image img    = doc.Image;
                Size size = img.Size;
                if (source.X < 0)
                {
                    source.Width += source.X; source.X = 0;
                }
                if (source.Y < 0)
                {
                    source.Height += source.Y; source.Y = 0;
                }
                if (source.Right > size.Width)
                {
                    source.Width -= (source.Right - size.Width);
                }
                if (source.Bottom > size.Height)
                {
                    source.Height -= (source.Bottom - size.Height);
                }

                if (rect.Width > 0 && rect.Height > 0)
                {
                    Graphics g = new Graphics(bitmap.Generator, bitmap);
                    g.DrawImage(img, source, new Point((rect.X < 0) ? -rect.X : 0, (rect.Y < 0) ? -rect.Y : 0));
                    g.Commit();
                    g.Dispose();
                }
            }
        }
Esempio n. 2
0
		public object Create (Image image, float opacity)
		{
			return new TextureBrushObject {
				Pixbuf = image.ToGdk (),
				Opacity = opacity
			};
		}
Esempio n. 3
0
		public object Create (Image image, float opacity)
		{
			var rect = new System.Windows.Rect (0, 0, image.Size.Width, image.Size.Height);
			return new swm.ImageBrush (image.ToWpf ()) {
				TileMode = swm.TileMode.Tile,
				Opacity = opacity,
				Stretch = swm.Stretch.None,
				ViewboxUnits = swm.BrushMappingMode.Absolute,
				Viewbox = rect,
				ViewportUnits = swm.BrushMappingMode.Absolute,
				Viewport = rect
			};
		}
Esempio n. 4
0
        protected ImageSource ImageSourceFromImage(Eto.Drawing.Image image)
        {
            var bitmap = ((Bitmap)image);

            return(new StreamImageSource()
            {
                Stream =
                    c =>
                    Task.FromResult(
                        (Stream) new MemoryStream(
                            bitmap.ToByteArray(ImageFormat.Png)
                            ))
            });
        }
Esempio n. 5
0
		Control Scaled(Image image)
		{
			return new ImageView { Image = image };
		}
Esempio n. 6
0
		Control SmallSize(Image image)
		{
			return new ImageView { Image = image, Size = new Size (64, 64) };
		}
Esempio n. 7
0
		Control LargeSize(Image image)
		{
			return new ImageView { Image = image, Size = new Size (200, 200) };
		}
Esempio n. 8
0
		Control AutoSized(Image image)
		{
			return TableLayout.AutoSized(new ImageView { Image = image }, centered: true);
		}
Esempio n. 9
0
		Control ImageTextButton(Image image)
		{
			var control = new Button { Text = "Image && Text Button", Image = image };
			control.Bind(r => r.ImagePosition, this, r => r.ImagePosition);
			LogEvents(control);
			return control;
		}
Esempio n. 10
0
		Control ImageButton(Image image)
		{
			var control = new Button { Image = image };
			control.Bind(r => r.ImagePosition, this, r => r.ImagePosition);
			var defaultMinimiumSize = control.MinimumSize;
            control.Bind(r => r.MinimumSize, Binding.Property(this, r => r.ClearMinimumSize).Convert(r => r ? Size.Empty : defaultMinimiumSize));
			LogEvents(control);
			return control;
		}