1 Lecture 14 Introduction to GDI 2 Drawing Demo picturebox1 txtSize button1 button2 txtX txtY 3 clicking mouse in picturebox1 draws a red circle at that location and update the X and Y textboxes. clicking the Draw Box button draws a blue box of the specified Size at the X and Y location. 4 positions box relative to upper left corner of picturebox1 draws a blue box of specified size 5 gets mousepoint (position x and y) displays mouse position draws red circle of size 20 6 clears picturebox1 7 allows user to type in a different size 8 Graphics - Drawing Demo 2005 image goofy.jpg located inside Folder Debug picBox txtFileName btnInvert btnGrayscale btnLoad 9 Method to Read Image File 10 class Form1 declare img as a Bitmap button event passes image by reference . . . 11 Method Invert( ) inverts level of each color value of each pixel 12 Method Grayscale( ) sets all three color values to the average level 13 OpenFileDialog Instead of requiring the user to type in a filename we can use the OpenFileDialog class to bring up a file directory. This directory will show the folder and files at the current level. We can limit the files to those with a particular set of extensions as shown. When the appropriate file is selected the picBox.Image can be assigned a new Bitmap using the selected image file. 14 Avast ye mateys! There be rough seas ahead! Lubbers should steer to the shore. Proceed at yer own risk! The following section is optional for those who are interested in learning how to make pixel-level image operations faster (i.e. practical). such as C C C with pointers !!!! 15 Image Pixel Format 24 bit per pixel is 1 byte per color scan line red byte blue byte green byte scan line must be a multiple of 4 bytes so each line is padded with between 0 and 3 bytes 16 Locking and Unlocking the Bitmap pointer to the beginning of the first scan line of the image 17 Pixel Operations 18 Fast Grayscale Method 19 Fast Invert Method 20 Form1 Button Events to Access ImgPro Methods 21 Disposing of Objects It is important to call the Dispose( ) method if you get a Graphics object by calling CreateGraphics( ). Alternatively you can use the using construct which automatically calls Dispose( ) when an object goes out of scope. using (Graphics g this.CreateGraphics()) g.DrawLine(Pens.Black new Point(0 0) new Point(3 5)) which is equivalent to... Graphics g this.CreateGraphics() try g.DrawLine(Pens.Black new Point(0 0) new Point(3 5) finally if(g ! null) ((IDisposable)g).Dispose() 22 (No Transcript) 23 (No Transcript) 24 (No Transcript) 25 (No Transcript) 26 (No Transcript) 27 (No Transcript) 28 (No Transcript) 29 (No Transcript) 30 (No Transcript)
PowerShow.com is a leading presentation/slideshow sharing website. Whether your application is business, how-to, education, medicine, school, church, sales, marketing, online training or just for fun, PowerShow.com is a great resource. And, best of all, most of its cool features are free and easy to use.
You can use PowerShow.com to find and download example online PowerPoint ppt presentations on just about any topic you can imagine so you can learn how to improve your own slides and presentations for free. Or use it to find and download high-quality how-to PowerPoint ppt presentations with illustrated or animated slides that will teach you how to do something new, also for free. Or use it to upload your own PowerPoint slides so you can share them with your teachers, class, students, bosses, employees, customers, potential investors or the world. Or use it to create really cool photo slideshows - with 2D and 3D transitions, animation, and your choice of music - that you can share with your Facebook friends or Google+ circles. That's all free as well!
For a small fee you can get the industry's best online privacy or publicly promote your presentations and slide shows with top rankings. But aside from that it's free. We'll even convert your presentations and slide shows into the universal Flash format with all their original multimedia glory, including animation, 2D and 3D transition effects, embedded music or other audio, or even video embedded in slides. All for free. Most of the presentations and slideshows on PowerShow.com are free to view, many are even free to download. (You can choose whether to allow people to download your original PowerPoint presentations and photo slideshows for a fee or free or not at all.) Check out PowerShow.com today - for FREE. There is truly something for everyone!