这篇教程C++ px函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中px函数的典型用法代码示例。如果您正苦于以下问题:C++ px函数的具体用法?C++ px怎么用?C++ px使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了px函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: pointer_constructorvoid pointer_constructor(){ { boost::interprocess::intrusive_ptr<X, VP> px(0); BOOST_TEST(px.get() == 0); } { boost::interprocess::intrusive_ptr<X, VP> px(0, false); BOOST_TEST(px.get() == 0); } { boost::interprocess::offset_ptr<X> p = new X; BOOST_TEST(p->use_count() == 0); boost::interprocess::intrusive_ptr<X, VP> px(p); BOOST_TEST(px.get() == p); BOOST_TEST(px->use_count() == 1); } { boost::interprocess::offset_ptr<X> p = new X; BOOST_TEST(p->use_count() == 0); intrusive_ptr_add_ref(p.get()); BOOST_TEST(p->use_count() == 1); boost::interprocess::intrusive_ptr<X, VP> px(p, false); BOOST_TEST(px.get() == p); BOOST_TEST(px->use_count() == 1); }}
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:33,
示例2: area bool tAoi::overlap( tAoi const& area_ )const { int s0 = area(); int s1 = area_.area(); if( s0 > s1 ) { int xend = area_.px() + area_.sx(); int yend = area_.py() + area_.sy(); for( int y = area_.py(); y < yend; y++ ) { for( int x = area_.px(); x < xend; x++ ) { if( inside( int32_xy( x, y ) ) != false ) { return true; } } } } else { int xend = px() + sx(); int yend = py() + sy(); for( int y = py(); y < yend; y++ ) { for( int x = px(); x < xend; x++ ) { if( area_.inside( int32_xy( x, y ) ) != false ) { return true; } } } } return false; }
开发者ID:rleofield,项目名称:image_read_write,代码行数:31,
示例3: st_setOutputWndint st_setOutputWnd(int x, int y, int w, int h){ cJSON *param = cJSON_CreateObject(); cJSON_AddItemToObject(param, "x_pos", px(x)); cJSON_AddItemToObject(param, "y_pos", px(y)); cJSON_AddItemToObject(param, "width", px(w)); cJSON_AddItemToObject(param, "height", px(h)); return st_command(elcmd_setOutputWnd, param);}
开发者ID:ElecardSTB,项目名称:elecard-apps,代码行数:9,
示例4: xfmt16static inline unsigned int xfmt16 (char *s, char const *key){ register unsigned int j = 0 ; j += px((unsigned char)key[0] >> 4) ; j += px((unsigned char)key[0] & 15) ; j += px((unsigned char)key[1] >> 4) ; j += px((unsigned char)key[1] & 15) ; return j ? j : (*s = '0', 1) ;}
开发者ID:Jubei-Mitsuyoshi,项目名称:aaa-skalibs,代码行数:9,
示例5: switchfloat Statistics::calcInformationMeasures1(){ float result = 0; for (int direction = 0; direction < 4; direction++) { float** com = 0; switch(direction) { case 0: com = this->m_cooc0; break; case 1: com = this->m_cooc1; break; case 2: com = this->m_cooc2; break; case 3: com = this->m_cooc3; break; } //calculate HXY1 float HXY1 = 0; for (int i = 0; i < this->m_numColors; i++) { for (int j = 0; j < this->m_numColors; j++) { HXY1 += com[i][j] * log(px(com, i) * py(com, j) + Statistics::epsilon); } } HXY1 *= -1; //calculate HX and HY float HX = 0, HY = 0; for (int i = 0; i < this->m_numColors; i++) { HX += px(com, i) * log(px(com, i) + Statistics::epsilon); HY += py(com, i) * log(py(com, i) + Statistics::epsilon); } HX *= -1; HY *= -1; //calculate HXY float HXY = calcEntropy(com); //calculate information measures 1 result += (HXY - HXY1) / max(HX, HY); } return result / 4;}
开发者ID:Degot,项目名称:Las-Vegas-Reconstruction,代码行数:51,
示例6: printvoid print(int n) { if(n<0) { n=-n; px('-'); } int i=10; char o[10]; do { o[--i] = (n%10) + '0'; n/=10; }while(n); do { px(o[i]); }while(++i<10);}
开发者ID:sourcecode123,项目名称:online-coding-contests,代码行数:14,
示例7: px bool tAoi::inside( int32_xy const& p )const { bool ret = false; int x = p.x(); int y = p.y(); if( x >= px() && x < static_cast<int>( ( px() + sx() ) ) && y >= py() && y < static_cast<int>( ( py() + sy() ) ) ) { ret = true; } return ret; }
开发者ID:rleofield,项目名称:image_read_write,代码行数:14,
示例8: NonMaximumSuppression/* the local maximal Gabor inhibits overlapping Gabors */void NonMaximumSuppression(int img, int mo, int mx, int my) { int x, y, orient, x1, y1, orient1, i, here, shift, startx0, endx0, starty0, endy0, trace[2]; float *f, maxResponse, maxResponse1; double *fc; /* inhibit on the SUM1 maps */ for (orient=0; orient<numOrient; orient++) { f = SUM1map[orient*numImage+img]; fc = Correlation[mo+orient*numOrient]; for (x=MAX(1, mx-2*halfFilterSize); x<=MIN(sizex, mx+2*halfFilterSize); x++) for (y=MAX(1, my-2*halfFilterSize); y<=MIN(sizey, my+2*halfFilterSize); y++) { f[px(x, y, sizex, sizey)] *= fc[px(x-mx+2*halfFilterSize+1, y-my+2*halfFilterSize+1, 4*halfFilterSize+1, 4*halfFilterSize+1)]; } } /* update the MAX1 maps */ startx0 = floor((mx-2*halfFilterSize)/subsample)-locationShiftLimit+1; starty0 = floor((my-2*halfFilterSize)/subsample)-locationShiftLimit+1; endx0 = floor((mx+2*halfFilterSize)/subsample)+locationShiftLimit; endy0 = floor((my+2*halfFilterSize)/subsample)+locationShiftLimit; for (orient=0; orient<numOrient; orient++) { i = orient*numImage+img; for (x=MAX(startx, startx0); x<=MIN(endx, endx0); x++) for (y=MAX(starty, starty0); y<=MIN(endy, endy0); y++) { /* go over the locations that may be affected */ here = px(x, y, sizexSubsample, sizeySubsample); maxResponse = MAX1map[i][here]; shift = trackMap[i][here]; orient1 = orientShifted[orient][shift]; x1 = x*subsample + xShift[orient][shift]; y1 = y*subsample + yShift[orient][shift]; if ((x1-mx>=-2*halfFilterSize)&&(x1-mx<=2*halfFilterSize)&& (y1-my>=-2*halfFilterSize)&&(y1-my<=2*halfFilterSize)) { /* if the previous local maximum is within the inhibition range */ if(Correlation[mo+orient1*numOrient] [px(x1-mx+2*halfFilterSize+1,y1-my+2*halfFilterSize+1,4*halfFilterSize+1,4*halfFilterSize+1)]==0.) { /* if it is indeed inhibited */ maxResponse1 = LocalMaximumPooling(img, orient, x*subsample, y*subsample, trace); trackMap[i][here] = trace[0]; MAX1map[i][here] = maxResponse1; pooledMax1map[orient][here] += (maxResponse1-maxResponse); } } } } }
开发者ID:uknowhuan,项目名称:AOT,代码行数:50,
示例9: pPoint3d PlaneDetector::depthCloseToPoint(Point2d p, PointCloud<PointXYZ>& pcl, int maxDelta) { for (int delta = 0; delta <= maxDelta; delta++) { for (int y = p.y - delta; y <= p.y + delta; y++) { for (int x = p.x - delta; x <= p.x + delta; x++) { if (!isnan(pcl.points[px(x, y)].z)) { Point3d p(pcl.points[px(x, y)].x, pcl.points[px(x, y)].y, pcl.points[px(x, y)].z); return p; } } } } return Point3d(-1, -1, -1);}
开发者ID:Zorgie,项目名称:Robotics,代码行数:15,
示例10: MultiScaleQuadrature MultiScaleQuadrature() : super( std::pow(2,ioption("msi.level"))+1 ) { int gridsize = std::pow(2,ioption("msi.level")); // build rules in x and y direction weights_type wx( gridsize+1 ); weights_type px( gridsize+1 ); double tmp=-1; for ( int i = 0; i <=gridsize ; i++ ) { // computes the weight of the k-th node this->M_w( i ) = 2./(gridsize+1) ;// wx( i ); this->M_points( 0, i ) = tmp ; tmp+=2./gridsize ; } boost::shared_ptr<GT_Lagrange<1,1,1, Hypercube,T> > gm( new GT_Lagrange<1, 1, 1, Hypercube, T> ); boost::shared_ptr<face_quad_type> face_qr( new face_quad_type ); // construct face quadratures this->constructQROnFace( Reference<Hypercube<1, 1>, 1, 1>(), gm, face_qr ); }
开发者ID:LANTZT,项目名称:feelpp,代码行数:26,
示例11: pxQPixmap ImageProcessor::drawPiece(int i, int j, const QPainterPath &shape, const Puzzle::Creation::Correction &corr){ QPainter p; QPixmap px(_p->descriptor.unitSize.width() + corr.widthCorrection + 1, _p->descriptor.unitSize.height() + corr.heightCorrection + 1); px.fill(Qt::transparent); p.begin(&px); p.setRenderHint(QPainter::SmoothPixmapTransform); p.setRenderHint(QPainter::Antialiasing); p.setRenderHint(QPainter::HighQualityAntialiasing); p.setClipping(true); p.setClipPath(shape); p.drawPixmap(_p->descriptor.tabFull + corr.xCorrection + corr.sxCorrection, _p->descriptor.tabFull + corr.yCorrection + corr.syCorrection, _p->pixmap, i * _p->descriptor.unitSize.width() + corr.sxCorrection, j * _p->descriptor.unitSize.height() + corr.syCorrection, _p->descriptor.unitSize.width() * 2, _p->descriptor.unitSize.height() * 2); p.end(); return px;}
开发者ID:Jornason,项目名称:puzzle-master,代码行数:25,
示例12: px/** * Fit to a function. * @param fun :: A function. */void Chebfun2DSpline::fit( AFunction2D fun ){ auto& xv = m_xBase->x; auto& yv = m_yBase->x; std::vector<double> px(nx() + 1); std::vector<double> py(ny() + 1); for(size_t ix = 0; ix < m_xFuns.size(); ++ix) { const double y = m_yLines[ix]; for( size_t i = 0 ; i < px.size(); ++i) { px[i] = fun(xv[i], y); } m_xFuns[ix].setP( px ); } for(size_t iy = 0; iy < m_yFuns.size(); ++iy) { const double x = m_xLines[iy]; for( size_t i = 0 ; i < py.size(); ++i) { py[i] = fun(x, yv[i]); } m_yFuns[iy].setP( py ); }}
开发者ID:rrnntt,项目名称:SmallProject,代码行数:29,
示例13: DrawElement//markvoid DrawElement(float *Template, int mo, int mx, int my, double w) { int x, y, here; float a; for (x=mx-halfFilterSize; x<=mx+halfFilterSize; x++) for (y=my-halfFilterSize; y<=my+halfFilterSize; y++) if ((x>=1)&&(x<=sizex)&&(y>=1)&&(y<=sizey)) { a = allSymbol[mo][px(x-mx+halfFilterSize+1, y-my+halfFilterSize+1, 2*halfFilterSize+1, 2*halfFilterSize+1)]*w; here = px(x, y, sizex, sizey); if (Template[here]<a) Template[here] = a; }}
开发者ID:uknowhuan,项目名称:AOT,代码行数:17,
示例14: gen2 void gen2() { const int unit = 64; resetGlobalIdx(); Operand pz(IntPtr, unit); Operand px(IntPtr, unit); Operand py(IntPtr, unit); std::string name = "add128"; Function f(name, Void, pz, px, py); beginFunc(f); Operand x = load(px); Operand y = load(py); x = zext(x, 128); y = zext(y, 128); x = add(x, y); Operand L = trunc(x, 64); store(L, pz); Operand xH = load(getelementptr(px, makeImm(32, 1))); Operand yH = load(getelementptr(py, makeImm(32, 1))); x = trunc(lshr(x, 64), 64); x = add(x, xH); x = add(x, yH); store(x, getelementptr(pz, makeImm(32, 1))); ret(Void); endFunc(); }
开发者ID:herumi,项目名称:opti,代码行数:27,
示例15: drawvoid Screen::draw(Drawable *drawable,bool isflip){ if(!isflip){ draw(drawable); } else{ vector<Pixel> result; //Hitung sumbu vertikal vector<Pixel> group_of_point=drawable->getPixels(); vector<Pixel>::iterator it; int vertical_axis=0; int numb=0; for(it=group_of_point.begin();it!=group_of_point.end();it++){ vertical_axis+=(it->getPosition()).x;numb++; } vertical_axis/=numb; //transformasi for(it=group_of_point.begin();it!=group_of_point.end();it++){ int temp=(it->getPosition()).x; temp=2*vertical_axis-temp; Point pt(temp,(it->getPosition()).y); Pixel px(pt,it->getColor()); result.push_back(px); } for(it=result.begin();it!=result.end();it++) drawPixel(*it); }}
开发者ID:daniarherikurniawan,项目名称:BattleOfYu,代码行数:28,
示例16: pxGLuint FileAssociatedTexture::getOrCreateCube( const QString & fileNames, OpenGLFunctions & gl, const GLenum mag_filter, const GLenum min_filter){ if (s_texturesByFilePath.contains(fileNames)) return s_texturesByFilePath[fileNames]; QString px(fileNames); px.replace("?", "px"); QString nx(fileNames); nx.replace("?", "nx"); QString py(fileNames); py.replace("?", "py"); QString ny(fileNames); ny.replace("?", "ny"); QString pz(fileNames); pz.replace("?", "pz"); QString nz(fileNames); nz.replace("?", "nz"); QStringList files = QStringList() << px << nx << py << ny << pz << nz; QStringList absolutes; foreach(const QString & file, files) { QFileInfo fi(file); if (!fi.exists()) { qWarning() << file << " does not exist: texture has no associated file."; return -1; } absolutes << fi.absoluteFilePath(); }
开发者ID:hpicgs,项目名称:cg2sandbox,代码行数:28,
示例17: pxbool SizeParam::fromString(const std::string& str){ if (str.length() < 2) return false; std::string temp; if (str[ 0 ] == 'p') { temp = str.substr(1, str.length() - 1); px(utility::parseInt(temp)); } else if (str[ 0 ] == 'f') { if (str[ 1 ] == 'f') mFlMode = FM_FREE_SPACE; else if (str[ 1 ] == 'p') mFlMode = FM_PARENT; else MYGUI_EXCEPT("Second character of float mode in SizeParam is invalid!"); temp = str.substr(2, str.length() - 2); mFl = utility::parseFloat(temp); } else MYGUI_EXCEPT("First character in SizeParam is invalid!"); return true;}
开发者ID:sskoruppa,项目名称:Glove_Code,代码行数:30,
示例18: InitializeMAX1map/* Initialize MAX1 maps */void InitializeMAX1map(){ int img, orient, x, y, here, i, trace[2]; /* calculate MAX1 maps and record the shifts */ pooledMax1map = float_matrix(numOrient, sizexSubsample*sizeySubsample); MAX1map = float_matrix(numImage*numOrient, sizexSubsample*sizeySubsample); trackMap = int_matrix(numImage*numOrient, sizexSubsample*sizeySubsample); startx = floor((halfFilterSize+1)/subsample)+1+locationShiftLimit; endx = floor((sizex-halfFilterSize)/subsample)-1-locationShiftLimit; starty = floor((halfFilterSize+1)/subsample)+1+locationShiftLimit; endy = floor((sizey-halfFilterSize)/subsample)-1-locationShiftLimit; for (x=startx; x<=endx; x++) for (y=starty; y<=endy; y++) { here = px(x, y, sizexSubsample, sizeySubsample); for (orient=0; orient<numOrient; orient++) { pooledMax1map[orient][here] = 0.; for (img=0; img<numImage; img++) { i = orient*numImage+img; MAX1map[i][here] = LocalMaximumPooling(img, orient, x*subsample, y*subsample, trace); trackMap[i][here] = trace[0]; pooledMax1map[orient][here] += MAX1map[i][here]; } } }}
开发者ID:uknowhuan,项目名称:AOT,代码行数:29,
示例19: destvoid FAMS::saveModeImg(const std::string& filename, bool pruned, const std::vector<multi_img::BandDesc>& ref) { size_t n = (pruned ? prunedModes.size() : modes.size()); if (n < 1) return; bool full = (n == h_ * w_); int h = (full ? h_ : n), w = (full ? w_ : 1); multi_img dest(h, w, modes[0].data.size()); dest.minval = minVal_; dest.maxval = maxVal_; for (int y = 0; y < h; ++y) { for (int x = 0; x < w; ++x) { multi_img::Pixel px(dest.size()); std::vector<unsigned short> &src = (pruned ? prunedModes[x*y] : modes[x*y].data); for (size_t d = 0; d < src.size(); ++d) px[d] = ushort2value(src[d]); dest.setPixel(y, x, px); } } dest.meta = ref; dest.write_out(filename);}
开发者ID:ajaskier,项目名称:gerbil,代码行数:27,
示例20: QDialogImageViewer::ImageViewer(QWidget *parent) : QDialog(parent){ setupUi(this); connect(lowerSpinBox, SIGNAL(valueChanged(double)), SLOT(slotUpdate())); connect(upperSpinBox, SIGNAL(valueChanged(double)), SLOT(slotUpdate())); connect(flipCheckBox, SIGNAL(stateChanged(int)), SLOT(slotUpdate())); connect(opaqueCheckBox, SIGNAL(stateChanged(int)), SLOT(slotUpdate())); QPixmap px(32, 32); QPainter p(&px); p.fillRect(0, 0, 32, 32, Qt::white); p.fillRect(0, 0, 16, 16, QColor(193, 193, 193)); p.fillRect(16, 16, 16, 16, QColor(193, 193, 193)); p.end(); QPalette pal = scrollAreaWidgetContents->palette(); pal.setBrush(QPalette::Background, QBrush(px)); pal.setBrush(QPalette::Base, QBrush(px)); scrollAreaWidgetContents->setPalette(pal);}
开发者ID:float-tw,项目名称:apitrace,代码行数:27,
示例21: QDialogAddressTool::AddressTool(QWidget *parent, int presetValue) : QDialog(parent) , ui(new Ui::AddressTool) , m_dipSwitch(NULL){ ui->setupUi(this); QPixmap px(16, 16); px.fill(QColor("#E7354A")); ui->m_redBtn->setIcon(QIcon(px)); px.fill(QColor("#0165DF")); ui->m_blueBtn->setIcon(QIcon(px)); px.fill(Qt::black); ui->m_blackBtn->setIcon(QIcon(px)); ui->m_addressSpin->setValue(presetValue); m_dipSwitch = new DIPSwitchWidget(this, presetValue); ui->m_gridLayout->addWidget(m_dipSwitch, 0, 0, 1, 5); m_dipSwitch->setMinimumHeight(80); connect(ui->m_addressSpin, SIGNAL(valueChanged(int)), m_dipSwitch, SLOT(slotSetValue(int))); connect(m_dipSwitch, SIGNAL(valueChanged(int)), ui->m_addressSpin, SLOT(setValue(int))); connect(ui->m_reverseVertCheck, SIGNAL(toggled(bool)), m_dipSwitch, SLOT(slotReverseVertically(bool))); connect(ui->m_reverseHorizCheck, SIGNAL(toggled(bool)), m_dipSwitch, SLOT(slotReverseHorizontally(bool)));}
开发者ID:Babbsdrebbler,项目名称:qlcplus,代码行数:33,
示例22: pxQSize KsirkChatItem::sizeHint(const QStyleOptionViewItem &option){ unsigned int w = 0; QTextDocument fake; // used to allow to compute lines height fake.setHtml("gpl"); fake.setDefaultFont(option.font); fake.adjustSize(); fake.setTextWidth ( -1 ); qreal h = fake.size().height(); for (int i = 0 ; i < m_order.size(); i++) { QTextDocument rt; rt.setHtml(m_strings[i]); rt.adjustSize(); rt.setTextWidth ( -1 ); QPixmap px(rt.size().toSize()); switch (m_order[i]) { case Text: w += px.width(); break; case Pixmap: if (! m_pixmaps[i].isNull()) { QPixmap scaled = m_pixmaps[i].scaledToHeight((int)h); w+= scaled.width(); } break; default: ; } }// kDebug() << "KsirkChatItem::sizeHint: " << QSize(w,h) << endl; return QSize(w,(int)h);}
开发者ID:KDE,项目名称:ksirk,代码行数:35,
示例23: pxvoid CCuboid::GetGripperPositions(std::list<GripData> *list, bool just_for_endof){ gp_Pnt o = m_pos.Location(); gp_Pnt px(o.XYZ() + m_pos.XDirection().XYZ() * m_x); gp_Pnt py(o.XYZ() + m_pos.YDirection().XYZ() * m_y); gp_Dir z_dir = m_pos.XDirection() ^ m_pos.YDirection(); gp_Pnt pz(o.XYZ() + z_dir.XYZ() * m_z); gp_Pnt m2(o.XYZ() + m_pos.XDirection().XYZ() * m_x + m_pos.YDirection().XYZ() * m_y/2); gp_Pnt m3(o.XYZ() + m_pos.XDirection().XYZ() * m_x/2 + m_pos.YDirection().XYZ() * m_y); gp_Pnt m8(o.XYZ() + m_pos.YDirection().XYZ() * m_y/2 + z_dir.XYZ() * m_z); gp_Pnt pxy(o.XYZ() + m_pos.XDirection().XYZ() * m_x + m_pos.YDirection().XYZ() * m_y); gp_Pnt pxz(o.XYZ() + m_pos.XDirection().XYZ() * m_x + z_dir.XYZ() * m_z); gp_Pnt pyz(o.XYZ() + m_pos.YDirection().XYZ() * m_y + z_dir.XYZ() * m_z); gp_Pnt pxyz(o.XYZ() + m_pos.XDirection().XYZ() * m_x + m_pos.YDirection().XYZ() * m_y + z_dir.XYZ() * m_z); list->push_back(GripData(GripperTypeTranslate,o.X(),o.Y(),o.Z(),NULL)); list->push_back(GripData(GripperTypeRotateObject,px.X(),px.Y(),px.Z(),NULL)); list->push_back(GripData(GripperTypeRotateObject,py.X(),py.Y(),py.Z(),NULL)); list->push_back(GripData(GripperTypeRotateObject,pz.X(),pz.Y(),pz.Z(),NULL)); list->push_back(GripData(GripperTypeScale,pxyz.X(),pxyz.Y(),pxyz.Z(),NULL)); list->push_back(GripData(GripperTypeRotate,pxy.X(),pxy.Y(),pxy.Z(),NULL)); list->push_back(GripData(GripperTypeRotate,pxz.X(),pxz.Y(),pxz.Z(),NULL)); list->push_back(GripData(GripperTypeRotate,pyz.X(),pyz.Y(),pyz.Z(),NULL)); list->push_back(GripData(GripperTypeObjectScaleX,m2.X(),m2.Y(),m2.Z(),NULL)); list->push_back(GripData(GripperTypeObjectScaleY,m3.X(),m3.Y(),m3.Z(),NULL)); list->push_back(GripData(GripperTypeObjectScaleZ,m8.X(),m8.Y(),m8.Z(),NULL));}
开发者ID:CarlosGS,项目名称:heekscad,代码行数:26,
示例24: pxvoid VCSlider::setClickAndGoWidgetFromLevel(uchar level){ if (m_cngType == ClickAndGoWidget::None || m_cngWidget == NULL) return; if (m_cngType == ClickAndGoWidget::RGB || m_cngType == ClickAndGoWidget::CMY) { QPixmap px(42, 42); float f = 0; if (m_slider) f = SCALE(float(level), float(m_slider->minimum()), float(m_slider->maximum()), float(0), float(200)); if ((uchar)f == 0) { px.fill(Qt::black); } else { QColor modColor = m_cngRGBvalue.lighter((uchar)f); px.fill(modColor); } m_cngButton->setIcon(px); } else m_cngButton->setIcon(QPixmap::fromImage(m_cngWidget->getImageFromValue(level)));}
开发者ID:dadoonet,项目名称:qlcplus,代码行数:27,
示例25: rxQString SnumPlugin::extractnum(const QString &unicoded, int a){ int pos; QString tmp = ""; QString seriesnum = ""; QString season = ""; QString episode = ""; QRegExp rx("(//d{1,2})[^//d]{1}(//d{1,3})"); pos = 0; pos = rx.indexIn(unicoded, pos); if (pos > -1) { season += rx.cap(1); episode += rx.cap(2); pos += rx.matchedLength(); } else { QRegExp px("(//d{1,2})[^//d]{2}(//d{1,3})"); pos = 0; pos = px.indexIn(unicoded, pos); if (pos > -1) { season += px.cap(1); episode += px.cap(2); pos += px.matchedLength(); } else { QRegExp gx("(//d{1,2})[^//d]{0}(//d{2})"); pos = 0; pos = gx.indexIn(unicoded, pos); if (pos > -1) { season += gx.cap(1); episode += gx.cap(2); pos += gx.matchedLength(); } } } if (season.length() == 1) { tmp = '0' + season; } else { tmp = season; } season = tmp; if (episode.length() == 1) { tmp = '0' + episode; } else { tmp = episode; } episode = tmp; seriesnum += season + 'e' + episode; if (a == 0) { return seriesnum; } else if (a == 1) { return season; } else { return episode; }}
开发者ID:KDE,项目名称:krename,代码行数:59,
示例26: collideint collide(int *a, int *b){ // sanity checking if (a == 000 || b == 000) return -1; // bad args if (b[0] < 1) return -2; // x at 0 if (b[1] < 1) return -3; // y at 0 if (b[2] < 1) return -4; // z at 0 if (b[0] > xres) return -5; // x at max if (b[0] > yres) return -6; // y at max if (b[0] > zres) return -7; // z at max int vec[3] = {(b[0]-a[0]), (b[1]-a[1]), (b[2]-a[2])}; // vector int result = 0; /* below is a fairly basic algo to keep checking until there is no conflict * may be optimizable */ do { result = 0; if (vec[0] > 0) { result += px(&b[0]); } if (vec[1] > 0) { result += py(&b[1]); } if (vec[2] > 0) { result += pz(&b[2]); } if (vec[0] < 0) { result += nx(&b[0]); } if (vec[1] < 0) { result += ny(&b[1]); } if (vec[2] < 0) { result += nz(&b[2]); } vec[0] = (b[0]-a[0]); vec[1] = (b[1]-a[1]); vec[2] = (b[2]-a[2]); // recalc. should eliminate unnecessary checks } while (result != 0); return 0;}
开发者ID:mthornton2,项目名称:portal,代码行数:59,
示例27: pxvoid ColorButton::setColor(QColor color){ CurrentColor = color; QPixmap px(this->size()-QSize(4, 4)); px.fill(color); setIcon(px); emit changed();}
开发者ID:euronomus,项目名称:SimplePainter,代码行数:8,
示例28: pxvoid MusicLrcArtPhotoLabel::saveImagePath(const QString &path) const{ QPixmap px(m_width, m_height); QPainter paint(&px); paint.drawPixmap(0, 0, m_width, m_height, m_showPix); paint.end(); px.save(path);}
开发者ID:zh335x,项目名称:TTKMusicplayer,代码行数:8,
注:本文中的px函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ px4_close函数代码示例 C++ pwrite64函数代码示例 |