Published: September 9, 2008
By Richard G. Baldwin
File: Allegro00135PracticeTest
1. True or False: The use of off-screen bitmap buffers can often improve the speed of a program.
2. True or False: Off-screen bitmap buffers are normally used to conserve memory and have little impact on the speed of a program.
3. True or False: A common practice is to draw on an off-screen bitmap buffer in memory, which can be done at high speed. Then a function named blit is called to copy the image from the buffer to the screen very quickly.
4. True or False: A common practice is to draw on an off-screen bitmap buffer in memory, which can be done at high speed. Then a function named screenCopy is called to copy the image from the buffer to the screen very quickly.
5. True or False: The code shown below can be used to create an off-screen bitmap buffer.
BITMAP *buffer = NULL; buffer = create_bitmap(256,256); |
6. True or False: The code shown below can be used to create an off-screen bitmap buffer.
BITMAP buffer = NULL; buffer = create_bitmap(256,256); |
7. True or False: When you create a bitmap image buffer, the image memory will be cleared automatically, with the integer value for the color black being automatically set into every pixel in the image buffer.
8. True or False: When you create a bitmap image buffer, the image memory will not be cleared, so it will probably contain garbage: you should clear the bitmap before using it.
9. True or False: The putpixel function cannot be used to set pixel colors in an off-screen bitmap buffer.
10. True or False: The putpixel function can be used to set pixel colors in an off-screen bitmap buffer.
11. True or False: The code shown below can be used to set the colors in a 255x255 block of pixels in an off-screen bitmap memory buffer, provided that the variable named buffer contains a pointer to the memory buffer.
for(int row = 0;row < 255;row++){ for(int column = 0;column < 255;column++){ putpixel(buffer,column,row,makecol(column,row,128)); }//end loop row }//end loop on column |
12. True or False: The code shown below is the typical way to set the colors in a 255x255 block of pixels in an off-screen bitmap memory buffer, provided that the variable named buffer contains a pointer to the memory buffer.
for(int row = 0;row < 255;row++){ for(int column = 0;column < 255;column++){ setPixel(buffer,column,row,makecol(column,row,128)); }//end loop row }//end loop on column |
13. True or False: By calling the blit function, a rectangular portion of a source bitmap can be copied to an arbitrary location in a destination bitmap and both bitmaps can be stored in off-screen memory buffers.
14. True or False: By calling the blit function, a rectangular portion of a source bitmap can be copied to an arbitrary location in a destination bitmap with the restriction that one of the bitmaps must be the screen.
15. True or False: In virtually all cases, producing an off-screen image and calling the blit function to copy the image onto the screen will be faster than constructing the image directly on the screen one pixel at a time.
Copyright 2008, Richard G. Baldwin.
Reproduction in whole or in part in any form or medium
without express written permission from Richard Baldwin is prohibited.
Richard has participated in numerous consulting projects and he frequently provides onsite training at the high-tech companies located in and around Austin, Texas. He is the author of Baldwin's Programming Tutorials, which have gained a worldwide following among experienced and aspiring programmers. He has also published articles in JavaPro magazine.
In addition to his programming expertise, Richard has many years of practical experience in Digital Signal Processing (DSP). His first job after he earned his Bachelor's degree was doing DSP in the Seismic Research Department of Texas Instruments. (TI is still a world leader in DSP.) In the following years, he applied his programming and DSP expertise to other interesting areas including sonar and underwater acoustics.
Richard holds an MSEE degree from Southern Methodist University and has many years of experience in the application of computer technology to real-world problems.
Copyright 2008, Richard G. Baldwin. Reproduction in whole or in part in any form or medium without express written permission from Richard Baldwin is prohibited.
Richard Baldwin is a college professor (at Austin Community College in Austin, TX) and private consultant whose primary focus is a combination of Java, C#, and XML. In addition to the many platform and/or language independent benefits of Java and C# applications, he believes that a combination of Java, C#, and XML will become the primary driving force in the delivery of structured information on the Web.Richard has participated in numerous consulting projects and he frequently provides onsite training at the high-tech companies located in and around Austin, Texas. He is the author of Baldwin's Programming Tutorials, which have gained a worldwide following among experienced and aspiring programmers. He has also published articles in JavaPro magazine.
In addition to his programming expertise, Richard has many years of practical experience in Digital Signal Processing (DSP). His first job after he earned his Bachelor's degree was doing DSP in the Seismic Research Department of Texas Instruments. (TI is still a world leader in DSP.) In the following years, he applied his programming and DSP expertise to other interesting areas including sonar and underwater acoustics.
Richard holds an MSEE degree from Southern Methodist University and has many years of experience in the application of computer technology to real-world problems.
-end-