本文整理汇总了C++中SkGlyph::getPackedID方法的典型用法代码示例。如果您正苦于以下问题:C++ SkGlyph::getPackedID方法的具体用法?C++ SkGlyph::getPackedID怎么用?C++ SkGlyph::getPackedID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkGlyph
的用法示例。
在下文中一共展示了SkGlyph::getPackedID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generateImage
void RandomScalerContext::generateImage(const SkGlyph& glyph) {
// TODO: can force down but not up
/*
SkMask::Format format = (SkMask::Format)glyph.fMaskFormat;
switch (glyph.getGlyphID() % 4) {
case 0: format = SkMask::kLCD16_Format; break;
case 1: format = SkMask::kA8_Format; break;
case 2: format = SkMask::kARGB32_Format; break;
case 3: format = SkMask::kBW_Format; break;
}
const_cast<SkGlyph&>(glyph).fMaskFormat = format;
*/
if (fFakeIt) {
sk_bzero(glyph.fImage, glyph.computeImageSize());
return;
}
if (SkMask::kARGB32_Format != glyph.fMaskFormat) {
fProxy->getImage(glyph);
return;
}
// If the format is ARGB, just draw the glyph from path.
SkPath path;
if (!fProxy->getPath(glyph.getPackedID(), &path)) {
fProxy->getImage(glyph);
return;
}
SkBitmap bm;
bm.installPixels(SkImageInfo::MakeN32Premul(glyph.fWidth, glyph.fHeight),
glyph.fImage,
glyph.rowBytes());
bm.eraseColor(0);
SkCanvas canvas(bm);
canvas.translate(-SkIntToScalar(glyph.fLeft), -SkIntToScalar(glyph.fTop));
canvas.drawPath(path, this->getRandomTypeface()->paint());
}