本文整理汇总了C++中RoundedRect类的典型用法代码示例。如果您正苦于以下问题:C++ RoundedRect类的具体用法?C++ RoundedRect怎么用?C++ RoundedRect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RoundedRect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fillRoundedRect
void GraphicsContext::fillRoundedRect(const RoundedRect& rect, const Color& color, ColorSpace colorSpace)
{
if (rect.isRounded())
fillRoundedRect(rect.rect(), rect.radii().topLeft(), rect.radii().topRight(), rect.radii().bottomLeft(), rect.radii().bottomRight(), color, colorSpace);
else
fillRect(rect.rect(), color, colorSpace);
}
示例2: fillRectWithRoundedHole
void GraphicsContext::fillRectWithRoundedHole(const IntRect& rect, const RoundedRect& 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);
}
示例3: deviceRGBColorSpaceRef
void RenderThemeSafari::paintMenuListButtonGradients(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
{
if (r.isEmpty())
return;
CGContextRef context = paintInfo.context->platformContext();
paintInfo.context->save();
RoundedRect bound = 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, bound.rect());
paintInfo.context->addRoundedRectClip(bound);
CGContextDrawShading(context, mainShading.get());
paintInfo.context->restore();
paintInfo.context->save();
CGContextClipToRect(context, topGradient);
paintInfo.context->addRoundedRectClip(RoundedRect(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->addRoundedRectClip(RoundedRect(enclosingIntRect(bottomGradient), IntSize(), IntSize(), bound.radii().bottomLeft(), bound.radii().bottomRight()));
CGContextDrawShading(context, bottomShading.get());
paintInfo.context->restore();
}
paintInfo.context->save();
CGContextClipToRect(context, bound.rect());
paintInfo.context->addRoundedRectClip(bound);
CGContextDrawShading(context, leftShading.get());
CGContextDrawShading(context, rightShading.get());
paintInfo.context->restore();
paintInfo.context->restore();
}
示例4: ASSERT
const Shape& ShapeOutsideInfo::computedShape() const
{
if (Shape* shape = m_shape.get())
return *shape;
const RenderStyle& style = m_renderer.style();
ASSERT(m_renderer.containingBlock());
const RenderStyle& containingBlockStyle = m_renderer.containingBlock()->style();
WritingMode writingMode = containingBlockStyle.writingMode();
float margin = floatValueForLength(m_renderer.style().shapeMargin(), m_renderer.containingBlock() ? m_renderer.containingBlock()->contentWidth() : LayoutUnit());
float shapeImageThreshold = style.shapeImageThreshold();
const ShapeValue& shapeValue = *style.shapeOutside();
switch (shapeValue.type()) {
case ShapeValue::Type::Shape:
ASSERT(shapeValue.shape());
m_shape = Shape::createShape(shapeValue.shape(), m_referenceBoxLogicalSize, writingMode, margin);
break;
case ShapeValue::Type::Image:
ASSERT(shapeValue.isImageValid());
m_shape = createShapeForImage(shapeValue.image(), shapeImageThreshold, writingMode, margin);
break;
case ShapeValue::Type::Box: {
RoundedRect shapeRect = computeRoundedRectForBoxShape(referenceBox(shapeValue), m_renderer);
if (!containingBlockStyle.isHorizontalWritingMode())
shapeRect = shapeRect.transposedRect();
m_shape = Shape::createBoxShape(shapeRect, writingMode, margin);
break;
}
}
ASSERT(m_shape);
return *m_shape;
}
示例5: setCompositeOperation
void GraphicsContext::fillRoundedRect(const RoundedRect& rect, const Color& color, ColorSpace colorSpace, BlendMode blendMode)
{
if (rect.isRounded()) {
setCompositeOperation(compositeOperation(), blendMode);
fillRoundedRect(rect.rect(), rect.radii().topLeft(), rect.radii().topRight(), rect.radii().bottomLeft(), rect.radii().bottomRight(), color, colorSpace);
setCompositeOperation(compositeOperation());
} else
fillRect(rect.rect(), color, colorSpace, compositeOperation(), blendMode);
}
示例6: rect
PassOwnPtr<Shape> Shape::createLayoutBoxShape(const RoundedRect& 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();
}
示例7: ASSERT
std::unique_ptr<Shape> Shape::createBoxShape(const RoundedRect& roundedRect, WritingMode writingMode, float margin)
{
ASSERT(roundedRect.rect().width() >= 0 && roundedRect.rect().height() >= 0);
FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height());
FloatRoundedRect bounds(rect, roundedRect.radii());
auto shape = std::make_unique<BoxShape>(bounds);
shape->m_writingMode = writingMode;
shape->m_margin = margin;
return WTF::move(shape);
}
示例8: FloatRect
void GraphicsContext::clipOutRoundedRect(const RoundedRect& rect)
{
if (paintingDisabled())
return;
BlackBerry::Platform::FloatRoundedRect r = BlackBerry::Platform::FloatRoundedRect(
FloatRect(rect.rect()),
FloatSize(rect.radii().topLeft()),
FloatSize(rect.radii().topRight()),
FloatSize(rect.radii().bottomLeft()),
FloatSize(rect.radii().bottomRight()));
platformContext()->clipOutRoundedRect(r);
}
示例9: ASSERT
PassOwnPtr<Shape> Shape::createLayoutBoxShape(const RoundedRect& roundedRect, WritingMode writingMode, Length margin, Length padding)
{
ASSERT(roundedRect.rect().width() >= 0 && roundedRect.rect().height() >= 0);
FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height());
FloatRoundedRect bounds(rect, roundedRect.radii());
OwnPtr<Shape> shape = adoptPtr(new BoxShape(bounds));
shape->m_writingMode = writingMode;
shape->m_margin = floatValueForLength(margin, 0);
shape->m_padding = floatValueForLength(padding, 0);
return shape.release();
}
示例10: QWidget
GUI::GUI(Synth *synth,QWidget *parent)
: QWidget(parent), synth_(synth){
setGeometry(0,0,500,500);
QPalette pal = palette();
pal.setColor(QPalette::Window,Qt::black);
setPalette(pal);
int knobSize = 32;
int knobPadding = 3;
int knobMargin = 5;
int rectMargin = 5;
int textHeight = 4;
int x = 0,y = 0;
RoundedRect *rect = new RoundedRect(this,knobSize/2+knobMargin);
rect->setGeometry(rectMargin,rectMargin,
2*rectMargin+3*knobSize+2*knobPadding,
2*rectMargin+knobSize+textHeight+knobMargin);
x = 0;
QKnob *volumeKnob = new QKnob(this);
volumeKnob->setRange(0, 1);
volumeKnob->setGeometry(rectMargin+knobMargin+x*(knobSize+knobPadding),
rectMargin+knobMargin+y*(knobSize+knobPadding),knobSize,knobSize);
volumeKnob->setValue(synth->volume());
connect(volumeKnob, SIGNAL(valueChanged(float)), synth, SLOT(setVolume(float)));
connect(synth, SIGNAL(volumeChanged(float)), volumeKnob, SLOT(setValue(float)));
x = 1;
QKnob *attackKnob = new QKnob(this);
attackKnob->setRange(0, 1);
attackKnob->setGeometry(rectMargin+knobMargin+x*(knobSize+knobPadding),
rectMargin+knobMargin+y*(knobSize+knobPadding),knobSize,knobSize);
cout << "volume = " << synth->volume();
attackKnob->setValue(synth->adsr.attack());
connect(attackKnob, SIGNAL(valueChanged(float)), &(synth->adsr), SLOT(setAttack(float)));
connect(&(synth->adsr), SIGNAL(attackChanged(float)), attackKnob, SLOT(setValue(float)));
x = 2;
QKnob *decayKnob = new QKnob(this);
decayKnob->setRange(0, 1);
decayKnob->setGeometry(rectMargin+knobMargin+x*(knobSize+knobPadding),
rectMargin+knobMargin+y*(knobSize+knobPadding),knobSize,knobSize);
decayKnob->setValue(synth->adsr.decay());
connect(decayKnob, SIGNAL(valueChanged(float)), &(synth->adsr), SLOT(setDecay(float)));
connect(&(synth->adsr), SIGNAL(decayChanged(float)), decayKnob, SLOT(setValue(float)));
}
示例11: clipOut
void GraphicsContext::clipOutRoundedRect(const RoundedRect& rect)
{
if (paintingDisabled())
return;
if (!rect.isRounded()) {
clipOut(rect.rect());
return;
}
Path path;
path.addRoundedRect(rect);
clipOut(path);
}
示例12: platformContext
void GraphicsContext::fillRectWithRoundedHole(const IntRect& rect, const RoundedRect& roundedHoleRect, const Color& color, ColorSpace)
{
if (paintingDisabled() || !color.isValid())
return;
if (this->mustUseShadowBlur())
platformContext()->shadowBlur().drawInsetShadow(this, rect, roundedHoleRect.rect(), roundedHoleRect.radii());
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);
}
示例13: addRoundedRect
void Path::addRoundedRect(const RoundedRect& r)
{
addRoundedRect(r.rect(), r.radii().topLeft(), r.radii().topRight(), r.radii().bottomLeft(), r.radii().bottomRight());
}
示例14: intersects
bool HitTestLocation::intersects(const RoundedRect& rect) const
{
return rect.intersectsQuad(m_transformedRect);
}
示例15: onUpdate
void onUpdate(float dt)
{
Quad::onUpdate(dt);
Vector sz = parent->scale;
if (sz.x < zoomMin)
sz.x = sz.y = zoomMin;
if (sz.x > zoomMax)
sz.x = sz.y = zoomMax;
if (sz.x > 1.0f)
{
scale.x = (1.0f/sz.x);
scale.y = (1.0f/sz.y);
}
else
{
scale = Vector(1,1);
}
Vector wp = getWorldPosition();
if (blink)
{
blinkTimer += dt;
if (blinkTimer > blinkPeriod)
{
if (alphaMod == 0)
alphaMod = 1;
else
alphaMod = 0;
blinkTimer = 0;
}
}
if (canMove)
{
if (mover == 0)
{
if (core->mouse.buttons.left && (core->mouse.position - wp).isLength2DIn(GEM_GRAB))
{
core->sound->playSfx("Gem-Move");
mover = this;
//offset = Vector(position - core->mouse.position);
//position += core->mouse.position - wp;
//offset = Vector(0, 4);
}
}
else if (mover == this)
{
//position = core->mouse.position;
position += (core->mouse.position - wp)/parent->scale.x;
if (!core->mouse.buttons.left)
{
mover = 0;
core->sound->playSfx("Gem-Place");
//position += offset;
//offset = Vector(0,0);
//offset = Vector(0,0);
gemData->pos = position;
}
}
}
if (textBG)
{
textBG->position = getWorldPosition() + Vector(0, -20);
}
if ((core->mouse.position - wp).isLength2DIn(GEM_GRAB))
{
//text->alpha.interpolateTo(1, 0.1);
/*
if (!gemData->userString.empty())
textBG->alpha.interpolateTo(1, 0.1);
*/
if (!gemData->userString.empty())
textBG->show();
}
else
{
/*
text->alpha.interpolateTo(0, 0.1);
textBG->alpha.interpolateTo(0, 0.1);
*/
if (textBG->alpha == 1)
textBG->hide();
}
}