diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index ac33798bdf50b8ce2c1fb1ea005604b8884d38f4..2f053c1357508df3c5865ae4351398f27704734f 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -2738,6 +2738,181 @@ void OH_Drawing_TypographyDestroyTextBox(OH_Drawing_TextBox*); void OH_Drawing_SetTextShadow(OH_Drawing_TextShadow* shadow, uint32_t color, OH_Drawing_Point* offset, double blurRadius); +/** + * @brief Gets the run glyph indices. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Run Indicates the pointer to an OH_Drawing_Run object. + * @param start the run start position. + * @param end the run end position. + * @return Run of glyph indices array. + * @since 13 + * @version 1.0 + */ +OH_Drawing_Array* OH_Drawing_GetRunStringIndices(OH_Drawing_Run* run, uint32_t start, uint32_t end); + +/** + * @brief Gets the run glyph indices by index. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Array the run glyph indices array. + * @param index The run of glyph index. + * @return Run of glyph indices element. + * @since 13 + * @version 1.0 + */ +uint32_t OH_Drawing_GetRunStringIndicesElement(OH_Drawing_Array* stringIndices, size_t index); + +/** + * @brief Releases the memory run glyph indices array. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param stringIndices glyph indices the pointer. + * @since 13 + * @version 1.0 + */ +void OH_Drawing_DestroyRunStringIndices(OH_Drawing_Array* stringIndices); + +/** + * @brief Gets the range run glyph location and length. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Run Indicates the pointer to an OH_Drawing_Run object. + * @param location The run of glyph location. + * @param length The run of glyph length. + * @since 13 + * @version 1.0 + */ +void OH_Drawing_GetRunStringRange(OH_Drawing_Run* run, uint32_t* location, uint32_t* length); + +/** + * @brief Gets the run typographic bound. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Run Indicates the pointer to an OH_Drawing_Run object. + * @param ascent The run of ascent. + * @param descent The run of descent. + * @param leading The run of leading. + * @return run typographic width. + * @since 13 + * @version 1.0 + */ +float OH_Drawing_GetRunTypographicBounds(OH_Drawing_Run* run, float* ascent, float* descent, float* leading); + +/** + * @brief Paints text on the canvas. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Run Indicates the pointer to an OH_Drawing_Run object. + * @param x Indicates the x coordinate. + * @param y Indicates the y coordinate. + * @since 13 + * @version 1.0 + */ +void OH_Drawing_RunPaint(OH_Drawing_Canvas*, OH_Drawing_Run* run, double x, double y); + +/** + * @brief Gets the run image bound. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Run Indicates the pointer to an OH_Drawing_Run object. + * @return OH_Drawing_Rect The run image bounds. + * @since 13 + * @version 1.0 + */ +OH_Drawing_Rect* OH_Drawing_GetRunImageBounds(OH_Drawing_Run* run); + + /** + * @brief Releases the memory run image bounds pointer. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Rect Run image bounds pointer. + * @since 13 + * @version 1.0 + */ +void OH_Drawing_DestroyRunImageBounds(OH_Drawing_Rect* rect); + +/** + * @brief Gets the range glyph identifier for each character. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Run Indicates the pointer to an OH_Drawing_Run object. + * @param start The run of start position. + * @param end The run of end position. + * @return Run of glyphs array. + * @since 13 + * @version 1.0 + */ +OH_Drawing_Array* OH_Drawing_GetRunGlyphs(OH_Drawing_Run* run, uint32_t start, uint32_t end); + +/** + * @brief Gets the glyph identifier by index. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param glyphs The run of glyphs array. + * @param index The run of glyphs index. + * @return Run of glyphs element. + * @since 13 + * @version 1.0 + */ +uint16_t OH_Drawing_GetRunGlyphsElement(OH_Drawing_Array* glyphs, size_t index); + +/** + * @brief Releases the memory run glyphs array. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param glyphs The run of glyphs array. + * @since 13 + * @version 1.0 + */ +void OH_Drawing_DestroyRunGlyphs(OH_Drawing_Array* glyphs); + +/** + * @brief Gets the range glyph positions array. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Run Indicates the pointer to an OH_Drawing_Run object. + * @param start the run start position. + * @param end the run end position. + * @return Run of positions array. + * @since 13 + * @version 1.0 + */ +OH_Drawing_Array* OH_Drawing_GetRunPositions(OH_Drawing_Run* run, uint32_t start, uint32_t end); + +/** + * @brief Gets the glyph positions by index. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Array The run of positions array. + * @param index The run of glyph index. + * @return Run of glyph position pointer. + * @since 13 + * @version 1.0 + */ +OH_Drawing_Point* OH_Drawing_GetRunPositionsElement(OH_Drawing_Array* positions, size_t index); + +/** + * @brief Releases the memory run of positions array. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param positions The run of position array. + * @since 13 + * @version 1.0 + */ +void OH_Drawing_DestroyRunPositions(OH_Drawing_Array* positions); + +/** + * @brief Gets the number of glyph. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Run Indicates the pointer to an OH_Drawing_Run object. + * @return The number of glyph. + * @since 13 + * @version 1.0 + */ +uint32_t OH_Drawing_GetRunGlyphCount(OH_Drawing_Run* run); #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index e8b3db2742adc5ab54a589b270caf77979a17af0..85a10030cda750453eb5d276db8ad37d0b16b670 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -1437,5 +1437,65 @@ { "first_introduced": "12", "name":"OH_Drawing_SetTextShadow" + }, + { + "first_introduced": "13", + "name":"OH_Drawing_GetRunStringIndices" + }, + { + "first_introduced": "13", + "name":"OH_Drawing_GetRunStringIndicesElement" + }, + { + "first_introduced": "13", + "name":"OH_Drawing_DestroyRunStringIndices" + }, + { + "first_introduced": "13", + "name":"OH_Drawing_GetRunStringRange" + }, + { + "first_introduced": "13", + "name":"OH_Drawing_GetRunTypographicBounds" + }, + { + "first_introduced": "13", + "name":"OH_Drawing_RunPaint" + }, + { + "first_introduced": "13", + "name":"OH_Drawing_GetRunImageBounds" + }, + { + "first_introduced": "13", + "name":"OH_Drawing_DestroyRunImageBounds" + }, + { + "first_introduced": "13", + "name":"OH_Drawing_GetRunGlyphs" + }, + { + "first_introduced": "13", + "name":"OH_Drawing_GetRunGlyphsElement" + }, + { + "first_introduced": "13", + "name":"OH_Drawing_DestroyRunGlyphs" + }, + { + "first_introduced": "13", + "name":"OH_Drawing_GetRunPositions" + }, + { + "first_introduced": "13", + "name":"OH_Drawing_GetRunPositionsElement" + }, + { + "first_introduced": "13", + "name":"OH_Drawing_DestroyRunPositions" + }, + { + "first_introduced": "13", + "name":"OH_Drawing_GetRunGlyphCount" } ] \ No newline at end of file