本文整理汇总了C++中Rect::Deflate方法的典型用法代码示例。如果您正苦于以下问题:C++ Rect::Deflate方法的具体用法?C++ Rect::Deflate怎么用?C++ Rect::Deflate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rect
的用法示例。
在下文中一共展示了Rect::Deflate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: srcOuter
/***
* Blur an inset box shadow by doing:
* 1) Create a minimal box shadow path that creates a frame.
* 2) Draw the box shadow portion over the destination surface.
* 3) The "inset" part is created by a clip rect that properly clips
* the alpha mask so that it has clean edges. We still create the full
* proper alpha mask, but let the clip deal with the clean edges.
*
* All parameters should already be in device pixels.
*/
void
gfxAlphaBoxBlur::BlurInsetBox(gfxContext* aDestinationCtx,
const Rect aDestinationRect,
const Rect aShadowClipRect,
const IntSize aBlurRadius,
const IntSize aSpreadRadius,
const Color& aShadowColor,
bool aHasBorderRadius,
const RectCornerRadii& aInnerClipRadii,
const Rect aSkipRect,
const Point aShadowOffset)
{
DrawTarget* destDrawTarget = aDestinationCtx->GetDrawTarget();
// Blur inset shadows ALWAYS have a 0 spread radius.
if ((aBlurRadius.width <= 0 && aBlurRadius.height <= 0)) {
FillDestinationPath(aDestinationCtx, aDestinationRect, aShadowClipRect,
aShadowColor, aHasBorderRadius, aInnerClipRadii);
return;
}
IntMargin extendDest;
IntMargin slice;
bool didMoveOffset;
RefPtr<SourceSurface> minInsetBlur = GetInsetBlur(extendDest, slice,
aDestinationRect, aShadowClipRect,
aBlurRadius, aSpreadRadius,
aInnerClipRadii, aShadowColor,
aHasBorderRadius, aShadowOffset,
didMoveOffset, destDrawTarget);
if (!minInsetBlur) {
return;
}
Rect srcOuter(Point(), Size(minInsetBlur->GetSize()));
Rect srcInner = srcOuter;
srcInner.Deflate(Margin(slice));
Rect dstOuter(aDestinationRect);
if (!didMoveOffset) {
dstOuter.MoveBy(aShadowOffset);
}
dstOuter.Inflate(Margin(extendDest));
Rect dstInner = dstOuter;
dstInner.Deflate(Margin(slice));
if (dstOuter.Size() == srcOuter.Size()) {
destDrawTarget->DrawSurface(minInsetBlur, dstOuter, srcOuter);
} else {
DrawBoxShadows(*destDrawTarget, minInsetBlur,
dstOuter, dstInner,
srcOuter, srcInner,
aSkipRect);
}
}
示例2: FrameLayout
void BorderFrame::FrameLayout(Rect& r)
{
Size sz = r.GetSize();
int n = (int)(intptr_t)*border;
if(sz.cx >= 2 * n && sz.cy >= 2 * n)
r.Deflate(n);
}
示例3: tileRect
void
DrawTargetTiled::StrokeRect(const Rect& aRect, const Pattern& aPattern, const StrokeOptions &aStrokeOptions, const DrawOptions& aDrawOptions)
{
Rect deviceRect = mTransform.TransformBounds(aRect);
Margin strokeMargin = MaxStrokeExtents(aStrokeOptions, mTransform);
Rect outerRect = deviceRect;
outerRect.Inflate(strokeMargin);
Rect innerRect;
if (mTransform.IsRectilinear()) {
// If rects are mapped to rects, we can compute the inner rect
// of the stroked rect.
innerRect = deviceRect;
innerRect.Deflate(strokeMargin);
}
for (size_t i = 0; i < mTiles.size(); i++) {
if (mTiles[i].mClippedOut) {
continue;
}
Rect tileRect(mTiles[i].mTileOrigin.x,
mTiles[i].mTileOrigin.y,
mTiles[i].mDrawTarget->GetSize().width,
mTiles[i].mDrawTarget->GetSize().height);
if (outerRect.Intersects(tileRect) && !innerRect.Contains(tileRect)) {
mTiles[i].mDrawTarget->StrokeRect(aRect, aPattern, aStrokeOptions, aDrawOptions);
}
}
}
示例4: GetDefaultWindowRect
Rect Ctrl::GetDefaultWindowRect() {
GuiLock __;
static int ii = 0;
Size sz = framebuffer.GetSize();
Rect rect = framebuffer.GetSize();
rect.Deflate(sz / 10);
rect.Offset(Size(GetStdFontCy(), 2 * GetStdFontCy()) * (++ii % 8));
return rect;
}
示例5:
RectCtrlTest::RectCtrlTest()
{
CtrlLayout(*this, "Window title");
Sizeable().Zoomable();
Rect r = rc.GetRect();
r.Deflate(r.Width()/4, r.Height()/4);
rc.SetData(r);
}
示例6: ShowOuterPopUps
void PopUpDockWindow::ShowOuterPopUps(DockCont &dc)
{
Rect wrect = GetScreenRect();
Point cp = wrect.CenterPoint();
Size psz(style->outersize, style->outersize);
Rect prect = Rect(psz);
psz /= 2;
wrect.Deflate(12, 12);
if (dc.IsDockAllowed(DOCK_LEFT)) ShowPopUp(outer[DOCK_LEFT], prect.Offseted(wrect.left + POPUP_SPACING, cp.y - psz.cy));
if (dc.IsDockAllowed(DOCK_TOP)) ShowPopUp(outer[DOCK_TOP], prect.Offseted(cp.x - psz.cx, wrect.top + POPUP_SPACING));
if (dc.IsDockAllowed(DOCK_RIGHT)) ShowPopUp(outer[DOCK_RIGHT], prect.Offseted(wrect.right - POPUP_SPACING - psz.cx*2, cp.y - psz.cy));
if (dc.IsDockAllowed(DOCK_BOTTOM)) ShowPopUp(outer[DOCK_BOTTOM], prect.Offseted(cp.x - psz.cx, wrect.bottom - POPUP_SPACING - psz.cy*2));
}
示例7: GetPartRect
Rect ScrollBar::GetPartRect(int p) const {
Rect h = Slider();
int sbo = style->overthumb;
int off = GetHV(h.left, h.top);
int ts = thumbsize;
if(ts < style->thumbmin)
ts = 0;
switch(p) {
case 0:
HV(h.right, h.bottom) = thumbpos - sbo + ts / 2 + off;
break;
case 1:
HV(h.left, h.top) = thumbpos + ts / 2 + sbo + off;
break;
case 2:
if(!IsNull(style->thumbwidth))
h.Deflate((style->barsize - style->thumbwidth) / 2);
HV(h.left, h.top) = thumbpos - sbo + off;
HV(h.right, h.bottom) = thumbpos + ts + sbo + off;
break;
}
return h;
}
示例8: srcOuter
/* static */ void
gfxAlphaBoxBlur::BlurRectangle(gfxContext* aDestinationCtx,
const gfxRect& aRect,
RectCornerRadii* aCornerRadii,
const gfxPoint& aBlurStdDev,
const gfxRGBA& aShadowColor,
const gfxRect& aDirtyRect,
const gfxRect& aSkipRect)
{
DrawTarget& destDrawTarget = *aDestinationCtx->GetDrawTarget();
IntSize blurRadius = CalculateBlurRadius(aBlurStdDev);
IntRect rect = RoundedToInt(ToRect(aRect));
IntMargin extendDestBy;
IntMargin slice;
RefPtr<SourceSurface> boxShadow = GetBlur(destDrawTarget,
rect.Size(), blurRadius,
aCornerRadii, aShadowColor,
extendDestBy, slice);
if (!boxShadow) {
return;
}
destDrawTarget.PushClipRect(ToRect(aDirtyRect));
// Copy the right parts from boxShadow into destDrawTarget. The middle parts
// will be stretched, border-image style.
Rect srcOuter(Point(), Size(boxShadow->GetSize()));
Rect srcInner = srcOuter;
srcInner.Deflate(Margin(slice));
rect.Inflate(extendDestBy);
Rect dstOuter(rect);
Rect dstInner(rect);
dstInner.Deflate(Margin(slice));
Rect skipRect = ToRect(aSkipRect);
if (srcInner.IsEqualInterior(srcOuter)) {
MOZ_ASSERT(dstInner.IsEqualInterior(dstOuter));
// The target rect is smaller than the minimal size so just draw the surface
destDrawTarget.DrawSurface(boxShadow, dstInner, srcInner);
} else {
DrawBoxShadows(destDrawTarget, boxShadow, dstOuter, dstInner,
srcOuter, srcInner, skipRect);
// Middle part
RepeatOrStretchSurface(destDrawTarget, boxShadow,
RectWithEdgesTRBL(dstInner.Y(), dstInner.XMost(),
dstInner.YMost(), dstInner.X()),
RectWithEdgesTRBL(srcInner.Y(), srcInner.XMost(),
srcInner.YMost(), srcInner.X()),
skipRect);
}
// A note about anti-aliasing and seems between adjacent parts:
// We don't explicitly disable anti-aliasing in the DrawSurface calls above,
// so if there's a transform on destDrawTarget that is not pixel-aligned,
// there will be seams between adjacent parts of the box-shadow. It's hard to
// avoid those without the use of an intermediate surface.
// You might think that we could avoid those by just turning of AA, but there
// is a problem with that: Box-shadow rendering needs to clip out the
// element's border box, and we'd like that clip to have anti-aliasing -
// especially if the element has rounded corners! So we can't do that unless
// we have a way to say "Please anti-alias the clip, but don't antialias the
// destination rect of the DrawSurface call".
// On OS X there is an additional problem with turning off AA: CoreGraphics
// will not just fill the pixels that have their pixel center inside the
// filled shape. Instead, it will fill all the pixels which are partially
// covered by the shape. So for pixels on the edge between two adjacent parts,
// all those pixels will be painted to by both parts, which looks very bad.
destDrawTarget.PopClip();
}