Question: Homework 01 - Image Editing Overview Your task in this assignment is to change the c program in main.cpp into a c++ program that uses
Homework 01 - Image Editing
Overview
Your task in this assignment is to change the c program in main.cpp into a c++ program that uses classes. You will read through the comments looking for opportunities to create objects. Our image editor should have at least the following classes:
- Application
- Window
- Image
- Texture
- TexturedRectange
- ShaderProgram
- Button
- (any others that you would like to add)
Define your classes and copy code out of main.cpp into the classes that you write. Be sure to change the Makefile to build your all your code. We may build or explore a few of these classes during lecture or in lab.
Single Responsibility Design Principle (High Cohesion) - Be sure that every class does only one thing and does it well. Be sure that every method does one thing and one thing well.
Requirements
Create at least the classes specified above. You may create more classes.
- Modify the makefile appropriately to build your program.
Classes should have both a header file (.h) and an implementation file (.cpp). Be sure to add header guards and follow class practices from class.
- Create classes within the namespace csci3081
- Use header guards.
- Only use using namespace in the implementation, not the header.
- Simple one line function implementations can be in header.
- Only use structs for super simple objects.
- Follow the Single Responsibility Principle.
The main.cpp should be simple. For example
#include "Applicaiton.h" int main() { using namespace csci3081; Application app; app.run(); return 0; }
Follow good memory management practices:
- Use new and delete in c++.
- If any memory is allocated, it must be deleted.
- If you have dynamic memory in a class, be sure to implement a copy constructor, the assignment operator, and a destructor.
Implement the Reset button. When this is clicked, it should remove the drawing on top of the background image. One way to do this is to reload the image.
Create another button with a new icon.
When the new button is clicked it must modify the background image in some way. Here are some options:
- Threshold the image by intensity.
- Grayscale the image.
- Change the color of the pen.
- Change the shape or size of the pen.
- Blur the image.
- Sharpen the image.
- Edge detect.
- Make the colors or a color brighter.
- Undo the last pen stroke.
- Copy the image to the clipboard.
- Rotate the image.
- (Many more ideas to consider) - Be creative! Remember we will be hopefully releasing some of these to the world, so more diverse features may lead to a better final product.
Submission
Please submit all your files (excpet the build directory) to the gradescope link provided by the due date.
Getting Started
On the CSE lab machines (TA Support)
Consider using Vole for remote development here: Vole - Virtual Online Linux Environment
- Clone the repository
git clone https://github.umn.edu/CSCI-3081-01-F25/public-hw01.git hw01 cd hw01
- Build the program
make
- Run the program
./build/ImageEditor
.gitignore:
build *.o ImageEditor
CMakeLists.tx:
cmake_minimum_required(VERSION 3.3) project(ImageEditor)
set(CMAKE_CXX_STANDARD 11) # no explicit compiler flags if possible set(OpenGL_GL_PREFERENCE GLVND)
find_package(OpenGL REQUIRED) find_package(glfw3 REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR}) include_directories(. lib)
add_executable(ImageEditor main.cpp lib/glad/glad.c)
target_link_libraries(ImageEditor ${OPENGL_gl_LIBRARY} glfw)
Makefile:
build/ImageEditor: build/main.o build/glad.o g++ build/main.o build/glad.o -o build/ImageEditor /usr/lib/x86_64-linux-gnu/libglfw.so.3.3
build/main.o: main.cpp mkdir -p build g++ -I. -Ilib -c main.cpp -o build/main.o
build/glad.o: lib/glad/glad.c mkdir -p build g++ -I. -Ilib -c lib/glad/glad.c -o build/glad.o
clean: rm -rf build
img_large.jpeg:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
