0

Programming Concepts: How to Design a Program that lets you draw images

Hi, Are there any fundamental concepts that I should read about when I want to create a program that lets the user draw? I want to make something that will allow the user to zoom in/out on their drawn work, undo/redo etc. I want to read about how to do this sort of thing first because I don't want to start programming such a thing, get so far into the project and realize I have designed my program incorrectly for an additional feature such as zooming. It doesn't matter what language, I am after base concepts to learn about for this. What should I really consider as the most fundamental/important things to base the design of the code around?

22nd Oct 2019, 10:47 PM
Nathan Stanley
Nathan Stanley - avatar
8 ответов
+ 1
Well, I didn't read any topics tbh, so I think there might be better ways than how I did. If you watch tutorials on youtube, you'll see that pictures get transformed to matrices with PIL (pillow) library, and then all you have to do is to manimulate them. Each 'box' of that matrix contains an rgb color. To understand better, look up this video: https://m.youtube.com/watch?v=6Qs3wObeWwc Then, all you have left to do is look formulas on google on how to make the picture grey, how to zoom better, they're easy and you can even make them yourself, if you need more help you can dm me, I'm not good in expnaining things though. But one thing I know, is that python is slow, and manipulating images takes a lot of memory depending on what actions you're going to perform that picture. If you main goal is to make a fast and reliable application, I don't think python would be the best choice.
23rd Oct 2019, 1:02 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 7
You can use js Check out the Khanacademy Processing JS course
23rd Oct 2019, 8:15 AM
Humayra🇧🇩
Humayra🇧🇩 - avatar
+ 1
In what language ?
22nd Oct 2019, 11:50 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
I personally did a similar project using pillow and PyQt5 with Python. You don't really know any knowledge, you just have to manipulate matrices of the images. I guess you know how images are represented with matrices right ?
23rd Oct 2019, 12:02 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
(All this is just my personal opinion) The code part is kind of tricky, because you will always have to go back and modify it. I thini it's better to start with writing down what actions you want to perform on your pictures, take some time and think of all possible things you'd like to do, because you don't want to modify your code later and body structure just because you forgot a zoom button, or any kind of widgets/actions. Then you can start building the body of you application in parallel with the actions assigned to each button. You'll never make it work in the first try though, because as you're writing more and more you're going to get better ideas of how to do certain things, and more effective ways of doing them.
23rd Oct 2019, 1:19 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
0
in any language. i am going to use kvs which is based on Qt
22nd Oct 2019, 11:59 PM
Nathan Stanley
Nathan Stanley - avatar
0
No. This is the sort of information I want to read about. Do you recommend any particular topics to read about?
23rd Oct 2019, 12:57 AM
Nathan Stanley
Nathan Stanley - avatar
0
ok thanks. i will take a look at those resources. i am thinking about this more from a progmatic viewpoint. Questions I find asking myself are: What should I make first? The classes and code to simply draw a graphic, or classes and code for a canvas that will handle scaling of graphics? KVS/Qt has a painter class that lets me do what I am aiming for. I am more daunted by how I can best design the code and the fact I know nothing in general about how graphics translate over into code form. Now that I understand they are held in arrays or matrices, I can see how formulas can be applied to operate functions on them, because they are simply arrays of data/numbers.
23rd Oct 2019, 1:13 AM
Nathan Stanley
Nathan Stanley - avatar