• Home
  • Textbooks
  • You Can Do It!: A Beginners Introduction to Computer Programming
  • Getting, Storing and Restoring Graphical Items

You Can Do It!: A Beginners Introduction to Computer Programming

Francis Glassborow

Chapter 14

Getting, Storing and Restoring Graphical Items - all with Video Answers

Educators


Chapter Questions

Problem 1

There are various transformations that we can apply to a block of pixels such as rotating the block, inverting or reversing it. Write and test functions to do some of those things to an area whose data is stored as an area_data object.

The <algorithms > header in the Standard C++ Library includes std: : reverse $\mathrm{O}$, which reverses the order of elements in a sequence container. Given cont is a suitable container the following reverses the elements:
reverse(cont.begin(), cont. end $\mathrm{O}$ );

Check back soon!
02:25

Problem 2

Using your answers to Exercise 1, add some other member functions to icon so that you can rotate and reflect the stored image. Note that an icon does not have to be rectangular, so you will need to add a function that levels up all the columns to the same height. That leads to the question as to what hue should be used for filling out short columns. Use black (0) which icon: : display $\mathrm{O}$ treats as invisible.

Charles Carter
Charles Carter
Numerade Educator
03:18

Problem 3

Write a program that asks the user to type in a message that you display in the Playpen.

Willis James
Willis James
Numerade Educator

Problem 4

The crialfont.png file contains lowercase letters, digits and quite a number of punctuation marks. Use the tools and the methods described in this chapter to produce a more complete font.

Check back soon!

Problem 5

Write a program that displays a menu in the Playpen and uses the mouse to select an item. You actually know enough to write a menu program where the item under the mouse cursor is highlighted. However if you succeed in doing that you are far above average as a programmer and have an understanding of how modern programs work.

Check back soon!