本文整理汇总了C++中RectF函数的典型用法代码示例。如果您正苦于以下问题:C++ RectF函数的具体用法?C++ RectF怎么用?C++ RectF使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RectF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Texture
void TextureResourceLoader::initTitleTexture(const String& pathImage)
{
this->titleTexture = Texture(pathImage);
this->tMain = this->titleTexture.uv(RectF(Vec2( 0.0, 0.0), Vec2(384.0, 64.0)));
this->tSub = this->titleTexture.uv(RectF(Vec2(384.0, 24.0), Vec2( 88.0, 36.0)));
this->tSpace = this->titleTexture.uv(RectF(Vec2( 16.0, 72.0), Vec2(224.0, 18.0)));
}
示例2: graphics
// 画图片信息
void CPopupList::DrawWindowEx(CDC &dc, CRect rcClient)
{
int nItemCount = m_vecItem.size();
CRect rcItem;
CSize sizeImage;
Graphics graphics(dc);
for(int i = 0; i < nItemCount; i++)
{
EditListItem &editListItem = m_vecItem.at(i);
rcItem = editListItem.rcItem;
sizeImage = editListItem.sizeImage;
// 删除按钮
if((i == m_nHoverItem) && (m_pImageClose != NULL))
{
graphics.DrawImage(m_pImageClose, RectF((Gdiplus::REAL)m_rcClose.left, (Gdiplus::REAL)m_rcClose.top, (Gdiplus::REAL)m_rcClose.Width(), (Gdiplus::REAL)m_rcClose.Height()),
(Gdiplus::REAL)(m_buttonState * m_sizeClose.cx), 0, (Gdiplus::REAL)m_sizeClose.cx, (Gdiplus::REAL)m_sizeClose.cy, UnitPixel);
}
// 列表图片
if(editListItem.pImage)
{
CRect rcHead(rcItem.left + 1, rcItem.top + 2, rcItem.left + 1 + rcItem.Height() - 4, rcItem.top + 2 + rcItem.Height() - 4);
graphics.DrawImage(editListItem.pImage, RectF((Gdiplus::REAL)rcHead.left, (Gdiplus::REAL)rcHead.top, (Gdiplus::REAL)rcHead.Width(), (Gdiplus::REAL)rcHead.Height()),
0, 0, (Gdiplus::REAL)editListItem.sizeImage.cx, (Gdiplus::REAL)editListItem.sizeImage.cy, UnitPixel);
DrawImageFrame(graphics, m_pImageHead, rcHead, i == m_nHoverItem ? m_sizeHead.cx : 0, 0, m_sizeHead.cx, m_sizeHead.cy, 5);
}
}
}
示例3: GdipCreateRoundRect
GraphicsPath* GdipCreateRoundRect( RectF& rect, int nRadiusLT, int nRadiusRT, int nRadiusRB, int nRadiusLB )
{
GraphicsPath roundRect;
if( nRadiusLT == 0 )
roundRect.AddLine( rect.GetLeft(), rect.GetTop(), rect.GetRight() - (nRadiusRT<<1), rect.GetTop() );
else
roundRect.AddArc( RectF(rect.GetLeft(), rect.GetTop(), (float)(nRadiusLT<<1), (float)(nRadiusLT<<1)), 180, 90 );
if( nRadiusRT == 0 )
roundRect.AddLine( rect.GetRight(), rect.GetTop(), rect.GetRight(), rect.GetBottom()-(float)(nRadiusRB<<1) );
else
roundRect.AddArc( RectF(rect.GetRight() - (float)(nRadiusRT<<1), rect.GetTop(), (float)(nRadiusRT<<1), (float)(nRadiusRT<<1)), 270, 90 );
if( nRadiusRB == 0 )
roundRect.AddLine( rect.GetRight(), rect.GetBottom(), rect.GetLeft()-(float)(nRadiusLB<<1), rect.GetBottom() );
else
roundRect.AddArc( RectF(rect.GetRight() - (float)(nRadiusRB<<1), rect.GetBottom() -(float)(nRadiusRB<<1), (float)(nRadiusRB<<1), (float)(nRadiusRB<<1)), 0, 90 );
if( nRadiusLB == 0 )
roundRect.AddLine( rect.GetLeft(), rect.GetBottom(), rect.GetLeft(), rect.GetTop()-(float)(nRadiusLT<<1) );
else
roundRect.AddArc( RectF(rect.GetLeft(), rect.GetBottom() -(float)(nRadiusLB<<1), (float)(nRadiusLB<<1), (float)(nRadiusLB<<1)), 90, 90 );
roundRect.CloseFigure();
return roundRect.Clone();
}
示例4: GetBlackBars
[[nodiscard]] inline Array<RectF> GetBlackBars(const Size& baseSize = Window::BaseSize())
{
const double sx = static_cast<double>(Window::Width()) / baseSize.x;
const double sy = static_cast<double>(Window::Height()) / baseSize.y;
const double s = Min(sx, sy);
if (sx < sy)
{
const double h = (Window::Height() - baseSize.y * s) * 0.5;
return Array<RectF>{ RectF(0, 0, Window::Width(), h), RectF(0, Window::Height() - h,Window::Width(), h) };
}
else if (sx > sy)
{
const double w = (Window::Width() - baseSize.x * s) * 0.5;
return Array<RectF>{ RectF(0, 0, w, Window::Height()), RectF(Window::Width() - w, 0, w, Window::Height()) };
}
else
{
return Array<RectF>();
}
}
示例5: uv
CoreRectangleShape_Imp::CoreRectangleShape_Imp()
:drawingArea(RectF())
, uv(RectF())
, angle(0)
{
}
示例6: Vec2
void TextureResourceLoader::divideBackgroundGraphs(const Image& baseImage)
{
const auto bkSize = Vec2(321.0f, 241.0f);
this->bkFrontSun = Texture(clipImage(baseImage, RectF(Vec2( 334.0, 10.0), bkSize), tsTransColor));
this->bkSun = Texture(clipImage(baseImage, RectF(Vec2(1630.0, 10.0), Vec2(97.0, 97.0)), tsTransColor));
this->bkBehindSun = Texture(clipImage(baseImage, RectF(Vec2( 658.0, 10.0), bkSize), tsTransColor));
this->bkBuildings.emplace_back(clipImage(baseImage, RectF(Vec2( 982.0, 10.0), bkSize), tsTransColor));
this->bkBuildings.emplace_back(clipImage(baseImage, RectF(Vec2(1306.0, 10.0), bkSize), tsTransColor));
}
示例7: RectF
AnimationFrame::AnimationFrame(spNativeTexture t)
{
_row = _column = 0;
_resAnim = 0;
_diffuse.base = t;
_diffuse.premultiplied = true;
_srcRect = RectF(0, 0, 1, 1);
_destRect = RectF(0, 0, (float)t->getWidth(), (float)t->getHeight());
_frameSize = Vector2((float)t->getWidth(), (float)t->getHeight());
}
示例8: RectF
RectF FontData::getRegion(const String& codePoints, const double lineSpacingScale)
{
if (!render(codePoints))
{
return RectF(0);
}
Vec2 penPos(0, 0);
Vec2 minPos(DBL_MAX, DBL_MAX);
Vec2 maxPos(DBL_MIN, DBL_MIN);
int32 lineCount = 0;
for (const auto codePoint : codePoints)
{
if (codePoint == U'\n')
{
penPos.x = 0;
penPos.y += m_lineSpacing * lineSpacingScale;
++lineCount;
}
else if (codePoint == U'\t')
{
minPos.x = std::min(minPos.x, penPos.x);
minPos.y = std::min(minPos.y, penPos.y + m_ascender);
maxPos.x = std::max(maxPos.x, penPos.x + m_tabWidth);
maxPos.y = std::max(maxPos.y, penPos.y);
penPos.x += m_tabWidth;
}
else if (!IsControl(codePoint))
{
if (lineCount == 0)
{
++lineCount;
}
const auto& glyphInfo = m_glyphs[m_glyphIndexTable[codePoint]];
const RectF region(penPos + glyphInfo.offset, glyphInfo.bitmapRect.size);
const int32 characterWidth = glyphInfo.xAdvance;
minPos.x = std::min(minPos.x, region.x);
minPos.y = std::min(minPos.y, region.y);
maxPos.x = std::max(maxPos.x, penPos.x + characterWidth);
maxPos.y = std::max(maxPos.y, region.y + region.h);
penPos.x += glyphInfo.xAdvance;
}
}
if (minPos == Vec2(DBL_MAX, DBL_MAX))
{
return RectF(0);
}
return RectF(0, 0, maxPos.x, lineCount * m_lineSpacing * lineSpacingScale);
}
示例9: g
void CPropSelUser::drawSkin(void)
{
if(!imgDialog)
return;
CDC *pdc=this->GetWindowDC();
if(!pdc)return;
CRect rc;
this->GetWindowRect(&rc);
Graphics g(pdc->m_hDC);
int topHeight=32;//GetSystemMetrics(SM_CYFRAME)+GetSystemMetrics(SM_CYSIZE)+6;
g.DrawImage(imgDialog,RectF(0.0f,0.0f,10.0f,topHeight),0.0f,0.0f,10.0f,topHeight,UnitPixel);
g.DrawImage(imgDialog,RectF(10.0f,0.0f,rc.Width()-20,topHeight),9.0f,0.0f,1.0f,topHeight,UnitPixel);
g.DrawImage(imgDialog,RectF((REAL)rc.Width()-10,0.0f,10.0f,topHeight),imgDialog->GetWidth()-10,0.0f,10.0f,topHeight,UnitPixel);
m_bkColor=pdc->GetPixel(9,topHeight-1);
m_txtColor^=m_bkColor;
int bottomHeight=10;
g.DrawImage(imgDialog,RectF(0.0f,topHeight,10.0f,rc.Height()-topHeight-bottomHeight),0.0f,topHeight,10.0f,imgDialog->GetHeight()-topHeight-bottomHeight,UnitPixel);
g.DrawImage(imgDialog,RectF(rc.Width()-10.0f,topHeight,10.0f,rc.Height()-topHeight-bottomHeight),
imgDialog->GetWidth()-10,topHeight,10.0f,1,UnitPixel);
g.DrawImage(imgDialog,RectF(0,rc.Height()-bottomHeight,imgDialog->GetWidth()-5,bottomHeight),0,imgDialog->GetHeight()-bottomHeight,10,bottomHeight,UnitPixel);
g.DrawImage(imgDialog,RectF(10,rc.Height()-bottomHeight,rc.Width()-20,bottomHeight),10,imgDialog->GetHeight()-bottomHeight,1,bottomHeight,UnitPixel);
g.DrawImage(imgDialog,RectF(rc.Width()-10,rc.Height()-bottomHeight,10,bottomHeight),imgDialog->GetWidth()-10,imgDialog->GetHeight()-bottomHeight,10,bottomHeight,UnitPixel);
CString s="宋体";
Font font(s.AllocSysString(),12,0,UnitPixel);
SolidBrush brush(Color(255,255,255));
s.Format("请选择道具 [%s] 使用对象,当前游戏中有 %d 个可用用户对象",propItemName,maxUser);
g.DrawString(s.AllocSysString(),-1,&font,PointF(5,5),0,&brush);
StringFormat sf;
sf.SetAlignment(StringAlignmentCenter);
m_bnClose.Invalidate(FALSE);
brush.SetColor(Color(0,0,0));
Pen pen(&brush);//20081128
REAL x,y,w,h; //20081128,计算具体图片的位置
for(int i=0;i<maxUser;i++)
{
x=userRect[i].left+(66-userImg[i]->GetWidth())/2;
y=userRect[i].top+(105-userImg[i]->GetHeight())/2;
w=userImg[i]->GetWidth();
h=userImg[i]->GetHeight();
g.DrawImage(userImg[i],x,y,w,h);//画头像,替换原来的画头像代码
//画选择区域边框
g.DrawRectangle(&pen,userRect[i].left , userRect[i].top ,
userRect[i].Width() , userRect[i].Height());
g.DrawString(userName[i].AllocSysString() ,-1 ,&font ,
RectF(userRect[i].left,userRect[i].bottom+5,userRect[i].Width(),30),&sf,&brush);
}
g.ReleaseHDC(pdc->m_hDC);
}
示例10: TextureLine
TextureLine(spNativeTexture t)
{
setVerticalMode(Box9Sprite::TILING_FULL);
setHorizontalMode(Box9Sprite::TILING_FULL);
Sprite::setResAnim(DebugActor::resSystem->getResAnim("checker"));
AnimationFrame f;
Vector2 s = fitSize(itemSize, Vector2((float)t->getWidth(), (float)t->getHeight()));
setSize(s);
Diffuse df;
df.base = t;
f.init(0, df, RectF(0, 0, 1.0f, 1.0f), RectF(0, 0, s.x, s.y), s);
spSprite image = initActor(new Sprite,
arg_blend = blend_disabled,
arg_resAnim = f);
addChild(image);
spColorRectSprite rect = initActor(new ColorRectSprite,
arg_color = Color(Color::White, 255),
arg_attachTo = this);
rect->addTween(Sprite::TweenColor(Color(Color::White, 0)), 4000, -1, true);
char path[255];
path::normalize(t->getName().c_str(), path);
char txt[255];
safe_sprintf(txt, "%s\n<div c=\"FF0000\">%s</div>-<div c=\"0000ff\">%dx%d</div>\nid: %d",
path,
textureFormat2String(t->getFormat()),
t->getWidth(), t->getHeight(), t->getObjectID());
spTextField text = initActor(new TextField,
arg_color = Color::Black,
arg_w = (float)itemSize.x,
arg_vAlign = TextStyle::VALIGN_TOP,
arg_hAlign = TextStyle::HALIGN_LEFT,
arg_multiline = true,
arg_attachTo = rect,
arg_htmlText = txt
);
text->setBreakLongWords(true);
rect->setSize(text->getTextRect().size.cast<Vector2>() + Vector2(2, 2));
rect->setY((itemSize.y - rect->getHeight()) / 2.0f);
}
示例11: RageVector3
void Actor::TweenState::Init()
{
pos = RageVector3( 0, 0, 0 );
rotation = RageVector3( 0, 0, 0 );
quat = RageVector4( 0, 0, 0, 1 );
scale = RageVector3( 1, 1, 1 );
crop = RectF( 0,0,0,0 );
fade = RectF( 0,0,0,0 );
fadecolor = RageColor( 1, 1, 1, 0 );
for(int i=0; i<4; i++)
diffuse[i] = RageColor( 1, 1, 1, 1 );
glow = RageColor( 1, 1, 1, 0 );
glowmode = GLOW_WHITEN;
}
示例12: SpriteData
EnermyWhiteBullet::EnermyWhiteBullet(float x, float y, bool isBoosting, float angle, int kindBullet)
{
pData = new SpriteData();
pData -> isHittable = false;
pData->isDesTroyed = false;
this->kindBullet = kindBullet;
pData->ppTextureArrays = new TextureArray*[2];
pData->ppTextureArrays[0] = new TextureArray("Resources\\Sprites\\Bullets", "wbullet", "", 1, 10);
pData->ppTextureArrays[0]->setAnchorPoint(0.5f, 0.5f);
pData->ppTextureArrays[1] = new TextureArray("Resources\\Sprites\\Bullets", "tankbullet", "", 1, 10);
pData->ppTextureArrays[1]->setAnchorPoint(0.5f, 0.5f);
pData->x = x;
pData->y = y;
pData->body = RectF(-pData->ppTextureArrays[kindBullet]->getWidth() / 2, -pData->ppTextureArrays[0]->getHeight(), pData->ppTextureArrays[0]->getWidth(), pData->ppTextureArrays[0]->getHeight());
pData->pState = new BulletMovingState(pData, 1.0f, angle, 0);
}
示例13: MeasureTextAccurate
// http://www.codeproject.com/KB/GDI-plus/measurestring.aspx
RectF MeasureTextAccurate(Graphics* g, Font* f, const WCHAR* s, int len) {
if (0 == len) {
return RectF(0, 0, 0, 0); // TODO: should set height to font's height
}
// note: frankly, I don't see a difference between those StringFormat variations
StringFormat sf(StringFormat::GenericTypographic());
sf.SetFormatFlags(sf.GetFormatFlags() | StringFormatFlagsMeasureTrailingSpaces);
// StringFormat sf(StringFormat::GenericDefault());
// StringFormat sf;
RectF layoutRect;
CharacterRange cr(0, len);
sf.SetMeasurableCharacterRanges(1, &cr);
Region r;
Status status = g->MeasureCharacterRanges(s, len, f, layoutRect, &sf, 1, &r);
if (status != Ok) {
// TODO: remove whem we figure out why we crash
if (!s) {
s = L"<null>";
}
auto s2 = str::conv::ToUtf8(s, (size_t)len);
dbglog::CrashLogF("MeasureTextAccurate: status: %d, font: %p, len: %d, s: '%s'\n", (int)status, f, len,
s2.Get());
CrashIf(status != Ok);
}
RectF bbox;
r.GetBounds(&bbox, g);
if (bbox.Width != 0)
bbox.Width += PER_STR_DX_ADJUST + (PER_CHAR_DX_ADJUST * (float)len);
return bbox;
}
示例14: FOREACH_ENUM
void StreamDisplay::Load( const RString & /* unreferenced: _sMetricsGroup */)
{
// XXX: actually load from the metrics group passed in -aj
RString sMetricsGroup = "StreamDisplay";
m_transformPill.SetFromReference( THEME->GetMetricR(sMetricsGroup,"PillTransformFunction") );
VELOCITY_MULTIPLIER.Load(sMetricsGroup, "VelocityMultiplier");
VELOCITY_MIN.Load(sMetricsGroup, "VelocityMin");
VELOCITY_MAX.Load(sMetricsGroup, "VelocityMax");
SPRING_MULTIPLIER.Load(sMetricsGroup, "SpringMultiplier");
VISCOSITY_MULTIPLIER.Load(sMetricsGroup, "ViscosityMultiplier");
float fTextureCoordScaleX = THEME->GetMetricF(sMetricsGroup,"TextureCoordScaleX");
int iNumPills = static_cast<int>(THEME->GetMetricF(sMetricsGroup,"NumPills"));
m_bAlwaysBounce = THEME->GetMetricB(sMetricsGroup,"AlwaysBounceNormalBar");
FOREACH_ENUM( StreamType, st )
{
ASSERT( m_vpSprPill[st].empty() );
for( int i=0; i<iNumPills; i++ )
{
Sprite *pSpr = new Sprite;
pSpr->Load( THEME->GetPathG( sMetricsGroup, StreamTypeToString(st) ) );
m_vpSprPill[st].push_back( pSpr );
m_transformPill.TransformItemDirect( *pSpr, -1, i, iNumPills );
float f = 1 / fTextureCoordScaleX;
pSpr->SetCustomTextureRect( RectF(f*i,0,f*(i+1),1) );
this->AddChild( pSpr );
}
}
示例15: RectF
VOID DUI_ImageButton::Draw(DUI_Status s)
{
m_MemDC->Clear();
if (m_bVisialbe)
{
if (s == S_Invalid)
{
s = m_CurState;
}
Image* pImg;
if (m_StatusImage[0] == nullptr)
{
pImg = m_StatusImage[s];
//ASSERT(pImg != nullptr);
m_MemDC->graphics->DrawImage(pImg, 0, 0);
}
else
{
pImg = m_StatusImage[0];
if (s == S_Focus || s == S_Disabled)
{
s = S_Normal;
}
m_MemDC->graphics->DrawImage(pImg, RectF(0.0, 0.0, m_Rect->Width, m_Rect->Height), m_Start + (s - 1)*m_Rect->Width, 0.0, m_Rect->Width, m_Rect->Height, UnitPixel);
}
if (m_Text != nullptr)
{
SolidBrush TextBrush(*m_Text->color);
INT offset = (m_bMouseDown) ? 1 : 0;
m_MemDC->graphics->DrawString(m_Text->string->GetString(), m_Text->string->GetLength(), m_Text->font, RectF(m_Text->rect->X + offset, m_Text->rect->Y + offset, m_Text->rect->Width, m_Text->rect->Height), m_Text->format, &TextBrush);
}
DUI_ControlBase::Draw();
}
return VOID();
}