Hacker News new | past | comments | ask | show | jobs | submit login
Where to start coding up a drawing app? (doreenlearnstocode.blogspot.com)
21 points by DoreenMichele 3 days ago | hide | past | web | favorite | 16 comments

Coincidently I just started working on a drawing app, specifically an iPad app with figure drawing as the main use case. If you could share more details on the kind of drawing you'd like to allow it'd be easier to help. In general, as others said, there's a big difference between vector and raster based drawing apps. In vector drawings, you need to capture the mouse/pen/touch input and fit the points to a bezier curve (google "An algorithm for automatically fitting digitized curves"). Then you have a bunch of bezier-curve objects and draw them to the screen, any 2D graphics library will support this. Raster based drawings are more tricky, you usually paint with a brush, which is a bitmap that gets blended to the existing drawing, possibly affected by the input (pressure, angle, etc.). Here your focus is on performing graphics operations efficiently, as there are many of them per second, and they should appear to occur in real-time. A GPU is very helpful to this kind of drawing.

Another big aspect of this sort of app is undo/redo support. Again it's gonna be different between vector and raster, but I find that in any undo-supporting app, figuring out how the undo mechanism will work can guide the rest of the software design quite effectively, so give that a thought.

If you're willing to share more details here I could probably help more concretely.

In a nutshell, I want to be able to hand draw on top of existing (pre-installed) images and I want a fill tool that will add textures, patterns or even bits from a photo in addition to plain color.

I would like it to have a tool set similar to Microsoft Paint. I'm very comfortable with Microsoft Paint and have used it to make hydrology maps for college classes. Sketchbook kind of has too many tools while (so far) failing to actually do what I want.

Maybe I will figure out how to do this in an existing program, but it looks like if I can, it would involve brute forcing it. I want something more convenient that gets results of a certain quality level without me having to treat every illustration like a masterpiece intended for a fine art gallery.

I have some art skills, but I'm not super talented. With the right tools, I can create quality illustrations and graphics, but freehanding everything is an excessive burden and an obstacle to productivity.


