class SkTextBlobPriv { public: /** * Serialize to a buffer.
*/ staticvoid Flatten(const SkTextBlob& , SkWriteBuffer&);
/** * Recreate an SkTextBlob that was serialized into a buffer. * * @param SkReadBuffer Serialized blob data. * @return A new SkTextBlob representing the serialized data, or NULL if the buffer is * invalid.
*/ static sk_sp<SkTextBlob> MakeFromBuffer(SkReadBuffer&);
staticbool HasRSXForm(const SkTextBlob& blob);
};
// // Textblob data is laid out into externally-managed storage as follows: // // ----------------------------------------------------------------------------- // | SkTextBlob | RunRecord | Glyphs[] | Pos[] | RunRecord | Glyphs[] | Pos[] | ... // ----------------------------------------------------------------------------- // // Each run record describes a text blob run, and can be used to determine the (implicit) // location of the following record. // // Extended Textblob runs have more data after the Pos[] array: // // ------------------------------------------------------------------------- // ... | RunRecord | Glyphs[] | Pos[] | TextSize | Clusters[] | Text[] | ... // ------------------------------------------------------------------------- // // To determine the length of the extended run data, the TextSize must be read. // // Extended Textblob runs may be mixed with non-extended runs.
uint16_t* glyphBuffer() const {
static_assert(SkIsAlignPtr(sizeof(RunRecord)), ""); // Glyphs are stored immediately following the record. returnreinterpret_cast<uint16_t*>(const_cast<RunRecord*>(this) + 1);
}
// can be aliased with pointBuffer() or xformBuffer()
SkScalar* posBuffer() const { // Position scalars follow the (aligned) glyph buffer. returnreinterpret_cast<SkScalar*>(reinterpret_cast<uint8_t*>(this->glyphBuffer()) +
SkAlign4(fCount * sizeof(uint16_t)));
}
// alias for posBuffer()
SkPoint* pointBuffer() const {
SkASSERT(this->positioning() == (GlyphPositioning)2); returnreinterpret_cast<SkPoint*>(this->posBuffer());
}
// alias for posBuffer()
SkRSXform* xformBuffer() const {
SkASSERT(this->positioning() == (GlyphPositioning)3); returnreinterpret_cast<SkRSXform*>(this->posBuffer());
}
enum Flags {
kPositioning_Mask = 0x03, // bits 0-1 reserved for positioning
kLast_Flag = 0x04, // set for the last blob run
kExtended_Flag = 0x08, // set for runs with text/cluster info
};
/** * Iterate through all of the text runs of the text blob. For example: * for (SkTextBlobRunIterator it(blob); !it.done(); it.next()) { * ..... * }
*/ class SK_SPI SkTextBlobRunIterator { public:
SkTextBlobRunIterator(const SkTextBlob* blob);
enum GlyphPositioning : uint8_t {
kDefault_Positioning = 0, // Default glyph advances -- zero scalars per glyph.
kHorizontal_Positioning = 1, // Horizontal positioning -- one scalar per glyph.
kFull_Positioning = 2, // Point positioning -- two scalars per glyph.
kRSXform_Positioning = 3, // RSXform positioning -- four scalars per glyph.
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.