Page 221 - DCAP408_WEB_PROGRAMMING
P. 221

Unit 13: Windows GDI




             Language Barriers                                                                  Notes

             Of course, there is also another issue – programming languages. Once a developer learns
             a programming language, he is not always eager to jump from what he knows to what he
             doesn't because this involves relearning a language. Karunakaran, who is well-versed
             with Java, says that he can't move to iOS because he is required to program it in Objective
             C, a language that he is not familiar with. He also has no desire to move to Android, a
             platform that he says he doesn't like. "Android has a lot of bugs even with basic features
             like phone calls and SMS. I have an Android phone and these bugs are making it difficult
             for me to use the phone," he said.

             So, is the BlackBerry developer market filled with people who don't like other platforms,
             or can't move away for various reasons? Mathew disagrees. "Apple is not the most popular
             brand in India. That is why developers want to get on to BlackBerry." Highlighting Indian
             players like MakeMyTrip, Naukri and Shaadi, she said, "They first made an appearance on
             BlackBerry and only then did they get on other platforms. For developers in India, it is
             BlackBerry, Android and iOS, in that order."

          13.2 Summary


              GDI stands for Graphics Device Interface. It provides many functions for displaying graphics
               in your Windows application.
              GDI uses the concept of Pens and Brushes. A Pen defines the style and colour that pixels
               will be drawn in while a brush determines the fill colour of shapes.
              We can use CreateSolidBrush to create a solid coloured brush or CreateBrushIndirect to
               create a brush with specific styles (like hatched) or even using a loaded bitmap.

              Sometimes you would like to update your window whenever you want. To do this you
               have to tell Windows that your window is dirty and needs a redraw. You can do this by
               using InvalidateRect.
          13.3 Keywords


          GDI: Graphics Device Interface
          HDC: Handle to a Device Context

          13.4 Review Questions

          1.   Windows-based applications do not access the graphics hardware directly. Explain.

          2.   To obtain the handle you call: BeginPaint, it takes your window handle and a pointer to a
               PAINTSTRUCT that you have declared. Discuss.
          3.   You can also use PolyLine, PolyPolyLine, Arc etc. To explore which ones are available
               look in the MSDN help. Analyze.
          4.   A number of the GDI drawing functions can be effected by  the pen  or brush chosen.
               Elaborate.
          5.   When you create a window you can specify its size. Explain with an example.








                                           LOVELY PROFESSIONAL UNIVERSITY                                   215
   216   217   218   219   220   221   222   223   224   225   226