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


C++ FloatRoundedRect类代码示例

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


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

示例1: fillRectWithRoundedHole

void GraphicsContext::fillRectWithRoundedHole(const IntRect& rect, const FloatRoundedRect& roundedHoleRect, const Color& color, ColorSpace colorSpace)
{
    if (paintingDisabled())
        return;

    Path path;
    path.addRect(rect);

    if (!roundedHoleRect.radii().isZero())
        path.addRoundedRect(roundedHoleRect);
    else
        path.addRect(roundedHoleRect.rect());

    WindRule oldFillRule = fillRule();
    Color oldFillColor = fillColor();
    ColorSpace oldFillColorSpace = fillColorSpace();
    
    setFillRule(RULE_EVENODD);
    setFillColor(color, colorSpace);

    fillPath(path);
    
    setFillRule(oldFillRule);
    setFillColor(oldFillColor, oldFillColorSpace);
}
开发者ID:Zirias,项目名称:webkitfltk,代码行数:25,代码来源:GraphicsContext.cpp

示例2: FloatRoundedRect

void RenderThemeSafari::paintMenuListButtonGradients(const RenderObject& o, const PaintInfo& paintInfo, const IntRect& r)
{
    if (r.isEmpty())
        return;

    CGContextRef context = paintInfo.context->platformContext();

    paintInfo.context->save();

    FloatRoundedRect bound = FloatRoundedRect(o.style().getRoundedBorderFor(r));
    int radius = bound.radii().topLeft().width();

    CGColorSpaceRef cspace = deviceRGBColorSpaceRef();

    FloatRect topGradient(r.x(), r.y(), r.width(), r.height() / 2.0f);
    struct CGFunctionCallbacks topCallbacks = { 0, TopGradientInterpolate, NULL };
    RetainPtr<CGFunctionRef> topFunction = adoptCF(CGFunctionCreate(NULL, 1, NULL, 4, NULL, &topCallbacks));
    RetainPtr<CGShadingRef> topShading = adoptCF(CGShadingCreateAxial(cspace, CGPointMake(topGradient.x(), topGradient.y()), CGPointMake(topGradient.x(), topGradient.maxY()), topFunction.get(), false, false));

    FloatRect bottomGradient(r.x() + radius, r.y() + r.height() / 2.0f, r.width() - 2.0f * radius, r.height() / 2.0f);
    struct CGFunctionCallbacks bottomCallbacks = { 0, BottomGradientInterpolate, NULL };
    RetainPtr<CGFunctionRef> bottomFunction = adoptCF(CGFunctionCreate(NULL, 1, NULL, 4, NULL, &bottomCallbacks));
    RetainPtr<CGShadingRef> bottomShading = adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bottomGradient.x(),  bottomGradient.y()), CGPointMake(bottomGradient.x(), bottomGradient.maxY()), bottomFunction.get(), false, false));

    struct CGFunctionCallbacks mainCallbacks = { 0, MainGradientInterpolate, NULL };
    RetainPtr<CGFunctionRef> mainFunction = adoptCF(CGFunctionCreate(NULL, 1, NULL, 4, NULL, &mainCallbacks));
    RetainPtr<CGShadingRef> mainShading = adoptCF(CGShadingCreateAxial(cspace, CGPointMake(r.x(),  r.y()), CGPointMake(r.x(), r.maxY()), mainFunction.get(), false, false));

    RetainPtr<CGShadingRef> leftShading = adoptCF(CGShadingCreateAxial(cspace, CGPointMake(r.x(),  r.y()), CGPointMake(r.x() + radius, r.y()), mainFunction.get(), false, false));

    RetainPtr<CGShadingRef> rightShading = adoptCF(CGShadingCreateAxial(cspace, CGPointMake(r.maxX(),  r.y()), CGPointMake(r.maxX() - radius, r.y()), mainFunction.get(), false, false));
    paintInfo.context->save();
    CGContextClipToRect(context, r);
    paintInfo.context->clipRoundedRect(bound);
    CGContextDrawShading(context, mainShading.get());
    paintInfo.context->restore();

    paintInfo.context->save();
    CGContextClipToRect(context, topGradient);
    paintInfo.context->clipRoundedRect(FloatRoundedRect(enclosingIntRect(topGradient), bound.radii().topLeft(), bound.radii().topRight(), IntSize(), IntSize()));
    CGContextDrawShading(context, topShading.get());
    paintInfo.context->restore();

    if (!bottomGradient.isEmpty()) {
        paintInfo.context->save();
        CGContextClipToRect(context, bottomGradient);
        paintInfo.context->clipRoundedRect(FloatRoundedRect(enclosingIntRect(bottomGradient), IntSize(), IntSize(), bound.radii().bottomLeft(), bound.radii().bottomRight()));
        CGContextDrawShading(context, bottomShading.get());
        paintInfo.context->restore();
    }

    paintInfo.context->save();
    CGContextClipToRect(context, r);
    paintInfo.context->clipRoundedRect(bound);
    CGContextDrawShading(context, leftShading.get());
    CGContextDrawShading(context, rightShading.get());
    paintInfo.context->restore();

    paintInfo.context->restore();
}
开发者ID:Wrichik1999,项目名称:webkit,代码行数:60,代码来源:RenderThemeSafari.cpp

