本文整理汇总了C++中ImpressionistUI::getSize方法的典型用法代码示例。如果您正苦于以下问题:C++ ImpressionistUI::getSize方法的具体用法?C++ ImpressionistUI::getSize怎么用?C++ ImpressionistUI::getSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImpressionistUI
的用法示例。
在下文中一共展示了ImpressionistUI::getSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BrushMove
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;
}
glBegin(GL_LINES);
float radius = ((float)dlg->getSize() / 2);
Point point = { target.x, target.y };
int counter = strcmp(BrushName(), "Scattered Lines") != 0 ? 1 : (float)dlg->getSize();
for (int i = 0; i < counter; i++) {
SetColor(point);
glVertex2d(point.x - radius, point.y);
glVertex2d(point.x + radius, point.y);
if (counter != 1) {
do {
point = { Math::rand_range(target.x - radius, target.x + radius), Math::rand_range(target.y - radius, target.y + radius) };
} while (fabs(Math::distance(point.x, point.y, target.x, target.y) - radius) > 0.05f);
}
}
glEnd();
}
示例2: BrushMove
void CircleBrush::BrushMove(const Point source, const Point target)
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg = pDoc->m_pUI;
if (pDoc == NULL) {
printf("CircleBrush::BrushMove document is NULL\n");
return;
}
glBegin(GL_TRIANGLE_FAN);
float theta, pos_x, pos_y = 0.0f;
float radius = ((float)dlg->getSize() / 2);
Point center = { target.x, target.y };
Point _center_;
int counter = strcmp(BrushName(), "Scattered Circles")!=0 ? 1 : 3;
for (int i = 0; i < counter; i++) {
SetColor(center);
for (int j = 0; j < 360; j++)
{
theta = 2 * M_PI * j / 360;
pos_x = center.x + cos(theta) * radius;
pos_y = center.y + sin(theta) * radius;
glVertex2f(pos_x, pos_y);
}
if (counter!=1) {
do {
_center_ = { Math::rand_range(center.x - radius, center.x + radius), Math::rand_range(center.y - radius, center.y + radius) };
} while (fabs(Math::distance(center.x, center.y, _center_.x, _center_.y) - radius) > 0.05f);
center = _center_;
}
}
glEnd();
}
示例3: BrushMove
void ScatteredPointBrush::BrushMove(const Point source, const Point target)
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg = pDoc->m_pUI;
if (pDoc == NULL) {
printf("PointBrush::BrushMove document is NULL\n");
return;
}
int size = dlg->getSize();
double radius = size / 2.0;
for (int i = (target.x - radius); i < target.x + radius; i++){
for (int j = (target.y - radius); j < target.y + radius; j++){
int random = rand() % 5;
if (random == 0){
glBegin(GL_POINTS);
SetColor(Point(i,j));
glVertex2d(i, j);
glEnd();
//ImpBrush::c_pBrushes[BRUSH_POINTS]->BrushMove(source, Point(i, j));
}
}
}
//DrawPoint(source);
//printf("source = ( %d, %d ) target = ( %d, %d ) \n", source.x, source.y, target.x, target.y);
//glBegin(GL_POINTS);
//glColor3f(1.0f, 0.0f, 0.0f);
//glVertex2d(source.x, source.y);
//SetColor(source);
//glVertex2d(target.x, target.y);
//glEnd();
}
示例4: BrushMove
void ScatteredLineBrush::BrushMove(const Point source, const Point target)
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg = pDoc->m_pUI;
if (pDoc == NULL) {
printf("PointBrush::BrushMove document is NULL\n");
return;
}
int size = dlg->getSize();
double radius = size / 2.0;
for (int i = (target.x - radius); i < target.x + radius; i++){
for (int j = (target.y - radius); j < target.y + radius; j++){
int random = rand() % 200;
if (random == 0){
ImpBrush::c_pBrushes[BRUSH_LINES]->BrushMove(source, Point(i, j));
}
}
}
/*
//setPrevPoint(target);
int angleType = dlg->getSelectedAngleType();
int size = dlg->getSize();
double angle = (dlg->getLineAngle()*M_PI) / 180;
double radius = size / 2.0;
double changeOfX = radius *cos(angle);
double changeOfY = radius *sin(angle);
glLineWidth(dlg->getLineWidth());
//glLineWidth(10);
//printf("%d", dlg->getLineWidth());
glBegin(GL_LINES);
SetColor(source);
//angle type == slider
if (angleType == 0){
glVertex2d(target.x + changeOfX, target.y + changeOfY);
glVertex2d(target.x - changeOfX, target.y - changeOfY);
}
//angle type == gradient
else if (angleType == 1){
}
//angle type == brush direction
else if (angleType == 2){
Point prevPoint = getPrevPoint();
double diffX = target.x - prevPoint.x;
double diffY = target.y - prevPoint.y;
double angleOfPrev;
if (diffX != 0){
angleOfPrev = atan(diffY / diffX) * 180 / M_PI;
changeOfX = radius *cos(angleOfPrev);
changeOfY = radius *sin(angleOfPrev);
glVertex2d(target.x + changeOfX, target.y + changeOfY);
glVertex2d(target.x - changeOfX, target.y - changeOfY);
}
else{
glVertex2d(target.x, target.y + radius);
glVertex2d(target.x, target.y - radius);
}
}
glEnd();
setPrevPoint(target);
*/
}