本文整理汇总了C++中nuiRect::Top方法的典型用法代码示例。如果您正苦于以下问题:C++ nuiRect::Top方法的具体用法?C++ nuiRect::Top怎么用?C++ nuiRect::Top使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nuiRect
的用法示例。
在下文中一共展示了nuiRect::Top方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 nuiMetaPainter::LoadProjectionMatrix(const nuiRect& rViewport, const nuiMatrix& rMatrix)
{
StoreOpCode(eLoadProjectionMatrix);
StoreFloat(rViewport.Left());
StoreFloat(rViewport.Top());
StoreFloat(rViewport.GetWidth());
StoreFloat(rViewport.GetHeight());
StoreBuffer(rMatrix.Array, sizeof(nuiSize), 16);
nuiPainter::LoadProjectionMatrix(rViewport, rMatrix);
}
示例3: 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);
}
示例4: 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);
}
示例5: 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();
}
示例6: 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);
}
示例7: SetRect
bool nuiTabBar::SetRect(const nuiRect& rRect)
{
nuiSize width = 0;
nuiWidget::SetRect(rRect);
IteratorPtr pIt;
for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
const nuiRect &childIdealRect = pItem->GetIdealRect();
nuiRect rect(width, rRect.Top(), childIdealRect.GetWidth(), childIdealRect.GetHeight());
width += childIdealRect.GetWidth();
pItem->SetLayout(rect);
}
delete pIt;
return true;
}
示例8: 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;
}
示例9: 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;
//.........这里部分代码省略.........
示例10: 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;
//.........这里部分代码省略.........
示例11: 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();
}
示例12: Display
void nuiSoftwarePainter::Display(nglWindow* pWindow, const nuiRect& rRect)
{
if (!pWindow)
return;
const nglWindow::OSInfo* pInfo = pWindow->GetOSInfo();
NGL_ASSERT(pInfo);
if (!pInfo)
return;
//TestAgg((char*)&mBuffer[0], mWidth, mHeight);
int32 x, y, w, h;
x = ToBelow(rRect.Left());
y = ToBelow(rRect.Top());
w = ToBelow(rRect.GetWidth());
h = ToBelow(rRect.GetHeight());
int32 offset = (x + mWidth * y);
#ifdef _WIN32_
HDC hdc = GetDC(pInfo->GLWindowHandle);
BITMAPV5HEADER bminfo;
// BITMAPV5HEADER
bminfo.bV5Size = sizeof(BITMAPV5HEADER);
bminfo.bV5Width = (LONG)mWidth;
bminfo.bV5Height = -(LONG)mHeight;
bminfo.bV5Planes = 1;
bminfo.bV5BitCount = 32;
bminfo.bV5Compression = BI_RGB;
bminfo.bV5SizeImage = 0;
bminfo.bV5XPelsPerMeter = 0;
bminfo.bV5YPelsPerMeter = 0;
bminfo.bV5ClrUsed = 0;
bminfo.bV5ClrImportant =0;
bminfo.bV5RedMask = 0;
bminfo.bV5GreenMask = 0;
bminfo.bV5BlueMask = 0;
bminfo.bV5AlphaMask = 0;
bminfo.bV5CSType = LCS_WINDOWS_COLOR_SPACE;
bminfo.bV5Endpoints.ciexyzRed.ciexyzX = 0;
bminfo.bV5Endpoints.ciexyzRed.ciexyzY = 0;
bminfo.bV5Endpoints.ciexyzRed.ciexyzZ = 0;
bminfo.bV5Endpoints.ciexyzGreen.ciexyzX = 0;
bminfo.bV5Endpoints.ciexyzGreen.ciexyzY = 0;
bminfo.bV5Endpoints.ciexyzGreen.ciexyzZ = 0;
bminfo.bV5Endpoints.ciexyzBlue.ciexyzX = 0;
bminfo.bV5Endpoints.ciexyzBlue.ciexyzY = 0;
bminfo.bV5Endpoints.ciexyzBlue.ciexyzZ = 0;
bminfo.bV5GammaRed = 0;
bminfo.bV5GammaGreen = 0;
bminfo.bV5GammaBlue = 0;
bminfo.bV5Intent = LCS_GM_IMAGES;
bminfo.bV5ProfileData = 0;
bminfo.bV5ProfileSize = 0;
bminfo.bV5Reserved = 0;
RECT r;
GetClientRect(pInfo->GLWindowHandle, &r);
r.right = (LONG)mWidth;
r.bottom = (LONG)mHeight;
uint32* pBuffer = mpRasterizer->GetBuffer();
/*
for (uint32 i = 0; i < mWidth * mHeight; i++)
pBuffer[i] = rand();
*/
SetDIBitsToDevice(
hdc, // handle to DC
x, // x-coord of destination upper-left corner
y, // y-coord of destination upper-left corner
w, // width of destination rectangle
h, // height of destination rectangle
x, // x-coord of source upper-left corner
mHeight - h - y, // y-coord of source upper-left corner
0, // first scan line
(LONG)mHeight, // number of scan lines
pBuffer, // bitmap bits
(const BITMAPINFO*)&bminfo, // bitmap data
DIB_RGB_COLORS // usage options
);
ReleaseDC(pInfo->GLWindowHandle, hdc);
#elif (defined _CARBON_)
WindowRef win = pInfo->WindowHandle;
if (!win)
win = pInfo->Parent;
//CGContextRef myMemoryContext;
//.........这里部分代码省略.........
示例13: SetWindowRect
void nuiMainWindow::SetWindowRect(nuiRect rect)
{
SetSize(rect.GetWidth(), rect.GetHeight());
SetPos(rect.Left(), rect.Top());
}
示例14: 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();
}
示例15: 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);
//.........这里部分代码省略.........