本文整理汇总了C++中sk_sp::gammaIsLinear方法的典型用法代码示例。如果您正苦于以下问题:C++ sk_sp::gammaIsLinear方法的具体用法?C++ sk_sp::gammaIsLinear怎么用?C++ sk_sp::gammaIsLinear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sk_sp
的用法示例。
在下文中一共展示了sk_sp::gammaIsLinear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SkPictureImageGenerator
std::unique_ptr<SkImageGenerator>
SkPictureImageGenerator::Make(const SkISize& size, sk_sp<SkPicture> picture, const SkMatrix* matrix,
const SkPaint* paint, SkImage::BitDepth bitDepth,
sk_sp<SkColorSpace> colorSpace) {
if (!picture || size.isEmpty()) {
return nullptr;
}
if (SkImage::BitDepth::kF16 == bitDepth && (!colorSpace || !colorSpace->gammaIsLinear())) {
return nullptr;
}
if (colorSpace && (!colorSpace->gammaCloseToSRGB() && !colorSpace->gammaIsLinear())) {
return nullptr;
}
SkColorType colorType = kN32_SkColorType;
if (SkImage::BitDepth::kF16 == bitDepth) {
colorType = kRGBA_F16_SkColorType;
}
SkImageInfo info = SkImageInfo::Make(size.width(), size.height(), colorType,
kPremul_SkAlphaType, std::move(colorSpace));
return std::unique_ptr<SkImageGenerator>(
new SkPictureImageGenerator(info, std::move(picture), matrix, paint));
}
示例2: sk_ref_sp
sk_sp<SkImage> SkImage::makeColorSpace(sk_sp<SkColorSpace> target,
SkTransferFunctionBehavior premulBehavior) const {
SkColorSpaceTransferFn fn;
if (!target || !target->isNumericalTransferFn(&fn)) {
return nullptr;
}
// No need to create a new image if:
// (1) The color spaces are equal.
// (2) The color type is kAlpha8.
if (SkColorSpace::Equals(this->colorSpace(), target.get()) ||
kAlpha_8_SkColorType == as_IB(this)->onImageInfo().colorType()) {
return sk_ref_sp(const_cast<SkImage*>(this));
}
SkColorType targetColorType = kN32_SkColorType;
if (SkTransferFunctionBehavior::kRespect == premulBehavior && target->gammaIsLinear()) {
targetColorType = kRGBA_F16_SkColorType;
}
// TODO: We might consider making this a deferred conversion?
return as_IB(this)->onMakeColorSpace(std::move(target), targetColorType, premulBehavior);
}