本文整理汇总了C++中SkAAClip::copyToMask方法的典型用法代码示例。如果您正苦于以下问题:C++ SkAAClip::copyToMask方法的具体用法?C++ SkAAClip::copyToMask怎么用?C++ SkAAClip::copyToMask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkAAClip
的用法示例。
在下文中一共展示了SkAAClip::copyToMask方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_path_with_hole
static void test_path_with_hole(skiatest::Reporter* reporter) {
static const uint8_t gExpectedImage[] = {
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
};
SkMask expected;
expected.fBounds.set(0, 0, 4, 6);
expected.fRowBytes = 4;
expected.fFormat = SkMask::kA8_Format;
expected.fImage = (uint8_t*)gExpectedImage;
SkPath path;
path.addRect(SkRect::MakeXYWH(0, 0,
SkIntToScalar(4), SkIntToScalar(2)));
path.addRect(SkRect::MakeXYWH(0, SkIntToScalar(4),
SkIntToScalar(4), SkIntToScalar(2)));
for (int i = 0; i < 2; ++i) {
SkAAClip clip;
clip.setPath(path, nullptr, 1 == i);
SkMask mask;
clip.copyToMask(&mask);
SkAutoMaskFreeImage freeM(mask.fImage);
REPORTER_ASSERT(reporter, expected == mask);
}
}
示例2: copyToMask
static bool operator==(const SkRegion& rgn, const SkAAClip& aaclip) {
SkMask mask0, mask1;
copyToMask(rgn, &mask0);
aaclip.copyToMask(&mask1);
bool eq = (mask0 == mask1);
SkMask::FreeImage(mask0.fImage);
SkMask::FreeImage(mask1.fImage);
return eq;
}
示例3: drawClip
static void drawClip(SkCanvas* canvas, const SkAAClip& clip) {
SkMask mask;
SkBitmap bm;
clip.copyToMask(&mask);
SkAutoMaskFreeImage amfi(mask.fImage);
bm.installMaskPixels(mask);
SkPaint paint;
canvas->drawBitmap(bm,
SK_Scalar1 * mask.fBounds.fLeft,
SK_Scalar1 * mask.fBounds.fTop,
&paint);
}
示例4: drawClip
static void drawClip(SkCanvas* canvas, const SkAAClip& clip) {
SkMask mask;
SkBitmap bm;
clip.copyToMask(&mask);
SkAutoMaskFreeImage amfi(mask.fImage);
bm.setConfig(SkBitmap::kA8_Config, mask.fBounds.width(),
mask.fBounds.height(), mask.fRowBytes);
bm.setPixels(mask.fImage);
SkPaint paint;
canvas->drawBitmap(bm,
SK_Scalar1 * mask.fBounds.fLeft,
SK_Scalar1 * mask.fBounds.fTop,
&paint);
}