本文整理汇总了C++中Rectangle类的典型用法代码示例。如果您正苦于以下问题:C++ Rectangle类的具体用法?C++ Rectangle怎么用?C++ Rectangle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Rectangle类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fillRect
void fillRect (const Rectangle<int>& r, bool /*replaceExistingContents*/)
{
fillRect (r.toFloat());
}
示例2: getTotalAreas
double getTotalAreas(Rectangle &r1, Rectangle &r2)
{
return r1.getArea()+r2.getArea();
}
示例3: clipRegionIntersects
bool clipRegionIntersects (const Rectangle<int>& r)
{
return currentState->clipRect.intersects (r.toFloat().transformed (currentState->transform).getSmallestIntegerContainer());
}
示例4: getWidth
//==============================================================================
void DrawablePad::paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown)
{
const int insetX = getWidth() / 4;
const int insetY = getHeight() / 4;
Rectangle imageSpace;
imageSpace.setBounds (insetX, insetY, getWidth() - insetX * 2, getHeight() - insetY * 2);
drawButtonBackground (g,
*this,
getBackgroundColour(),
isMouseOverButton,
isButtonDown);
g.setOpacity (1.0f);
const Drawable* imageToDraw = 0;
if (isEnabled())
{
imageToDraw = getCurrentImage();
}
else
{
imageToDraw = getToggleState() ? disabledImageOn
: disabledImage;
if (imageToDraw == 0)
{
g.setOpacity (0.4f);
imageToDraw = getNormalImage();
}
}
if (imageToDraw != 0)
{
g.setImageResamplingQuality (Graphics::highResamplingQuality);
imageToDraw->drawWithin (g,
imageSpace.getX(),
imageSpace.getY(),
imageSpace.getWidth(),
imageSpace.getHeight(),
RectanglePlacement::centred,
1.0f);
}
float fontsize = jmin ((float)(proportionOfWidth(0.2f)),(float)(proportionOfHeight(0.15f)));
if (fontsize < 5.0) fontsize=5.0;
g.setFont (Font (fontsize, Font::bold));
g.setColour (getBackgroundColour().contrasting(0.8f));
g.drawText (Label,
proportionOfWidth (0.0447f),
proportionOfHeight (0.0499f),
proportionOfWidth (0.9137f),
proportionOfHeight (0.1355f),
Justification::centred, true);
if (showdot && ! hex)
{
g.setFont (Font (fontsize*0.9f, Font::plain));
String xy;
if (showx && showy) xy = T("x:") + String((int)(x*127.1)) + T(" y:") + String((int)(y*127.1));
else if (showx) xy = T("x:") + String((int)(x*127.1));
else if (showy) xy = T("y:") + String((int)(y*127.1));
g.drawText (xy,
proportionOfWidth (0.0447f),
proportionOfHeight (0.8057f),
proportionOfWidth (0.9137f),
proportionOfHeight (0.1355f),
Justification::centred, true);
float diameter = jmin ((float)(proportionOfHeight(0.125f)), (float)(proportionOfWidth(0.5f)));
g.setColour (Colour (0x88faa52a));
g.fillEllipse ((float)(proportionOfWidth(x)) - diameter*0.5f,
(float)(proportionOfHeight(1.0f-y)) - diameter*0.5f,
diameter,
diameter);
g.setColour (Colour (0x99a52a88));
g.drawEllipse ((float)(proportionOfWidth(x)) - diameter*0.5f,
(float)(proportionOfHeight(1.0f-y)) - diameter*0.5f,
diameter,
diameter,
diameter*0.1f);
}
}