예제 #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();
                }
            }
        }
예제 #2
0
		public object Create (Image image, float opacity)
		{
			return new TextureBrushObject {
				Pixbuf = image.ToGdk (),
				Opacity = opacity
			};
		}
예제 #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
			};
		}
예제 #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)
                            ))
            });
        }
예제 #5
0
		Control Scaled(Image image)
		{
			return new ImageView { Image = image };
		}
예제 #6
0
		Control SmallSize(Image image)
		{
			return new ImageView { Image = image, Size = new Size (64, 64) };
		}
예제 #7
0
		Control LargeSize(Image image)
		{
			return new ImageView { Image = image, Size = new Size (200, 200) };
		}
예제 #8
0
		Control AutoSized(Image image)
		{
			return TableLayout.AutoSized(new ImageView { Image = image }, centered: true);
		}
예제 #9
0
파일: ButtonSection.cs 프로젝트: mhusen/Eto
		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;
		}
예제 #10
0
파일: ButtonSection.cs 프로젝트: mhusen/Eto
		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;
		}