//----------------------------------------------------
// Set the color to paint with to the color at source,
// which is the coord at the original window to sample 
// the color from
//----------------------------------------------------
void AlphaMappedBrush::SetAlphaColor (const Point source)
{
	ImpressionistDoc* pDoc = GetDocument();

	if (pDoc->m_ucAlpha == 0)
	{
		SetColor(source);
		return;
	}
	GLubyte color[4];

	memcpy ( color, pDoc->GetAlphaPixel( source ), 4);

	for (int i = 0; i < 3; i++) {
		if (pDoc->m_pUI->m_ReverseColorButton->value()) color[i] = (GLubyte) (255 - color[i] * pDoc->m_pUI->blendColor[i]);
		else color[i] = (GLubyte) (color[i] * pDoc->m_pUI->blendColor[i]);
	}
 
	glColor4ubv( color );
}