本文整理汇总了C++中SkPaint::getColor4f方法的典型用法代码示例。如果您正苦于以下问题:C++ SkPaint::getColor4f方法的具体用法?C++ SkPaint::getColor4f怎么用?C++ SkPaint::getColor4f使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkPaint
的用法示例。
在下文中一共展示了SkPaint::getColor4f方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
void setup(const SkPixmap& dst, int left, int top, const SkPaint& paint) override {
fDst = dst;
fLeft = left;
fTop = top;
fPaintColor = paint.getColor4f();
SkRasterPipeline p(fAlloc);
p.append_load(fSource.colorType(), &fSrcPtr);
if (fSource.colorType() == kAlpha_8_SkColorType) {
// The color for A8 images comes from the (sRGB) paint color.
p.append_set_rgb(fAlloc, fPaintColor);
p.append(SkRasterPipeline::premul);
}
if (auto dstCS = fDst.colorSpace()) {
auto srcCS = fSource.colorSpace();
if (!srcCS || fSource.colorType() == kAlpha_8_SkColorType) {
// We treat untagged images as sRGB.
// A8 images get their r,g,b from the paint color, so they're also sRGB.
srcCS = sk_srgb_singleton();
}
auto srcAT = fSource.isOpaque() ? kOpaque_SkAlphaType
: kPremul_SkAlphaType;
fAlloc->make<SkColorSpaceXformSteps>(srcCS, srcAT,
dstCS, kPremul_SkAlphaType)
->apply(&p, fSource.colorType());
}
if (fPaintColor.fA != 1.0f) {
p.append(SkRasterPipeline::scale_1_float, &fPaintColor.fA);
}
bool is_opaque = fSource.isOpaque() && fPaintColor.fA == 1.0f;
fBlitter = SkCreateRasterPipelineBlitter(fDst, paint, p, is_opaque, fAlloc);
}
示例2:
// Even with kEntirePaint_Bits, we always ensure that the master paint's
// text-encoding is respected, since that controls how we interpret the
// text/length parameters of a draw[Pos]Text call.
void SkLayerDrawLooper::LayerDrawLooperContext::ApplyInfo(
SkPaint* dst, const SkPaint& src, const LayerInfo& info) {
SkColor4f srcColor = src.getColor4f();
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
// The framework may respect the alpha value on the original paint.
// Match this legacy behavior.
if (src.getAlpha() == 255) {
srcColor.fA = dst->getColor4f().fA;
}
#endif
dst->setColor4f(xferColor(srcColor, dst->getColor4f(), (SkBlendMode)info.fColorMode),
sk_srgb_singleton());
BitFlags bits = info.fPaintBits;
SkPaint::TextEncoding encoding = dst->getTextEncoding();
if (0 == bits) {
return;
}
if (kEntirePaint_Bits == bits) {
// we've already computed these, so save it from the assignment
uint32_t f = dst->getFlags();
SkColor4f c = dst->getColor4f();
*dst = src;
dst->setFlags(f);
dst->setColor4f(c, sk_srgb_singleton());
dst->setTextEncoding(encoding);
return;
}
if (bits & kStyle_Bit) {
dst->setStyle(src.getStyle());
dst->setStrokeWidth(src.getStrokeWidth());
dst->setStrokeMiter(src.getStrokeMiter());
dst->setStrokeCap(src.getStrokeCap());
dst->setStrokeJoin(src.getStrokeJoin());
}
if (bits & kTextSkewX_Bit) {
dst->setTextSkewX(src.getTextSkewX());
}
if (bits & kPathEffect_Bit) {
dst->setPathEffect(src.refPathEffect());
}
if (bits & kMaskFilter_Bit) {
dst->setMaskFilter(src.refMaskFilter());
}
if (bits & kShader_Bit) {
dst->setShader(src.refShader());
}
if (bits & kColorFilter_Bit) {
dst->setColorFilter(src.refColorFilter());
}
if (bits & kXfermode_Bit) {
dst->setBlendMode(src.getBlendMode());
}
// we don't override these
#if 0
dst->setTypeface(src.getTypeface());
dst->setTextSize(src.getTextSize());
dst->setTextScaleX(src.getTextScaleX());
dst->setRasterizer(src.getRasterizer());
dst->setLooper(src.getLooper());
dst->setTextEncoding(src.getTextEncoding());
dst->setHinting(src.getHinting());
#endif
}
示例3: makeGrPaint
void makeGrPaint(GrMaskFormat, const SkPaint& skPaint, const SkMatrix&,
GrPaint* grPaint) override {
grPaint->setColor4f(GrColor4f::FromRGBA4f(skPaint.getColor4f().premul()));
}