这篇教程C++ startPoint函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中startPoint函数的典型用法代码示例。如果您正苦于以下问题:C++ startPoint函数的具体用法?C++ startPoint怎么用?C++ startPoint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了startPoint函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: computeAnglevoid ArrowLine::drawShape(QPainter &p){ p.setPen(darkGray); QCanvasLine::drawShape(p); double angle = computeAngle(startPoint().x(), startPoint().y(), endPoint().x(), endPoint().y()); QPointArray pts(3); QWMatrix m; int x, y; m.rotate(angle); m.map(-5, -2, &x, &y); pts.setPoint(0, x, y); m.map(-5, 2, &x, &y); pts.setPoint(1, x, y); m.map(0, 0, &x, &y); pts.setPoint(2, x, y); pts.translate(endPoint().x(), endPoint().y()); p.setBrush(QColor(darkGray)); p.drawPolygon(pts);}
开发者ID:BackupTheBerlios,项目名称:poa,代码行数:26,
示例2: UNREFERENCED_PARAMETERCXTPChartDeviceCommand* CXTPChartRadarAxisXView::CreateTickMarksDeviceCommand(CXTPChartDeviceContext* pDC){ UNREFERENCED_PARAMETER(pDC); CXTPChartDeviceCommand* pCommands = new CXTPChartHitTestElementCommand(m_pAxis, m_rcBounds); CXTPChartAxisTickMarks* pTickMarks = m_pAxis->GetTickMarks(); if (!pTickMarks->IsVisible()) return pCommands; CXTPChartColor clrAxis = m_pAxis->GetActualColor(); int nLength = pTickMarks->GetLength(); int nThickness = pTickMarks->GetThickness(); BOOL bMinorVisible = pTickMarks->IsMinorVisible(); BOOL bCross = pTickMarks->IsCrossAxis(); int nAxisThickness = m_pAxis->GetThickness() - 1; int nExtraLength = bCross ? nLength + nAxisThickness : 0; for (int i = 0; i < m_arrTicks.GetSize(); i++) { double lineAngle = ValueToAngle(m_arrTicks[i].m_dValue); double cs = cos(lineAngle); double sn = sin(lineAngle); CXTPChartPointF startPoint(m_ptCenter.X + (m_nRadius - nExtraLength) * cs, m_ptCenter.Y - (m_nRadius - nExtraLength) * sn); CXTPChartPointF finishPoint(m_ptCenter.X + (m_nRadius + nAxisThickness + nLength) * cs, m_ptCenter.Y - (m_nRadius + nAxisThickness + nLength) * sn); pCommands->AddChildCommand(new CXTPChartSolidLineDeviceCommand(startPoint, finishPoint, clrAxis, nThickness)); } if (bMinorVisible && !IsPolygonDiagramStyle()) { nLength = pTickMarks->GetMinorLength(); int nExtraLength = bCross ? nLength + nAxisThickness : 0; int nMinorThickness = pTickMarks->GetMinorThickness(); for (int i = 0; i < m_arrMinorTicks.GetSize(); i++) { double lineAngle = ValueToAngle(m_arrMinorTicks[i]); double cs = cos(lineAngle); double sn = sin(lineAngle); CXTPChartPointF startPoint(m_ptCenter.X + (m_nRadius - nExtraLength) * cs, m_ptCenter.Y - (m_nRadius - nExtraLength) * sn); CXTPChartPointF finishPoint(m_ptCenter.X + (m_nRadius + nAxisThickness + nLength) * cs, m_ptCenter.Y - (m_nRadius + nAxisThickness + nLength) * sn); pCommands->AddChildCommand(new CXTPChartSolidLineDeviceCommand(startPoint, finishPoint, clrAxis, nMinorThickness)); } } return pCommands;}
开发者ID:lai3d,项目名称:ThisIsASoftRenderer,代码行数:54,
示例3: OSvoid Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const{#if OS(WINDOWS) // This glyph buffer holds our glyphs + advances + font data for each glyph. GlyphBuffer glyphBuffer; float startX = point.x(); UniscribeController controller(this, run); controller.advance(from); float beforeWidth = controller.runWidthSoFar(); controller.advance(to, &glyphBuffer); // We couldn't generate any glyphs for the run. Give up. if (glyphBuffer.isEmpty()) return; float afterWidth = controller.runWidthSoFar(); if (run.rtl()) { controller.advance(run.length()); startX += controller.runWidthSoFar() - afterWidth; } else startX += beforeWidth; // Draw the glyph buffer now at the starting point returned in startX. FloatPoint startPoint(startX, point.y()); drawGlyphBuffer(context, glyphBuffer, run, startPoint);#else notImplemented();#endif}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:31,
示例4: draw void KviCanvasLine::draw(QPainter &p) { if(isEnabled()) { p.setPen(pen()); p.drawLine(startPoint(),endPoint()); } if(isSelected()) { p.setRasterOp(NotROP); p.setPen(QPen(DotLine)); p.drawLine(startPoint(),endPoint()); p.setRasterOp(CopyROP); } }
开发者ID:netrunner-debian-kde-extras,项目名称:kvirc,代码行数:16,
示例5: resetSamplerbool Viewport::getSample(vec2 &p, Ray &r) { _i += 1.0/_incPP; if (_i >= _pixelsWide) { _i = _incPP/2; _j += 1.0/_incPP; } if (_j >= _pixelsHigh) { resetSampler(); return false; } p = vec2(_i,_j); // friendly progress counter int soFar = int( 100*((floor(_i)+1)*(floor(_j)+1) / (double) (_pixelsWide * _pixelsHigh)) ); if (soFar >= _percentage+10) { _percentage = soFar; cout << soFar << "% Done." << endl; } double u = _i / (double) _pixelsWide; double v = _j / (double) _pixelsHigh; vec4 startPoint(((1-u)*((1-v)*_LL[0] + v*_UL[0]) + u*((1-v)*_LR[0] + v*_UR[0])), ((1-u)*((1-v)*_LL[1] + v*_UL[1]) + u*((1-v)*_LR[1] + v*_UR[1])), ((1-u)*((1-v)*_LL[2] + v*_UL[2]) + u*((1-v)*_LR[2] + v*_UR[2])),1); _lens.getRays(startPoint, r); return true;}
开发者ID:ch1pmunks,项目名称:cs184,代码行数:30,
示例6: SmallIconvoid KipiImageItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& sortMappedindex) const{ if (sortMappedindex.column() != KipiImageItem::ColumnThumbnail) { QItemDelegate::paint(painter, option, sortMappedindex); return; } const QModelIndex& sourceModelIndex = d->imageList->getSortProxyModel()->mapToSource(sortMappedindex); if (option.state & QStyle::State_Selected) { painter->fillRect(option.rect, option.palette.highlight()); } // TODO: clipping, selected state, disabled state, etc. QPixmap itemPixmap = d->imageList->getModel()->getPixmapForIndex(sourceModelIndex, d->thumbnailSize); if (itemPixmap.isNull()) { // TODO: paint some default logo // TODO: cache this logo itemPixmap = SmallIcon("image-x-generic", d->thumbnailSize, KIconLoader::DisabledState); } const QSize availableSize = option.rect.size(); const QSize pixmapSize = itemPixmap.size().boundedTo(availableSize); QPoint startPoint((availableSize.width() - pixmapSize.width()) / 2, (availableSize.height() - pixmapSize.height()) / 2); startPoint += option.rect.topLeft(); painter->drawPixmap(QRect(startPoint, pixmapSize), itemPixmap, QRect(QPoint(0, 0), pixmapSize));}
开发者ID:rickysarraf,项目名称:digikam,代码行数:32,
示例7: ASSERTvoid Font::drawEmphasisMarks(GraphicsContext* context, const TextRun& run, const GlyphBuffer& glyphBuffer, const AtomicString& mark, const FloatPoint& point) const{ FontCachePurgePreventer purgePreventer; GlyphData markGlyphData; if (!getEmphasisMarkGlyphData(mark, markGlyphData)) return; const SimpleFontData* markFontData = markGlyphData.fontData; ASSERT(markFontData); if (!markFontData) return; Glyph markGlyph = markGlyphData.glyph; Glyph spaceGlyph = markFontData->spaceGlyph(); float middleOfLastGlyph = offsetToMiddleOfGlyphAtIndex(glyphBuffer, 0); FloatPoint startPoint(point.x() + middleOfLastGlyph - offsetToMiddleOfGlyph(markFontData, markGlyph), point.y()); GlyphBuffer markBuffer; for (int i = 0; i + 1 < glyphBuffer.size(); ++i) { float middleOfNextGlyph = offsetToMiddleOfGlyphAtIndex(glyphBuffer, i + 1); float advance = glyphBuffer.advanceAt(i).width() - middleOfLastGlyph + middleOfNextGlyph; markBuffer.add(glyphBuffer.glyphAt(i) ? markGlyph : spaceGlyph, markFontData, advance); middleOfLastGlyph = middleOfNextGlyph; } markBuffer.add(glyphBuffer.glyphAt(glyphBuffer.size() - 1) ? markGlyph : spaceGlyph, markFontData, 0); drawGlyphBuffer(context, run, markBuffer, startPoint);}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:30,
示例8: PLATFORMvoid Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const{#if PLATFORM(CHROMIUM) if (preferHarfBuzz(this)) { GlyphBuffer glyphBuffer; HarfBuzzShaper shaper(this, run); shaper.setDrawRange(from, to); if (shaper.shape(&glyphBuffer)) { drawGlyphBuffer(context, run, glyphBuffer, point); return; } }#endif // This glyph buffer holds our glyphs + advances + font data for each glyph. GlyphBuffer glyphBuffer; float startX = point.x() + getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer); // We couldn't generate any glyphs for the run. Give up. if (glyphBuffer.isEmpty()) return; // Draw the glyph buffer now at the starting point returned in startX. FloatPoint startPoint(startX, point.y()); drawGlyphBuffer(context, run, glyphBuffer, startPoint);}
开发者ID:harlanlewis,项目名称:webkit,代码行数:26,
示例9: itvoid Font::drawSimpleText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const{ // This glyph buffer holds our glyphs+advances+font data for each glyph. GlyphBuffer glyphBuffer; float startX = point.x(); WidthIterator it(this, run); it.advance(from); float beforeWidth = it.m_runWidthSoFar; it.advance(to, &glyphBuffer); // We couldn't generate any glyphs for the run. Give up. if (glyphBuffer.isEmpty()) return; float afterWidth = it.m_runWidthSoFar; if (run.rtl()) { float finalRoundingWidth = it.m_finalRoundingWidth; it.advance(run.length()); startX += finalRoundingWidth + it.m_runWidthSoFar - afterWidth; } else startX += beforeWidth; // Swap the order of the glyphs if right-to-left. if (run.rtl()) for (int i = 0, end = glyphBuffer.size() - 1; i < glyphBuffer.size() / 2; ++i, --end) glyphBuffer.swap(i, end); // Calculate the starting point of the glyphs to be displayed by adding // all the advances up to the first glyph. FloatPoint startPoint(startX, point.y()); drawGlyphBuffer(context, glyphBuffer, run, startPoint);}
开发者ID:Chingliu,项目名称:EAWebkit,代码行数:34,
示例10: switchint RDLogLine::segueLength(RDLogLine::TransType next_trans){ switch(type()) { case RDLogLine::Cart: switch(next_trans) { case RDLogLine::Stop: case RDLogLine::Play: return log_effective_length; case RDLogLine::Segue: if(segueStartPoint(RDLogLine::AutoPointer)<0) { return log_effective_length; } return segueStartPoint(RDLogLine::AutoPointer)- startPoint(RDLogLine::AutoPointer); default: break; } break; case RDLogLine::Macro: return log_effective_length; case RDLogLine::Marker: return 0; default: break; } return 0;}
开发者ID:laborautonomo,项目名称:rivendell,代码行数:32,
示例11: numberOfCoordsvoid Initial::setCoordString(){ int ylen = numberOfCoords(); string *coordList = new string[ylen]; int i = startPoint(); int j = 0; string str = ""; /*List of strings. Each string is a coordinate *pair.*/ while(j<ylen) { while(i<buffer.length() && buffer[i]!=')') str+=buffer[i++]; //Grabs ) if(i<buffer.length()) str+=buffer[i++]; //Skips comma inbetween ) ( i++; coordList[j++] = str; str = ""; } setCoord(coordList,ylen);}
开发者ID:aojeleye,项目名称:GameOfLife,代码行数:25,
示例12: runLazyFlipper//Run inference with Lazy Flipper initialized to setting in initlabvoid runLazyFlipper(GraphicalModelType* gm,std::string ofname, std::string initlab, size_t subGraphsize){ //Initial Labelling std::vector<LabelType> startPoint(gm->numberOfVariables()); std::ifstream input; input.open(initlab.c_str()); int label; for(size_t i=0;i<gm->numberOfVariables();i++) { input>>label; startPoint[i] = LabelType(label); #ifdef DEBUG std::cout<<"L"<<i<<":"<<label<<" ";#endif } //Run Inference size_t maxSubgraphsize; if(subGraphsize<=0) maxSubgraphsize = gm->numberOfVariables()/2; else maxSubgraphsize = subGraphsize; LazyFlipper::Parameter para(maxSubgraphsize); LazyFlipper lf(*gm,para); lf.setStartingPoint(startPoint.begin()); std::cout<<"Running Inference"<<std::endl; lf.infer(); std::cout << "MAP Result: " << lf.value() << " Bound: "<<lf.bound()<<std::endl; std::vector<LabelType> result; lf.arg(result); //Write Result writeResult(result,ofname);}
开发者ID:clinicalml,项目名称:fw-inference,代码行数:35,
示例13: runICM//Run inference with Lazy Flipper initialized to setting in initlabvoid runICM(GraphicalModelType* gm,std::string ofname, std::string initlab){ //Initial Labelling std::vector<LabelType> startPoint(gm->numberOfVariables()); std::ifstream input; input.open(initlab.c_str()); int label; for(size_t i=0;i<gm->numberOfVariables();i++) { input>>label; startPoint[i] = LabelType(label); #ifdef DEBUG std::cout<<"L"<<i<<":"<<label<<" ";#endif } //Run Inference ICM::Parameter para(startPoint); ICM icm(*gm,para); std::cout<<"Running Inference"<<std::endl; icm.infer(); std::cout << "MAP Result: " << icm.value() << " Bound: "<<icm.bound()<<std::endl; std::vector<LabelType> result; icm.arg(result); //Write Result writeResult(result,ofname);}
开发者ID:clinicalml,项目名称:fw-inference,代码行数:27,
示例14: controllervoid Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const{ // This glyph buffer holds our glyphs + advances + font data for each glyph. GlyphBuffer glyphBuffer; float startX = point.x(); CoreTextController controller(this, run); controller.advance(from); float beforeWidth = controller.runWidthSoFar(); controller.advance(to, &glyphBuffer); // We couldn't generate any glyphs for the run. Give up. if (glyphBuffer.isEmpty()) return; float afterWidth = controller.runWidthSoFar(); if (run.rtl()) { startX += controller.totalWidth() + controller.finalRoundingWidth() - afterWidth; for (int i = 0, end = glyphBuffer.size() - 1; i < glyphBuffer.size() / 2; ++i, --end) glyphBuffer.swap(i, end); } else startX += beforeWidth; // Draw the glyph buffer now at the starting point returned in startX. FloatPoint startPoint(startX, point.y()); drawGlyphBuffer(context, glyphBuffer, run, startPoint);}
开发者ID:acss,项目名称:owb-mirror,代码行数:29,
示例15: m_pathPolyRefs////////////////// PathInfo //////////////////PathInfo::PathInfo(const Unit* owner, const float destX, const float destY, const float destZ, bool useStraightPath) : m_pathPolyRefs(NULL), m_polyLength(0), m_type(PATHFIND_BLANK), m_useStraightPath(useStraightPath), m_sourceUnit(owner), m_navMesh(NULL), m_navMeshQuery(NULL){ PathNode endPoint(destX, destY, destZ); setEndPosition(endPoint); float x,y,z; m_sourceUnit->GetPosition(x, y, z); PathNode startPoint(x, y, m_sourceUnit->GetMap()->GetHeight(x,y,z,100.0f)); setStartPosition(startPoint); PATH_DEBUG("++ PathInfo::PathInfo for %u /n", m_sourceUnit->GetGUID()); uint32 mapId = m_sourceUnit->GetMapId(); MMAP::MMapManager* mmap = MMAP::MMapFactory::createOrGetMMapManager(); m_navMesh = mmap->GetNavMesh(mapId); m_navMeshQuery = mmap->GetNavMeshQuery(mapId); if (m_navMesh && m_navMeshQuery) { BuildPolyPath(startPoint, endPoint); } else { BuildShortcut(); m_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); }}
开发者ID:nerzhul,项目名称:MangosFX,代码行数:30,
示例16: addVertexvoid QgsLineStringV2::close(){ if ( numPoints() < 1 || isClosed() ) { return; } addVertex( startPoint() );}
开发者ID:saberraz,项目名称:QGIS,代码行数:8,
示例17: addVertexvoid QgsCompoundCurve::close(){ if ( numPoints() < 1 || isClosed() ) { return; } addVertex( startPoint() );}
开发者ID:alexbruy,项目名称:QGIS,代码行数:8,
示例18: WidgetAdvisorReligionWindow::AdvisorReligionWindow( CityPtr city, Widget* parent, int id ) : Widget( parent, id, Rect( 0, 0, 1, 1 ) ), _d( new Impl ){ setGeometry( Rect( Point( (parent->getWidth() - 640 )/2, parent->getHeight() / 2 - 242 ), Size( 640, 280 ) ) ); Label* title = new Label( this, Rect( 60, 10, 60 + 210, 10 + 40) ); title->setText( _("##Religion advisor##") ); title->setFont( Font::create( FONT_3 ) ); title->setTextAlignment( alignUpperLeft, alignCenter ); _d->background.reset( Picture::create( getSize() ) ); //main _d->_d->background PictureDecorator::draw( *_d->background, Rect( Point( 0, 0 ), getSize() ), PictureDecorator::whiteFrame ); //buttons _d->_d->background PictureDecorator::draw( *_d->background, Rect( 35, 62, getWidth() - 35, 62 + 130 ), PictureDecorator::blackFrame ); Picture& icon = Picture::load( ResourceGroup::panelBackground, 264 ); _d->background->draw( icon, Point( 11, 11 ) ); Font font = Font::create( FONT_1 ); font.draw( *_d->background, _("##Temples##"), 268, 32, false ); font.draw( *_d->background, _("##small##"), 240, 47, false ); font.draw( *_d->background, _("##large##"), 297, 47, false ); font.draw( *_d->background, _("##Fest.##"), 370, 47, false ); font.draw( *_d->background, _("##Mood##"), 450, 47, false ); Point startPoint( 42, 65 ); Size labelSize( 550, 20 ); Impl::InfrastructureInfo info = _d->getInfo( city, building::templeCeres, building::B_BIG_TEMPLE_CERES ); _d->lbCeresInfo = new ReligionInfoLabel( this, Rect( startPoint, labelSize ), DivinePantheon::ceres(), info.smallTemplCount, info.bigTempleCount ); info = _d->getInfo( city, building::B_TEMPLE_NEPTUNE, building::B_BIG_TEMPLE_NEPTUNE ); _d->lbNeptuneInfo = new ReligionInfoLabel( this, Rect( startPoint + Point( 0, 20), labelSize), DivinePantheon::neptune(), info.smallTemplCount, info.bigTempleCount ); info = _d->getInfo( city, building::B_TEMPLE_MERCURE, building::B_BIG_TEMPLE_MERCURE ); _d->lbMercuryInfo = new ReligionInfoLabel( this, Rect( startPoint + Point( 0, 40), labelSize), DivinePantheon::mercury(), info.smallTemplCount, info.bigTempleCount ); info = _d->getInfo( city, building::B_TEMPLE_MARS, building::B_BIG_TEMPLE_MARS ); _d->lbMarsInfo = new ReligionInfoLabel( this, Rect( startPoint + Point( 0, 60), labelSize), DivinePantheon::mars(), info.smallTemplCount, info.bigTempleCount ); info = _d->getInfo( city, building::B_TEMPLE_VENUS, building::B_BIG_TEMPLE_VENUS ); _d->lbVenusInfo = new ReligionInfoLabel( this, Rect( startPoint + Point( 0, 80), labelSize), DivinePantheon::venus(), info.smallTemplCount, info.bigTempleCount ); info = _d->getInfo( city, building::B_TEMPLE_ORACLE, building::B_TEMPLE_ORACLE ); _d->lbOracleInfo = new ReligionInfoLabel( this, Rect( startPoint + Point( 0, 100), labelSize), RomeDivinityPtr(), info.smallTemplCount, 0 ); _d->btnHelp = new TexturedButton( this, Point( 12, getHeight() - 39), Size( 24 ), -1, ResourceMenu::helpInfBtnPicId );}
开发者ID:BlackFoks,项目名称:opencaesar3,代码行数:56,
示例19: startPointvoid MetropolisHastings::Initialize(){ Algorithm::Initialize(); if (fBetas.empty()) fBetas = { 1.0 };// const size_t nChainConfigs = fChains.size(); const size_t nBetas = fBetas.size(); // global start point in parameter space Sample startPoint( fParameterConfig.GetStartValues(false) ); Evaluate( startPoint ); startPoint.SetAccepted( true ); // if not set by the user, instantiate default proposal function if (!fProposalFunction) { LOG(Info, "Using default proposal function 'ProposalGaussian'."); fProposalFunction = make_shared<ProposalNormal>(); } // initialize chain configurations for (auto& chainConfig : fChainConfigs) { chainConfig.reset( new ChainConfig(nBetas, fParameterConfig, fProposalFunction.get()) ); // for each PT (beta) chain, setup an individual parameter configuration const double initialErrorScaling = fParameterConfig.GetErrorScaling(); for (size_t iBeta = 0; iBeta < nBetas; iBeta++) { // scale parameter configurations if (iBeta > 0) chainConfig->fDynamicParamConfigs[iBeta].SetErrorScaling( initialErrorScaling / sqrt(fBetas[iBeta]) ); // update proposal functions with parameter configuration chainConfig->fProposalFunctions[iBeta]->UpdateParameterConfig( chainConfig->fDynamicParamConfigs[iBeta] ); } // setup start points for (auto& chain : chainConfig->fPtChains) { // if required, randomize the starting vector for each chain if (fRandomizeStartPoint) { startPoint.Values() = GetParameterConfig().GetStartValues(true); Evaluate( startPoint ); } chain.reserve( GetTotalLength()+1 ); chain.push_back( startPoint ); } }}
开发者ID:mkleesiek,项目名称:fast-mcmc,代码行数:55,
示例20: startPointbool QgsCurve::isClosed() const{ if ( numPoints() == 0 ) return false; //don't consider M-coordinates when testing closedness QgsPointV2 start = startPoint(); QgsPointV2 end = endPoint(); return ( qgsDoubleNear( start.x(), end.x(), 1E-8 ) && qgsDoubleNear( start.y(), end.y(), 1E-8 ) && qgsDoubleNear( start.z(), end.z(), 1E-8 ) );}
开发者ID:3liz,项目名称:Quantum-GIS,代码行数:12,
示例21: pen/** * Paints the specified arrow * @return the end point */void Arrow::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *){// if (myStartItem->collidesWithItem(myEndItem)) return; QPen myPen = pen(); myPen.setColor(myColor); qreal arrowSize = 10; painter->setPen(myPen); painter->setBrush(myColor); setLine(QLineF(startPoint(), endPoint())); line1 = QLineF(startPoint(), midPoint()); line2 = QLineF(midPoint(), endPoint()); double angle = acos(line1.dx() / line1.length()); if (line1.dy() >= 0) angle = (Pi * 2) - angle; QPointF arrowP1 = line1.p1() + QPointF(sin(angle + Pi / 3) * arrowSize, cos(angle + Pi / 3) * arrowSize); QPointF arrowP2 = line1.p1() + QPointF(sin(angle + Pi - Pi / 3) * arrowSize, cos(angle + Pi - Pi / 3) * arrowSize); //arrow corner cornerLine1= QLineF(endPoint(),endPoint()+QPointF(0,10)); cornerLine2= QLineF(endPoint(),endPoint()-QPointF(10,0)); arrowHead.clear(); arrowHead << line1.p1() << arrowP1 << arrowP2; painter->setRenderHint(QPainter::Antialiasing); painter->drawLine(line1); painter->drawLine(line2); painter->drawLine(cornerLine1); painter->drawLine(cornerLine2); painter->drawPolygon(arrowHead);}
开发者ID:fejo,项目名称:TrollEdit-1,代码行数:43,
示例22: getGlyphsAndAdvancesForSimpleTextvoid Font::drawSimpleText(GraphicsContext* context, const TextRunPaintInfo& runInfo, const FloatPoint& point) const{ // This glyph buffer holds our glyphs+advances+font data for each glyph. GlyphBuffer glyphBuffer; float startX = point.x() + getGlyphsAndAdvancesForSimpleText(runInfo.run, runInfo.from, runInfo.to, glyphBuffer); if (glyphBuffer.isEmpty()) return; FloatPoint startPoint(startX, point.y()); drawGlyphBuffer(context, runInfo, glyphBuffer, startPoint);}
开发者ID:glenkim-dev,项目名称:blink-crosswalk,代码行数:13,
示例23: QgsMultiPointQgsAbstractGeometry *QgsCurve::boundary() const{ if ( isEmpty() ) return nullptr; if ( isClosed() ) return nullptr; QgsMultiPoint *multiPoint = new QgsMultiPoint(); multiPoint->addGeometry( new QgsPoint( startPoint() ) ); multiPoint->addGeometry( new QgsPoint( endPoint() ) ); return multiPoint;}
开发者ID:AlisterH,项目名称:Quantum-GIS,代码行数:13,
示例24: gameOverMsg /** * Writes game over on the gametable */ void GameTable::showGameOverScreen() { std::vector<GameTableLetterCube*> gameOver; std::string gameOverMsg("gameover"); std::string pressMsg("press"); std::string enterMsg("enter"); // create game over msg for(unsigned int i=0; i<gameOverMsg.size(); i++){ Point startPoint(i*this->cubeUnit+this->cubePadding+this->startX, this->height, 0.0f+this->cubePadding); Dimension dimension(this->cubeUnit-2*this->cubePadding, 0.3f-2*this->cubePadding, this->cubeUnit-2*this->cubePadding); GameTableLetterCube* letterCube = new GameTableLetterCube(startPoint, dimension, gameOverMsg.at(i), this->cubeUnit); gameOver.push_back(letterCube); } // create game over msg for(unsigned int i=0; i<pressMsg.size(); i++){ Point startPoint(i*this->cubeUnit+this->cubePadding+this->startX, this->height, 0.0f+this->cubePadding); Dimension dimension(this->cubeUnit-2*this->cubePadding, 0.3f-2*this->cubePadding, this->cubeUnit-2*this->cubePadding); GameTableLetterCube* letterCube = new GameTableLetterCube(startPoint, dimension, pressMsg.at(i), this->cubeUnit); letterCube->incrementRow(); gameOver.push_back(letterCube); } // create game over msg for(unsigned int i=0; i<enterMsg.size(); i++){ Point startPoint(i*this->cubeUnit+this->cubePadding+this->startX, this->height, 0.0f+this->cubePadding); Dimension dimension(this->cubeUnit-2*this->cubePadding, 0.3f-2*this->cubePadding, this->cubeUnit-2*this->cubePadding); GameTableLetterCube* letterCube = new GameTableLetterCube(startPoint, dimension, enterMsg.at(i), this->cubeUnit); letterCube->incrementRow(); letterCube->incrementRow(); gameOver.push_back(letterCube); } this->letterCubes.clear(); this->letterCubes = gameOver; }
开发者ID:BernhardPosselt,项目名称:bif4-cge,代码行数:42,
示例25: UNUSED_PARAMvoid Font::drawGlyphBuffer(GraphicsContext* context, const TextRun& run, const GlyphBuffer& glyphBuffer, FloatPoint& point) const{#if !ENABLE(SVG_FONTS) UNUSED_PARAM(run);#endif // Draw each contiguous run of glyphs that use the same font data. const SimpleFontData* fontData = glyphBuffer.fontDataAt(0); FloatSize offset = glyphBuffer.offsetAt(0); FloatPoint startPoint(point.x(), point.y() - glyphBuffer.initialAdvance().height()); float nextX = startPoint.x() + glyphBuffer.advanceAt(0).width(); float nextY = startPoint.y() + glyphBuffer.advanceAt(0).height(); int lastFrom = 0; int nextGlyph = 1;#if ENABLE(SVG_FONTS) TextRun::RenderingContext* renderingContext = run.renderingContext();#endif while (nextGlyph < glyphBuffer.size()) { const SimpleFontData* nextFontData = glyphBuffer.fontDataAt(nextGlyph); FloatSize nextOffset = glyphBuffer.offsetAt(nextGlyph); if (nextFontData != fontData || nextOffset != offset) {#if ENABLE(SVG_FONTS) if (renderingContext && fontData->isSVGFont()) renderingContext->drawSVGGlyphs(context, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint); else#endif drawGlyphs(context, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint); lastFrom = nextGlyph; fontData = nextFontData; offset = nextOffset; startPoint.setX(nextX); startPoint.setY(nextY); } nextX += glyphBuffer.advanceAt(nextGlyph).width(); nextY += glyphBuffer.advanceAt(nextGlyph).height(); nextGlyph++; }#if ENABLE(SVG_FONTS) if (renderingContext && fontData->isSVGFont()) renderingContext->drawSVGGlyphs(context, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint); else {#endif drawGlyphs(context, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint); point.setX(nextX);#if ENABLE(SVG_FONTS) }#endif}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:51,
示例26: startPoint/** * Return whether on seq. line. * Takes into account destruction box if shown. * * @param p The point to investigate. * @return Non-zero if point is on this sequence line. */int SeqLineWidget::onWidget(const QPoint & p){ int nOnWidget = 0; QPoint sp = startPoint(); QPoint ep = endPoint(); //see if on widget ( for message creation ) if( sp.x() - m_nMouseDownEpsilonX < p.x() && ep.x() + m_nMouseDownEpsilonX > p.x() && sp.y() < p.y() && ep.y() + 3 > p.y() ) { nOnWidget = 1; } return nOnWidget;}
开发者ID:ShermanHuang,项目名称:kdesdk,代码行数:21,
示例27: filevoid ReportPrintSetting::drawPosition(int type, QString content, QPainter &painter, int drawType,QString img, int fontSize, const QString family, bool bold){ ReportFormDefinition report; // QString file("../tcdstation/reportForm.xml"); QString file("reportForm.xml"); report.ReadReportContent(file); QRectF rectF; report.GetPosition(type,rectF); QFont font; font.setPointSize(fontSize); font.setBold(bold); font.setFamily(family); painter.setFont(font); if(drawType == SPLITTER) { QPoint startPoint(rectF.x(),rectF.y()); QPoint endPoint(rectF.x()+rectF.width(),rectF.y()+rectF.height()); painter.drawLine(startPoint,endPoint); } else if(drawType == TEXT) { painter.drawText(rectF,Qt::TextWordWrap,content); } else if(drawType == IMAGE) { //QImage image(img); QPixmap pixmap; pixmap.load(img); //painter.drawImage(rectF,image); painter.drawPixmap(rectF.x(),rectF.y(),rectF.width(),rectF.height(),pixmap); } else if(drawType == WIDGET) { QPixmap grabImage; QRect rect; rect.setSize(QSize(rectF.width(),rectF.height())); m_tableView->resize(rect.size()); grabImage = m_tableView->grab(QRect(0,0,m_tableView->width(),m_tableView->height())); grabImage.scaled(rect.size(),Qt::KeepAspectRatio); painter.drawPixmap(rectF.x(),rectF.y(),grabImage); }}
开发者ID:hypermoon,项目名称:TCDstation,代码行数:50,
注:本文中的startPoint函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ startPoolMining函数代码示例 C++ startParameters函数代码示例 |