示例3: PrintTo

void PrintTo(const FloatRoundedRect& roundedRect, std::ostream* os)
{
    *os << "FloatRoundedRect(";
    PrintTo(roundedRect.rect(), os);
    *os << ", ";
    PrintTo(roundedRect.getRadii(), os);
    *os << ")";
}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:8,代码来源:GeometryPrinters.cpp

示例4: fillRoundedRect

void GraphicsContext::fillRoundedRect(const FloatRoundedRect& rect, const Color& color, BlendMode blendMode)
{
    if (rect.isRounded()) {
        setCompositeOperation(compositeOperation(), blendMode);
        platformFillRoundedRect(rect, color);
        setCompositeOperation(compositeOperation());
    } else
        fillRect(rect.rect(), color, compositeOperation(), blendMode);
}
开发者ID:josedealcala,项目名称:webkit,代码行数:9,代码来源:GraphicsContext.cpp

示例5: rect

PassOwnPtr<Shape> Shape::createLayoutBoxShape(const FloatRoundedRect& roundedRect, WritingMode writingMode, float margin)
{
    FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height());
    FloatRoundedRect bounds(rect, roundedRect.radii());
    OwnPtr<Shape> shape = createInsetShape(bounds);
    shape->m_writingMode = writingMode;
    shape->m_margin = margin;

    return shape.release();
}
开发者ID:howardroark2018,项目名称:chromium,代码行数:10,代码来源:Shape.cpp

示例6: rect

std::unique_ptr<Shape> Shape::createLayoutBoxShape(
    const FloatRoundedRect& roundedRect,
    WritingMode writingMode,
    float margin) {
  FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height());
  FloatRoundedRect bounds(rect, roundedRect.getRadii());
  std::unique_ptr<Shape> shape = createInsetShape(bounds);
  shape->m_writingMode = writingMode;
  shape->m_margin = margin;

  return shape;
}
开发者ID:mirror,项目名称:chromium,代码行数:12,代码来源:Shape.cpp

示例7: clipOutRoundedRect

void GraphicsContext::clipOutRoundedRect(const FloatRoundedRect& rect)
{
    if (paintingDisabled())
        return;

    if (!rect.isRounded()) {
        clipOut(rect.rect());
        return;
    }

    Path path;
    path.addRoundedRect(rect);
    clipOut(path);
}
开发者ID:josedealcala,项目名称:webkit,代码行数:14,代码来源:GraphicsContext.cpp

示例8: fillRoundedRect

void GraphicsContext::fillRoundedRect(const FloatRoundedRect& rect, const Color& color, BlendMode blendMode)
{
    if (paintingDisabled())
        return;

    if (isRecording()) {
        m_displayListRecorder->fillRoundedRect(rect, color, blendMode);
        return;
    }

    if (rect.isRounded()) {
        setCompositeOperation(compositeOperation(), blendMode);
        platformFillRoundedRect(rect, color);
        setCompositeOperation(compositeOperation());
    } else
        fillRect(rect.rect(), color, compositeOperation(), blendMode);
}
开发者ID:caiolima,项目名称:webkit,代码行数:17,代码来源:GraphicsContext.cpp

示例9: fillRectWithRoundedHole

