This is a paint like program, where on a click or drag, a circle with certain fills will appear.

I'm having issues with the Quadratic and Gaussian Brushes. Each provide me with a small dot, the QuadraticBush is about 20 pixels in diameter and the GaussianBrush is 1 pixel. Each start with a radius and flow of 128. These are the two functions that create the mask which stores the flow.

They are wrapped in a double for loop holding i as each row and j as each column.

Size is the width and height of the array.

Distance is the distance from the click location to each pixel in the mask.

Flow can be from 0 to 255 and represents the amount of color applied.

Rho is some constant for the Gaussian equation.

Quadratic:

Code:if( distance <= (double)radius ) { if (distance < 1) { m_mask[i*(size-1)+j] = m_flow; } else { m_mask[i*(size-1)+j] = m_flow / (distance * distance); if (m_mask[i*(size-1)+j] > m_flow) { m_mask[i*(size-1)+j] = m_flow; } } } else { m_mask[i*(size-1)+j] = 0; }

Gaussian:

This is a linear blur which works just fine. It goes from 100% inside and 0% outside.Code:if( distance <= (double)radius ) { float base = 1 /(2 * PI * rho * rho); float exponent = -1.0 * ((distance * distance) / (2.0 * rho * rho)); m_mask[i*(size-1)+j] = m_flow * base * exp(exponent); if (m_mask[i*(size-1)+j] > m_flow) { m_mask[i*(size-1)+j] = m_flow; } } else { m_mask[i*(size-1)+j] = 0; }

Linear:

Any help would be great.Code:int radius = m_radius; int size = radius*2 +1; int count=0; int arraysize = size * size; m_mask = new float[arraysize]; double distance; for(int i=0; i<size; i++) { for(int j=0; j<size; j++) { distance = sqrt((double)((radius-i)*(radius-i) + (radius-j)*(radius-j))); if( distance <= (double)radius ) { m_mask[i*(size-1)+j] = ((radius-distance)/(double)radius) * m_flow; } else { m_mask[i*(size-1)+j] = 0; } } }