public void PageLoaded(object sender, RoutedEventArgs args) { // Create Image element. Mono.System.Windows.Controls.Image rotated90 = new Mono.System.Windows.Controls.Image(); rotated90.Width = 150; // Create the TransformedBitmap to use as the Image source. TransformedBitmap tb = new TransformedBitmap(); // Create the source to use as the tb source. BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.UriSource = new Uri(@"sampleImages/watermelon.jpg", UriKind.RelativeOrAbsolute); bi.EndInit(); // Properties must be set between BeginInit and EndInit calls. tb.BeginInit(); tb.Source = bi; // Set image rotation. RotateTransform transform = new RotateTransform(90); tb.Transform = transform; tb.EndInit(); // Set the Image source. rotated90.Source = tb; //Add Image to the UI Grid.SetColumn(rotated90, 1); Grid.SetRow(rotated90, 1); transformedGrid.Children.Add(rotated90); }
public void PageLoaded(object sender, RoutedEventArgs args) { // Create an Image element. Mono.System.Windows.Controls.Image croppedImage = new Mono.System.Windows.Controls.Image(); croppedImage.Width = 200; croppedImage.Margin = new Thickness(5); // Create a CroppedBitmap based off of a xaml defined resource. CroppedBitmap cb = new CroppedBitmap( (BitmapSource)this.Resources["masterImage"], new Int32Rect(30, 20, 105, 50)); //select region rect croppedImage.Source = cb; //set image source to cropped // Add Image to the UI Grid.SetColumn(croppedImage, 1); Grid.SetRow(croppedImage, 1); croppedGrid.Children.Add(croppedImage); // Create an Image element. Mono.System.Windows.Controls.Image chainImage = new Mono.System.Windows.Controls.Image(); chainImage.Width = 200; chainImage.Margin = new Thickness(5); // Create the cropped image based on previous CroppedBitmap. CroppedBitmap chained = new CroppedBitmap(cb, new Int32Rect(30, 0, (int)cb.Width-30, (int)cb.Height)); // Set the image's source. chainImage.Source = chained; // Add Image to the UI. Grid.SetColumn(chainImage, 1); Grid.SetRow(chainImage, 3); croppedGrid.Children.Add(chainImage); }
public void PageLoaded(object sender, RoutedEventArgs args) { // Create an Image element. Mono.System.Windows.Controls.Image grayImage = new Mono.System.Windows.Controls.Image(); grayImage.Width = 200; grayImage.Margin = new Thickness(5); // Create the image source using a xaml defined resource. FormatConvertedBitmap fcb = new FormatConvertedBitmap( (BitmapImage)this.Resources["masterImage"],PixelFormats.Gray4,null,0); // Set the image source. grayImage.Source = fcb; // Add Image to the UI. Grid.SetColumn(grayImage, 2); Grid.SetRow(grayImage, 1); convertedGrid.Children.Add(grayImage); }
public void PageLoaded(object sender, RoutedEventArgs args) { // Create an Image element. Mono.System.Windows.Controls.Image grayImage = new Mono.System.Windows.Controls.Image(); grayImage.Width = 200; grayImage.Margin = new Thickness(5); // Create the image source using a xaml defined resource. FormatConvertedBitmap fcb = new FormatConvertedBitmap( (BitmapImage)this.Resources["masterImage"], PixelFormats.Gray4, null, 0); // Set the image source. grayImage.Source = fcb; // Add Image to the UI. Grid.SetColumn(grayImage, 2); Grid.SetRow(grayImage, 1); convertedGrid.Children.Add(grayImage); }
public void PageLoaded(object sender, RoutedEventArgs args) { // Create the image element. Mono.System.Windows.Controls.Image simpleImage = new Mono.System.Windows.Controls.Image(); simpleImage.Width = 200; simpleImage.Margin = new Thickness(5); // Create source. BitmapImage bi = new BitmapImage(); // BitmapImage.UriSource must be in a BeginInit/EndInit block. bi.BeginInit(); bi.UriSource = new Uri(@"/sampleImages/cherries_larger.jpg",UriKind.RelativeOrAbsolute); bi.EndInit(); // Set the image source. simpleImage.Source = bi; //Add Image to the UI Grid.SetColumn(simpleImage, 2); Grid.SetRow(simpleImage, 1); simpleGrid.Children.Add(simpleImage); }
public void PageLoaded(object sender, RoutedEventArgs args) { // Create the image element. Mono.System.Windows.Controls.Image simpleImage = new Mono.System.Windows.Controls.Image(); simpleImage.Width = 200; simpleImage.Margin = new Thickness(5); // Create source. BitmapImage bi = new BitmapImage(); // BitmapImage.UriSource must be in a BeginInit/EndInit block. bi.BeginInit(); bi.UriSource = new Uri(@"/sampleImages/cherries_larger.jpg", UriKind.RelativeOrAbsolute); bi.EndInit(); // Set the image source. simpleImage.Source = bi; //Add Image to the UI Grid.SetColumn(simpleImage, 2); Grid.SetRow(simpleImage, 1); simpleGrid.Children.Add(simpleImage); }
public void PageLoaded(object sender, RoutedEventArgs args) { // Create an Image element. Mono.System.Windows.Controls.Image croppedImage = new Mono.System.Windows.Controls.Image(); croppedImage.Width = 200; croppedImage.Margin = new Thickness(5); // Create a CroppedBitmap based off of a xaml defined resource. CroppedBitmap cb = new CroppedBitmap( (BitmapSource)this.Resources["masterImage"], new Int32Rect(30, 20, 105, 50)); //select region rect croppedImage.Source = cb; //set image source to cropped // Add Image to the UI Grid.SetColumn(croppedImage, 1); Grid.SetRow(croppedImage, 1); croppedGrid.Children.Add(croppedImage); // Create an Image element. Mono.System.Windows.Controls.Image chainImage = new Mono.System.Windows.Controls.Image(); chainImage.Width = 200; chainImage.Margin = new Thickness(5); // Create the cropped image based on previous CroppedBitmap. CroppedBitmap chained = new CroppedBitmap(cb, new Int32Rect(30, 0, (int)cb.Width - 30, (int)cb.Height)); // Set the image's source. chainImage.Source = chained; // Add Image to the UI. Grid.SetColumn(chainImage, 1); Grid.SetRow(chainImage, 3); croppedGrid.Children.Add(chainImage); }