private void button4_Click(object sender, EventArgs e) { if (CurrentImage == null) // sanity check: make sure we have an image to manipulate { return; } // // Example of calling library, which then dumps data about the given image // to Visual Studio's "Output" window. Note you must run with debugging (F5) // in order to see the output. // //PPMImageLibrary.DebugOutput( // CurrentImage.Header.Width, // CurrentImage.Header.Height, // CurrentImage.Header.Depth, // CurrentImage.ImageListData //); // // we have an image, perform transformation and display new result: // FSharpList <FSharpList <Tuple <int, int, int> > > newImageList; int factor; bool success = System.Int32.TryParse(txtFactor.Text, out factor); if (!success) { factor = 2; txtFactor.Text = factor.ToString(); } newImageList = PPMImageLibrary.Zoom( CurrentImage.Header.Width, CurrentImage.Header.Height, CurrentImage.Header.Depth, CurrentImage.ImageListData, factor ); // // create a new PixelMap here on the client-side, which creates a new bitmap // we then display to the user: // CurrentImage = new PixelMap(newImageList); picImage.Image = CurrentImage.BitMap; }
private void button5_Click(object sender, EventArgs e) { int number = int.Parse(textBox1.Text); if (CurrentImage == null) // sanity check: make sure we have an image to manipulate { return; } // // Example of calling library, which then dumps data about the given image // to Visual Studio's "Output" window. Note you must run with debugging (F5) // in order to see the output. // //PPMImageLibrary.DebugOutput( // CurrentImage.Header.Width, // CurrentImage.Header.Height, // CurrentImage.Header.Depth, // CurrentImage.ImageListData //); // // Perform transformation: // FSharpList <FSharpList <int> > newImageList; // newImageList = PPMImageLibrary.Zoom( CurrentImage.Header.Width, CurrentImage.Header.Height, CurrentImage.Header.Depth, CurrentImage.ImageListData, number ); // // create a new PixelMap here on the client-side, which creates a new bitmap // we then display to the user: // CurrentImage = new PixelMap(newImageList); picImage.Image = CurrentImage.BitMap; }