Drawing round, triangular and fan-shaped avatars in Android image processing

preface

I believe it is easy to draw circles and pictures in the daily development of Android, but drawing circular pictures is a little difficult. In the past, in order to be lazy, I went directly to GitHub to find an open source project. Later, I found that drawing circular pictures is actually a very simple thing.

Drawing a circular picture also requires two steps:

Draw a circle and draw a picture, just let them take and combine, and the result is a circular picture.

Direct code:

The effects are as follows:

The key in the code is this sentence:

SRC_ In this mode allows the intersection of two rendering effects to be displayed. It should be noted that DST needs to be drawn first, and then Src. For example, the above example is to draw a circle first, and then a bitmap. If the order is reversed, you can only see a circle.

Except SRC_ In addition to this mode, there are 15 other modes. If you are interested, you can try the effect yourself. The corresponding code can be found in the official apidemo.

After knowing this principle, we can draw pictures of various shapes. We only need to draw different shapes instead of circles.

triangle:

sector:

summary

The above is the whole content of this article. I hope the content of this article can bring some help to Android developers. If you have any questions, you can leave a message. Thank you for your support for programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>