Exemplo 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();
                }
            }
        }
Exemplo n.º 2
0
		public object Create (Image image, float opacity)
		{
			return new TextureBrushObject {
				Pixbuf = image.ToGdk (),
				Opacity = opacity
			};
		}
Exemplo 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
			};
		}
Exemplo 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)
                            ))
            });
        }
Exemplo n.º 5
0
		Control Scaled(Image image)
		{
			return new ImageView { Image = image };
		}
Exemplo n.º 6
0
		Control SmallSize(Image image)
		{
			return new ImageView { Image = image, Size = new Size (64, 64) };
		}
Exemplo n.º 7
0
		Control LargeSize(Image image)
		{
			return new ImageView { Image = image, Size = new Size (200, 200) };
		}
Exemplo n.º 8
0
		Control AutoSized(Image image)
		{
			return TableLayout.AutoSized(new ImageView { Image = image }, centered: true);
		}
Exemplo 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;
		}
Exemplo 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;
		}