这篇教程C++ xf函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中xf函数的典型用法代码示例。如果您正苦于以下问题:C++ xf函数的具体用法?C++ xf怎么用?C++ xf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了xf函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mgMinfloat GiGraphics::calcPenWidth(float lineWidth, bool useViewScale) const{ float w = mgMin(m_impl->minPenWidth, 1.f); if (m_impl->maxPenWidth <= 1) lineWidth = 0; if (lineWidth > 0) { // 单位:0.01mm w = lineWidth / 2540.f * xf().getDpiY(); if (useViewScale) w *= xf().getViewScale(); } else if (lineWidth < 0) { // 单位:像素 if (lineWidth < -1e3f) // 不使用UI放缩系数 w = 1e3f - lineWidth; else w = -lineWidth * _penWidthFactor; if (useViewScale) w *= xf().getViewScale(); } w = mgMin(w, m_impl->maxPenWidth); w = mgMax(w, m_impl->minPenWidth); //if (lineWidth <= 0 && xf().getDpiY() > getScreenDpi()) // w = w * xf().getDpiY() / getScreenDpi(); return w;}
开发者ID:Vito2015,项目名称:vgcore,代码行数:27,
示例2: xfbool GiGraphics::setClipBox(const RECT_2D& rc){ if (m_impl->drawRefcnt < 1) return false; bool ret = false; Box2d rect; if (!rect.intersectWith(Box2d(rc), Box2d(m_impl->clipBox0)).isEmpty()) { if (rect != Box2d(m_impl->clipBox)) { rect.get(m_impl->clipBox); m_impl->rectDraw.set(Box2d(rc)); m_impl->rectDraw.inflate(GiGraphicsImpl::CLIP_INFLATE); m_impl->rectDrawM = m_impl->rectDraw * xf().displayToModel(); m_impl->rectDrawW = m_impl->rectDrawM * xf().modelToWorld(); SafeCall(m_impl->canvas, clipRect(m_impl->clipBox.left, m_impl->clipBox.top, m_impl->clipBox.width(), m_impl->clipBox.height())); } ret = true; } return ret;}
开发者ID:gkrists,项目名称:TouchVG,代码行数:26,
示例3: xffloat GiGraphics::calcPenWidth(float lineWidth, bool useViewScale) const{ float w = 1; float px; if (m_impl->maxPenWidth <= 1) lineWidth = 0; if (lineWidth > 0) // 单位:0.01mm { px = lineWidth / 2540.f * xf().getDpiY(); if (useViewScale) px *= xf().getViewScale(); w = mgMin(px, m_impl->maxPenWidth); } else if (lineWidth < 0) // 单位:像素 { w = mgMin(-lineWidth, m_impl->maxPenWidth); } w = mgMax(w, m_impl->minPenWidth); if (lineWidth <= 0 && xf().getDpiY() > getScreenDpi()) { w = w * xf().getDpiY() / getScreenDpi(); } return w;}
开发者ID:acekiller,项目名称:touchvg,代码行数:27,
示例4: boxbool GiGraphics::setClipWorld(const Box2d& rectWorld){ bool ret = false; if (isDrawing() && !rectWorld.isEmpty()) { Box2d box (rectWorld * xf().worldToDisplay()); box.intersectWith(Box2d(m_impl->clipBox0)); if (!box.isEmpty(Tol(1, 0))) { if (box != Box2d(m_impl->clipBox)) { box.get(m_impl->clipBox); m_impl->rectDraw = box; m_impl->rectDraw.inflate(GiGraphicsImpl::CLIP_INFLATE); m_impl->rectDrawM = m_impl->rectDraw * xf().displayToModel(); m_impl->rectDrawW = m_impl->rectDrawM * xf().modelToWorld(); SafeCall(m_impl->canvas, _clipBoxChanged(m_impl->clipBox)); } ret = true; } } return ret;}
开发者ID:acekiller,项目名称:touchvg,代码行数:27,
示例5: GetGValuebool GiCanvasGdip::beginPaint(HDC hdc, HDC attribDC, bool buffered, bool overlay){ bool ret = (NULL == m_draw->m_gs) && GiCanvasWin::beginPaint(hdc, attribDC, buffered, overlay); if (!ret) return false; buffered = buffered && !gs()->isPrint(); COLORREF cr = ::GetBkColor(hdc); m_draw->m_bkColor.set(GetRValue(cr), GetGValue(cr), GetBValue(cr)); GdipOverlayBmp oldDrawing; if (buffered && overlay) oldDrawing.save(m_owner, hdc); m_draw->m_gs = new G::Graphics(hdc); if (m_draw->m_gs == NULL) { GiCanvasWin::endPaint(false); return false; } if (buffered) { m_draw->m_memBitmap = new G::Bitmap(xf().getWidth(), xf().getHeight()); m_draw->m_memGs = G::Graphics::FromImage(m_draw->m_memBitmap); oldDrawing.draw(m_draw->m_memGs); } _antiAliasModeChanged(gs()->isAntiAliasMode()); return ret;}
开发者ID:fanliugen,项目名称:touchvg,代码行数:33,
示例6: xfbool GiCanvasGdi::drawCachedBitmap2(const GiCanvas* p, float x, float y, bool secondBmp){ if (p && p->getCanvasType() == getCanvasType()) { const GiCanvasGdi* gs = static_cast<const GiCanvasGdi*>(p); return gs->xf().getWidth() == xf().getWidth() && gs->xf().getHeight() == xf().getHeight() && GdiCachedBmp(secondBmp).draw(m_draw, m_draw->getDrawDC(), x, y); } return false;}
开发者ID:huangzongwu,项目名称:touchvg,代码行数:11,
示例7: vecbool GiGraphics::drawBeeline(const GiContext* ctx, const Point2d& startPt, const Point2d& endPt, bool modelUnit){ Vector2d vec((endPt - startPt) * RAYMUL); Point2d pts[2] = { (startPt - vec) * S2D(xf(), modelUnit), (endPt + vec) * S2D(xf(), modelUnit) }; if (!mglnrel::clipLine(pts[0], pts[1], m_impl->rectDraw)) return false; return rawLine(ctx, pts[0].x, pts[0].y, pts[1].x, pts[1].y);}
开发者ID:Vito2015,项目名称:vgcore,代码行数:12,
示例8: wcvoidRegularizedHingeIntegration::getSectionWeights(int numSections, double L, double *wt){ beamInt->getSectionWeights(numSections-2, L, wt); double oneOverL = 1.0/L; double betaI = lpI*oneOverL; wt[1] = wt[0]-betaI; wt[0] = betaI; double betaJ = lpJ*oneOverL; wt[2] = wt[numSections-3]-betaJ; wt[3] = betaJ; const int nc = 4; int nf = numSections - nc; if (nf > 0) { if (wf == 0) wf = new double[nf]; double pt[100]; this->getSectionLocations(numSections, L, pt); Vector wc(wt, nc); Vector xc(pt, nc); Vector xf(&pt[nc], nf); Vector R(nf); for (int i = 0; i < nf; i++) { double sum = 0.0; for (int j = 0; j < nc; j++) sum += pow(xc(j),i)*wc(j); R(i) = 1.0/(i+1) - sum; } Matrix J(nf,nf); for (int i = 0; i < nf; i++) for (int j = 0; j < nf; j++) J(i,j) = pow(xf(j),i); Vector wfVec(wf, nf); J.Solve(R, wfVec); } for (int i = 0; i < nf; i++) wt[i+nc] = wf[i];}
开发者ID:lge88,项目名称:OpenSees,代码行数:52,
示例9: S2Dbool GiGraphics::drawLine(const GiContext* ctx, const Point2d& startPt, const Point2d& endPt, bool modelUnit){ if (!DRAW_RECT(m_impl, modelUnit).isIntersect(Box2d(startPt, endPt))) return false; Point2d pts[2] = { startPt * S2D(xf(), modelUnit), endPt * S2D(xf(), modelUnit) }; if (!mglnrel::clipLine(pts[0], pts[1], m_impl->rectDraw)) return false; return rawLine(ctx, pts[0].x, pts[0].y, pts[1].x, pts[1].y);}
开发者ID:Vito2015,项目名称:vgcore,代码行数:13,
示例10: giInterlockedIncrementbool GiGraphics::beginPaint(GiCanvas* canvas, const RECT_2D& clipBox){ if (!canvas || m_impl->canvas || m_impl->drawRefcnt > 0) { return false; } m_impl->canvas = canvas; m_impl->ctxused = 0; m_impl->stopping = 0; giInterlockedIncrement(&m_impl->drawRefcnt); if (m_impl->lastZoomTimes != xf().getZoomTimes()) { m_impl->zoomChanged(); m_impl->lastZoomTimes = xf().getZoomTimes(); } m_impl->clipBox0 = clipBox; if (Box2d(clipBox).isEmpty()) { (xf().getWndRectW() * xf().worldToDisplay()).get(m_impl->clipBox0); } m_impl->clipBox = m_impl->clipBox0; m_impl->rectDraw = m_impl->clipBox0; m_impl->rectDraw.inflate(GiGraphicsImpl::CLIP_INFLATE); m_impl->rectDrawM = Box2d(m_impl->rectDraw) * xf().displayToModel(); m_impl->rectDrawMaxM = xf().getWndRectM(); m_impl->rectDrawW = m_impl->rectDrawM * xf().modelToWorld(); m_impl->rectDrawMaxW = m_impl->rectDrawMaxM * xf().modelToWorld(); return true;}
开发者ID:gkrists,项目名称:TouchVG,代码行数:30,
示例11: reverse void reverse() { if (xf() == 0) { xf() = 1; xi()--; } else if (xf() == 1) { xf() = 0; xi()++; } else if (yf() == 0) { yf() = 1; yi()--; } else if (yf() == 1) { yf() = 0; yi()++; } }
开发者ID:vbeffara,项目名称:Simulations,代码行数:15,
示例12: lockbool GiGraphics::drawPath(const GiContext* ctx, int count, const Point2d* points, const UInt8* types, bool modelUnit){ if (m_impl->drawRefcnt == 0 || count < 2 || points == NULL || types == NULL) return false; GiLock lock (&m_impl->drawRefcnt); if (count > 0x2000) count = 0x2000; Matrix2d matD(S2D(xf(), modelUnit)); const Box2d extent (count, points); // 模型坐标范围 if (!DRAW_RECT(m_impl, modelUnit).isIntersect(extent)) // 全部在显示区域外 return false; vector<Point2d> pxpoints; pxpoints.resize(count); Point2d *pxs = &pxpoints.front(); for (int i = 0; i < count; i++) pxs[i] = points[i] * matD; return rawPath(ctx, count, pxs, types);}
开发者ID:acekiller,项目名称:touchvg,代码行数:26,
示例13: put_xformintput_xform( /* translate and print transform */ register XF_SPEC *spec){ register char **av; register int n; n = xf_ac(spec) - xf_ac(spec->prev); if (xf(&spec->xf, n, av=xf_av(spec)) != n) return(-1); printf("%sMatrixTransform {/n", tabs); indent(1); printf("%s# xf", tabs); /* put out original as comment */ while (n--) { putchar(' '); fputs(*av++, stdout); } putchar('/n'); /* put out computed matrix */ printf("%smatrix %13.9g %13.9g %13.9g %13.9g/n", tabs, spec->xf.xfm[0][0], spec->xf.xfm[0][1], spec->xf.xfm[0][2], spec->xf.xfm[0][3]); for (n = 1; n < 4; n++) printf("%s %13.9g %13.9g %13.9g %13.9g/n", tabs, spec->xf.xfm[n][0], spec->xf.xfm[n][1], spec->xf.xfm[n][2], spec->xf.xfm[n][3]); indent(0); printf("%s}/n", tabs); return(0);}
开发者ID:MITSustainableDesignLab,项目名称:Daysim,代码行数:30,
示例14: matDbool GiGraphics::drawEllipse(const GiContext* ctx, const Point2d& center, float rx, float ry, bool modelUnit){ if (rx < _MGZERO || isStopping()) return false; bool ret = false; Matrix2d matD(S2D(xf(), modelUnit)); if (ry < _MGZERO) { ry = (Vector2d(rx, rx) * matD).x; ry = fabsf((Vector2d(ry, ry) * matD.inverse()).y); } const Box2d extent (center, rx*2.f, ry*2.f); // 模型坐标范围 if (!DRAW_RECT(m_impl, modelUnit).isIntersect(extent)) // 全部在显示区域外 return false; if (mgIsZero(matD.m12) && mgIsZero(matD.m21)) { Point2d cen (center * matD); rx *= fabsf(matD.m11); ry *= fabsf(matD.m22); ret = rawEllipse(ctx, cen.x - rx, cen.y - ry, 2 * rx, 2 * ry); } else { Point2d pxs[13]; mgcurv::ellipseToBezier(pxs, center, rx, ry); matD.transformPoints(13, pxs); ret = rawBeziers(ctx, pxs, 13, true); } return ret;}
开发者ID:Vito2015,项目名称:vgcore,代码行数:33,
示例15: xf_handlerintxf_handler(int ac, char **av) /* handle xf entity */{ register XF_SPEC *spec; register int n; int rv; if (ac == 1) { /* something with existing transform */ if ((spec = xf_context) == NULL) return(MG_ECNTXT); n = -1; if (spec->xarr != NULL) { /* check for iteration */ register struct xf_array *ap = spec->xarr; (void)xf_aname((struct xf_array *)NULL); n = ap->ndim; while (n--) { if (++ap->aarg[n].i < ap->aarg[n].n) break; (void)strcpy(ap->aarg[n].arg, "0"); ap->aarg[n].i = 0; } if (n >= 0) { if ((rv = mg_fgoto(&ap->spos)) != MG_OK) return(rv); sprintf(ap->aarg[n].arg, "%d", ap->aarg[n].i); (void)xf_aname(ap); } } if (n < 0) { /* pop transform */ xf_context = spec->prev; free_xf(spec); return(MG_OK); } } else { /* else allocate transform */ if ((spec = new_xf(ac-1, av+1)) == NULL) return(MG_EMEM); if (spec->xarr != NULL) (void)xf_aname(spec->xarr); spec->prev = xf_context; /* push onto stack */ xf_context = spec; } /* translate new specification */ n = xf_ac(spec); n -= xf_ac(spec->prev); /* incremental comp. is more eff. */ if (xf(&spec->xf, n, xf_av(spec)) != n) return(MG_ETYPE); /* check for vertex reversal */ if ((spec->rev = (spec->xf.sca < 0.))) spec->xf.sca = -spec->xf.sca; /* compute total transformation */ if (spec->prev != NULL) { multmat4(spec->xf.xfm, spec->xf.xfm, spec->prev->xf.xfm); spec->xf.sca *= spec->prev->xf.sca; spec->rev ^= spec->prev->rev; } spec->xid = comp_xfid(spec->xf.xfm); /* compute unique ID */ return(MG_OK);}
开发者ID:MITSustainableDesignLab,项目名称:Daysim,代码行数:59,
示例16: ptdbool GiGraphics::drawHandle(const Point2d& pnt, int type, float angle, bool modelUnit){ if (m_impl->canvas && type >= 0 && !m_impl->stopping && !pnt.isDegenerate()) { Point2d ptd(pnt * S2D(xf(), modelUnit)); return m_impl->canvas->drawHandle(ptd.x, ptd.y, type, angle); } return false;}
开发者ID:Vito2015,项目名称:vgcore,代码行数:8,
示例17: pathwbool GiGraphics::drawPath(const GiContext* ctx, const MgPath& path, bool fill, bool modelUnit){ if (ctx && ctx->hasArrayHead() && path.getSubPathCount() == 1 && !path.isClosed()) { MgPath pathw(path); GiContext ctx2(*ctx); pathw.transform(S2D(xf(), modelUnit)); ctx2.setNoFillColor(); ctx2.setStartArrayHead(0); ctx2.setEndArrayHead(0); return drawPathWithArrayHead(ctx2, pathw, ctx->getStartArrayHead(), ctx->getEndArrayHead()); } return drawPath_(ctx, path, fill, S2D(xf(), modelUnit));}
开发者ID:Vito2015,项目名称:vgcore,代码行数:17,
示例18: fabsfbool GiGraphics::beginPaint(GiCanvas* canvas, const RECT_2D& clipBox){ if (!canvas || m_impl->canvas || isStopping()) { return false; } m_impl->canvas = canvas; m_impl->ctxused = 0; m_impl->stopping = 0; float phase = fabsf(m_impl->phase); m_impl->phase = (phase < 1e4f ? phase + 0.5f : 0.5f) * (m_impl->phase > 0 ? 1.f : -1.f); if (m_impl->lastZoomTimes != xf().getZoomTimes()) { m_impl->zoomChanged(); m_impl->lastZoomTimes = xf().getZoomTimes(); } m_impl->clipBox0 = clipBox; if (Box2d(clipBox).isEmpty()) { xf().getWndRect().get(m_impl->clipBox0); } m_impl->clipBox = m_impl->clipBox0; m_impl->rectDraw = m_impl->clipBox0; m_impl->rectDraw.inflate(GiGraphicsImpl::CLIP_INFLATE); m_impl->rectDrawM = Box2d(m_impl->rectDraw) * xf().displayToModel(); m_impl->rectDrawMaxM = xf().getWndRectM(); m_impl->rectDrawW = m_impl->rectDrawM * xf().modelToWorld(); m_impl->rectDrawMaxW = m_impl->rectDrawMaxM * xf().modelToWorld(); return true;}
开发者ID:Vito2015,项目名称:vgcore,代码行数:32,
示例19: ptdbool GiGraphics::drawHandle(const Point2d& pnt, int type, bool modelUnit){ if (m_impl->canvas && type >= 0 && !m_impl->stopping) { Point2d ptd(pnt * S2D(xf(), modelUnit)); m_impl->canvas->drawHandle(ptd.x, ptd.y, type); return true; } return false;}
开发者ID:gkrists,项目名称:TouchVG,代码行数:9,
示例20: cube/*static*/GfMatrix4dUsdImagingCubeAdapter::GetMeshTransform(UsdPrim const& prim, UsdTimeCode time){ double size = 2.0; UsdGeomCube cube(prim); TF_VERIFY(cube.GetSizeAttr().Get(&size, time)); GfMatrix4d xf(GfVec4d(size, size, size, 1.0)); return xf;}
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:11,
示例21: sphere/*static*/GfMatrix4dUsdImagingSphereAdapter::GetMeshTransform(UsdPrim const& prim, UsdTimeCode time){ double radius = 1.0; UsdGeomSphere sphere(prim); TF_VERIFY(sphere.GetRadiusAttr().Get(&radius, time)); GfMatrix4d xf(GfVec4d(radius, radius, radius, 1.0)); return xf;}
开发者ID:mplanck,项目名称:USD,代码行数:11,
示例22: ide_scsi_io_buffers/* * PIO data transfer routine using the scatter gather table. */static void ide_scsi_io_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, unsigned int bcount, int write){ ide_hwif_t *hwif = drive->hwif; const struct ide_tp_ops *tp_ops = hwif->tp_ops; xfer_func_t *xf = write ? tp_ops->output_data : tp_ops->input_data; char *buf; int count; while (bcount) { count = min(pc->sg->length - pc->b_count, bcount); if (PageHighMem(sg_page(pc->sg))) { unsigned long flags; local_irq_save(flags); buf = kmap_atomic(sg_page(pc->sg), KM_IRQ0) + pc->sg->offset; xf(drive, NULL, buf + pc->b_count, count); kunmap_atomic(buf - pc->sg->offset, KM_IRQ0); local_irq_restore(flags); } else { buf = sg_virt(pc->sg); xf(drive, NULL, buf + pc->b_count, count); } bcount -= count; pc->b_count += count; if (pc->b_count == pc->sg->length) { if (!--pc->sg_cnt) break; pc->sg = sg_next(pc->sg); pc->b_count = 0; } } if (bcount) { printk(KERN_ERR "%s: scatter gather table too small, %s/n", drive->name, write ? "padding with zeros" : "discarding data"); ide_pad_transfer(drive, write, bcount); }}
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:43,
示例23: GetDeviceCapsbool GiCanvasWin::beginPaint(HDC hdc, HDC attribDC, bool buffered, bool){ if (m_owner->isDrawing() || hdc == NULL) return false; if (attribDC == hdc) attribDC = NULL; HDC prtDC = (attribDC != NULL) ? attribDC : hdc; if (::GetMapMode(prtDC) != MM_TEXT) return false; m_attribDC = attribDC; m_impl->drawColors = GetDeviceCaps(prtDC, NUMCOLORS); m_impl->xform->setResolution((float)GetDeviceCaps(prtDC, LOGPIXELSX), (float)GetDeviceCaps(prtDC, LOGPIXELSY)); m_impl->isPrint = (DT_RASDISPLAY != GetDeviceCaps(prtDC, TECHNOLOGY)); if (m_impl->isPrint) { m_impl->xform->setWndSize(GetDeviceCaps(prtDC, HORZRES), GetDeviceCaps(prtDC, VERTRES)); } else { m_attribDC = NULL; } RECT clipBox; if (m_owner->isPrint() || (buffered && !hasCachedBitmap()) || ERROR == ::GetClipBox(hdc, &clipBox) || ::IsRectEmpty(&clipBox)) { ::SetRect(&clipBox, 0, 0, xf().getWidth(), xf().getHeight()); } m_owner->_beginPaint(giConvertRect(clipBox)); return true;}
开发者ID:acekiller,项目名称:touchvg,代码行数:40,
注:本文中的xf函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ xf86DrvMsg函数代码示例 C++ xexit函数代码示例 |