Class TextBlob
- java.lang.Object
-
- io.github.humbleui.skija.impl.Native
-
- io.github.humbleui.skija.impl.Managed
-
- io.github.humbleui.skija.TextBlob
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class TextBlob extends Managed
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTextBlob._FinalizerHolder-
Nested classes/interfaces inherited from class io.github.humbleui.skija.impl.Managed
Managed.CleanerThunk
-
-
Field Summary
-
Fields inherited from class io.github.humbleui.skija.impl.Managed
_cleanable
-
-
Constructor Summary
Constructors Constructor Description TextBlob(long ptr)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static io.github.humbleui.types.Rect_nBounds(long ptr)static io.github.humbleui.types.Rect_nGetBlockBounds(long ptr)static int[]_nGetClusters(long ptr)static long_nGetFinalizer()static java.lang.Float_nGetFirstBaseline(long ptr)static short[]_nGetGlyphs(long ptr)static float[]_nGetIntercepts(long ptr, float lower, float upper, long paintPtr)static java.lang.Float_nGetLastBaseline(long ptr)static float[]_nGetPositions(long ptr)static io.github.humbleui.types.Rect_nGetTightBounds(long ptr)static int_nGetUniqueId(long ptr)static long_nMakeFromData(long dataPtr)static long_nMakeFromPos(short[] glyphs, float[] pos, long fontPtr)static long_nMakeFromPosH(short[] glyphs, float[] xpos, float ypos, long fontPtr)static long_nMakeFromRSXform(short[] glyphs, float[] xform, long fontPtr)static long_nSerializeToData(long ptr)@NotNull io.github.humbleui.types.RectgetBlockBounds()Only works on TextBlobs that come from TextBlobBuilderRunHandler/Shaper default handler.io.github.humbleui.types.RectgetBounds()Returns conservative bounding box.@org.jetbrains.annotations.NotNull int[]getClusters()Only works on TextBlobs that come from TextBlobBuilderRunHandler/Shaper default handler.@NotNull java.lang.FloatgetFirstBaseline()Only works on TextBlobs that come from TextBlobBuilderRunHandler/Shaper default handler.@org.jetbrains.annotations.NotNull short[]getGlyphs()@org.jetbrains.annotations.Nullable float[]getIntercepts(float lowerBound, float upperBound)Returns the number of intervals that intersect bounds.@org.jetbrains.annotations.Nullable float[]getIntercepts(float lowerBound, float upperBound, @Nullable Paint paint)Returns the number of intervals that intersect bounds.@NotNull java.lang.FloatgetLastBaseline()Only works on TextBlobs that come from TextBlobBuilderRunHandler/Shaper default handler.@org.jetbrains.annotations.NotNull float[]getPositions()Return result depends on how blob was constructed.@NotNull io.github.humbleui.types.RectgetTightBounds()Only works on TextBlobs that come from TextBlobBuilderRunHandler/Shaper default handler.intgetUniqueId()Returns a non-zero value unique among all text blobs.static @Nullable TextBlobmakeFromData(Data data)static TextBlobmakeFromPos(short[] glyphs, io.github.humbleui.types.Point[] pos, Font font)Returns a TextBlob built from a single run of text with positions.static TextBlobmakeFromPosH(short[] glyphs, float[] xpos, float ypos, Font font)Returns a TextBlob built from a single run of text with x-positions and a single y value.static TextBlobmakeFromRSXform(short[] glyphs, RSXform[] xform, Font font)DataserializeToData()-
Methods inherited from class io.github.humbleui.skija.impl.Managed
_nInvokeFinalizer, close, isClosed
-
-
-
-
Method Detail
-
getBounds
public io.github.humbleui.types.Rect getBounds()
Returns conservative bounding box. Uses Paint associated with each glyph to determine glyph bounds, and unions all bounds. Returned bounds may be larger than the bounds of all glyphs in runs.- Returns:
- conservative bounding box
-
getUniqueId
public int getUniqueId()
Returns a non-zero value unique among all text blobs.- Returns:
- identifier for TextBlob
-
getIntercepts
@Nullable public @org.jetbrains.annotations.Nullable float[] getIntercepts(float lowerBound, float upperBound)Returns the number of intervals that intersect bounds. bounds describes a pair of lines parallel to the text advance. The return array size is a multiple of two, and is at most twice the number of glyphs in the the blob.
Runs within the blob that contain SkRSXform are ignored when computing intercepts.
- Parameters:
lowerBound- lower line parallel to the advanceupperBound- upper line parallel to the advance- Returns:
- intersections; may be null
-
getIntercepts
@Nullable public @org.jetbrains.annotations.Nullable float[] getIntercepts(float lowerBound, float upperBound, @Nullable @Nullable Paint paint)Returns the number of intervals that intersect bounds. bounds describes a pair of lines parallel to the text advance. The return array size is a multiple of two, and is at most twice the number of glyphs in the the blob.
Runs within the blob that contain SkRSXform are ignored when computing intercepts.
- Parameters:
lowerBound- lower line parallel to the advanceupperBound- upper line parallel to the advancepaint- specifies stroking, PathEffect that affects the result; may be null- Returns:
- intersections; may be null
-
makeFromPosH
public static TextBlob makeFromPosH(short[] glyphs, float[] xpos, float ypos, Font font)
Returns a TextBlob built from a single run of text with x-positions and a single y value. Returns null if glyphs is empty.- Parameters:
glyphs- glyphs drawnxpos- array of x-positions, must contain values for all of the glyphs.ypos- shared y-position for each glyph, to be paired with each xpos.font- Font used for this run- Returns:
- new TextBlob or null
-
makeFromPos
public static TextBlob makeFromPos(short[] glyphs, io.github.humbleui.types.Point[] pos, Font font)
Returns a TextBlob built from a single run of text with positions. Returns null if glyphs is empty.- Parameters:
glyphs- glyphs drawnpos- array of positions, must contain values for all of the glyphs.font- Font used for this run- Returns:
- new TextBlob or null
-
serializeToData
public Data serializeToData()
-
getGlyphs
@NotNull public @org.jetbrains.annotations.NotNull short[] getGlyphs()
- Returns:
- glyph indices for the whole blob
-
getPositions
@NotNull public @org.jetbrains.annotations.NotNull float[] getPositions()
Return result depends on how blob was constructed.
- makeFromPosH returns 1 float per glyph (x pos)
- makeFromPos returns 2 floats per glyph (x, y pos)
- makeFromRSXform returns 4 floats per glyph
Blobs constructed by TextBlobBuilderRunHandler/Shaper default handler have 2 floats per glyph.
- Returns:
- glyph positions for the blob if it was made with makeFromPos, null otherwise
-
getClusters
@NotNull public @org.jetbrains.annotations.NotNull int[] getClusters()
Only works on TextBlobs that come from TextBlobBuilderRunHandler/Shaper default handler.- Returns:
- utf-16 offsets of clusters that start the glyph
- Throws:
java.lang.IllegalArgumentException- if TextBlob doesn’t have this information
-
getTightBounds
@NotNull public @NotNull io.github.humbleui.types.Rect getTightBounds()
Only works on TextBlobs that come from TextBlobBuilderRunHandler/Shaper default handler.- Returns:
- tight bounds around all the glyphs in the TextBlob
- Throws:
java.lang.IllegalArgumentException- if TextBlob doesn’t have this information
-
getBlockBounds
@NotNull public @NotNull io.github.humbleui.types.Rect getBlockBounds()
Only works on TextBlobs that come from TextBlobBuilderRunHandler/Shaper default handler.- Returns:
- tight bounds around all the glyphs in the TextBlob
- Throws:
java.lang.IllegalArgumentException- if TextBlob doesn’t have this information
-
getFirstBaseline
@NotNull public @NotNull java.lang.Float getFirstBaseline()
Only works on TextBlobs that come from TextBlobBuilderRunHandler/Shaper default handler.- Returns:
- first baseline in TextBlob
- Throws:
java.lang.IllegalArgumentException- if TextBlob doesn’t have this information
-
getLastBaseline
@NotNull public @NotNull java.lang.Float getLastBaseline()
Only works on TextBlobs that come from TextBlobBuilderRunHandler/Shaper default handler.- Returns:
- last baseline in TextBlob
- Throws:
java.lang.IllegalArgumentException- if TextBlob doesn’t have this information
-
_nGetFinalizer
@Internal public static long _nGetFinalizer()
-
_nBounds
@Internal public static io.github.humbleui.types.Rect _nBounds(long ptr)
-
_nGetUniqueId
@Internal public static int _nGetUniqueId(long ptr)
-
_nGetIntercepts
@Internal public static float[] _nGetIntercepts(long ptr, float lower, float upper, long paintPtr)
-
_nMakeFromPosH
@Internal public static long _nMakeFromPosH(short[] glyphs, float[] xpos, float ypos, long fontPtr)
-
_nMakeFromPos
@Internal public static long _nMakeFromPos(short[] glyphs, float[] pos, long fontPtr)
-
_nMakeFromRSXform
@Internal public static long _nMakeFromRSXform(short[] glyphs, float[] xform, long fontPtr)
-
_nSerializeToData
@Internal public static long _nSerializeToData(long ptr)
-
_nMakeFromData
@Internal public static long _nMakeFromData(long dataPtr)
-
_nGetGlyphs
@Internal public static short[] _nGetGlyphs(long ptr)
-
_nGetPositions
@Internal public static float[] _nGetPositions(long ptr)
-
_nGetClusters
@Internal public static int[] _nGetClusters(long ptr)
-
_nGetTightBounds
@Internal public static io.github.humbleui.types.Rect _nGetTightBounds(long ptr)
-
_nGetBlockBounds
@Internal public static io.github.humbleui.types.Rect _nGetBlockBounds(long ptr)
-
_nGetFirstBaseline
@Internal public static java.lang.Float _nGetFirstBaseline(long ptr)
-
_nGetLastBaseline
@Internal public static java.lang.Float _nGetLastBaseline(long ptr)
-
-