What I want to do is adjust the transparency of every pixel in a picture according to its ink ratio. I will take an example: A node-link graph
In this picture, I want to calculate every pixel's ink ratio(That is, the ratio of the part covered by the line in each pixel to the size of the entire pixel). Then assign a transparency value to each pixel according to this ratio, the higher the ratio is, the lower the transparency. Finally,rendering the picture.
But now I don't know how to achieve it. Can someone help me or give me some advice to solve it? I will be very grateful!