本文整理汇总了C++中SkPixmap::isOpaque方法的典型用法代码示例。如果您正苦于以下问题:C++ SkPixmap::isOpaque方法的具体用法?C++ SkPixmap::isOpaque怎么用?C++ SkPixmap::isOpaque使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkPixmap
的用法示例。
在下文中一共展示了SkPixmap::isOpaque方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Supports
static bool Supports(const SkPixmap& dst, const SkPixmap& src, const SkPaint& paint) {
if (dst.colorType() != src.colorType()) {
return false;
}
if (dst.info().profileType() != src.info().profileType()) {
return false;
}
if (paint.getMaskFilter() || paint.getColorFilter() || paint.getImageFilter()) {
return false;
}
if (0xFF != paint.getAlpha()) {
return false;
}
SkXfermode::Mode mode;
if (!SkXfermode::AsMode(paint.getXfermode(), &mode)) {
return false;
}
if (SkXfermode::kSrc_Mode == mode) {
return true;
}
if (SkXfermode::kSrcOver_Mode == mode && src.isOpaque()) {
return true;
}
return false;
}
示例2: Supports
static bool Supports(const SkPixmap& dst, const SkPixmap& src, const SkPaint& paint) {
if (dst.colorType() != src.colorType()) {
return false;
}
if (dst.info().gammaCloseToSRGB() != src.info().gammaCloseToSRGB()) {
return false;
}
if (paint.getMaskFilter() || paint.getColorFilter() || paint.getImageFilter()) {
return false;
}
if (0xFF != paint.getAlpha()) {
return false;
}
SkBlendMode mode = paint.getBlendMode();
if (SkBlendMode::kSrc == mode) {
return true;
}
if (SkBlendMode::kSrcOver == mode && src.isOpaque()) {
return true;
}
// At this point memcpy can't be used. The following check for using SrcOver.
if (dst.colorType() != kN32_SkColorType || !dst.info().gammaCloseToSRGB()) {
return false;
}
return SkBlendMode::kSrcOver == mode;
}
示例3: Resize
bool SkBitmapScaler::Resize(const SkPixmap& result, const SkPixmap& source, ResizeMethod method) {
if (!valid_for_resize(source, result.width(), result.height())) {
return false;
}
if (!result.addr() || result.colorType() != source.colorType()) {
return false;
}
SkConvolutionProcs convolveProcs= { 0, nullptr, nullptr, nullptr, nullptr };
PlatformConvolutionProcs(&convolveProcs);
SkRect destSubset = SkRect::MakeIWH(result.width(), result.height());
SkResizeFilter filter(method, source.width(), source.height(),
result.width(), result.height(), destSubset, convolveProcs);
// Get a subset encompassing this touched area. We construct the
// offsets and row strides such that it looks like a new bitmap, while
// referring to the old data.
const uint8_t* sourceSubset = reinterpret_cast<const uint8_t*>(source.addr());
return BGRAConvolve2D(sourceSubset, static_cast<int>(source.rowBytes()),
!source.isOpaque(), filter.xFilter(), filter.yFilter(),
static_cast<int>(result.rowBytes()),
static_cast<unsigned char*>(result.writable_addr()),
convolveProcs, true);
}
示例4: INHERITED
Sprite_sRGB(const SkPixmap& src, const SkPaint& paint) : INHERITED(src, paint) {
uint32_t flags = SkXfermode::kDstIsSRGB_D32Flag;
if (src.isOpaque()) {
flags |= SkXfermode::kSrcIsOpaque_D32Flag;
}
fWriter = SkXfermode::GetD32Proc(fXfer, flags);
}
示例5: Resize
bool SkBitmapScaler::Resize(SkBitmap* resultPtr, const SkPixmap& source, ResizeMethod method,
int destWidth, int destHeight, SkBitmap::Allocator* allocator) {
if (nullptr == source.addr() || source.colorType() != kN32_SkColorType ||
source.width() < 1 || source.height() < 1)
{
return false;
}
if (destWidth < 1 || destHeight < 1) {
return false;
}
SkConvolutionProcs convolveProcs= { 0, nullptr, nullptr, nullptr, nullptr };
PlatformConvolutionProcs(&convolveProcs);
SkRect destSubset = SkRect::MakeIWH(destWidth, destHeight);
SkResizeFilter filter(method, source.width(), source.height(),
destWidth, destHeight, destSubset, convolveProcs);
// Get a subset encompassing this touched area. We construct the
// offsets and row strides such that it looks like a new bitmap, while
// referring to the old data.
const uint8_t* sourceSubset = reinterpret_cast<const uint8_t*>(source.addr());
// Convolve into the result.
SkBitmap result;
result.setInfo(SkImageInfo::MakeN32(SkScalarCeilToInt(destSubset.width()),
SkScalarCeilToInt(destSubset.height()),
source.alphaType()));
result.allocPixels(allocator, nullptr);
if (!result.readyToDraw()) {
return false;
}
if (!BGRAConvolve2D(sourceSubset, static_cast<int>(source.rowBytes()),
!source.isOpaque(), filter.xFilter(), filter.yFilter(),
static_cast<int>(result.rowBytes()),
static_cast<unsigned char*>(result.getPixels()),
convolveProcs, true)) {
return false;
}
*resultPtr = result;
resultPtr->lockPixels();
SkASSERT(resultPtr->getPixels());
return true;
}
示例6: Supports
static bool Supports(const SkPixmap& dst, const SkPixmap& src, const SkPaint& paint) {
// the caller has already inspected the colorspace on src and dst
SkASSERT(!SkColorSpaceXformSteps::Required(src.colorSpace(), dst.colorSpace()));
if (dst.colorType() != src.colorType()) {
return false;
}
if (paint.getMaskFilter() || paint.getColorFilter() || paint.getImageFilter()) {
return false;
}
if (0xFF != paint.getAlpha()) {
return false;
}
SkBlendMode mode = paint.getBlendMode();
return SkBlendMode::kSrc == mode || (SkBlendMode::kSrcOver == mode && src.isOpaque());
}
示例7: Supports
static bool Supports(const SkPixmap& dst, const SkPixmap& src, const SkPaint& paint) {
if (dst.colorType() != src.colorType()) {
return false;
}
if (!SkColorSpace::Equals(dst.colorSpace(), src.colorSpace())) {
return false;
}
if (paint.getMaskFilter() || paint.getColorFilter() || paint.getImageFilter()) {
return false;
}
if (0xFF != paint.getAlpha()) {
return false;
}
SkBlendMode mode = paint.getBlendMode();
return SkBlendMode::kSrc == mode || (SkBlendMode::kSrcOver == mode && src.isOpaque());
}