本文整理汇总了C++中RectF类的典型用法代码示例。如果您正苦于以下问题:C++ RectF类的具体用法?C++ RectF怎么用?C++ RectF使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RectF类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SelectItemsWithin
void CRender::SelectItemsWithin(const RectF &r)
{
CComPtr<boost::scoped_lock_ref_counted> lock;
CComPtr<IGraphItem> item;
CComPtr<IUnknown> unk;
CComQIPtr<IRenderer> ir;
RectF box;
IGraphItemVector results;
m_graph->GetChildren(results);
for(IGraphItemVector::iterator itr=results.begin(); itr!=results.end(); ++itr)
{
item=*itr;
unk=item->GetPropertyUnknown(0);
if(unk)
{
ir=static_cast<IRenderer*>(unk.p);
if(ir!=0)
{
ir->GetBoundsBox(box);
if(box.IntersectsWith(r))
ir->SetSelected(true, true);
}
}
}
}
示例2: GPDrawShadowTextSimple
void GPDrawShadowTextSimple( Graphics&gc, CString& strTxtIn, CRect& rcIn, Gdiplus::Font& fontIn, ARGB BrushClrIn, ARGB shadowBrushClrIn /*= 0xff000000*/, int nOffXIn /*= 2*/, int nOffYIn /*= 2*/, StringFormat* fmtIn /*= NULL*/ )
{
Gdiplus::Font& gcfont = fontIn;
Rect rcText = CRect2Rect(rcIn);
StringFormat fmt;
fmt.SetAlignment(StringAlignmentCenter);
fmt.SetTrimming(StringTrimmingEllipsisWord);
fmt.SetLineAlignment(StringAlignmentCenter);
StringFormat& fmtUse = fmtIn == NULL? fmt:*fmtIn;
GraphicsContainer gcContainer = gc.BeginContainer();
gc.SetSmoothingMode(SmoothingModeAntiAlias);
CComBSTR btrTxtIn(strTxtIn);
SolidBrush textbrush(ARGB2Color(shadowBrushClrIn));
RectF rfText = Rect2RectF(rcText);
if (shadowBrushClrIn != 0)
{
rfText.Offset(1.0, 1.0);
gc.DrawString(btrTxtIn, -1, &gcfont, rfText, &fmtUse, &textbrush);
}
textbrush.SetColor(ARGB2Color(BrushClrIn));
gc.DrawString(btrTxtIn, -1, &gcfont, rfText, &fmtUse, &textbrush);
gc.EndContainer(gcContainer);
}
示例3: AssertFatal
void GFXDrawUtil::drawBitmapSR( GFXTextureObject*texture, const Point2F &in_rAt, const RectF &srcRect, const GFXBitmapFlip in_flip /*= GFXBitmapFlip_None*/, const GFXTextureFilterType filter /*= GFXTextureFilterPoint */ , bool in_wrap /*= true*/ )
{
AssertFatal( texture != 0, "No texture specified for drawBitmapSR()" );
RectF stretch( in_rAt.x, in_rAt.y, srcRect.len_x(), srcRect.len_y() );
drawBitmapStretchSR( texture, stretch, srcRect, in_flip, filter, in_wrap );
}
示例4: CreateSharedPtrWithReleaseDLL
void CoreLayer2D_Imp::DrawRotatedRectangleAdditionally(RectF drawingArea, Color color, Vector2DF rotationCenter, float angle, RectF uv, Texture2D* texture, AlphaBlendMode alphaBlend, int32_t priority)
{
Sprite sprite;
std::array<Color, 4> col = { color, color, color, color };
SafeAddRef(texture);
auto vertexes = drawingArea.GetVertexes();
auto globalCenter = vertexes[0] + rotationCenter;
for (auto& vert : vertexes)
{
vert -= globalCenter;
auto deg = vert.GetDegree();
deg += angle;
vert.SetDegree(deg);
vert += globalCenter;
}
sprite.pos = vertexes;
sprite.col = col;
sprite.uv = uv.GetVertexes();
sprite.Texture_ = CreateSharedPtrWithReleaseDLL(texture);
sprite.AlphaBlend_ = alphaBlend;
sprite.Priority = priority;
sprites.push_back(sprite);
}
示例5: r
void TreeInspectorPreview::init(spActor item)
{
//_item = item;
STDRenderer r(&_videoCache);
RenderState rs;
rs.renderer = &r;
rs.transform = item->getTransform();
r.begin(0);
//r.setTransform(rs.transform);
item->doRender(rs);
r.end();
r.drawBatch();
setSize(30, 30);
RectF itemRect = _videoCache._bounds;
if (itemRect.isEmpty())
{
itemRect = item->getDestRect();
if (itemRect.isEmpty())
itemRect.setSize(Vector2(10, 4));
}
Vector2 ns = fitSize(Vector2(50.0f, 50.0f), itemRect.size);
float scale = ns.x / itemRect.size.x;
_cacheTransform.identity();
_cacheTransform.scale(Vector2(scale, scale));
_cacheTransform.translate(-itemRect.pos);
AnimationFrame fr = _tree->_resSystem->getResAnim("checker")->getFrame(0, 0);
//Point itemSize(30, 30);// = _getItemRect().size;
RectF srcRect = fr.getSrcRect();
const Diffuse& df = fr.getDiffuse();
srcRect.size.x = ns.x / (float)df.base->getWidth();
srcRect.size.y = ns.y / (float)df.base->getHeight();
RectF destRect = fr.getDestRect();
destRect.size = ns;
AnimationFrame cfr;
cfr.init(0, df, srcRect, destRect, ns);
setAnimFrame(cfr);
/*
spEventHandler bh = new EventHandler();
bh->setCallbackEnter(CLOSURE(this, &TreeInspectorPreview::_onEvent));
bh->setCallbackExit(CLOSURE(this, &TreeInspectorPreview::_onEvent));
bh->setCallbackPressDown(CLOSURE(this, &TreeInspectorPreview::_onEvent));
bh->setCallbackPressUp(CLOSURE(this, &TreeInspectorPreview::_onEvent));
addEventHandler(bh);
*/
}
示例6: GetParentRectangle
RectF WidgetLayout::GetRect() const
{
RectF parentRect = GetParentRectangle();
RectF rectangle(mData->offsetMin + mData->anchorMin*parentRect.Size(),
mData->offsetMax + mData->anchorMax*parentRect.Size());
return rectangle;
}
示例7: RectFUnion
static RectF RectFUnion(RectF& r1, RectF& r2) {
if (r2.IsEmptyArea())
return r1;
if (r1.IsEmptyArea())
return r2;
RectF ru;
ru.Union(ru, r1, r2);
return ru;
}
示例8: deselect
void GridLabel::deselect(void)
{
RectF r;
r.setLeft(-2);
r.setRight(-2);
r.setTop(-1);
r.setBottom(-1);
m_pEditData->setCatchRect(r);
update();
}
示例9: FillRectangle
void Graphics::FillRectangle(Brush* brush, const RectF& rc) {
cairo_t* cg = reinterpret_cast<cairo_t*>(_private);
cairo_save(cg);
cairo_pattern_t* cp = reinterpret_cast<cairo_pattern_t*>(brush->_private);
cairo_set_source(cg, cp);
cairo_translate(cg, rc.GetLeft(), rc.GetTop());
cairo_rectangle(cg, 0, 0, rc.GetWidth(), rc.GetHeight());
cairo_fill(cg);
cairo_restore(cg);
}
示例10: GTEST_TEST
GTEST_TEST(RageRect, float_center)
{
using namespace Rage;
RectF test;
RectF bigger{ -1, -1, 1, 1 };
EXPECT_EQ(test.GetCenterX(), bigger.GetCenterX());
EXPECT_EQ(test.GetCenterY(), bigger.GetCenterY());
}
示例11: DrawImage
void Graphics::DrawImage(Image* image, const RectF& rc, const ImageAttributes* attr) {
Gdiplus::Graphics* g = reinterpret_cast<Gdiplus::Graphics*>(_private);
Gdiplus::Image* gdiImage = reinterpret_cast<Gdiplus::Image*>(image->_private);
if(attr!=0) {
Gdiplus::ImageAttributes* ia = reinterpret_cast<Gdiplus::ImageAttributes*>(attr->_private);
g->DrawImage(gdiImage, Gdiplus::RectF(rc.GetLeft(), rc.GetTop(), rc.GetWidth(), rc.GetHeight()), 0.0f, 0.0f, (float)gdiImage->GetWidth(), (float)gdiImage->GetHeight(), Gdiplus::UnitPixel, ia);
}
else {
g->DrawImage(gdiImage, ToGDIRect<RectF, Gdiplus::RectF>(rc));
}
}
示例12: DrawRectangle
void Graphics::DrawRectangle(Pen* pen, const RectF& rc) {
cairo_t* cg = reinterpret_cast<cairo_t*>(_private);
cairo_save(cg);
PenPrivate* pp = reinterpret_cast<PenPrivate*>(pen->_private);
cairo_pattern_t* cp = pp->pattern;
cairo_set_source(cg, cp);
cairo_set_line_width(cg, pp->width);
cairo_translate(cg, rc.GetLeft(), rc.GetTop());
cairo_rectangle(cg, 0, 0, rc.GetWidth(), rc.GetHeight());
cairo_stroke(cg);
cairo_restore(cg);
}
示例13: selectionRectUV
void UnwrappedSurface::zoom() {
if (!m_viewImage)
return;
RectF newView = selectionRectUV();
if (newView.isEmpty())
return;
m_zoomStack.push(m_viewRect);
m_viewRect = newView;
updateView();
emptySelectionRect();
emit updateInfoText();
}
示例14: DrawShadow
void CRevisionGraphWnd::DrawShadow (GraphicsDevice& graphics, const RectF& rect,
Color shadowColor, NodeShape shape)
{
// draw the shadow
RectF shadow = rect;
shadow.Offset (2, 2);
Pen pen (shadowColor);
SolidBrush brush (shadowColor);
DrawShape (graphics, shadowColor, 1, &pen, shadowColor, &brush, shadow, shape);
}
示例15: transformBox
RectF Transformation::transformedBounds() const
{
// Get transformed corners
Corners corners;
transformBox(corners);
// Create a union of all corners
RectF bounds;
for (int i=0; i<Corners::NUM_OF_CORNERS; ++i)
bounds = bounds.createUnion(RectF(corners[i].x, corners[i].y, 1, 1));
return bounds;
}