int imProcessRadial(const imImage* src_image, imImage* dst_image, float k1, int order) { int ret = 0; int counter = imCounterBegin("Radial Distort"); int src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth; imCounterTotal(counter, src_depth*dst_image->height, "Processing..."); /* size of the destiny image */ for (int i = 0; i < src_depth; i++) { switch(src_image->data_type) { case IM_BYTE: ret = Radial(src_image->width, src_image->height, (imbyte*)src_image->data[i], (imbyte*)dst_image->data[i], k1, counter, float(0), order); break; case IM_USHORT: ret = Radial(src_image->width, src_image->height, (imushort*)src_image->data[i], (imushort*)dst_image->data[i], k1, counter, float(0), order); break; case IM_INT: ret = Radial(src_image->width, src_image->height, (int*)src_image->data[i], (int*)dst_image->data[i], k1, counter, float(0), order); break; case IM_FLOAT: ret = Radial(src_image->width, src_image->height, (float*)src_image->data[i], (float*)dst_image->data[i], k1, counter, float(0), order); break; case IM_CFLOAT: ret = Radial(src_image->width, src_image->height, (imcfloat*)src_image->data[i], (imcfloat*)dst_image->data[i], k1, counter, imcfloat(0,0), order); break; } if (!ret) break; } imCounterEnd(counter); return ret; }
QmitkBulgeToolGUI::QmitkBulgeToolGUI() :QmitkToolGUI() { std::cout << "hi from " << __FUNCSIG__ << std::endl; // create the visible widgets QBoxLayout* verticalLayout = new QVBoxLayout( this ); m_HorizontalLayout = new QHBoxLayout(); verticalLayout->addLayout(m_HorizontalLayout); m_HorizontalLayout1 = new QHBoxLayout(); verticalLayout->addLayout(m_HorizontalLayout1); m_HorizontalLayout2 = new QHBoxLayout(); verticalLayout->addLayout(m_HorizontalLayout2); m_SelectSurfaceBox = new QComboBox(); m_HorizontalLayout->addWidget(m_SelectSurfaceBox); connect(m_SelectSurfaceBox, SIGNAL(activated(int)), this, SLOT(SelectSurface(int))); m_PbtnSelectSurfaceViaMouse = new QPushButton(); QIcon icn_OpenFile; icn_OpenFile.addFile(":/threeDEditing/res/threeDEditing/mousepointer.png"); m_PbtnSelectSurfaceViaMouse->setIcon(icn_OpenFile); m_PbtnSelectSurfaceViaMouse->setFixedSize(22,22); m_HorizontalLayout->addWidget(m_PbtnSelectSurfaceViaMouse); connect(m_PbtnSelectSurfaceViaMouse, SIGNAL(clicked()), this, SLOT(SelectSurfaceViaMouse())); m_PbtnReinitSelection = new QPushButton(); m_PbtnReinitSelection->setText("Reinit Selection"); m_PbtnReinitSelection->setCheckable(true); m_HorizontalLayout1->addWidget(m_PbtnReinitSelection); connect(m_PbtnReinitSelection, SIGNAL(clicked()), this, SLOT(ReinitSelection())); m_PbtnJumpToPosition = new QPushButton(); m_PbtnJumpToPosition->setText("Jump to Position"); m_PbtnJumpToPosition->setCheckable(true); m_HorizontalLayout1->addWidget(m_PbtnJumpToPosition); connect(m_PbtnJumpToPosition, SIGNAL(clicked()), this, SLOT(JumpToPosition())); QLabel* label = new QLabel( "Radius", this ); QFont f = label->font(); f.setBold(false); label->setFont( f ); m_HorizontalLayout2->addWidget(label); m_RadiusSlider = new QSlider(Qt::Horizontal); m_RadiusSlider->setSliderPosition(20); m_HorizontalLayout2->addWidget(m_RadiusSlider); QObject::connect(m_RadiusSlider, SIGNAL(sliderMoved(int)), this, SLOT(RadiusChanged(int))); // Tool Specific QBoxLayout* horizontalLayout3 = new QHBoxLayout(); verticalLayout->addLayout(horizontalLayout3); QBoxLayout* horizontalLayout4 = new QHBoxLayout(); verticalLayout->addLayout(horizontalLayout4); QBoxLayout* horizontalLayout5 = new QHBoxLayout(); verticalLayout->addLayout(horizontalLayout5); QBoxLayout* horizontalLayout6 = new QHBoxLayout(); verticalLayout->addLayout(horizontalLayout6); QBoxLayout* horizontalLayout7 = new QHBoxLayout(); verticalLayout->addLayout(horizontalLayout7); QBoxLayout* horizontalLayout8 = new QHBoxLayout(); verticalLayout->addLayout(horizontalLayout8); QBoxLayout* horizontalLayout9 = new QHBoxLayout(); verticalLayout->addLayout(horizontalLayout9); QBoxLayout* horizontalLayout10 = new QHBoxLayout(); verticalLayout->addLayout(horizontalLayout10); QBoxLayout* horizontalLayout11 = new QHBoxLayout(); verticalLayout->addLayout(horizontalLayout11); QFrame *frame = new QFrame( this ); frame->setFrameStyle( QFrame::Box | QFrame::Plain ); frame->setLineWidth(10); frame->setFixedSize(200,10); QColor color(214,247,202); QPalette colorPalette(color); colorPalette.setColor(QPalette::Foreground, color); frame->setPalette(colorPalette); horizontalLayout3->addWidget(frame); QLabel* label2 = new QLabel( "Select move points technique:", this ); QFont f2 = label2->font(); f2.setBold(false); label->setFont( f2 ); horizontalLayout4->addWidget(label2); m_pbtn_Collinear = new QPushButton(); m_pbtn_Collinear->setText("Collinear"); m_pbtn_Collinear->setToolTip("Move points in the same direction as the mouse moves."); m_pbtn_Collinear->setCheckable(true); m_pbtn_Collinear->setChecked(true); horizontalLayout5->addWidget(m_pbtn_Collinear); connect(m_pbtn_Collinear, SIGNAL(clicked()), this, SLOT(Collinear())); m_pbtn_Radial = new QPushButton(); m_pbtn_Radial->setText("Radial"); m_pbtn_Radial->setToolTip("Move points outside radial from the origin of the tool."); m_pbtn_Radial->setCheckable(true); horizontalLayout5->addWidget(m_pbtn_Radial); connect(m_pbtn_Radial, SIGNAL(clicked()), this, SLOT(Radial())); QFrame *frame1 = new QFrame( this ); frame1->setFrameStyle( QFrame::Box | QFrame::Plain ); frame1->setLineWidth(10); frame1->setFixedSize(200,10); frame1->setPalette(colorPalette); horizontalLayout6->addWidget(frame1); QLabel* label3 = new QLabel( "The tool can add further points while bulging.", this ); QFont f3 = label3->font(); f3.setBold(false); label3->setFont( f ); horizontalLayout7->addWidget(label3); m_SelectRefinementMethodeBox = new QComboBox(); m_SelectRefinementMethodeBox->addItem("Off. Don't add points"); m_SelectRefinementMethodeBox->addItem("Automatic"); m_SelectRefinementMethodeBox->addItem("Insert Point(s)"); m_SelectRefinementMethodeBox->addItem("Subdivide Edge(s)"); horizontalLayout8->addWidget(m_SelectRefinementMethodeBox); connect(m_SelectRefinementMethodeBox, SIGNAL(activated(int)), this, SLOT(SelectRefinementMethode(int))); QFrame *frame2 = new QFrame( this ); frame2->setFrameStyle( QFrame::Box | QFrame::Plain ); frame2->setLineWidth(10); frame2->setFixedSize(200,10); frame2->setPalette(colorPalette); horizontalLayout9->addWidget(frame2); QPushButton* pbtn_ShowTool = new QPushButton(); pbtn_ShowTool->setText("Show Bulge Tool"); pbtn_ShowTool->setCheckable(true); horizontalLayout10->addWidget(pbtn_ShowTool); connect(pbtn_ShowTool, SIGNAL(clicked()), this, SLOT(ShowTool())); QPushButton* pbtnReinitNow = new QPushButton(); pbtnReinitNow->setText("Reinit Now"); horizontalLayout11->addWidget(pbtnReinitNow); connect(pbtnReinitNow, SIGNAL(clicked()), this, SLOT(ReinitNow())); connect(this, SIGNAL(NewToolAssociated(mitk::Tool*)), this, SLOT(OnNewToolAssociated(mitk::Tool*))); std::cout << "ciao from " << __FUNCSIG__ << std::endl; }
void QArcItem::SetPattern(int nPATTERN) { nPatternType = nPATTERN; //样式类型 //QRectF nrect(0,0,qWidth,qHeight); QRectF nrect = this->m_qrcEllipseBndRect; QLinearGradient gradient(nrect.topLeft(),nrect.bottomRight()); QRadialGradient Radial(nrect.center(),nrect.width()/2,nrect.center()); gradient.setSpread(QGradient::PadSpread);// RepeatSpread QBrush br=brush(); br.setColor(nFrontColor); //设置前景色即样式颜色 switch(nPATTERN) { // case 0:br.setStyle(Qt::NoBrush);break; // case 1:br.setColor(nBackColor);br.setStyle(Qt::SolidPattern);break; // case 2:br.setStyle(Qt::Dense1Pattern);break; // case 3:br.setStyle(Qt::Dense2Pattern);break; // case 4:br.setStyle(Qt::Dense3Pattern);break; // case 5:br.setStyle(Qt::Dense4Pattern);break; // case 6:br.setStyle(Qt::Dense5Pattern);break; // case 7:br.setStyle(Qt::Dense6Pattern);break; // case 8:br.setStyle(Qt::Dense7Pattern);break; // case 9:br.setStyle(Qt::HorPattern);break;//setBrush(Qt::HorPattern);break; // case 10:br.setStyle(Qt::VerPattern);break; // case 11:br.setStyle(Qt::CrossPattern);break; // case 12:br.setStyle(Qt::BDiagPattern);break; // case 13:br.setStyle(Qt::FDiagPattern);break; // case 14:br.setStyle(Qt::DiagCrossPattern);break; case 0:br.setStyle(Qt::NoBrush);break;//透明 case 1:br.setColor(nBackColor);br.setStyle(Qt::SolidPattern);break;//纯色 case 2: //横向过度 gradient.setStart(nrect.x(),nrect.y()+nrect.height()); gradient.setColorAt(0,nFrontColor ); gradient.setColorAt(1,nBackColor ); break; case 3: //横向对称过度 gradient.setStart(nrect.x(),nrect.y()+nrect.height()); gradient.setColorAt(0,nFrontColor ); gradient.setColorAt(0.5,nBackColor ); gradient.setColorAt(1,nFrontColor ); break; case 4: //纵向过度 gradient.setStart(nrect.x()+nrect.width(),nrect.y()); gradient.setColorAt(0,nFrontColor ); gradient.setColorAt(1,nBackColor); break; case 5: //纵向对称过度 gradient.setStart(nrect.x()+nrect.width(),nrect.y()); gradient.setColorAt(0,nFrontColor ); gradient.setColorAt(0.5,nBackColor); gradient.setColorAt(1,nFrontColor ); break; case 6: //斜上过度 gradient.setColorAt(0,nFrontColor ); gradient.setColorAt(1,nBackColor ); break; case 7: //斜上对称过度 gradient.setColorAt(0,nFrontColor ); gradient.setColorAt(0.5,nBackColor ); gradient.setColorAt(1,nFrontColor ); break; case 8: //斜下过度 gradient.setStart(nrect.x(),nrect.y()+nrect.height()); gradient.setFinalStop(nrect.x()+nrect.width(),nrect.y()); gradient.setColorAt(0,nBackColor ); gradient.setColorAt(1,nFrontColor); break; case 9: //斜下对称过度 gradient.setStart(nrect.x(),nrect.y()+nrect.height()); gradient.setFinalStop(nrect.x()+nrect.width(),nrect.y()); gradient.setColorAt(0,nFrontColor ); gradient.setColorAt(0.5,nBackColor ); gradient.setColorAt(1,nFrontColor ); break; case 10: //右上角辐射 gradient.setStart(nrect.x()+nrect.width(),nrect.y()); gradient.setFinalStop(nrect.x(),nrect.y()+nrect.height()); gradient.setColorAt(0,nBackColor ); gradient.setColorAt(1,nFrontColor ); break; case 11: //左上角辐射 gradient.setColorAt(0,nBackColor ); gradient.setColorAt(1, nFrontColor); break; case 12: //中心辐射 Radial.setColorAt(0,nBackColor ); Radial.setColorAt(1,nFrontColor ); setBrush(Radial); return; break; case 13: //待操作 Radial.setFocalPoint(nrect.x(),nrect.y()+nrect.height()/2); Radial.setColorAt(0,nBackColor ); Radial.setColorAt(1,nFrontColor ); setBrush(Radial); return; break; default: break; } if(nPATTERN >= 2 ) { setBrush(gradient); } else { setBrush(br); } }