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