コード例 #1
0
ファイル: impBrush.cpp プロジェクト: rapidsnow/imp
void	ImpBrush::AngleDragBegin(const Point source) 
{
	ImpressionistDoc* pDoc = GetDocument();

	if(pDoc->getAngleRadio() != 1)
		return;

	pDoc->setRightClickStart(source);

}
コード例 #2
0
ファイル: impBrush.cpp プロジェクト: rapidsnow/imp
void	ImpBrush::AngleDragEnd(const Point source)
{
	ImpressionistDoc* pDoc = GetDocument();

	if(pDoc->getAngleRadio() != 1)
		return;

	Point start = pDoc->getRightClickStart();

	int angle = int( atan( float( (source.y - start.y) )/(source.x - start.x) ) * (180./M_PI));

	pDoc->setBrushAngle(angle);
}
コード例 #3
0
ファイル: lineBrush.cpp プロジェクト: rapidsnow/imp
void LineBrush::BrushMove( const Point source, const Point target )
{
    ImpressionistDoc* pDoc = GetDocument();
    ImpressionistUI* dlg=pDoc->m_pUI;

    if ( pDoc == NULL ) {
        printf( "LineBrush::BrushMove  document is NULL\n" );
        return;
    }
    int length;
    int angleSelection;
    float angle;
    Point lastPoint;

    //Define the length and figure out how we are determining the brush angle
    length = pDoc->getSize();
    angleSelection = pDoc->getAngleRadio();

    //If the brush angle selection is based off of cursor direction, do this
    if (angleSelection == 2)
    {
        lastPoint = pDoc->getLastPoint();
        angle = atan(float(lastPoint.y - source.y)/(lastPoint.x - source.x)) + M_PI/2.;
    }
    else
        angle = pDoc->getBrushAngle() * (M_PI/180.);

    //Create the lines

    glBegin( GL_LINES );
    SetColor( source );
    glVertex2d( source.x, source.y );
    glVertex2d( source.x + cos(angle) * length, source.y + sin(angle) * length);
    glEnd();

    pDoc->setLastPoint(source);
}