How programm 2d graphic engine?

I am just a beginner in programming, I want to write my own 2D graphics editor ( like Krita, SAI ) for educational purposes.

Can you tell me books, videos, articles and ways how can I figure out the topic of creating a 2D graphic editor?