This will almost certainly not help you. But maybe it will? It's a "drawing app" written in JavaScript over a decade ago. It does a lot of things wrong and is terrible. But it's also good enough that thousands of people have used it. (Well it's free and it's on the internet and it's been around for thousands and thousands of days.)

If there's any good, it did some mouse-tracking/behavior stuff that you might use, but you'd almost certainly be better off with modern canvas code. I wrote the above and the only library I used was a ~50 line AJAX library, because AJAX was new and shiny at the time. I don't recommend using that library. Then again, all of this 13+ year old code actually still works in modern browsers, so it's got that going for it.

To sum up...

Provide drawing tool selections and options

Track the user inputs and store the changes they make to the drawings

Figure out all the really hard stuff such as math!

I apologize for how unhelpful this probably is, but if you're into tearing apart someone's embarrassing source code, this will be a real treat!

EDIT: Thought so - I once made a super-basic "Paint-like" drawing page in JavaScript - source is easily viewed. http://www.talltree.us/projects/shapes/drawing.asp

Would need a lot of work, i.e. a usable brush and a million other things.

Thanks. I'll look at it.

In Alice, they say begin at the beginning, go on until you get to the end, and then stop.

Getting to the end seems to be hardest, followed by stopping.

Javascript is a sensible choice, provided you can keep away from the sharp, jagged bits of the language.

For a completely new program that doesn't need to slot into somebody else's web site, Svelte is supposed to be the simplest, cleanest framework; people like to use a framework, for Javascript apps.

The best way to learn Javascript is to study the Javascript code downloaded from/as-implementation-of online apps you admire. Given the right license, you might even be able to alter that code to be exactly what you want. Or, that could be a first prototype, before you set off in a different direction.

Good luck, learning by doing is invigorating. I have seen very excellent programmers come up that way, with better instincts than computer-science graduates get.

The only thing few develop that way is a habit of measuring to help make informed choices. You should be accumulating what amounts to lab equipment you build yourself as you discover things to measure and ways to do each.

You need to first figure out the core of how your app will be different from others (but also what other more usual features you'll need to include to make it usable).

For example, I'm working on a micro voxel game, but existing tools lean more towards artist needs, such as creating and colouring static voxel data sets (which can then be rendered etc). So while working on the game I'm also making an editor that will have more advanced features such as different types of animation, dynamic voxel scaling, support for larger scenes, lighting&shaders etc.

So after figuring out what your app will do you'll need to figure out where/how it'll be used.

Again, I'm coding in Unity, so I'm making the editor also run as a Unity app. You probably need to decide between online/offline, then figuring out a framework that will allow you to create your tool in. While figuring that out you also need to investigate how you'll eventually publish it etc.

> It would be nice if apparently misogynistic assholes on HN gave half as much attention to an actual coding question from me as they do to BS excuses to behave shittily:


What is the basis for this accusation?

I read her original Ask HN thread and there was precisely zero snark or anything even remotely approaching misogyny.


There are two links in that tweet, one to my question that got largely ignored and got a single reply. The other link is to a short comment by me that was downvoted to the negatives, collapsed by the mods and had sixteen replies under it the last time I looked.

I've been here over a decade. I appear to be the only woman to have ever spent time on the leader board, yet this ratio of negative to positive attention remains an intractable issue.

Here is a guy with less than 1500 karma who has been on HN a similar amount of time as me who has had zero problem using it to network and make money:


Here is one of my many comments complaining about how poor I am and how HN doesn't work that way for me:


When I tell a guy he can discuss that with me further via email, I get shitty inquiries into basically "can we hook up, honey?" while their supposed important area of concern that I am knowledgeable about doesn't get mentioned at all. One of the few men on HN who was willing to exchange emails with me spent months pretending to be "friends" while intentionally not mentioning that he was ridiculously younger than me and married, which I learned when he finally decided to dump on me about how his marriage was in trouble, he was afraid he was facing a divorce and he needed a shoulder to cry on.*

I'm quite open about being desperately poor and wanting to find some way to support myself and my adult special-needs sons adequately and I occasionally get a few bucks of charity kicked my way by people who have a smidgen of compassion, but I mostly can't get men here to talk to me in a substantive way about topics that would have some hope of helping me resolve my problems.

Instead, I get lots of people willing to argue with me, tell me I'm wrong and stupid and so forth or men letting me know that although they can't be arsed to care one whit about my dire poverty they would nonetheless like to hit that and are absolutely sure that because a woman spoke to them, this is clearly a hook up opportunity.

After more than a decade of that pattern repeating over and over ad nauseum no matter what I do, including nearly six years of that spent homeless, I'm rather frustrated. I'm quite fed up with being poor and unable to get my questions answered while everyone acts like I'm just a whiner who should get a real job. Meanwhile, there are no shortage of men using HN to figure out how to make an adequate income online.

I'm not apologizing for being extremely frustrated and venting on Twitter. I added it to the bottom of the post because there is a long history of people on HN digging up some kind of "dirt" on me to sling mud and act like me getting frustrated with this extremely maddening situation is evidence that shitty treatment of me is completely justified.

Misogyny is perhaps not the best word. I don't think we have a good word for the phenomenon in question.

But after more than a decade of enduring this nonsense, I'm increasingly sympathetic to man-hating feminazi types because regardless of the relatively benign motives behind most of it, the impact on my life is overwhelmingly negative and there comes a point past which you can't reasonably claim that no one here had any idea that this was such a big problem for me.

Thank you to those people who engaged with my actual question instead of focusing on drama.

* (This is very, very slowly changing. In recent weeks, there are two men met through HN willing to exchange emails with me about housing issues.)

I suppose I have not really noticed this specific type of behavior here.

My interest in HN comes mostly from the technical and historical articles that get posted, and the often illuminating discussion threads, rather than the entrepreneurial or networking angle -- I tend to skip the business related stuff and I have never engaged with other HN'ers beyond replying to their posts (like this).

Thanks for replying. I understand better now.

For various reasons, it's going to be difficult to notice if you aren't on the receiving end of it. The vast majority of it is not intentionally malicious behavior, which is why words like misogyny and sexism are actively problematic in trying to address the systemic issues that get in the way of so many women.

But I honestly don't know what else to call it. My experience has been that getting too creative in an effort to distance myself from baggage associated with standard language for a particular problem space often ends up failing to actually communicate at all.

Thank you for posting a good faith question about the matter and following up in good faith.

If you're going the Javascript way, you could have a look at how Wick editor was built. It's a Flash like animation editor whith simple drawing tools and is open source.


I'm no expert in this, but I think step 1 would be deciding between vectors or pixels. For this it would be important what the use-case is.

Vectors are cooler, but you'll need more magic for performance I bet.

With that decision done maybe just throw together a small iterative prototype to try things?: draw a straight line, draw it with the cursor/mouse/touch, draw a spline, draw free-hand. Layers, saving, blending, brushes....

That is excellent question.

There are two competing schools, top down and bottom up design.

For projects that I don't have clear picture where they will take me I prefer bottom up design where I initially focus on small parts if my project that I know I will need anyway and only in later start linking them together.

I'm familiar with the concept of a Design Doc. I've been playing with existing apps and seeing how close they can get to what I want to do and making notes about what I'm trying to achieve in light of those experiments.

I'm no expert in this, but I think step 1 would be deciding between vectors or pixels. For this it would be important what the use-case is.

Vectors are cooler, but you'll need more magic for performance I bet.

-_- double post, sorry. pls delete ^

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact