本文整理汇总了C++中nuiRect::Bottom方法的典型用法代码示例。如果您正苦于以下问题:C++ nuiRect::Bottom方法的具体用法?C++ nuiRect::Bottom怎么用?C++ nuiRect::Bottom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nuiRect
的用法示例。
在下文中一共展示了nuiRect::Bottom方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GlobalToClientRect
void nuiDecoration::GlobalToClientRect(nuiRect& rRect, const nuiWidget* pWidget) const
{
nuiRect clientRect = GetIdealClientRect(pWidget);
// nuiSize bordertop = GetBorder(nuiTop, pWidget);
// nuiSize borderleft = GetBorder(nuiLeft, pWidget);
nuiSize borderright = GetBorder(nuiRight, pWidget);
nuiSize borderbottom = GetBorder(nuiBottom, pWidget);
float X1 = (float)clientRect.Left();
float X2 = (float)clientRect.Right();
float X3 = (float)clientRect.Right()+borderright;
float Y1 = (float)clientRect.Top();
float Y2 = (float)clientRect.Bottom();
float Y3 = (float)clientRect.Bottom()+borderbottom;
const float x0 = (float)rRect.Left();
const float x1 = x0 + X1;
const float x3 = (float)rRect.Right();
const float x2 = x3 - (X3 - X2);
const float y0 = (float)rRect.Top();
const float y1 = y0 + Y1;
const float y3 = (float)rRect.Bottom();
const float y2 = y3 - (Y3 - Y2);
rRect.Set(x1, y1, x2, y2, false);
}
示例2: LoadProjectionMatrix
void nuiPainter::LoadProjectionMatrix(const nuiRect& rViewport, const nuiMatrix& rMatrix)
{
NGL_ASSERT(!mProjectionMatrixStack.empty());
mProjectionMatrixStack.top() = rMatrix;
nuiMatrix LocalMatrix(mMatrixStack.top());
nuiVector vec1(rViewport.Left(), rViewport.Top(), 0.0f);
nuiVector vec2(rViewport.Right(), rViewport.Bottom(), 0.0f);
vec1 = LocalMatrix * vec1;
vec2 = LocalMatrix * vec2;
mProjectionViewportStack.top().Set(vec1[0], vec1[1], vec2[0], vec2[1], false);
}
示例3: TextureToImageCoord
void nuiTexture::TextureToImageCoord(nuiRect& rRect) const
{
nuiSize x, y, xx, yy;
x = rRect.Left();
y = rRect.Top();
xx = rRect.Right();
yy = rRect.Bottom();
TextureToImageCoord(x, y);
TextureToImageCoord(xx, yy);
rRect.Set(x, y, xx, yy, false);
}
示例4: nuiDrawRect
static void nuiDrawRect(const nuiRect& out, nuiRenderArray& rArray)
{
rArray.SetMode(GL_TRIANGLE_STRIP);
rArray.Reserve(8);
nuiRect in(out);
in.Grow(-nuiGetInvScaleFactor(), -nuiGetInvScaleFactor());
rArray.SetVertex(out.Left(), out.Top()); rArray.PushVertex();
rArray.SetVertex(in.Left(), in.Top()); rArray.PushVertex();
rArray.SetVertex(out.Right(), out.Top()); rArray.PushVertex();
rArray.SetVertex(in.Right(), in.Top()); rArray.PushVertex();
rArray.SetVertex(out.Right(), out.Bottom()); rArray.PushVertex();
rArray.SetVertex(in.Right(), in.Bottom()); rArray.PushVertex();
rArray.SetVertex(out.Left(), out.Bottom()); rArray.PushVertex();
rArray.SetVertex(in.Left(), in.Bottom()); rArray.PushVertex();
rArray.SetVertex(out.Left(), out.Top()); rArray.PushVertex();
rArray.SetVertex(in.Left(), in.Top()); rArray.PushVertex();
}
示例5: ClientToGlobalRect
void nuiDecoration::ClientToGlobalRect(nuiRect& rRect, const nuiWidget* pWidget) const
{
nuiSize bordertop = GetBorder(nuiTop, pWidget);
nuiSize borderleft = GetBorder(nuiLeft, pWidget);
nuiSize borderright = GetBorder(nuiRight, pWidget);
nuiSize borderbottom = GetBorder(nuiBottom, pWidget);
rRect.Set(rRect.Left() - borderleft,
rRect.Top() - bordertop,
rRect.Right() + borderright,
rRect.Bottom() + borderbottom,
false);
}
示例6: GetClipRect
bool nuiPainter::GetClipRect(nuiRect& rRect, bool LocalRect) const
{
if (mClip.mEnabled)
{
rRect = mClip;
}
else
{
rRect.Set(0, 0, mWidth, mHeight);
}
if (LocalRect)
{
// Transform the rect with the inverse of the current matrix
nglMatrixf m(GetMatrix());
m.InvertHomogenous();
nglVectorf v1(rRect.Left(), rRect.Top(), 0, 1);
nglVectorf v2(rRect.Right(), rRect.Bottom(), 0, 1);
v1 = m * v1;
v2 = m * v2;
rRect.Set(v1[0], v1[1], v2[0], v2[1], false);
}
return mClip.mEnabled;
}
示例7: DrawGradient
void nuiGLDrawContext::DrawGradient(const nuiGradient& rGradient, const nuiRect& rEnclosingRect, nuiSize x1, nuiSize y1, nuiSize x2, nuiSize y2)
{
nglVector2f vec(x2 - x1, y2 - y1);
nglVector2f para(-vec[1], vec[0]);
nglVector2f vec1(vec);
nglVector2f para1(para);
vec1.Normalize();
para1.Normalize();
// What Quadrant are we in?:
// |
// a | b
// |
// ----------------
// |
// c | d
// |
float xa, xb, xc, xd;
float ya, yb, yc, yd;
float x, y;
float xp, yp;
float xx, yy;
float xxp, yyp;
xa = xc = rEnclosingRect.Left();
xb = xd = rEnclosingRect.Right();
ya = yb = rEnclosingRect.Top();
yc = yd = rEnclosingRect.Bottom();
if (x1 < x2)
{
// Go from a to d or c to b
if (y1 == y2)
{
x = xa; y = ya;
xp = xc; yp = yc;
xx = xd; yy = yd;
xxp= xb; yyp= yb;
}
else if (y1 < y2)
{
// a to d
IntersectLines(xa,ya, para1[0], para1[1], xb, yb, vec1[0], vec1[1], x, y);
IntersectLines(xa,ya, para1[0], para1[1], xc, yc, vec1[0], vec1[1], xp, yp);
IntersectLines(xd,yd, para1[0], para1[1], xc, yc, vec1[0], vec1[1], xx, yy);
IntersectLines(xd,yd, para1[0], para1[1], xb, yb, vec1[0], vec1[1], xxp, yyp);
}
else
{
// c to d
IntersectLines(xc,yc, para1[0], para1[1], xa, ya, vec1[0], vec1[1], x, y);
IntersectLines(xc,yc, para1[0], para1[1], xd, yd, vec1[0], vec1[1], xp, yp);
IntersectLines(xb,yb, para1[0], para1[1], xd, yd, vec1[0], vec1[1], xx, yy);
IntersectLines(xb,yb, para1[0], para1[1], xa, ya, vec1[0], vec1[1], xxp, yyp);
}
}
else
{
if (y1 == y2)
{
x = xd; y = yd;
xp = xb; yp = yb;
xx = xa; yy = ya;
xxp= xc; yyp= yc;
}
else if (y1 < y2)
{
// b to c
IntersectLines(xb,yb, para1[0], para1[1], xd, yd, vec1[0], vec1[1], x, y);
IntersectLines(xb,yb, para1[0], para1[1], xa, ya, vec1[0], vec1[1], xp, yp);
IntersectLines(xc,yc, para1[0], para1[1], xa, ya, vec1[0], vec1[1], xx, yy);
IntersectLines(xc,yc, para1[0], para1[1], xd, yd, vec1[0], vec1[1], xxp, yyp);
}
else
{
// d to a
IntersectLines(xd,yd, para1[0], para1[1], xc, yc, vec1[0], vec1[1], x, y);
IntersectLines(xd,yd, para1[0], para1[1], xb, yb, vec1[0], vec1[1], xp, yp);
IntersectLines(xa,ya, para1[0], para1[1], xb, yb, vec1[0], vec1[1], xx, yy);
IntersectLines(xa,ya, para1[0], para1[1], xc, yc, vec1[0], vec1[1], xxp, yyp);
}
}
float startx,starty;
float startxp,startyp;
float stopx,stopy;
float stopxp,stopyp;
if (y1 != y2)
{
IntersectLines(x1, y1, para1[0], para1[1], x, y, vec1[0], vec1[1], startx, starty);
IntersectLines(x1, y1, para1[0], para1[1], xp, yp, vec1[0], vec1[1], startxp, startyp);
IntersectLines(x2, y2, para1[0], para1[1], x, y, vec1[0], vec1[1], stopx, stopy);
IntersectLines(x2, y2, para1[0], para1[1], xp, yp, vec1[0], vec1[1], stopxp, stopyp);
}
else
{
startx = x1; starty = y;
startxp = x1; startyp = yp;
stopx = x2; stopy = y;
//.........这里部分代码省略.........
示例8: DrawGradient
void nuiDrawContext::DrawGradient(const nuiGradient& rGradient, const nuiRect& rEnclosingRect, nuiSize x1, nuiSize y1, nuiSize x2, nuiSize y2)
{
nuiVector2 vec(x2 - x1, y2 - y1);
nuiVector2 para(-vec[1], vec[0]);
nuiVector2 vec1(vec);
nuiVector2 para1(para);
vec1.Normalize();
para1.Normalize();
// What Quadrant are we in?:
// |
// a | b
// |
// ----------------
// |
// c | d
// |
float xa, xb, xc, xd;
float ya, yb, yc, yd;
float x, y;
float xp, yp;
float xx, yy;
float xxp, yyp;
xa = xc = rEnclosingRect.Left();
xb = xd = rEnclosingRect.Right();
ya = yb = rEnclosingRect.Top();
yc = yd = rEnclosingRect.Bottom();
if (x1 < x2)
{
// Go from a to d or c to b
if (y1 == y2)
{
x = xa; y = ya;
xp = xc; yp = yc;
xx = xd; yy = yd;
xxp= xb; yyp= yb;
}
else if (y1 < y2)
{
// a to d
IntersectLines(xa,ya, para1[0], para1[1], xb, yb, vec1[0], vec1[1], x, y);
IntersectLines(xa,ya, para1[0], para1[1], xc, yc, vec1[0], vec1[1], xp, yp);
IntersectLines(xd,yd, para1[0], para1[1], xc, yc, vec1[0], vec1[1], xx, yy);
IntersectLines(xd,yd, para1[0], para1[1], xb, yb, vec1[0], vec1[1], xxp, yyp);
}
else
{
// c to d
IntersectLines(xc,yc, para1[0], para1[1], xa, ya, vec1[0], vec1[1], x, y);
IntersectLines(xc,yc, para1[0], para1[1], xd, yd, vec1[0], vec1[1], xp, yp);
IntersectLines(xb,yb, para1[0], para1[1], xd, yd, vec1[0], vec1[1], xx, yy);
IntersectLines(xb,yb, para1[0], para1[1], xa, ya, vec1[0], vec1[1], xxp, yyp);
}
}
else
{
if (y1 == y2)
{
x = xd; y = yd;
xp = xb; yp = yb;
xx = xa; yy = ya;
xxp= xc; yyp= yc;
}
else if (y1 < y2)
{
// b to c
IntersectLines(xb,yb, para1[0], para1[1], xd, yd, vec1[0], vec1[1], x, y);
IntersectLines(xb,yb, para1[0], para1[1], xa, ya, vec1[0], vec1[1], xp, yp);
IntersectLines(xc,yc, para1[0], para1[1], xa, ya, vec1[0], vec1[1], xx, yy);
IntersectLines(xc,yc, para1[0], para1[1], xd, yd, vec1[0], vec1[1], xxp, yyp);
}
else
{
// d to a
IntersectLines(xd,yd, para1[0], para1[1], xc, yc, vec1[0], vec1[1], x, y);
IntersectLines(xd,yd, para1[0], para1[1], xb, yb, vec1[0], vec1[1], xp, yp);
IntersectLines(xa,ya, para1[0], para1[1], xb, yb, vec1[0], vec1[1], xx, yy);
IntersectLines(xa,ya, para1[0], para1[1], xc, yc, vec1[0], vec1[1], xxp, yyp);
}
}
float startx,starty;
float startxp,startyp;
float stopx,stopy;
float stopxp,stopyp;
if (y1 != y2)
{
IntersectLines(x1, y1, para1[0], para1[1], x, y, vec1[0], vec1[1], startx, starty);
IntersectLines(x1, y1, para1[0], para1[1], xp, yp, vec1[0], vec1[1], startxp, startyp);
IntersectLines(x2, y2, para1[0], para1[1], x, y, vec1[0], vec1[1], stopx, stopy);
IntersectLines(x2, y2, para1[0], para1[1], xp, yp, vec1[0], vec1[1], stopxp, stopyp);
}
else
{
startx = x1; starty = y;
startxp = x1; startyp = yp;
stopx = x2; stopy = y;
//.........这里部分代码省略.........
示例9: Draw
//virtual
void nuiGradientDecoration::Draw(nuiDrawContext* pContext, nuiWidget* pWidget, const nuiRect& rDestRect)
{
nuiColor c1 = mColor1;
nuiColor c2 = mColor2;
nuiColor c3 = mColor3;
nuiColor c4 = mColor4;
nuiColor s = mStrokeColor;
pContext->PushState();
pContext->ResetState();
pContext->EnableAntialiasing(false);
pContext->EnableBlending(true);
pContext->SetBlendFunc(nuiBlendTransp);
pContext->EnableTexturing(false);
if (mUseWidgetAlpha && pWidget)
{
float widgetAlpha = pWidget->GetMixedAlpha();
c1.Multiply(widgetAlpha);
c2.Multiply(widgetAlpha);
s.Multiply(widgetAlpha);
}
pContext->SetFillColor(nuiColor(1, 1, 1, 1));
pContext->SetStrokeColor(s);
nuiGradient gradient;
if (!mUserOffsets)
InitOffsets();
gradient.AddStop(c1, mOffset1);
gradient.AddStop(c2, mOffset2);
if (mGradientType == nuiGradient4Colors)
{
if (mUseWidgetAlpha && pWidget)
{
float widgetAlpha = pWidget->GetMixedAlpha();
c3.Multiply(widgetAlpha);
c4.Multiply(widgetAlpha);
}
gradient.AddStop(c3, mOffset3);
gradient.AddStop(c4, mOffset4);
}
if (mOrientation == nuiVertical)
pContext->DrawGradient(gradient, rDestRect, 0, rDestRect.Top(), 0, rDestRect.Bottom());
else
{
pContext->DrawGradient(gradient, rDestRect, 0, rDestRect.Top(), rDestRect.Right(), rDestRect.Top());
}
if (((mShapeMode == eStrokeShape) || (mShapeMode == eStrokeAndFillShape)) && mStrokeSize)
{
pContext->SetFillColor(s);
nuiRect rect(rDestRect.Left(), rDestRect.Top(), rDestRect.GetWidth(), mStrokeSize);
pContext->DrawRect(rect, eFillShape);
rect = nuiRect(rDestRect.Left(), rDestRect.Bottom()-mStrokeSize, rDestRect.GetWidth(), mStrokeSize);
pContext->DrawRect(rect, eFillShape);
rect = nuiRect(rDestRect.Left(), rDestRect.Top(), mStrokeSize, rDestRect.GetHeight());
pContext->DrawRect(rect, eFillShape);
rect = nuiRect(rDestRect.Right()-mStrokeSize, rDestRect.Top(), mStrokeSize, rDestRect.GetHeight());
pContext->DrawRect(rect, eFillShape);
}
pContext->PopState();
}
示例10: Draw
// virtual
void nuiBorderDecoration::Draw(nuiDrawContext* pContext, nuiWidget* pWidget, const nuiRect& rDestRect)
{
pContext->PushState();
pContext->ResetState();
pContext->EnableAntialiasing(false);
pContext->EnableBlending(true);
pContext->SetBlendFunc(mBlendFunc);
pContext->EnableTexturing(false);
pContext->SetLineWidth(mStrokeSize);
if ((mBorderType == eBorderAll) && mUseStrokeGlobalColor)
{
pContext->SetStrokeColor(mStrokeColor);
pContext->DrawRect(rDestRect, eStrokeShape);
return;
}
// left
if ((mBorderType == eBorderAll) || (mBorderType == eBorderLeft) || (mBorderType == eBorderVertical))
{
if (mUseStrokeLeftColor)
pContext->SetStrokeColor(mStrokeLeftColor);
else
pContext->SetStrokeColor(mStrokeColor);
pContext->DrawLine(rDestRect.Left(), rDestRect.Top(), rDestRect.Left(), rDestRect.Bottom());
}
// right
if ((mBorderType == eBorderAll) || (mBorderType == eBorderRight) || (mBorderType == eBorderVertical))
{
if (mUseStrokeRightColor)
pContext->SetStrokeColor(mStrokeRightColor);
else
pContext->SetStrokeColor(mStrokeColor);
pContext->DrawLine(rDestRect.Right()-1, rDestRect.Top(), rDestRect.Right()-1, rDestRect.Bottom());
}
//top
if ((mBorderType == eBorderAll) || (mBorderType == eBorderTop) || (mBorderType == eBorderHorizontal))
{
if (mUseStrokeTopColor)
pContext->SetStrokeColor(mStrokeTopColor);
else
pContext->SetStrokeColor(mStrokeColor);
pContext->DrawLine(rDestRect.Left(), rDestRect.Top(), rDestRect.Right(), rDestRect.Top());
}
// bottom
if ((mBorderType == eBorderAll) || (mBorderType == eBorderBottom) || (mBorderType == eBorderHorizontal))
{
if (mUseStrokeBottomColor)
pContext->SetStrokeColor(mStrokeBottomColor);
else
pContext->SetStrokeColor(mStrokeColor);
pContext->DrawLine(rDestRect.Left(), rDestRect.Bottom()-1, rDestRect.Right(), rDestRect.Bottom()-1);
}
pContext->PopState();
}
示例11: Draw
// virtual
void nuiFrame::Draw(nuiDrawContext* pContext, nuiWidget* pWidget, const nuiRect& rDestRect)
{
pContext->PushState();
pContext->ResetState();
// nuiRenderArray* pArray = new nuiRenderArray(GL_TRIANGLES);
nuiRenderArray* pArray = new nuiRenderArray(GL_TRIANGLE_STRIP);
pArray->EnableArray(nuiRenderArray::eVertex, true);
pArray->EnableArray(nuiRenderArray::eTexCoord, true);
pArray->EnableArray(nuiRenderArray::eColor, false);
nuiSize w = mpTexture->GetWidth();
nuiSize h = mpTexture->GetHeight();
float X0 = 0;
float X1 = (float)mClientRect.Left();
float X2 = (float)mClientRect.Right();
float X3 = (float)w;
float Y0 = 0;
float Y1 = (float)mClientRect.Top();
float Y2 = (float)mClientRect.Bottom();
float Y3 = (float)h;
const float x0 = (float)rDestRect.Left();
const float x1 = x0 + X1;
const float x3 = (float)rDestRect.Right();
const float x2 = x3 - (X3 - X2);
const float y0 = (float)rDestRect.Top();
const float y1 = y0 + Y1;
const float y3 = (float)rDestRect.Bottom();
const float y2 = y3 - (Y3 - Y2);
mpTexture->ImageToTextureCoord(X0, Y0);
mpTexture->ImageToTextureCoord(X1, Y1);
mpTexture->ImageToTextureCoord(X2, Y2);
mpTexture->ImageToTextureCoord(X3, Y3);
// Reserve 28 vertices
pArray->Reserve(28);
//////// TOP PART
// TopLeft rect:
pArray->SetVertex(x0, y0);
pArray->SetTexCoords(X0, Y0);
pArray->PushVertex();
pArray->SetVertex(x0, y1);
pArray->SetTexCoords(X0, Y1);
pArray->PushVertex();
pArray->SetVertex(x1, y0);
pArray->SetTexCoords(X1, Y0);
pArray->PushVertex();
pArray->SetVertex(x1, y1);
pArray->SetTexCoords(X1, Y1);
pArray->PushVertex();
// TopMiddle rect:
pArray->SetVertex(x2, y0);
pArray->SetTexCoords(X2, Y0);
pArray->PushVertex();
pArray->SetVertex(x2, y1);
pArray->SetTexCoords(X2, Y1);
pArray->PushVertex();
// TopRight rect:
pArray->SetVertex(x3, y0);
pArray->SetTexCoords(X3, Y0);
pArray->PushVertex();
pArray->SetVertex(x3, y1);
pArray->SetTexCoords(X3, Y1);
pArray->PushVertex();
// Double the last vertex to create a flat triangle that will not be displayed
pArray->PushVertex();
///// MIDDLE PART
// LeftSide rect:
pArray->SetVertex(x0, y1);
pArray->SetTexCoords(X0, Y1);
pArray->PushVertex();
// Double the first vertex to create a flat triangle that will not be displayed
pArray->PushVertex();
pArray->SetVertex(x0, y2);
pArray->SetTexCoords(X0, Y2);
pArray->PushVertex();
pArray->SetVertex(x1, y1);
pArray->SetTexCoords(X1, Y1);
pArray->PushVertex();
pArray->SetVertex(x1, y2);
//.........这里部分代码省略.........