Graphics Programming using Allegro

Practice Test

Reading and Displaying Image Files

Published:  September 9, 2008
By Richard G. Baldwin

File: Allegro00140PracticeTest


Questions

1.  True or False:  According to the documentation for the load_bitmap function, BMP, LBM, PCX, and TGA files are supported by default.

Answer and Explanation

2.  True or False:  According to the documentation for the load_bitmap function, JPG, BMP, LBM, PCX, and TGA files are supported by default.

Answer and Explanation

3.  True or False:  The code shown below will load an image file named starfish.pcs (if it exists in the current directory) and display it in an existing Allegro graphics window on the screen.

  BITMAP *picA = NULL;
  picA = load_bitmap("starfish.pcx", NULL);
  blit(picA, screen, 0,0,0,0,324,330);

Answer and Explanation

4.  True or False:  The code shown below will load an image file named starfish.jpg (if it exists in the current directory) and display it in an existing Allegro graphics window on the screen.

  BITMAP *picA = NULL;
  picA = load_bitmap("starfish.jpg", NULL);
  blit(picA, screen, 0,0,0,0,324,330);

Answer and Explanation

5.  True or False:  Before calling the load_bitmap function to load an image into memory, you must first call the create_bitmap function to create the bitmap into which the image will be loaded.

Answer and Explanation

6.  True or False:  The load_bitmap function can be called to create a new bitmap in memory and to populate it with the contents of an image file.

Answer and Explanation



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.

Baldwin@DickBaldwin.com

 


Answers and Explanations


Answer 6

True

Explanation 6

Back to Question 6


Answer 5

False - the load_bitmap function creates its own bitmap in memory

Explanation 5

Back to Question 5


Answer 4

False - the load_bitmap function doesn't support jpg image files

Explanation 4

Back to Question 4


Answer 3

True

Explanation 3

Back to Question 3


 

Answer 2

False - According to the documentation for the load_bitmap function, JPG files are not supported by default.

Explanation 2

Back to Question 2


Answer 1

True

Explanation 1

Back to Question 1


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.

Baldwin@DickBaldwin.com

 

-end-