21.7 GRAPHICS

21.7.1 Bit map editor

Microsoft has provided a bitmap editor in Visual C++ package. Bit Map Editor is a general graphical utility, useful in creating very small pictures. Let us develop a simple bitmap editor ourselves.

Problem: Write a program to edit a bitmap.

Solution: Any medium size programming task needs proper specifications. Let us define on our own specifications for this program.

  1. It should be a monochrome bitmap editor.
  2. Size should be 16 by 16 pixels.
  3. While editing keys assignments are as follows:

    Draw        -> Any normal key

    Erase        -> Space bar

    End Edit   -> Escape

See Program 21.20.

Program 21.20 Bit map editor

// bitmap.cpp// monocrome bit map editor#include<fstream.h>#define no_rows 16#define no_cols ...

Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.