本文整理汇总了C++中ImpressionistUI类的典型用法代码示例。如果您正苦于以下问题:C++ ImpressionistUI类的具体用法?C++ ImpressionistUI怎么用?C++ ImpressionistUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ImpressionistUI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: cb_paintlyJvSlider
void ImpressionistUI::cb_paintlyJvSlider(Fl_Widget* o, void* v)
{
ImpressionistUI* pUI = ((ImpressionistUI *)(o->user_data()));
ImpressionistDoc* pDoc = pUI->getDocument();
double val = double(((Fl_Slider *)o)->value());
pDoc->setPaintlyJv(val);
}
示例4: 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();
}
示例5: 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();
}
}
示例6: GetDocument
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();
}
示例7: cb_strokeDirectionChoice
void ImpressionistUI::cb_strokeDirectionChoice(Fl_Widget* o, void* v)
{
ImpressionistUI* pUI = ((ImpressionistUI*)(o->user_data()));
ImpressionistDoc* pDoc = pUI->getDocument();
int type = (int)v;
pDoc->setStrokeDirectionType(type);
}
示例8: whoami
void ImpressionistUI::cb_another_view(Fl_Menu_* o, void* v)
{
ImpressionistUI *pUI = whoami(o);
ImpressionistDoc *pDoc = pUI->getDocument();
if (pDoc->m_ucAnother)
pUI->m_origView->viewMode = OriginalView::ANOTHER_MODE;
pUI->m_origView->refresh();
}
示例9: cb_filter_size_check
void ImpressionistUI::cb_filter_size_check(Fl_Widget* o, void* v)
{
ImpressionistUI* db = (ImpressionistUI*)o->user_data();
int w = atoi((db->m_filterWidth->value()));
int h = atoi((db->m_filterHeight->value()));
w = w > 1 ? w : 1;
h = h > 1 ? h : 1;
db->ShowFilterEntry(w, h);
db->m_filterSizeWindow->hide();
}
示例10: cb_EdgeClipping
//---The light button callback for edge clipping---------------------
void ImpressionistUI::cb_EdgeClipping(Fl_Widget* o, void* v)
{
ImpressionistUI *pUI = ((ImpressionistUI*)(o->user_data()));
if (pUI->m_bEdgeClipping == TRUE) pUI->m_bEdgeClipping = FALSE;
else {
pUI->m_bEdgeClipping = TRUE;
ImpressionistDoc* pDoc = pUI->getDocument();
pDoc->CalculateEdgeMap(pUI->m_nEdgeThreshold);
}
}
示例11: cb_applyFilterKernal
void ImpressionistUI::cb_applyFilterKernal(Fl_Widget *o, void *v) {
ImpressionistUI *pUI = (ImpressionistUI*)o->user_data();
pUI->m_dFilterKernal = new double[pUI->m_nFilterWidth * pUI->m_nFilterHeight];
for (int j = 0; j < pUI->m_nFilterHeight; j++) {
for (int i = 0; i < pUI->m_nFilterWidth; i++) {
printf(pUI->m_filterKernalEntries[i + j * pUI->m_nFilterHeight]->value());
pUI->m_dFilterKernal[i + j * pUI->m_nFilterHeight] = atof(pUI->m_filterKernalEntries[i + j * pUI->m_nFilterHeight]->value());
}
}
pUI->getDocument()->applyFilterKernal();
}
示例12: cb_paintlyStrokeChoice
void ImpressionistUI::cb_paintlyStrokeChoice(Fl_Widget* o, void* v)
{
ImpressionistUI* pUI = ((ImpressionistUI *)(o->user_data()));
ImpressionistDoc* pDoc = pUI->getDocument();
int type = (int)v;
switch (type)
{
case STROKE_CIRCLEBRUSH:
pDoc->setPaintlyStroke(type);
pDoc->setBrushType(BRUSH_CIRCLES); cout << "here" << endl;
break;
case STROKE_CURVEDBRUSH:
pDoc->setPaintlyStroke(type);
break;
}
}
示例13: cb_applyFilter
void ImpressionistUI::cb_applyFilter(Fl_Widget* o, void* v)
{
ImpressionistUI* db = (ImpressionistUI*)o->user_data();
double* kernel = new double[db->m_nKernelH * db->m_nKernelW];
for (int i = 0; i < db->m_nKernelH; ++i)
{
for (int j = 0; j < db->m_nKernelW; ++j)
{
int pixel = i * db->m_nKernelW + j;
double weight = atof(db->m_EntryInputs[pixel]->value());
//cout << weight << endl;
kernel[pixel] = weight;
}
}
db->getDocument()->applyCustomFilter(kernel, db->m_nKernelW, db->m_nKernelH);
db->m_paintView->refresh();
}
示例14: GetDocument
void ScatteredLineBrush::BrushEnd(const Point source, const Point target)
{
ImpressionistDoc* pDoc = GetDocument();
ImpressionistUI* dlg = pDoc->m_pUI;
int strokeDirChoice = dlg->m_StrokeDirChoice->value();
// values useful for the right mouse drag
int dx = target.x - source.x;
int dy = target.y - source.y;
int size = sqrt(dx*dx + dy*dy);
int angle = -(int)(atan2(dy, dx)*57.32) % 360;
switch (strokeDirChoice){
// slider/right mouse mode
case 0:
if (isRightMouse){
dlg->setAngle(angle);
dlg->setSize(size);
}
break;
// gradient mode: do nothing
case 1:
if (isRightMouse){
dlg->setSize(size);
}
break;
// brush direction mode
case 2:
if (!isRightMouse){
prev.x = -1;
prev.y = -1;
current.x = -1;
current.y = -1;
}
break;
default:
break;
}
}
示例15: GetDocument
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();
}