本文整理汇总了C++中SkPaint::isSrcOver方法的典型用法代码示例。如果您正苦于以下问题:C++ SkPaint::isSrcOver方法的具体用法?C++ SkPaint::isSrcOver怎么用?C++ SkPaint::isSrcOver使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkPaint
的用法示例。
在下文中一共展示了SkPaint::isSrcOver方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: INHERITED
SkRGB16_Black_Blitter::SkRGB16_Black_Blitter(const SkPixmap& device, const SkPaint& paint)
: INHERITED(device, paint) {
SkASSERT(paint.getShader() == nullptr);
SkASSERT(paint.getColorFilter() == nullptr);
SkASSERT(paint.isSrcOver());
SkASSERT(paint.getColor() == SK_ColorBLACK);
}
示例2: drawImageLattice
void SkBaseDevice::drawImageLattice(const SkImage* image,
const SkCanvas::Lattice& lattice, const SkRect& dst,
const SkPaint& paint) {
SkLatticeIter iter(lattice, dst);
SkRect srcR, dstR;
SkColor c;
bool isFixedColor = false;
const SkImageInfo info = SkImageInfo::Make(1, 1, kBGRA_8888_SkColorType, kUnpremul_SkAlphaType);
while (iter.next(&srcR, &dstR, &isFixedColor, &c)) {
if (isFixedColor || (srcR.width() <= 1.0f && srcR.height() <= 1.0f &&
image->readPixels(info, &c, 4, srcR.fLeft, srcR.fTop))) {
// Fast draw with drawRect, if this is a patch containing a single color
// or if this is a patch containing a single pixel.
if (0 != c || !paint.isSrcOver()) {
SkPaint paintCopy(paint);
int alpha = SkAlphaMul(SkColorGetA(c), SkAlpha255To256(paint.getAlpha()));
paintCopy.setColor(SkColorSetA(c, alpha));
this->drawRect(dstR, paintCopy);
}
} else {
this->drawImageRect(image, &srcR, dstR, paint, SkCanvas::kStrict_SrcRectConstraint);
}
}
}
示例3: onShouldDisableLCD
bool SkBitmapDevice::onShouldDisableLCD(const SkPaint& paint) const {
if (kN32_SkColorType != fBitmap.colorType() ||
paint.getRasterizer() ||
paint.getPathEffect() ||
paint.isFakeBoldText() ||
paint.getStyle() != SkPaint::kFill_Style ||
!paint.isSrcOver())
{
return true;
}
return false;
}
示例4: SkRasterBlitter
SkA8_Coverage_Blitter::SkA8_Coverage_Blitter(const SkPixmap& device,
const SkPaint& paint) : SkRasterBlitter(device) {
SkASSERT(nullptr == paint.getShader());
SkASSERT(paint.isSrcOver());
SkASSERT(nullptr == paint.getColorFilter());
}
示例5: fpArgs
//.........这里部分代码省略.........
// The above may return null if compose results in a pass through of the prim color.
if (shaderFP) {
grPaint->addColorFragmentProcessor(std::move(shaderFP));
}
// We can ignore origColor here - alpha is unchanged by gamma
GrColor paintAlpha = SkColorAlphaToGrColor(skPaint.getColor());
if (GrColor_WHITE != paintAlpha) {
// No gamut conversion - paintAlpha is a (linear) alpha value, splatted to all
// color channels. It's value should be treated as the same in ANY color space.
grPaint->addColorFragmentProcessor(GrConstColorProcessor::Make(
GrColor4f::FromGrColor(paintAlpha),
GrConstColorProcessor::InputMode::kModulateRGBA));
}
} else {
// The shader's FP sees the paint unpremul color
grPaint->setColor4f(origColor);
grPaint->addColorFragmentProcessor(std::move(shaderFP));
}
} else {
if (primColorMode) {
// There is a blend between the primitive color and the paint color. The blend considers
// the opaque paint color. The paint's alpha is applied to the post-blended color.
auto processor = GrConstColorProcessor::Make(origColor.opaque(),
GrConstColorProcessor::InputMode::kIgnore);
processor = GrXfermodeFragmentProcessor::MakeFromSrcProcessor(std::move(processor),
*primColorMode);
if (processor) {
grPaint->addColorFragmentProcessor(std::move(processor));
}
grPaint->setColor4f(origColor.opaque());
// We can ignore origColor here - alpha is unchanged by gamma
GrColor paintAlpha = SkColorAlphaToGrColor(skPaint.getColor());
if (GrColor_WHITE != paintAlpha) {
// No gamut conversion - paintAlpha is a (linear) alpha value, splatted to all
// color channels. It's value should be treated as the same in ANY color space.
grPaint->addColorFragmentProcessor(GrConstColorProcessor::Make(
GrColor4f::FromGrColor(paintAlpha),
GrConstColorProcessor::InputMode::kModulateRGBA));
}
} else {
// No shader, no primitive color.
grPaint->setColor4f(origColor.premul());
applyColorFilterToPaintColor = true;
}
}
SkColorFilter* colorFilter = skPaint.getColorFilter();
if (colorFilter) {
if (applyColorFilterToPaintColor) {
// If we're in legacy mode, we *must* avoid using the 4f version of the color filter,
// because that will combine with the linearized version of the stored color.
if (colorSpaceInfo.isGammaCorrect()) {
grPaint->setColor4f(GrColor4f::FromSkColor4f(
colorFilter->filterColor4f(origColor.toSkColor4f())).premul());
} else {
grPaint->setColor4f(SkColorToPremulGrColor4fLegacy(
colorFilter->filterColor(skPaint.getColor())));
}
} else {
auto cfFP = colorFilter->asFragmentProcessor(context, colorSpaceInfo);
if (cfFP) {
grPaint->addColorFragmentProcessor(std::move(cfFP));
} else {
return false;
}
}
}
SkMaskFilterBase* maskFilter = as_MFB(skPaint.getMaskFilter());
if (maskFilter) {
if (auto mfFP = maskFilter->asFragmentProcessor(fpArgs)) {
grPaint->addCoverageFragmentProcessor(std::move(mfFP));
}
}
// When the xfermode is null on the SkPaint (meaning kSrcOver) we need the XPFactory field on
// the GrPaint to also be null (also kSrcOver).
SkASSERT(!grPaint->getXPFactory());
if (!skPaint.isSrcOver()) {
grPaint->setXPFactory(SkBlendMode_AsXPFactory(skPaint.getBlendMode()));
}
#ifndef SK_IGNORE_GPU_DITHER
// Conservative default, in case GrPixelConfigToColorType() fails.
SkColorType ct = SkColorType::kRGB_565_SkColorType;
GrPixelConfigToColorType(colorSpaceInfo.config(), &ct);
if (SkPaintPriv::ShouldDither(skPaint, ct) && grPaint->numColorFragmentProcessors() > 0 &&
!colorSpaceInfo.isGammaCorrect()) {
auto ditherFP = GrDitherEffect::Make(colorSpaceInfo.config());
if (ditherFP) {
grPaint->addColorFragmentProcessor(std::move(ditherFP));
}
}
#endif
return true;
}