Writing C++ code for image viewers