本文整理汇总了C++中ImpressionistDoc::getSize方法的典型用法代码示例。如果您正苦于以下问题:C++ ImpressionistDoc::getSize方法的具体用法?C++ ImpressionistDoc::getSize怎么用?C++ ImpressionistDoc::getSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImpressionistDoc
的用法示例。
在下文中一共展示了ImpressionistDoc::getSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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_POLYGON );
SetColor( source );
int radius = pDoc->getSize();
for (int i=0;i<1000;i++) glVertex2d( target.x+radius*cos(2*M_PI*i/1000), target.y+radius*sin(2*M_PI*i/1000) );
glEnd();
}
示例2: BrushMove
void CircleBrush::BrushMove (const Point source, const Point target) {
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg=pDoc->m_pUI;
if ( pDoc == NULL ) {
printf( "Circlerush::BrushMove document is NULL\n" );
return;
}
int size = pDoc->getSize();
int radius = size / 2;
glBegin( GL_TRIANGLE_FAN );
SetColor( source );
for (double i = 0; i < 2*M_PI; i+=0.1){
glVertex2d(target.x + radius*cos(i), target.y + radius*sin(i));
}
glEnd();
}
示例3: 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();
}
}
示例4: BrushMove
void ScatteredCirclesBrush::BrushMove( const Point source, const Point target )
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg=pDoc->m_pUI;
int scatterRadius = pDoc->getScatterRadius();
float randAngle;
if ( pDoc == NULL ) {
printf( "ScatteredCirclesBrush::BrushMove document is NULL\n" );
return;
}
int radius = pDoc->getSize();
for(int i = 0; i < 20; i++) {
randAngle = frand() * 2 * M_PI;
MakeCircle(Point(source.x + (frand() - 0.5) * scatterRadius * cos(randAngle),
source.y + (frand() - 0.5) * scatterRadius * sin(randAngle)), radius);
}
}
示例5: GetDocument
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;
}
glBegin(GL_LINES);
{
float size = (float)pDoc->getSize();
SetColor(source);
glVertex2d((float)target.x - size / 2.0f, target.y);
glVertex2d((float)target.x + size / 2.0f, target.y);
}
glEnd();
}
示例6: BrushMove
void FilterBrush::BrushMove( const Point source, const Point target , int bsize)
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg=pDoc->m_pUI;
if ( pDoc == NULL ) {
printf( "FilterBrush::BrushMove document is NULL\n" );
return;
}
dlg->get_filter_parameters(m_matrix, m_divisor, m_offset);
int size = pDoc->getSize();
// maybe useful
if (bsize > 0) {
size = bsize;
}
filter_image(pDoc->m_ucPainting, pDoc->m_nWidth, pDoc->m_nHeight, target.x - size / 2, target.y - size / 2, size, size, m_matrix, m_divisor, m_offset, pDoc);
dlg->m_paintView->RestoreContent();
}
示例7: 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;
}
int size = pDoc->getSize();
int alpha = pDoc->getAlpha();
glEnable(GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBegin( GL_POLYGON );
SetColor( source, alpha );
for (int i = 0;i<360;i++)
glVertex2d( target.x +0.5*size*cos(6.28*i/360) , target.y+0.5*size*sin(6.28*i/360));
glEnd();
}
示例8: Auto
void PointBrush::Auto(int startx, int endx, int starty,int endy, int w)
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg = pDoc->m_pUI;
int size = pDoc->getSize();
int spacing = pDoc->getSpacing();
double alpha = pDoc->getOpac();
glPointSize((float)size);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBegin(GL_POINTS);
for (int i = startx; i < endx + 1; i+=spacing){
for (int j = starty; j < endy + 1; j+=spacing){
SetColorOpac(Point(startx+i,endy-j),alpha);
glVertex2d(i,w-j);
}
}
glEnd();
}
示例9: 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 = pDoc->getSize();
float alpha = pDoc->getAlpha();
int angle = pDoc->getAngle();
if(dlg->getDirMode()==1)
angle = pDoc->getDirAngle();
float cos_angle,sin_angle;
float rad_angle = (angle*PI)/180;
cos_angle = cos(-rad_angle);
sin_angle = sin(-rad_angle);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
float orig_x,orig_y,x,y;
SetColor( source, alpha );
glBegin( GL_POINTS );
for(int i = 0;i<0.05*size*size;i++)
while(true){
orig_x=-(size/2)+size*frand();
orig_y=-(size/2)+size*frand();
x = orig_x*cos_angle-orig_y*sin_angle;
y = orig_x*sin_angle+orig_y*cos_angle;
glVertex2d( target.x+x, target.y+y );
break;
}
glEnd();
}
示例10: BrushMove
void CircleBrush::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;
}
float radius = (float)pDoc->getSize();
float alpha = pDoc->getAlpha();
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glBegin(GL_POLYGON);
SetColor(source, alpha);
for (double i = 0; i < 2 * PI; i += PI / INTERVAL) {
glVertex2d(target.x + cos(i)*radius, target.y + sin(i)*radius);
}
glEnd();
glFlush();
}
示例11: BrushMove
void CsprayBrush::BrushMove( const Point source, const Point target )
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg=pDoc->m_pUI;
if ( pDoc == NULL ) {
printf( "CsprayBrush::BrushMove document is NULL\n" );
return;
}
int size = pDoc->getSize();
int density = pDoc->getDensity();
int alpha = pDoc->getAlpha();
glEnable(GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
SetColor( source , alpha);
for (int i = 0;i<density;i++){
float r = rand() %10 ;
r = r*size/10;
oneCircle(target.x+r*cos(6.28*i/density) , target.y+r*sin(6.28*i/density), rand()%3);
}
}
示例12: 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();
}
}
示例13: 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;
}
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);
}
示例14: BrushMove
void ScatteredPointBrush::BrushMove( const Point source, const Point target )
{
ImpressionistDoc* pDoc = GetDocument();
//ImpressionistUI* dlg=pDoc->m_pUI;
if ( pDoc == NULL ) {
printf( "ScatteredPointBrush::BrushMove document is NULL\n" );
return;
}
int size = pDoc->getSize();
int halfSize = size / 2;
int minX = source.x - halfSize;
int maxX = minX + size;
int minY = source.y - halfSize;
int maxY = minY + size;
int offsetX = target.x - source.x;
int offsetY = target.y - source.y;
glBegin(GL_POINTS);
for (int x = minX; x <= maxX; x++)
{
for (int y = minY; y <= maxY; y++)
{
int paintPoint = rand() % 100;
if (paintPoint >= 75)
{
Point individualSource(x, y);
Point individualTarget(x + offsetX, y + offsetY);
PointBrush::DrawPoint(pDoc, individualSource, individualTarget);
}
}
}
glEnd();
}
示例15: 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 = pDoc->getSize();
//set random target coordinates
//srand(time(NULL));
int numOfPoints = rand() % (size/2)*(size/2) + 1;
for (int i = 0; i < numOfPoints; i++){
int xDisplacement = rand() % size;
int yDisplacement = rand() % size;
Point newSource(source.x + xDisplacement, source.y + yDisplacement);
Point newTarget(target.x + xDisplacement, target.y + yDisplacement);
PointBrush::BrushMove(newSource, newTarget);
}
}