本文整理汇总了C++中ImpressionistDoc类的典型用法代码示例。如果您正苦于以下问题:C++ ImpressionistDoc类的具体用法?C++ ImpressionistDoc怎么用?C++ ImpressionistDoc使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ImpressionistDoc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDocument
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: GetDocument
void TriangleBrush::BrushMove(const Point source, const Point target) {
ImpressionistDoc* pDoc = GetDocument();
if (pDoc == NULL) {
printf("TriangleBrush::BrushMove document is NULL\n");
return;
}
int size = pDoc->getSize(); // get brush size
float alphaValue = pDoc->getAlpha();
glPushMatrix();
glTranslatef(target.x, target.y, 0); // move (0, 0) to the tip of mouse cursor
glBegin(GL_POLYGON);
SetColor(source, alphaValue);
for (int i = 0; i < 3; i++) {
float theta = -M_PI / 6 + 2.0f * M_PI * float(i) / float(3); // get the current angle (start from -30 degree)
float x = cosf(theta) * size / 2; // calculate the x component
float y = sinf(theta) * size / 2; // calculate the y component
glVertex2f(x, y); // output vertex
}
glEnd();
glPopMatrix();
}
示例3: GetDocument
void PointBrush::BrushMove( const Point source, const Point target )
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg=pDoc->m_pUI;
int size = pDoc->getSize();
// rand size start
if(dlg->getIsPaint() && dlg->getIsRandSize()){
size = rand() % pDoc->getSize() + 1;
}
// rand size end
glPointSize( (float)size );
if ( pDoc == NULL ) {
printf( "PointBrush::BrushMove document is NULL\n" );
return;
}
glBegin( GL_POINTS );
SetColor( source );
glVertex2d( target.x, target.y );
glEnd();
}
示例4: GetDocument
void ScatteredCirclesBrush::BrushMove(const Point source, const Point target)
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg = pDoc->m_pUI;
int size = pDoc->getSize();
double PI = 3.1415;
if (pDoc == NULL) {
printf("PointBrush::BrushMove document is NULL\n");
return;
}
glBegin(GL_POINTS);
for (int k = 0; k < 3; ++k){
double randx = (double)(rand() % size/2);
double randy = (double)(rand() % size/2);
Point randpt = Point((int)(target.x + pow((-1.0), randx)* randx), (int)(target.y + pow((-1.0), randy)* randy));
SetColor(randpt);
for (int j = 0; j < size; ++j){
for (int i = 0; i < 300; ++i)
glVertex2d(randpt.x + j / 2 * cos(2 * PI / 300 * i), randpt.y + j / 2 * sin(2 * PI / 300 * i));
}
}
glEnd();
}
示例5: GetDocument
void ScatteredCircleBrush::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();
this->radius = (double)size;
int loop_time = irand(2) + 2;
for (int i = 0; i < loop_time; ++i)
{
glBegin(GL_POLYGON);
int Xoffset = irand(this->radius) - this->radius/2;
int Yoffset = irand(this->radius) - this->radius/2;
SetColor(source.x + Xoffset,source.y + Yoffset);
for (int i = 0; i < 360; ++i)
{
double theta = i * 3.14159 / 180;
glVertex2d(target.x + Xoffset - radius * cos(theta), target.y + Yoffset - radius * sin(theta));
}
glEnd();
}
}
示例6: GetDocument
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 lineAmount = 4;
int size = pDoc->getSize();
for (int i = 0; i < lineAmount; i++) {
// Get random numbers to set scatter location in the brush area
int randomX = rand() % size + (-size / 2);
int randomY = rand() % size + (-size / 2);
// We need to set a new Point source for the brush as well to
// match the location of the source and the target point
Point newSource(source.x + randomX, source.y + randomY);
Point newTarget(target.x + randomX, target.y + randomY);
LineBrush::BrushMove(newSource, newTarget);
}
}
示例7: GetDocument
void ScatteredTriangleBrush::BrushMove(const Point source, const Point target)
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg = pDoc->m_pUI;
int size = pDoc->getSize();
glPointSize((float)size);
if (pDoc == NULL) {
printf("PointBrush::BrushMove document is NULL\n");
return;
}
for (int i = 0; i < rand() % 6 + 2; i++){
// rand size start
if(dlg->getIsPaint() && dlg->getIsRandSize()){
size = rand() % pDoc->getSize() + 1;
}
// rand size end
int randx = target.x - size / 2 + irand(size);
int randy = target.y - size / 2 + irand(size);
glBegin(GL_TRIANGLES);
SetColor(source);
glVertex2d(randx, randy + sqrt(0.75 * size * size) / 2);
glVertex2d(randx - 0.5 * size, randy - sqrt(0.75 * size * size) / 2);
glVertex2d(randx + 0.5 * size, randy - sqrt(0.75 * size * size) / 2);
glEnd();
}
}
示例8: GetDocument
void FilterBrush::BrushMove(const Point source, const Point target)
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg = pDoc->m_pUI;
if (pDoc == NULL) {
printf("FilterBrush::BrushMove document is NULL\n");
return;
}
int size = pDoc->getSize();
double opacity = pDoc->getOpac();
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if (isBlur){
glPointSize(2);
glBegin(GL_POINTS);
Blur(source, opacity);
glVertex2d(target.x, target.y);
glEnd();
}
else{
glPointSize(2);
glBegin(GL_POINTS);
Sharpen(source, opacity);
glVertex2d(target.x, target.y);
glEnd();
}
}
示例9: GetDocument
void TriangleBrush::BrushMove(const Point source, const Point target)
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg = pDoc->m_pUI;
int size = pDoc->getSize();
glPointSize((float)size);
// rand size start
if(dlg->getIsPaint() && dlg->getIsRandSize()){
size = rand() % pDoc->getSize() + 1;
}
// rand size end
if (pDoc == NULL) {
printf("PointBrush::BrushMove document is NULL\n");
return;
}
glBegin(GL_TRIANGLES);
SetColor(source);
glVertex2d(target.x, target.y + sqrt(0.75 * size * size) / 2);
glVertex2d(target.x - 0.5 * size, target.y - sqrt(0.75 * size * size) / 2);
glVertex2d(target.x + 0.5 * size, target.y - sqrt(0.75 * size * size) / 2);
glEnd();
}
示例10: GetDocument
//----------------------------------------------------
// Set the color to paint with to the color at source,
// which is the coord at the original window to sample
// the color from
//----------------------------------------------------
void ImpBrush::SetColor (const Point source, int optional_alpha)
{
ImpressionistDoc* pDoc = GetDocument();
GLubyte color[4];
memcpy ( color, pDoc->GetOriginalPixel( source ), 3 );
color[3] = static_cast<GLubyte>(255.0f * m_pDoc->getAlpha());
// dirty patch
// just bear it, this is life
// for debug
/*
int tset = optional_alpha;
char msg[222];
sprintf(msg, "%d\n\n", tset);
OutputDebugString(msg);
*/
if (optional_alpha > 0) {
// OutputDebugString("called, gengge\n");
color[3] = (GLubyte)optional_alpha;
}
for (int i = 0; i < 3; i++) {
if (m_pDoc->m_pUI->m_ReverseColorButton->value()) color[i] = (GLubyte) (255 - color[i] * m_pDoc->m_pUI->blendColor[i]);
else color[i] = (GLubyte) (color[i] * m_pDoc->m_pUI->blendColor[i]);
}
glColor4ubv( color );
}
示例11: cb_paintlyStyleChoice
void ImpressionistUI::cb_paintlyStyleChoice(Fl_Widget* o, void* v)
{
ImpressionistUI* pUI = ((ImpressionistUI *)(o->user_data()));
ImpressionistDoc* pDoc = pUI->getDocument();
int type = (int)v;
pDoc->setPaintlyStyle(type);
}
示例12: cb_paintlyLayersSlider
void ImpressionistUI::cb_paintlyLayersSlider(Fl_Widget* o, void* v)
{
ImpressionistUI* pUI = ((ImpressionistUI *)(o->user_data()));
ImpressionistDoc* pDoc = pUI->getDocument();
int val = int(((Fl_Slider *)o)->value());
pDoc->setPaintlyLayers(val);
}
示例13: GetDocument
void TriangleBrush::BrushMove( const ImpBrush::Point source, const ImpBrush::Point target )
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg=pDoc->m_pUI;
int size = pDoc->getSize();
int Ax, Ay, Bx, By, Cx, Cy;
Ax = target.x - (.5*size);
Bx = target.x + (.5*size);
Cx = target.x;
Ay = target.y - (.5*size);
By = target.y - (.5*size);
Cy = target.y + (.5*size);
if ( pDoc == NULL ) {
printf( "TriangleBrush::BrushMove document is NULL\n" );
return;
}
glBegin( GL_POLYGON );
SetColor( source );
glVertex2i(Ax, Ay);
glVertex2i(Bx, By);
glVertex2i(Cx, Cy);
glEnd();
}
示例14: GetDocument
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();
float Ax,Ay;
glPointSize(1.0);
glBegin(GL_POINTS);
SetColor(source);
for(int i=0; i < 10 ; i++) {
Ax = target.x - size/2+rand()%size;
Ay = target.y - size/2+rand()%size;
glVertex2i(Ax , Ay);
}
glEnd();
}
示例15: GetDocument
void SPointsBrush::BrushMove( const Point source, const Point target )
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg=pDoc->m_pUI;
int x, y, i, j, size = pDoc->getSize();
if ( pDoc == NULL ) {
printf( "SPointsBrush::BrushMove document is NULL\n" );
return;
}
glPointSize( 1.0f );
glBegin( GL_POINTS );
for(x = target.x - (size >> 1), i = 0; i <= size; i++, x++) {
for(y = target.y - (size >> 1), j = 0; j <= size; j++, y++) {
if(!irand(5)) { // Make it more scattered
SetColor( Point(x, y) );
glVertex2d(x, y);
}
}
}
glEnd();
}