本文整理汇总了C++中ImpressionistDoc::getWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ ImpressionistDoc::getWidth方法的具体用法?C++ ImpressionistDoc::getWidth怎么用?C++ ImpressionistDoc::getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImpressionistDoc
的用法示例。
在下文中一共展示了ImpressionistDoc::getWidth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BrushBegin
void ScatteredLineBrush::BrushBegin(const Point source, const Point target)
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg = pDoc->m_pUI;
int size = pDoc->getSize();
int width = pDoc->getWidth();
glPointSize((float)size);
glLineWidth((float)width);
BrushMove(source, target);
}
示例2: BrushMove
void ScatteredLineBrush::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;
}
const int size = pDoc->getSize();
const float half_size = size / 2.0f;
const int width = pDoc->getWidth();
const int angle = pDoc->getAngle();
const float half_line_width = width / 2.0f;
float alpha = pDoc->getAlpha();
float x, y;
//glBegin(GL_POINTS);
for (int i = 0; i < 3; i++)
{
x = target.x - size / 2 + irand(size);
y = target.y - size / 2 + irand(size);
Point random = Point(x, y);
glPushMatrix();
glTranslatef(random.x, random.y, 0.0f);
glRotatef(angle, 0, 0, 1.0f);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBegin(GL_LINES);
SetColor(random, alpha);
glVertex2f(-half_size, 0);
glVertex2f(half_size, 0);
glEnd();
glPopMatrix();
}
}
示例3: BrushMove
void LineBrush::BrushMove( const Point source, const Point target , int brushsize)
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg=pDoc->m_pUI;
if ( pDoc == NULL ) {
printf( "PointBrush::BrushMove document is NULL\n" );
return;
}
int half_size;
glGetIntegerv(GL_POINT_SIZE, &half_size);
half_size /= 2;
// dirty patch
if (brushsize > 0) {
glPointSize(brushsize);
half_size = brushsize / 2;
if (half_size == 0) half_size = 1;
} else {
// then it's normal paint
// should set color according to original
SetColor( source );
}
int width = ceil(pDoc->getWidth() / 2.0); //make sure it works when width is 1
int angle = pDoc->getAngle();
float m_sin = sin(2.0f * M_PI * angle / 360);
float m_cos = cos(2.0f * M_PI * angle / 360);
float depth = dlg->m_paintView->current_depth;
glBegin( GL_POLYGON );
if (pDoc->m_pUI->m_EdgeClipButton->value())
{
int nLength;
int pLength;
for (nLength = 0; nLength <= half_size; nLength++)
{
if (pDoc->isEdge(target.x - (int)(nLength * m_cos), target.y - (int)(nLength * m_sin)))
{
break;
}
}
for (pLength = 0; pLength <= half_size; pLength++)
{
if (pDoc->isEdge(target.x + (int)(pLength * m_cos), target.y + (int)(pLength * m_sin)))
{
break;
}
}
glVertex2d( target.x - nLength * m_cos - width * m_sin, target.y - nLength * m_sin + width * m_cos);
glVertex2d( target.x + pLength * m_cos - width * m_sin, target.y + pLength * m_sin + width * m_cos);
glVertex2d( target.x + pLength * m_cos + width * m_sin, target.y + pLength * m_sin - width * m_cos);
glVertex2d( target.x - nLength * m_cos + width * m_sin, target.y - nLength * m_sin - width * m_cos);
}
else
{
glVertex2d( target.x - half_size * m_cos - width * m_sin, target.y - half_size * m_sin + width * m_cos);
glVertex2d( target.x + half_size * m_cos - width * m_sin, target.y + half_size * m_sin + width * m_cos);
glVertex2d( target.x + half_size * m_cos + width * m_sin, target.y + half_size * m_sin - width * m_cos);
glVertex2d( target.x - half_size * m_cos + width * m_sin, target.y - half_size * m_sin - width * m_cos);
}
glEnd();
}