コード例 #1
0
void CsprayBrush::BrushMove( const Point source, const Point target )
{
	ImpressionistDoc* pDoc = GetDocument();
	ImpressionistUI* dlg=pDoc->m_pUI;

	if ( pDoc == NULL ) {
		printf( "CsprayBrush::BrushMove  document is NULL\n" );
		return;
	}
	
	int size = pDoc->getSize();
	int density = pDoc->getDensity();
	int alpha = pDoc->getAlpha();
	glEnable(GL_BLEND);
	glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	SetColor( source , alpha);
	for (int i = 0;i<density;i++){
			float r = rand() %10 ;
			r = r*size/10;
			oneCircle(target.x+r*cos(6.28*i/density) , target.y+r*sin(6.28*i/density), rand()%3);
		}

}
コード例 #2
0
void SprayBrush::BrushMove( const Point source, const Point target )
{
	ImpressionistDoc* pDoc = GetDocument();
	ImpressionistUI* dlg=pDoc->m_pUI;

	if ( pDoc == NULL ) {
		printf( "SprayBrush::BrushMove  document is NULL\n" );
		return;
	}
	
	int size = pDoc->getSize();
	int density = pDoc->getDensity();
	int alpha = pDoc->getAlpha();
	glEnable(GL_BLEND);
	glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	for (int i = 0; i<density; i++)
		{
			glPointSize( rand()%5+1 );
			glBegin( GL_POINTS );
			SetColor( source , alpha );
			glVertex2d( target.x - size/2 + rand()%size, target.y -size/2 + rand()%size);
			glEnd();
		}
}