本文整理汇总了C++中SkPaint::flatten方法的典型用法代码示例。如果您正苦于以下问题:C++ SkPaint::flatten方法的具体用法?C++ SkPaint::flatten怎么用?C++ SkPaint::flatten使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkPaint
的用法示例。
在下文中一共展示了SkPaint::flatten方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Reconstruct
static size_t Reconstruct(const SkPaint& src, SkPaint* dst) {
SkOrderedWriteBuffer writer;
src.flatten(writer);
const size_t size = writer.bytesWritten();
SkAutoMalloc bytes(size);
writer.writeToMemory(bytes.get());
SkOrderedReadBuffer reader(bytes.get(), size);
dst->unflatten(reader);
return size;
}
示例2: writePaint
void SkBinaryWriteBuffer::writePaint(const SkPaint& paint) {
paint.flatten(*this);
}
示例3: reader
DEF_TEST(Paint_flattening, reporter) {
const SkFilterQuality levels[] = {
kNone_SkFilterQuality,
kLow_SkFilterQuality,
kMedium_SkFilterQuality,
kHigh_SkFilterQuality,
};
const SkPaint::Hinting hinting[] = {
SkPaint::kNo_Hinting,
SkPaint::kSlight_Hinting,
SkPaint::kNormal_Hinting,
SkPaint::kFull_Hinting,
};
const SkPaint::Align align[] = {
SkPaint::kLeft_Align,
SkPaint::kCenter_Align,
SkPaint::kRight_Align
};
const SkPaint::Cap caps[] = {
SkPaint::kButt_Cap,
SkPaint::kRound_Cap,
SkPaint::kSquare_Cap,
};
const SkPaint::Join joins[] = {
SkPaint::kMiter_Join,
SkPaint::kRound_Join,
SkPaint::kBevel_Join,
};
const SkPaint::TextEncoding encodings[] = {
SkPaint::kUTF8_TextEncoding,
SkPaint::kUTF16_TextEncoding,
SkPaint::kUTF32_TextEncoding,
SkPaint::kGlyphID_TextEncoding,
};
const SkPaint::Style styles[] = {
SkPaint::kFill_Style,
SkPaint::kStroke_Style,
SkPaint::kStrokeAndFill_Style,
};
#define FOR_SETUP(index, array, setter) \
for (size_t index = 0; index < SK_ARRAY_COUNT(array); ++index) { \
paint.setter(array[index]); \
SkPaint paint;
paint.setFlags(0x1234);
FOR_SETUP(i, levels, setFilterQuality)
FOR_SETUP(j, hinting, setHinting)
FOR_SETUP(k, align, setTextAlign)
FOR_SETUP(l, caps, setStrokeCap)
FOR_SETUP(m, joins, setStrokeJoin)
FOR_SETUP(n, encodings, setTextEncoding)
FOR_SETUP(p, styles, setStyle)
SkWriteBuffer writer;
paint.flatten(writer);
const uint32_t* written = writer.getWriter32()->contiguousArray();
SkReadBuffer reader(written, writer.bytesWritten());
SkPaint paint2;
paint2.unflatten(reader);
REPORTER_ASSERT(reporter, paint2 == paint);
}}}}}}}
示例4: writePaint
void SkFlattenableWriteBuffer::writePaint(const SkPaint& paint) {
paint.flatten(*this);
}