Dejan Senji

unread,
Nov 9, 2015, 8:34:55 AM11/9/15
to MIT App Inventor Forum
I have a problem with line size in my first application. I have followed tutorials for PaintPot 1&2 thoroughly and got an idea to make small drawing application for my baby girl. However, since I am someone that wants everything to be perfect, I am trying to solve this problem for past 2 days but no luck. Anyone can give me any suggestion? 

On this screenshot, line size is 20.0. But in the app, I have defined slider from 1.0 to 10.0 just to avoid this kind of line types. However, I still want to have 20.0 line size, but that is the problem.

Second picture are the blocks that define lines. 

I am almost certainly sure that I am making somewhere mistake, but since I am new, I still have a problem to see it. Maybe someone can help?


Also, I have a question, is there a possibility to add "glow" to my lines? And how :)

Thanks everyone!!!
Screenshot_2015-11-09-14-23-42.png
Untitled.jpg

Dejan Senji

unread,
Nov 9, 2015, 8:52:25 AM11/9/15
to MIT App Inventor Forum
I have read this discussion https://groups.google.com/forum/#!searchin/mitappinventortest/draw$20canvas/mitappinventortest/b3u6-mMnCes/NNGdCpy6nXgJ

so I have to ask, there is no way to make lines smoother in app inventor or there is?!

Italo

unread,
Nov 9, 2015, 9:27:41 AM11/9/15
to mitappinv...@googlegroups.com

To have smooth lines, you have to do 2 things:
First, add a circle with a radius that is half the size of the current  Line.Width in the currentx, currenty position each time you draw a line. This avoids that nasty looking line specially when the line is thick.
Second, a basic "anti-aliasing" method (if you don't know what that is, please check the image) which you get it by drawing first the line with the current paint color but with some transparency and 1 or 2 pixels thicker, then you draw the normal line on top of the "soft" line.
The results are surprisingly good, taking in consideration that App Inventor 2 is not really good for graphics.
If you tinker around with the colors, you can even achieve the "glow" effect that you wanted.

Please download the aia attached and see for yourself. In my example I use 2 passes for the anti aliasing, giving a very smooth line when you select the brush tool. If you select the pencil tool, the anti aliasing is skipped.



In this screen you see the "pencil" or normal way of drawing the lines, and the "brush" or anti aliased method with two passes




soft_brush.aia

Dejan Senji

unread,
Nov 9, 2015, 11:42:20 AM11/9/15
to MIT App Inventor Forum
Thank you for your answer. I tried and your blocks setup works as I would like. But since I have a combination of colours and different types of line size I will have to work a little bit on it (since I am a newbie :) )
I will give you update after I try in my application.

Italo

unread,
Nov 9, 2015, 12:14:01 PM11/9/15
to MIT App Inventor Forum
Use these blocks to change the transparency of the actual Paint.Color whichever it may be.


Reply all
Reply to author
Forward
0 new messages