gui/game/brush: Add smooth/organic elliptical brush

Not sure why TPT's ellptical brush currently looks like that,
when you type "pixel circle" on Google every result is the
smooth version.

Got the idea from this post:
https://powdertoy.co.uk/Browse/View.html?ID=2464991

Signed-off-by: Nick Renieris <velocityra@gmail.com>
This commit is contained in:
Nick Renieris 2019-09-26 23:13:36 +03:00 committed by Tamás Bálint Misius
parent 0b1cd53377
commit 024c3c1b45

View File

@ -31,7 +31,9 @@ public:
int yTop = ry+1, yBottom, i;
for (i = 0; i <= rx; i++)
{
while (pow(i-rx,2.0)*pow(ry,2.0) + pow(yTop-ry,2.0)*pow(rx,2.0) <= pow(rx,2.0)*pow(ry,2.0))
while ( pow(i - rx, 2.0) * pow(ry - 0.5, 2.0) +
pow(yTop - ry, 2.0) * pow(rx - 0.5, 2.0) <=
pow(rx, 2.0) * pow(ry, 2.0))
yTop++;
yBottom = 2*ry - yTop;
for (int j = 0; j <= ry*2; j++)