本文整理汇总了C++中ImpressionistDoc::getThickness方法的典型用法代码示例。如果您正苦于以下问题:C++ ImpressionistDoc::getThickness方法的具体用法?C++ ImpressionistDoc::getThickness怎么用?C++ ImpressionistDoc::getThickness使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImpressionistDoc
的用法示例。
在下文中一共展示了ImpressionistDoc::getThickness方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BrushBegin
void PolkadotsBrush::BrushBegin( const Point source, const Point target )
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg=pDoc->m_pUI;
int superRadiusStep;
int X, Y, angle, centerx, centery, outerAngle;
float density = 0.3;
int radius = pDoc->getSize ();
int thickness = pDoc->getThickness ();
int disp = rand () % thickness;
for (outerAngle = 30; outerAngle < 360; outerAngle+=30)
{
centerx = target.x + (cos (outerAngle) * disp);
centery = target.y + (sin (outerAngle) * disp);
glBegin (GL_TRIANGLE_FAN);
SetColor (source);
glVertex2d (centerx, centery);
for (angle = 0; angle <= 360; angle+=5)
{
glVertex2d (centerx + (sin (angle) * radius), centery + (cos (angle) * radius));
}
glEnd();
}
}
示例2: BrushBegin
void LineBrush::BrushBegin( const Point source, const Point target )
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg=pDoc->m_pUI;
if (dlg->directionOfStroke == CLICK_STROKE_DIRECTION)
{
int newX, newY;
int size = pDoc->getSize ();
int angle = pDoc->getAngle ();
int disp;
int thickness = pDoc->getThickness ();
if (size < 5)
disp = size * 2;
else
disp = size;
if (!angle || (angle == 180))
{
newY = target.y;
newX = target.x + disp;
}
else if (angle == 90)
{
newY = target.y + disp;
newX = target.x;
}
else
{
int tanAngle = (int) tan (angle);
int c = target.y - (tanAngle * target.x);
newY = target.y + disp;
newX = (newY - c) / tanAngle;
}
printf ("Setting line thickness to %d\n", thickness);
glLineWidth( (float) thickness );
printf ("In LineBrush::BrushBegin with source (%d, %d) and Target (%d, %d)\n",
source.x, source.y, target.x, target.y);
glBegin( GL_LINES );
SetColor( source );
glVertex2d( target.x, target.y);
glVertex2d( newX, newY);
glEnd();
}
else
return ;
}
示例3: BrushBegin
void LineBrush::BrushBegin( const Point source, const Point target )
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg=pDoc->m_pUI;
int width = pDoc->getThickness();
//glPointSize( (float)size );
glLineWidth( (float)width );
BrushMove( source, target );
}
示例4: BrushBegin
void SpraycanBrush::BrushBegin( const Point source, const Point target )
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg=pDoc->m_pUI;
int pointNo;
int X, Y;
float density = 0.8;
int size = pDoc->getSize ();
int thickness = pDoc->getThickness ();
int topLeftX = target.x - (thickness / 2);
int topLeftY = target.y + (size / 2);
int bottomRightX = target.x + (thickness / 2);
int bottomRightY = target.y - (size / 2);
int totalPoints = thickness * size;
int fillPoints = (int) (density * totalPoints);
glPointSize (1.0);
for (int i = 0; i < fillPoints; i++)
{
pointNo = rand () % totalPoints;
Y = topLeftY - (pointNo / thickness);
X = topLeftX + (pointNo % thickness);
glBegin( GL_POINTS );
SetColor( source );
glVertex2d(X, Y);
glEnd();
}
}
示例5: BrushMove
void LineBrush::BrushMove( const Point source, const Point target )
{
int newX, newY, sourceNewX, sourceNewY;
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg=pDoc->m_pUI;
if ( pDoc == NULL ) {
printf( "LineBrush::BrushMove:document is NULL\n" );
return;
}
#if DEBUG
printf ("In LineBrush::BrushMove with Source (%d, %d) and Target (%d, %d)\n",
source.x, source.y, target.x, target.y);
#endif
if (dlg->directionOfStroke == CLICK_STROKE_DIRECTION)
{
int size = pDoc->getSize ();
int angle = pDoc->getAngle ();
int disp;
int thickness = pDoc->getThickness ();
if (size < 5)
disp = size * 2;
else
disp = size;
if (!angle || (angle == 180))
{
newY = target.y;
newX = target.x + disp;
// sourceNewY = source.y;
// sourceNewX = source.x + disp;
}
else if (angle == 90)
{
newY = target.y + disp;
newX = target.x;
// sourceNewY = source.y + disp;
// sourceNewX = source.x;
}
else
{
int tanAngle = (int) tan (angle);
int c = target.y - (tanAngle * target.x);
newY = target.y + disp;
newX = (newY - c) / tanAngle;
// sourceNewY = source.y + disp;
// sourceNewX = (sourceNewY - c) / tanAngle;
}
glLineWidth( (float)thickness );
#if DEBUG
printf ("LineBrush::BrushMove: Drawing a line from (%d,%d) to (%d,%d) of angle %d\n",
target.x, target.y, newX, newY, angle);
#endif
glBegin( GL_LINES );
SetColor( source );
glVertex2d( target.x, target.y);
glVertex2d( newX, newY);
glEnd();
}
else if (dlg->directionOfStroke == DRAG_STROKE_DIRECTION)
{
int size = pDoc->getSize ();
int angle = pDoc->getAngle ();
int thickness = pDoc->getThickness ();
glLineWidth( (float)thickness );
if (lastPointX != -1)
{
#if DEBUG
printf ("LineBrush::BrushMove: Drawing a line from (%d,%d) to (%d,%d) of angle %d\n",
target.x, target.y, newX, newY, angle);
#endif
glBegin( GL_LINES );
SetColor( source );
glVertex2d (lastPointX, lastPointY);
glVertex2d( target.x, target.y);
glEnd();
lastPointX = target.x;
lastPointY = target.y;
}
else
{
lastPointX = target.x;
lastPointY = target.y;
}
}
}