当前位置: 首页>>代码示例>>C++>>正文


C++ ImpressionistDoc::getStrokeDirection方法代码示例

本文整理汇总了C++中ImpressionistDoc::getStrokeDirection方法的典型用法代码示例。如果您正苦于以下问题:C++ ImpressionistDoc::getStrokeDirection方法的具体用法?C++ ImpressionistDoc::getStrokeDirection怎么用?C++ ImpressionistDoc::getStrokeDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ImpressionistDoc的用法示例。


在下文中一共展示了ImpressionistDoc::getStrokeDirection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BrushMove

void LineBrush::BrushMove( const ImpBrush::Point source, const ImpBrush::Point target )
{
    ImpressionistDoc* pDoc = GetDocument();
    ImpressionistUI* dlg=pDoc->m_pUI;

    if ( pDoc == NULL ) {
        printf( "LineBrush::BrushMove  document is NULL\n" );
        return;
    }

    int size = pDoc->getSize();
    int width = pDoc->getLineSize();
    int angle = pDoc->getLineAngle();
    int direction = pDoc->getStrokeDirection();

    if(direction == STROKE_DIRECTION_GRADIENT)
    {
        //
        // Use sobel gradient
        //
        angle = SobelGradient(source);
    }

    GLint Ax,Ay,Bx,By,Qx,Qy;

    //
    // Compute Line points
    //
    Ax = target.x - (.5*size);
    Bx = target.x + (.5*size);
    Ay = target.y;
    By = target.y;


    //
    // Translate, Rotate, Translate
    //
    glPushMatrix();
    glTranslatef(target.x, target.y, 0);
    glRotatef (angle, 0.0, 0.0, 1.0);
    glTranslatef(-target.x, -target.y, 0);

    SetColor( source );
    glBegin( GL_LINES );

    glVertex2i( Ax, Ay );
    glVertex2i( Bx, By );

    glEnd();
    glPopMatrix();
}
开发者ID:thebandrews,项目名称:csep_557,代码行数:51,代码来源:lineBrush.cpp

示例2: BrushMove

void ScatteredLinesBrush::BrushMove(const ImpBrush::Point source, const ImpBrush::Point target)
{
	// Get the basic pointers to document and UI.  
	ImpressionistDoc* pDoc = GetDocument();
	ImpressionistUI* dlg=pDoc->m_pUI;

	// Draw Random Lines
	m_ccount >= INT_MAX ? m_ccount = 0 : m_ccount++; 
	srand(time(NULL) + m_ccount);
	ImpBrush::Point temp_point;
	GLint total_lines = 4; 
	GLint A1x, A2x, AxMid, A1y, A2y, Ox, Oy; 
	
	if ( pDoc == NULL ) {
		printf( "SingleLineBrush::BrushMove  document is NULL\n" );
		return;
	}
	
	// Get the size, width, angle, and direction of the stroke
	int dSize = pDoc->getSize();
	int dWidth = pDoc->getLineSize(); 
	int dAngle = pDoc->getLineAngle();  
	int dDirection = pDoc->getStrokeDirection(); 

	// Overwrite stroke if GRADIENT chosen
	if (dDirection == STROKE_DIRECTION_GRADIENT)
	{
		dAngle = SobelGradient(source); 
	}

	// Compute Line Points
	Ox = target.x - (.5 * dSize); 
	Oy = target.y - (.5 * dSize);

	GLint rand_lines = rand() % total_lines + 1; 
	for (int i = 0; i < rand_lines; i++)
	{
		// Get Y first
		A1y = rand() % dSize + Oy; 
		A2y = A1y; 

		// Get X1 and X2 ( start and end lines ) 
		A1x = rand() % dSize + Ox;
		A2x = A1x + dSize;
		AxMid = .5*(A1x + A2x);

		temp_point.x = source.x + (AxMid - target.x);
		temp_point.y = source.y + (A1y - target.y);
		SetColor(temp_point);

		// Translate, Rotate, Translate
		glPushMatrix();
		glTranslatef(target.x, target.y, 0);
		glRotatef(dAngle, 0.0, 0.0, 1.0);
		glTranslatef(-target.x, -target.y, 0);

		glBegin(GL_LINES);

		glVertex2i(A1x, A1y);
		glVertex2i(A2x, A2y);

		glEnd();
		glPopMatrix();

	}
}
开发者ID:prashar,项目名称:Graphics,代码行数:66,代码来源:ScatteredLinesBrush.cpp


注:本文中的ImpressionistDoc::getStrokeDirection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。