I have a problem concerning the concept of using vector graphics instead of bitmaps in order to draw on canvas. Usually to draw on canvas we set a bitmap to that canvas and we start drawing pixels on it by simply moving our finger on the screen. However, this method will result very pixelated - relatively low-quality drawings.

It is noteworthy that there are some drawing apps that result in very smooth curves when you want to draw via them. After doing some googling and researching, I knew that there is the new concept of use vector graphics that is being used in order to draw smooth edged drawings on the screen.

Look guys, the thing is when I developed my drawing app, I used bitmap **(which was already there as an object given by Android)**in order to draw cubic Bezier curves. No matter how much I tried to smooth my drawings out, I always get stair-like edges.

If you are interested in how I developed the curve, please read this. If not, just ignore this bold paragraph:

In order to draw the cubic bezier curves I simply took the sampled touch points and for every 4 points in these sampled points I calculated the 2 intermediate control points (the ones that the curve never touch) to create a bezier through the sampled points. For the curve to appear, I used bitmap and paint objects given by android.

After getting the undesired result (low-quality curve), I decided that I want to use vector graphics in order to do the same thing but with a higher quality. The thing is that I am very new to Vector Graphics, that I don't know where to start.

My question is simple as is: Is there a platform given to me by Android in order to use vector drawable like in the case of bitmap? If not, am I supposed to start this from scratch? I am clueless and any tip or hint from you will be greatly appreciated.

  • \$\begingroup\$ It's pretty unusual to use straight vector content in a realtime drawing game. Those are more often found in professional graphic design software like Illustrator, or engineering tools like CAD suites. In drawing & sketching apps, it's more common to work in rasters as you've described: taking the user's input, applying some smoothing, and using that to write colours into a raster grid. Reducing artifacts is more a matter of resolution, smoothing, blending, and anti-aliasing - which you'd have to solve when rasterizing to the screen even if your shapes are stored as vectors. \$\endgroup\$ – DMGregory Jul 9 '17 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.