Hi,
for various reasons, in one of my projects, I don’t use DrawNode to draw shapes on screen, but instead I create unsigned char* data
array. In other words it’s a pixel array. Using this array I simply put it into Texture
class and then into Sprite
. It works nicely and I have full control of what I draw. Of course, I had to create drawing methods from scratch. From simple setPixel
through drawLine
to drawFilledCircle
. The problem is, especially for circles, that it has jagged edges. In other words, I need antialiasing. There are a lot of algorithms. For example: Drawing Antialiased Circles and Ellipses Before that I’ve even created my own very dumb algorithm - simply the outer circle is drawn with lower transparency. And it somehow works, but only if there’s one circle. But when there are 2 circles intersecting each other, no matter if it’s mine dumb method or something better, the outer line of circle is too “transparent”. In other words you can see a line in the intersection part, which shouldn’t be there:
It’s not really cocos2d-x problem, but a logical one.
Another example will be something like a brush, which draws a filled circle when user moves a finger. When you don’t antialias the “line” looks nice, but of course you have jagged edges, however antialiasing this circle creates the issue I’ve described above.
Have someone maybe encountered this problem and knows how to solve it? Any links or resources will be appreciated.