本文整理汇总了C++中GraphicsContext::clipOut方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphicsContext::clipOut方法的具体用法?C++ GraphicsContext::clipOut怎么用?C++ GraphicsContext::clipOut使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicsContext
的用法示例。
在下文中一共展示了GraphicsContext::clipOut方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintBoxDecorationBackground
void FieldsetPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (!paintInfo.shouldPaintWithinRoot(&m_renderFieldset))
return;
LayoutRect paintRect(paintOffset, m_renderFieldset.size());
RenderBox* legend = m_renderFieldset.findLegend();
if (!legend)
return BoxPainter(m_renderFieldset).paintBoxDecorationBackground(paintInfo, paintOffset);
// FIXME: We need to work with "rl" and "bt" block flow directions. In those
// cases the legend is embedded in the right and bottom borders respectively.
// https://bugs.webkit.org/show_bug.cgi?id=47236
if (m_renderFieldset.style()->isHorizontalWritingMode()) {
LayoutUnit yOff = (legend->location().y() > 0) ? LayoutUnit() : (legend->size().height() - m_renderFieldset.borderTop()) / 2;
paintRect.setHeight(paintRect.height() - yOff);
paintRect.setY(paintRect.y() + yOff);
} else {
LayoutUnit xOff = (legend->location().x() > 0) ? LayoutUnit() : (legend->size().width() - m_renderFieldset.borderLeft()) / 2;
paintRect.setWidth(paintRect.width() - xOff);
paintRect.setX(paintRect.x() + xOff);
}
RenderDrawingRecorder recorder(paintInfo.context, m_renderFieldset, paintInfo.phase, pixelSnappedIntRect(paintOffset, paintRect.size()));
if (recorder.canUseCachedDrawing())
return;
BoxDecorationData boxDecorationData(m_renderFieldset, paintInfo.context);
if (boxDecorationData.bleedAvoidance() == BackgroundBleedNone)
BoxPainter::paintBoxShadow(paintInfo, paintRect, m_renderFieldset.style(), Normal);
BoxPainter(m_renderFieldset).paintFillLayers(paintInfo, boxDecorationData.backgroundColor, m_renderFieldset.style()->backgroundLayers(), paintRect);
BoxPainter::paintBoxShadow(paintInfo, paintRect, m_renderFieldset.style(), Inset);
if (!boxDecorationData.hasBorder)
return;
// Create a clipping region around the legend and paint the border as normal
GraphicsContext* graphicsContext = paintInfo.context;
GraphicsContextStateSaver stateSaver(*graphicsContext);
// FIXME: We need to work with "rl" and "bt" block flow directions. In those
// cases the legend is embedded in the right and bottom borders respectively.
// https://bugs.webkit.org/show_bug.cgi?id=47236
if (m_renderFieldset.style()->isHorizontalWritingMode()) {
LayoutUnit clipTop = paintRect.y();
LayoutUnit clipHeight = max(static_cast<LayoutUnit>(m_renderFieldset.style()->borderTopWidth()), legend->size().height() - ((legend->size().height() - m_renderFieldset.borderTop()) / 2));
graphicsContext->clipOut(pixelSnappedIntRect(paintRect.x() + legend->location().x(), clipTop, legend->size().width(), clipHeight));
} else {
LayoutUnit clipLeft = paintRect.x();
LayoutUnit clipWidth = max(static_cast<LayoutUnit>(m_renderFieldset.style()->borderLeftWidth()), legend->size().width());
graphicsContext->clipOut(pixelSnappedIntRect(clipLeft, paintRect.y() + legend->location().y(), clipWidth, legend->size().height()));
}
BoxPainter::paintBorder(m_renderFieldset, paintInfo, paintRect, m_renderFieldset.style());
}
示例2: paintBoxDecorations
void RenderFieldset::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
{
if (!paintInfo.shouldPaintWithinRoot(this))
return;
int w = width();
int h = height();
RenderBox* legend = findLegend();
if (!legend)
return RenderBlock::paintBoxDecorations(paintInfo, tx, ty);
// FIXME: We need to work with "rl" and "bt" block flow directions. In those
// cases the legend is embedded in the right and bottom borders respectively.
// https://bugs.webkit.org/show_bug.cgi?id=47236
if (style()->isHorizontalWritingMode()) {
int yOff = (legend->y() > 0) ? 0 : (legend->height() - borderTop()) / 2;
h -= yOff;
ty += yOff;
} else {
int xOff = (legend->x() > 0) ? 0 : (legend->width() - borderLeft()) / 2;
w -= xOff;
tx += xOff;
}
paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Normal);
paintFillLayers(paintInfo, style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->backgroundLayers(), tx, ty, w, h);
paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Inset);
if (!style()->hasBorder())
return;
// Create a clipping region around the legend and paint the border as normal
GraphicsContext* graphicsContext = paintInfo.context;
graphicsContext->save();
// FIXME: We need to work with "rl" and "bt" block flow directions. In those
// cases the legend is embedded in the right and bottom borders respectively.
// https://bugs.webkit.org/show_bug.cgi?id=47236
if (style()->isHorizontalWritingMode()) {
int clipTop = ty;
int clipHeight = max(static_cast<int>(style()->borderTopWidth()), legend->height());
graphicsContext->clipOut(IntRect(tx + legend->x(), clipTop, legend->width(), clipHeight));
} else {
int clipLeft = tx;
int clipWidth = max(static_cast<int>(style()->borderLeftWidth()), legend->width());
graphicsContext->clipOut(IntRect(clipLeft, ty + legend->y(), clipWidth, legend->height()));
}
paintBorder(paintInfo.context, tx, ty, w, h, style(), true, true);
graphicsContext->restore();
}
示例3: paintBoxDecorations
void RenderFieldset::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (!paintInfo.shouldPaintWithinRoot(this))
return;
LayoutRect paintRect(paintOffset, size());
RenderBox* legend = findLegend();
if (!legend)
return RenderBlock::paintBoxDecorations(paintInfo, paintOffset);
// FIXME: We need to work with "rl" and "bt" block flow directions. In those
// cases the legend is embedded in the right and bottom borders respectively.
// https://bugs.webkit.org/show_bug.cgi?id=47236
if (style()->isHorizontalWritingMode()) {
LayoutUnit yOff = (legend->y() > 0) ? zeroLayoutUnit : (legend->height() - borderTop()) / 2;
paintRect.setHeight(paintRect.height() - yOff);
paintRect.setY(paintRect.y() + yOff);
} else {
LayoutUnit xOff = (legend->x() > 0) ? zeroLayoutUnit : (legend->width() - borderLeft()) / 2;
paintRect.setWidth(paintRect.width() - xOff);
paintRect.setX(paintRect.x() + xOff);
}
if (!boxShadowShouldBeAppliedToBackground(determineBackgroundBleedAvoidance(paintInfo.context)))
paintBoxShadow(paintInfo, paintRect, style(), Normal);
paintFillLayers(paintInfo, style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->backgroundLayers(), paintRect);
paintBoxShadow(paintInfo, paintRect, style(), Inset);
if (!style()->hasBorder())
return;
// Create a clipping region around the legend and paint the border as normal
GraphicsContext* graphicsContext = paintInfo.context;
GraphicsContextStateSaver stateSaver(*graphicsContext);
// FIXME: We need to work with "rl" and "bt" block flow directions. In those
// cases the legend is embedded in the right and bottom borders respectively.
// https://bugs.webkit.org/show_bug.cgi?id=47236
if (style()->isHorizontalWritingMode()) {
LayoutUnit clipTop = paintRect.y();
LayoutUnit clipHeight = max(static_cast<LayoutUnit>(style()->borderTopWidth()), legend->height() - ((legend->height() - borderTop()) / 2));
graphicsContext->clipOut(pixelSnappedIntRect(paintRect.x() + legend->x(), clipTop, legend->width(), clipHeight));
} else {
LayoutUnit clipLeft = paintRect.x();
LayoutUnit clipWidth = max(static_cast<LayoutUnit>(style()->borderLeftWidth()), legend->width());
graphicsContext->clipOut(pixelSnappedIntRect(clipLeft, paintRect.y() + legend->y(), clipWidth, legend->height()));
}
paintBorder(paintInfo, paintRect, style());
}
示例4: paintBoxDecorations
void RenderFieldset::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
{
int w = width();
int h = height() + borderTopExtra() + borderBottomExtra();
RenderObject* legend = findLegend();
if (!legend)
return RenderBlock::paintBoxDecorations(paintInfo, tx, ty);
int yOff = (legend->yPos() > 0) ? 0 : (legend->height() - borderTop()) / 2;
int legendBottom = ty + legend->yPos() + legend->height();
h -= yOff;
ty += yOff - borderTopExtra();
int my = max(ty, paintInfo.rect.y());
int end = min(paintInfo.rect.bottom(), ty + h);
int mh = end - my;
paintBoxShadow(paintInfo.context, tx, ty, w, h, style());
paintFillLayers(paintInfo, style()->backgroundColor(), style()->backgroundLayers(), my, mh, tx, ty, w, h);
if (!style()->hasBorder())
return;
// Save time by not saving and restoring the GraphicsContext in the straight border case
if (!style()->hasBorderRadius())
return paintBorderMinusLegend(paintInfo.context, tx, ty, w, h, style(), legend->xPos(), legend->width(), legendBottom);
// We have rounded borders, create a clipping region
// around the legend and paint the border as normal
GraphicsContext* graphicsContext = paintInfo.context;
graphicsContext->save();
int clipTop = ty;
int clipHeight = max(static_cast<int>(style()->borderTopWidth()), legend->height());
graphicsContext->clipOut(IntRect(tx + legend->xPos(), clipTop,
legend->width(), clipHeight));
paintBorder(paintInfo.context, tx, ty, w, h, style(), true, true);
graphicsContext->restore();
}
示例5: paintBoxDecorations
void RenderFieldset::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
{
#if PLATFORM(WKC)
CRASH_IF_STACK_OVERFLOW(WKC_STACK_MARGIN_DEFAULT);
#endif
int w = width();
int h = height();
RenderBox* legend = findLegend();
if (!legend)
return RenderBlock::paintBoxDecorations(paintInfo, tx, ty);
int yOff = (legend->y() > 0) ? 0 : (legend->height() - borderTop()) / 2;
int legendBottom = ty + legend->y() + legend->height();
h -= yOff;
ty += yOff;
paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Normal);
paintFillLayers(paintInfo, style()->backgroundColor(), style()->backgroundLayers(), tx, ty, w, h);
paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Inset);
if (!style()->hasBorder())
return;
// Save time by not saving and restoring the GraphicsContext in the straight border case
if (!style()->hasBorderRadius())
return paintBorderMinusLegend(paintInfo.context, tx, ty, w, h, style(), legend->x(), legend->width(), legendBottom);
// We have rounded borders, create a clipping region
// around the legend and paint the border as normal
GraphicsContext* graphicsContext = paintInfo.context;
graphicsContext->save();
int clipTop = ty;
int clipHeight = max(static_cast<int>(style()->borderTopWidth()), legend->height());
graphicsContext->clipOut(IntRect(tx + legend->x(), clipTop,
legend->width(), clipHeight));
paintBorder(paintInfo.context, tx, ty, w, h, style(), true, true);
graphicsContext->restore();
}
示例6: apply
void ClipOutToPath::apply(GraphicsContext& context) const
{
context.clipOut(m_path);
}