当前位置: 首页>>代码示例>>C++>>正文


C++ Rectangle类代码示例

本文整理汇总了C++中Rectangle的典型用法代码示例。如果您正苦于以下问题:C++ Rectangle类的具体用法?C++ Rectangle怎么用?C++ Rectangle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Rectangle类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fillRect

 void fillRect (const Rectangle<int>& r, bool /*replaceExistingContents*/)
 {
     fillRect (r.toFloat());
 }
开发者ID:Robert-yeh,项目名称:Kiwano,代码行数:4,代码来源:juce_win32_Direct2DGraphicsContext.cpp

示例2: getTotalAreas

double getTotalAreas(Rectangle &r1, Rectangle &r2)
{
	return r1.getArea()+r2.getArea();
}
开发者ID:jpiercefield,项目名称:CPlusPlus,代码行数:4,代码来源:classex.cpp

示例3: clipRegionIntersects

 bool clipRegionIntersects (const Rectangle<int>& r)
 {
     return currentState->clipRect.intersects (r.toFloat().transformed (currentState->transform).getSmallestIntegerContainer());
 }
开发者ID:Robert-yeh,项目名称:Kiwano,代码行数:4,代码来源:juce_win32_Direct2DGraphicsContext.cpp

示例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);
    }

}
开发者ID:alessandropetrolati,项目名称:juced,代码行数:93,代码来源:jucetice_DrawablePad.cpp


注:本文中的Rectangle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。