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


C++ RectanglePlacement类代码示例

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


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

示例1: drawImageWithin

void Graphics::drawImageWithin (const Image& imageToDraw,
                                const int destX, const int destY,
                                const int destW, const int destH,
                                const RectanglePlacement& placementWithinTarget,
                                const bool fillAlphaChannelWithCurrentBrush) const
{
    // passing in a silly number can cause maths problems in rendering!
    jassert (areCoordsSensibleNumbers (destX, destY, destW, destH));

    if (imageToDraw.isValid())
    {
        const int imageW = imageToDraw.getWidth();
        const int imageH = imageToDraw.getHeight();

        if (imageW > 0 && imageH > 0)
        {
            double newX = 0.0, newY = 0.0;
            double newW = imageW;
            double newH = imageH;

            placementWithinTarget.applyTo (newX, newY, newW, newH,
                                           destX, destY, destW, destH);

            if (newW > 0 && newH > 0)
            {
                drawImage (imageToDraw,
                           roundToInt (newX), roundToInt (newY),
                           roundToInt (newW), roundToInt (newH),
                           0, 0, imageW, imageH,
                           fillAlphaChannelWithCurrentBrush);
            }
        }
    }
}
开发者ID:anthonyhuecouret,项目名称:argotlunar,代码行数:34,代码来源:juce_GraphicsContext.cpp

示例2: setBoundsWithCorrectAspectRatio

void QuickTimeMovieComponent::setBoundsWithCorrectAspectRatio (const Rectangle& spaceToFitWithin,
        const RectanglePlacement& placement)
{
    int normalWidth, normalHeight;
    getMovieNormalSize (normalWidth, normalHeight);

    if (normalWidth > 0 && normalHeight > 0 && ! spaceToFitWithin.isEmpty())
    {
        double x = 0.0, y = 0.0, w = normalWidth, h = normalHeight;

        placement.applyTo (x, y, w, h,
                           spaceToFitWithin.getX(), spaceToFitWithin.getY(),
                           spaceToFitWithin.getWidth(), spaceToFitWithin.getHeight());

        if (w > 0 && h > 0)
        {
            setBounds (roundToInt (x), roundToInt (y),
                       roundToInt (w), roundToInt (h));
        }
    }
    else
    {
        setBounds (spaceToFitWithin);
    }
}
开发者ID:harry-g,项目名称:juced,代码行数:25,代码来源:juce_win32_QuickTimeMovieComponent.cpp

示例3: drawImage

void Graphics::drawImage (const Image& imageToDraw, Rectangle<float> targetArea,
                          RectanglePlacement placementWithinTarget, bool fillAlphaChannelWithCurrentBrush) const
{
    if (imageToDraw.isValid())
        drawImageTransformed (imageToDraw,
                              placementWithinTarget.getTransformToFit (imageToDraw.getBounds().toFloat(), targetArea),
                              fillAlphaChannelWithCurrentBrush);
}
开发者ID:kmatheussen,项目名称:radium,代码行数:8,代码来源:juce_GraphicsContext.cpp

示例4: drawImageWithin

void Graphics::drawImageWithin (const Image& imageToDraw,
                                int dx, int dy, int dw, int dh,
                                RectanglePlacement placementWithinTarget,
                                const bool fillAlphaChannelWithCurrentBrush) const
{
    if (imageToDraw.isValid())
        drawImageTransformed (imageToDraw,
                              placementWithinTarget.getTransformToFit (imageToDraw.getBounds().toFloat(),
                                                                       coordsToRectangle (dx, dy, dw, dh).toFloat()),
                              fillAlphaChannelWithCurrentBrush);
}
开发者ID:DinoPollano,项目名称:OwlSim,代码行数:11,代码来源:juce_GraphicsContext.cpp

示例5: setBoundsWithCorrectAspectRatio

void QuickTimeMovieComponent::setBoundsWithCorrectAspectRatio (const Rectangle<int>& spaceToFitWithin,
                                                               RectanglePlacement placement)
{
    int normalWidth, normalHeight;
    getMovieNormalSize (normalWidth, normalHeight);

    const Rectangle<int> normalSize (0, 0, normalWidth, normalHeight);

    if (! (spaceToFitWithin.isEmpty() || normalSize.isEmpty()))
        setBounds (placement.appliedTo (normalSize, spaceToFitWithin));
    else
        setBounds (spaceToFitWithin);
}
开发者ID:AndyBrown91,项目名称:JuceGames,代码行数:13,代码来源:juce_win32_QuickTimeMovieComponent.cpp

示例6: drawCurrentImage

    void drawCurrentImage (Graphics& g, int x, int y, int w, int h)
    {
        if (imageNeedsFlipping)
        {
            const ScopedLock sl (imageSwapLock);
            std::swap (loadingImage, activeImage);
            imageNeedsFlipping = false;
        }

        RectanglePlacement rp (RectanglePlacement::centred);
        double dx = 0, dy = 0, dw = width, dh = height;
        rp.applyTo (dx, dy, dw, dh, x, y, w, h);
        const int rx = roundToInt (dx), ry = roundToInt (dy);
        const int rw = roundToInt (dw), rh = roundToInt (dh);

        {
            Graphics::ScopedSaveState ss (g);

            g.excludeClipRegion (Rectangle<int> (rx, ry, rw, rh));
            g.fillAll (Colours::black);
        }

        g.drawImage (activeImage, rx, ry, rw, rh, 0, 0, width, height);
    }
开发者ID:bpartridge,项目名称:JUCE,代码行数:24,代码来源:juce_win32_CameraDevice.cpp

示例7: drawWithin

void Drawable::drawWithin (Graphics& g, const Rectangle<float>& destArea, const RectanglePlacement& placement, float opacity) const
{
    draw (g, opacity, placement.getTransformToFit (getDrawableBounds(), destArea));
}
开发者ID:Labmind,项目名称:GUI,代码行数:4,代码来源:juce_Drawable.cpp

示例8: setTransformToFit

void Drawable::setTransformToFit (const Rectangle<float>& area, const RectanglePlacement& placement)
{
    if (! area.isEmpty())
        setTransform (placement.getTransformToFit (getDrawableBounds(), area));
}
开发者ID:Labmind,项目名称:GUI,代码行数:5,代码来源:juce_Drawable.cpp


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