class SkData; class SkPaint; class SkTypeface; struct SkDeserialProcs; struct SkSerialProcs;
namespace sktext { class GlyphRunList;
}
/** \class SkTextBlob SkTextBlobcombinesmultipletextrunsintoanimmutablecontainer.Eachtext runconsistsofglyphs,SkPaint,andposition.OnlypartsofSkPaintrelatedto fontsandtextrenderingareusedbyrun.
*/ class SK_API SkTextBlob final : public SkNVRefCnt<SkTextBlob> { private: class RunRecord;
public:
/** Returns conservative bounding box. Uses SkPaint associated with each glyph to determineglyphbounds,andunionsallbounds.Returnedboundsmaybe largerthantheboundsofallglyphsinruns.
/** Returns the number of intervals that intersect bounds. boundsdescribesapairoflinesparalleltothetextadvance. Thereturncountiszerooramultipleoftwo,andisatmosttwicethenumberofglyphsin thetheblob.
/** Returns a textblob built from a single run of text with x-positions and a single y value. ThisisequivalenttousingSkTextBlobBuilderandcallingallocRunPosH(). ReturnsnullptrifbyteLengthiszero.
/** Returns a textblob built from a single run of text with positions. ThisisequivalenttousingSkTextBlobBuilderandcallingallocRunPos(). ReturnsnullptrifbyteLengthiszero.
/** Writes data to allow later reconstruction of SkTextBlob. memory points to storage toreceivetheencodeddata,andmemory_sizedescribesthesizeofstorage. Returnsbytesusedifprovidedstorageislargeenoughtoholdalldata; otherwise,returnszero.
/** Recreates SkTextBlob that was serialized into data. Returns constructed SkTextBlob ifsuccessful;otherwise,returnsnullptr.Failsifsizeissmallerthan requireddatalength,orifdatadoesnotpermitconstructingvalidSkTextBlob.
// Experimental, DO NO USE, will change/go-away struct ExperimentalRun {
SkFont font; int count; const SkGlyphID* glyphs; const SkPoint* positions;
}; bool experimentalNext(ExperimentalRun*);
private: const RunRecord* fRunRecord;
};
private: friendclass SkNVRefCnt<SkTextBlob>;
enum GlyphPositioning : uint8_t;
explicit SkTextBlob(const SkRect& bounds);
~SkTextBlob();
// Memory for objects of this class is created with sk_malloc rather than operator new and must // be freed with sk_free. voidoperatordelete(void* p); void* operatornew(size_t); void* operatornew(size_t, void* p);
using PurgeDelegate = void (*)(uint32_t blobID, uint32_t cacheID);
// Call when this blob is part of the key to a cache entry. This allows the cache // to know automatically those entries can be purged when this SkTextBlob is deleted. void notifyAddedToCache(uint32_t cacheID, PurgeDelegate purgeDelegate) const {
fCacheID.store(cacheID);
fPurgeDelegate.store(purgeDelegate);
}
/** Deletes data allocated internally by SkTextBlobBuilder.
*/
~SkTextBlobBuilder();
/** Returns SkTextBlob built from runs of glyphs added by builder. Returned SkTextBlobisimmutable;itmaybecopied,butitscontentsmaynotbealtered. Returnsnullptrifnorunsofglyphswereaddedbybuilder.
Arunisasequenceofglyphssharingfontmetricsandpositioning. Eachrunmaypositionitsglyphsinoneofthreeways: byspecifyingwherethefirstglyphisdrawn,andallowingfontmetricsto determinetheadvancetosubsequentglyphs;byspecifyingabaseline,and thepositiononthatbaselineforeachglyphinrun;orbyprovidingSkPoint array,oneperglyph.
*/ struct RunBuffer {
SkGlyphID* glyphs; //!< storage for glyph indexes in run
SkScalar* pos; //!< storage for glyph positions in run char* utf8text; //!< storage for text UTF-8 code units in run
uint32_t* clusters; //!< storage for glyph clusters (index of UTF-8 code unit)
// Helpers, since the "pos" field can be different types (always some number of floats).
SkPoint* points() const { return reinterpret_cast<SkPoint*>(pos); }
SkRSXform* xforms() const { return reinterpret_cast<SkRSXform*>(pos); }
};
/** Returns run with storage for glyphs. Caller must write count glyphs to RunBuffer::glyphsbeforenextcalltoSkTextBlobBuilder.
/** Returns run with storage for glyphs and positions along baseline. Caller must writecountglyphstoRunBuffer::glyphsandcountscalarstoRunBuffer::pos beforenextcalltoSkTextBlobBuilder.
@paramfontSkFontusedforthisrun @paramcountnumberofglyphs @paramyverticaloffsetwithintheblob @paramboundsoptionalrunboundingbox @returnwritableglyphbufferandx-axispositionbuffer
*/ const RunBuffer& allocRunPosH(const SkFont& font, int count, SkScalar y, const SkRect* bounds = nullptr);
/** Returns run with storage for glyphs and SkPoint positions. Caller must writecountglyphstoRunBuffer::glyphsandcountSkPointtoRunBuffer::pos beforenextcalltoSkTextBlobBuilder.
// RunBuffer.pos points to SkRSXform array const RunBuffer& allocRunRSXform(const SkFont& font, int count);
/** Returns run with storage for glyphs, text, and clusters. Caller must writecountglyphstoRunBuffer::glyphs,textByteCountUTF-8codeunits intoRunBuffer::utf8text,andcountmonotonicindexesintoutf8text intoRunBuffer::clustersbeforenextcalltoSkTextBlobBuilder.
@paramfontSkFontusedforthisrun @paramcountnumberofglyphs @paramxhorizontaloffsetwithintheblob @paramyverticaloffsetwithintheblob @paramtextByteCountnumberofUTF-8codeunits @paramboundsoptionalrunboundingbox @returnwritableglyphbuffer,textbuffer,andclusterbuffer
*/ const RunBuffer& allocRunText(const SkFont& font, int count, SkScalar x, SkScalar y, int textByteCount, const SkRect* bounds = nullptr);
/** Returns run with storage for glyphs, positions along baseline, text, andclusters.CallermustwritecountglyphstoRunBuffer::glyphs, countscalarstoRunBuffer::pos,textByteCountUTF-8codeunitsinto RunBuffer::utf8text,andcountmonotonicindexesintoutf8textinto RunBuffer::clustersbeforenextcalltoSkTextBlobBuilder.
@paramfontSkFontusedforthisrun @paramcountnumberofglyphs @paramyverticaloffsetwithintheblob @paramtextByteCountnumberofUTF-8codeunits @paramboundsoptionalrunboundingbox @returnwritableglyphbuffer,x-axispositionbuffer,textbuffer,andclusterbuffer
*/ const RunBuffer& allocRunTextPosH(const SkFont& font, int count, SkScalar y, int textByteCount, const SkRect* bounds = nullptr);
/** Returns run with storage for glyphs, SkPoint positions, text, and clusters.CallermustwritecountglyphstoRunBuffer::glyphs,count SkPointtoRunBuffer::pos,textByteCountUTF-8codeunitsinto RunBuffer::utf8text,andcountmonotonicindexesintoutf8textinto RunBuffer::clustersbeforenextcalltoSkTextBlobBuilder.
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.