Example #1
0
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);
}
Example #2
0
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);
}
Example #3
0
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);


}
Example #4
0
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;
}