void GraphicsContext::fillRectWithRoundedHole(const FloatRect& rect, const FloatRoundedRect& roundedHoleRect, const Color& color, ColorSpace)
{
    if (paintingDisabled() || !color.isValid())
        return;

    if (this->mustUseShadowBlur())
        platformContext()->shadowBlur().drawInsetShadow(this, rect, roundedHoleRect);

    Path path;
    path.addRect(rect);
    if (!roundedHoleRect.radii().isZero())
        path.addRoundedRect(roundedHoleRect);
    else
        path.addRect(roundedHoleRect.rect());

    cairo_t* cr = platformContext()->cr();
    cairo_save(cr);
    setPathOnCairoContext(platformContext()->cr(), path.platformPath()->context());
    fillCurrentCairoPath(this);
    cairo_restore(cr);
}
开发者ID:ddxxyy,项目名称:webkit,代码行数:21,代码来源:GraphicsContextCairo.cpp

示例10: addRoundedRect

void Path::addRoundedRect(const FloatRoundedRect& r) {
  addRoundedRect(r.rect(), r.getRadii().topLeft(), r.getRadii().topRight(),
                 r.getRadii().bottomLeft(), r.getRadii().bottomRight());
}
开发者ID:mirror,项目名称:chromium,代码行数:4,代码来源:Path.cpp

示例11: createInsetShape

static PassOwnPtr<Shape> createInsetShape(const FloatRoundedRect& bounds)
{
    ASSERT(bounds.rect().width() >= 0 && bounds.rect().height() >= 0);
    return adoptPtr(new BoxShape(bounds));
}
开发者ID:howardroark2018,项目名称:chromium,代码行数:5,代码来源:Shape.cpp

示例12: TEST

TEST(FloatRoundedRectTest, zeroRadii)
{
    FloatRoundedRect r = FloatRoundedRect(1, 2, 3, 4);

    EXPECT_EQ(FloatRect(1, 2, 3, 4), r.rect());
    EXPECT_EQ(FloatSize(), r.radii().topLeft());
    EXPECT_EQ(FloatSize(), r.radii().topRight());
    EXPECT_EQ(FloatSize(), r.radii().bottomLeft());
    EXPECT_EQ(FloatSize(), r.radii().bottomRight());
    EXPECT_TRUE(r.radii().isZero());
    EXPECT_FALSE(r.isRounded());
    EXPECT_FALSE(r.isEmpty());

    EXPECT_EQ(FloatRect(1, 2, 0, 0), r.topLeftCorner());
    EXPECT_EQ(FloatRect(4, 2, 0, 0), r.topRightCorner());
    EXPECT_EQ(FloatRect(4, 6, 0, 0), r.bottomRightCorner());
    EXPECT_EQ(FloatRect(1, 6, 0, 0), r.bottomLeftCorner());

    TEST_INTERCEPTS(r, 2, r.rect().x(), r.rect().maxX());
    TEST_INTERCEPTS(r, 4, r.rect().x(), r.rect().maxX());
    TEST_INTERCEPTS(r, 6, r.rect().x(), r.rect().maxX());

    float minXIntercept;
    float maxXIntercept;

    EXPECT_FALSE(r.xInterceptsAtY(1, minXIntercept, maxXIntercept));
    EXPECT_FALSE(r.xInterceptsAtY(7, minXIntercept, maxXIntercept));

    // The FloatRoundedRect::expandRadii() function doesn't change radii FloatSizes that
    // are <= zero. Same as RoundedRect::expandRadii().
    r.expandRadii(20);
    r.shrinkRadii(10);
    EXPECT_TRUE(r.radii().isZero());
}
开发者ID:dstockwell,项目名称:blink,代码行数:34,代码来源:FloatRoundedRectTest.cpp

示例13: createBoxShape

static PassOwnPtr<Shape> createBoxShape(const FloatRoundedRect& bounds, float shapeMargin, float shapePadding)
{
    ASSERT(bounds.rect().width() >= 0 && bounds.rect().height() >= 0);
    return adoptPtr(new BoxShape(bounds, shapeMargin, shapePadding));
}
开发者ID:Igalia,项目名称:blink,代码行数:5,代码来源:Shape.cpp

示例14: createInsetShape

static std::unique_ptr<Shape> createInsetShape(const FloatRoundedRect& bounds) {
  ASSERT(bounds.rect().width() >= 0 && bounds.rect().height() >= 0);
  return wrapUnique(new BoxShape(bounds));
}
开发者ID:mirror,项目名称:chromium,代码行数:4,代码来源:Shape.cpp

示例15: isKeyNull

 static bool isKeyNull(const FloatRoundedRect& rect) { return rect.isEmpty(); }
开发者ID:JohnDn,项目名称:webkit,代码行数:1,代码来源:BasicShapes.cpp


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