+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Defines a struct for a UTD.
+ *
+ * @since 12
+ */
+typedef struct OH_Utd OH_Utd;
+
+/**
+ * @brief Creates a pointer to an {@link OH_Utd} instance.
+ *
+ * @param typeId Pointer to the ID of the UTD instance to create.
+ * @return Returns the pointer to the {@link OH_Utd} instance created if the operation is successful;
+ * returns nullptr otherwise.
+ * If this pointer is no longer required, use {@link OH_Utd_Destroy} to destroy it. Otherwise, memory leaks may occur.
+ * @see OH_Utd
+ * @since 12
+ */
+OH_Utd* OH_Utd_Create(const char* typeId);
+
+/**
+ * @brief Destroys an {@link OH_Utd} instance.
+ *
+ * @param pThis Pointer to the {@link OH_Utd} instance to destroy.
+ * @see OH_Utd
+ * @since 12
+ */
+void OH_Utd_Destroy(OH_Utd* pThis);
+
+/**
+ * @brief Obtains the type ID from an {@link OH_Utd} instance.
+ *
+ * @param pThis Pointer to the target {@link OH_Utd} instance.
+ * @return Returns the pointer to the type ID obtained if the operation is successful; returns nullptr otherwise.
+ * @see OH_Utd
+ * @since 12
+ */
+const char* OH_Utd_GetTypeId(OH_Utd* pThis);
+
+/**
+ * @brief Obtains the type description from an {@link OH_Utd} instance.
+ *
+ * @param pThis Pointer to the target {@link OH_Utd} instance.
+ * @return Returns the pointer to the description obtained if the operation is successful;
+ * returns nullptr otherwise.
+ * @see OH_Utd
+ * @since 12
+ */
+const char* OH_Utd_GetDescription(OH_Utd* pThis);
+
+/**
+ * @brief Obtains the URL from an {@link OH_Utd} instance.
+ *
+ * @param pThis Pointer to the target {@link OH_Utd} instance.
+ * @return Returns the pointer to the URL obtained if the operation is successful; returns nullptr otherwise.
+ * @see OH_Utd
+ * @since 12
+ */
+const char* OH_Utd_GetReferenceUrl(OH_Utd* pThis);
+
+/**
+ * @brief Obtains the default icon file path from an {@link OH_Utd} instance.
+ *
+ * @param pThis Pointer to the target {@link OH_Utd} instance.
+ * @return Returns the pointer to the path of the default icon file obtained if the operation is successful;
+ * returns nullptr otherwise.
+ * @see OH_Utd
+ * @since 12
+ */
+const char* OH_Utd_GetIconFile(OH_Utd* pThis);
+
+/**
+ * @brief Obtains the types to which an {@link OH_Utd} belongs.
+ *
+ * @param pThis Pointer to the target {@link OH_Utd} instance.
+ * @param count Pointer to the number of UTD types obtained.
+ * @return Returns the pointer to the UTD types obtained if the operation is successful;
+ * returns nullptr otherwise.
+ * @see OH_Utd
+ * @since 12
+ */
+const char** OH_Utd_GetBelongingToTypes(OH_Utd* pThis, unsigned int* count);
+
+/**
+ * @brief Obtains the file name extensions associated with an {@link OH_Utd} instance.
+ *
+ * @param pThis Pointer to the target {@link OH_Utd} instance.
+ * @param count Pointer to the number of file name extensions obtained.
+ * @return Returns the pointer to the file name extensions obtained if the operation is successful;
+ * returns nullptr otherwise.
+ * @see OH_Utd
+ * @since 12
+ */
+const char** OH_Utd_GetFilenameExtensions(OH_Utd* pThis, unsigned int* count);
+
+/**
+ * @brief Obtains the MIME types associated with an {@link OH_Utd} instance.
+ *
+ * @param pThis Pointer to the target {@link OH_Utd} instance.
+ * @param count Pointer to the number of MIME types obtained.
+ * @return Returns the pointer to the MIME types obtained if the operation is successful;
+ * returns nullptr otherwise.
+ * @see OH_Utd
+ * @since 12
+ */
+const char** OH_Utd_GetMimeTypes(OH_Utd* pThis, unsigned int* count);
+
+/**
+ * @brief Obtains the UTDs based on the given file name extension.
+ *
+ * @param extension Pointer to the file name extension.
+ * @param count Pointer to the number of UTDs obtained.
+ * @return Returns the pointer to the UTDs obtained.
+ * If a pointer is not required, use {@link OH_Utd_DestroyStringList} to destroy it in a timely manner.
+ * Otherwise, memory leakage occurs.
+ * @since 12
+ */
+const char** OH_Utd_GetTypesByFilenameExtension(const char* extension, unsigned int* count);
+
+/**
+ * @brief Obtains the UTDs based on the given MIME type.
+ *
+ * @param mimeType Pointer to the MIME type.
+ * @param count Pointer to the number of UTDs obtained.
+ * @return Returns the pointer to the UTDs obtained.
+ * If a pointer is not required, use {@link OH_Utd_DestroyStringList} to destroy it in a timely manner.
+ * Otherwise, memory leakage occurs.
+ * @since 12
+ */
+const char** OH_Utd_GetTypesByMimeType(const char* mimeType, unsigned int* count);
+
+/**
+ * @brief Checks whether a UTD belongs to the target UTD.
+ *
+ * @param srcTypeId Pointer to the UTD to check.
+ * @param destTypeId Pointer to the target UTD.
+ * @return Returns true if the UTD belongs to the target UTD; returns false otherwise.
+ * @since 12
+ */
+bool OH_Utd_BelongsTo(const char* srcTypeId, const char* destTypeId);
+
+/**
+ * @brief Checks whether a UTD is a lower-level type of the target UTD.
+ * For example, TYPE_SCRIPT is a lower-level type of SOURCE_CODE, and TYPE_SCRIPT
+ * and SOURCE_CODE are lower-level types of PLAIN_TEXT.
+ *
+ * @param srcTypeId Pointer to the UTD to check.
+ * @param destTypeId Pointer to the target UTD.
+ * @return Returns true if the UTD is a lower-level type of the target UTD; returns false otherwise.
+ * @since 12
+ */
+bool OH_Utd_IsLower(const char* srcTypeId, const char* destTypeId);
+
+/**
+ * @brief Checks whether a UTD is a higher-level type of the target UTD.
+ * For example, SOURCE_CODE is a higher-level type of TYPE_SCRIPT, and PLAIN_TEXT is
+ * a higher-level type of SOURCE_CODE and TYPE_SCRIPT.
+ *
+ * @param srcTypeId Pointer to the UTD to check.
+ * @param destTypeId Pointer to the target UTD.
+ * @return Returns true if the UTD is a higher-level type of the target UTD; returns false otherwise.
+ * @since 12
+ */
+bool OH_Utd_IsHigher(const char* srcTypeId, const char* destTypeId);
+
+/**
+ * @brief Checks whether two UTDs are the same.
+ *
+ * @param desc1 Pointer to one {@link OH_Utd} instance to compare.
+ * @param desc2 Pointer to the other {@link OH_Utd} instance to compare.
+ * @return Returns true if the two instances are the same; returns false otherwise.
+ * @since 12
+ */
+bool OH_Utd_Equals(OH_Utd* utd1, OH_Utd* utd2);
+
+/**
+ * @brief Destroys a UTD list.
+ *
+ * @param list Pointer to the UTD list to destroy.
+ * @param count Length of the UTD list to destroy.
+ * @since 12
+ */
+void OH_Utd_DestroyStringList(const char** list, unsigned int count);
+
+#ifdef __cplusplus
+};
+#endif
+
+/** @} */
+#endif
diff --git a/en/native_sdk/dfx/hiappevent.h b/en/native_sdk/dfx/hiappevent.h
new file mode 100644
index 0000000000000000000000000000000000000000..16c4eb8ae3387209a2bf35827e9e819a7dc761e1
--- /dev/null
+++ b/en/native_sdk/dfx/hiappevent.h
@@ -0,0 +1,609 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HIVIEWDFX_HIAPPEVENT_H
+#define HIVIEWDFX_HIAPPEVENT_H
+/**
+ * @addtogroup HiAppEvent
+ * @{
+ *
+ * @brief Provides APIs for implementing the application event logging function.
+ *
+ * This function allows your application to record fault events, statistics events, security events,
+ * and user behavior events reported during system running. Based on the event information, you can
+ * analyze the operating status of your application.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiAppEvent
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file hiappevent.h
+ *
+ * @brief Defines the application event logging functions of the HiAppEvent module.
+ *
+ * Before performing application event logging, you must construct a parameter list object to store
+ * the input event parameters and specify the event domain, event name, and event type.
+ *
+ * Event domain: domain associated with the application event.
+ *
Event name: name of the application event.
+ *
Event type: fault, statistics, security, or behavior.
+ *
Parameter list: a linked list used to store event parameters. Each parameter consists of a
+ * parameter name and a parameter value.
+ *
+ * Example:
+ * Import the header file:
+ *
+ * #include "hiappevent/hiappevent.h"
+ *
+ * Create a parameter list pointer:
+ *
+ * ParamList list = OH_HiAppEvent_CreateParamList();
+ *
+ * Add parameters to the parameter list.
+ *
+ * bool boolean = true;
+ * OH_HiAppEvent_AddBoolParam(list, "bool_key", boolean);
+ * int32_t nums[] = {1, 2, 3};
+ * OH_HiAppEvent_AddInt32ArrayParam(list, "int32_arr_key", nums, sizeof(nums) / sizeof(nums[0]));
+ *
+ * Perform event logging:
+ *
+ * int res = OH_HiAppEvent_Write("test_domain", "test_event", BEHAVIOR, list);
+ *
+ * Destroy the parameter list pointer and release its allocated memory:
+ *
+ * OH_HiAppEvent_DestroyParamList(list);
+ *
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+#include
+#include
+
+#include "hiappevent_cfg.h"
+#include "hiappevent_event.h"
+#include "hiappevent_param.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Enumerates the event types.
+ *
+ * You are advised to select an event type based on the application scenario.
+ *
+ * @since 8
+ * @version 1.0
+ */
+enum EventType {
+ /* Fault event */
+ FAULT = 1,
+
+ /* Statistics event */
+ STATISTIC = 2,
+
+ /* Security event */
+ SECURITY = 3,
+
+ /* Behavior event */
+ BEHAVIOR = 4
+};
+
+/**
+ * @brief Defines information about a single event, including the event domain, event name, event type,
+ * and custom parameter list in JSON string format.
+ *
+ * @SystemCapability.HiviewDFX.HiAppEvent
+ * @since 12
+ * @version 1.0
+ */
+typedef struct HiAppEvent_AppEventInfo {
+ /** Event domain. */
+ const char* domain;
+ /** Event name. */
+ const char* name;
+ /** Event type. */
+ enum EventType type;
+ /** Event parameter list in JSON string format. */
+ const char* params;
+} HiAppEvent_AppEventInfo;
+
+/**
+ * @brief Event groups with the same event name.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiAppEvent
+ * @since 12
+ * @version 1.0
+ */
+typedef struct HiAppEvent_AppEventGroup {
+ /** Same event name in the event array. */
+ const char* name;
+ /** Event array with the same event name. */
+ const struct HiAppEvent_AppEventInfo* appEventInfos;
+ /** Length of the event array with the same event name. */
+ uint32_t infoLen;
+} HiAppEvent_AppEventGroup;
+
+/**
+ * @brief Defines an event parameter list node.
+ *
+ * @since 8
+ * @version 1.0
+ */
+typedef struct ParamListNode* ParamList;
+
+/**
+ * @brief Defines the watcher for application events.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiAppEvent
+ * @since 12
+ * @version 1.0
+ */
+typedef struct HiAppEvent_Watcher HiAppEvent_Watcher;
+
+/**
+ * @brief Callback invoked to pass event content to the caller.
+ *
+ * Note: The lifecycle of the object pointed by the pointer in the callback is limited to the callback function.
+ * Do not use the pointer outside of the callback function. If the information needs to be cached, perform a
+ * deep copy of the content pointed by the pointer.
+ *
+ * @SystemCapability.HiviewDFX.HiAppEvent
+ * @param domain Domain of the received application event.
+ * @param appEventGroups Event group array .
+ * @param groupLen Length of the event group array.
+ * @since 12
+ * @version 1.0
+ */
+typedef void (*OH_HiAppEvent_OnReceive)(
+ const char* domain, const struct HiAppEvent_AppEventGroup* appEventGroups, uint32_t groupLen);
+
+/**
+ * @brief Callback invoked if the event received by the watcher meets the conditions specified by
+ * OH_HiAppEvent_SetTriggerCondition. Specifically, if the OH_HiAppEvent_OnReceive callback is not
+ * set in the watcher, the event received by the watcher will be saved. If the saved event meets the
+ * conditions * specified by OH_HiAppEvent_SetTriggerCondition, the callback is invoked.
+ * After the callback is complete, if a newly saved event meets the specified condition, the callback is invoked again.
+ *
+ * @SystemCapability.HiviewDFX.HiAppEvent
+ * @param row Number of events newly received by the watcher.
+ * @param size Total size of events newly received by the watcher. The size of a single event is the length
+ * of the JSON string converted from the event.
+ * @since 12
+ * @version 1.0
+ */
+typedef void (*OH_HiAppEvent_OnTrigger)(int row, int size);
+
+/**
+ * @brief Callback invoked to pass the events received by the watcher to the caller when OH_HiAppEvent_TakeWatcherData
+ * is used to obtain the events.
+ *
+ * Note: The lifecycle of the object pointed by the pointer in the callback is limited to the callback function.
+ * Do not use the pointer outside of the callback function. If the information needs to be cached, perform a
+ * deep copy of the content pointed by the pointer.
+ *
+ * @SystemCapability.HiviewDFX.HiAppEvent
+ * @param events Event array in JSON string format.
+ * @param eventLen Size of the event array.
+ * @since 12
+ * @version 1.0
+ */
+typedef void (*OH_HiAppEvent_OnTake)(const char* const *events, uint32_t eventLen);
+
+/**
+ * @brief Creates a pointer to a parameter list object.
+ *
+ * @return Pointer to the parameter list object.
+ * @since 8
+ * @version 1.0
+ */
+ParamList OH_HiAppEvent_CreateParamList(void);
+
+/**
+ * @brief Destroys a pointer to a parameter list object and releases its allocated memory.
+ *
+ * @param list Pointer to the parameter list object.
+ * @since 8
+ * @version 1.0
+ */
+void OH_HiAppEvent_DestroyParamList(ParamList list);
+
+/**
+ * @brief Adds an event parameter of the Boolean type to the parameter list.
+ *
+ * @param list Pointer to the parameter list to which parameters are to be added.
+ * @param name Name of the parameter to be added.
+ * @param boolean Value of the Boolean parameter to be added.
+ * @return Pointer to the parameter list that contains the parameters added.
+ * @since 8
+ * @version 1.0
+ */
+ParamList OH_HiAppEvent_AddBoolParam(ParamList list, const char* name, bool boolean);
+
+/**
+ * @brief Adds an event parameter of the Boolean array type to the parameter list.
+ *
+ * @param list Pointer to the parameter list to which parameters are to be added.
+ * @param name Name of the parameter to be added.
+ * @param booleans Value of the Boolean array parameter to be added.
+ * @param arrSize Size of the parameter array to be added.
+ * @return Pointer to the parameter list that contains the parameters added.
+ * @since 8
+ * @version 1.0
+ */
+ParamList OH_HiAppEvent_AddBoolArrayParam(ParamList list, const char* name, const bool* booleans, int arrSize);
+
+/**
+ * @brief Adds an event parameter of the int8_t type to the parameter list.
+ *
+ * @param list Pointer to the parameter list to which parameters are to be added.
+ * @param name Name of the parameter to be added.
+ * @param num Value of the int8_t parameter to be added.
+ * @return Pointer to the parameter list that contains the parameters added.
+ * @since 8
+ * @version 1.0
+ */
+ParamList OH_HiAppEvent_AddInt8Param(ParamList list, const char* name, int8_t num);
+
+/**
+ * @brief Adds an event parameter of the int8_t array type to the parameter list.
+ *
+ * @param list Pointer to the parameter list to which parameters are to be added.
+ * @param name Name of the parameter to be added.
+ * @param nums Value of the int8_t array parameter to be added.
+ * @param arrSize Size of the parameter array to be added.
+ * @return Pointer to the parameter list that contains the parameters added.
+ * @since 8
+ * @version 1.0
+ */
+ParamList OH_HiAppEvent_AddInt8ArrayParam(ParamList list, const char* name, const int8_t* nums, int arrSize);
+
+/**
+ * @brief Adds an event parameter of the int16_t type to the parameter list.
+ *
+ * @param list Pointer to the parameter list to which parameters are to be added.
+ * @param name Name of the parameter to be added.
+ * @param num Value of the int16_t parameter to be added.
+ * @return Pointer to the parameter list that contains the parameters added.
+ * @since 8
+ * @version 1.0
+ */
+ParamList OH_HiAppEvent_AddInt16Param(ParamList list, const char* name, int16_t num);
+
+/**
+ * @brief Adds an event parameter of the int16_t array type to the parameter list.
+ *
+ * @param list Pointer to the parameter list to which parameters are to be added.
+ * @param name Name of the parameter to be added.
+ * @param nums Value of the int16_t array parameter to be added.
+ * @param arrSize Size of the parameter array to be added.
+ * @return Pointer to the parameter list that contains the parameters added.
+ * @since 8
+ * @version 1.0
+ */
+ParamList OH_HiAppEvent_AddInt16ArrayParam(ParamList list, const char* name, const int16_t* nums, int arrSize);
+
+/**
+ * @brief Adds an event parameter of the int32_t type to the parameter list.
+ *
+ * @param list Pointer to the parameter list to which parameters are to be added.
+ * @param name Name of the parameter to be added.
+ * @param num Value of the int32_t parameter to be added.
+ * @return Pointer to the parameter list that contains the parameters added.
+ * @since 8
+ * @version 1.0
+ */
+ParamList OH_HiAppEvent_AddInt32Param(ParamList list, const char* name, int32_t num);
+
+/**
+ * @brief Adds an event parameter of the int32_t array type to the parameter list.
+ *
+ * @param list Pointer to the parameter list to which parameters are to be added.
+ * @param name Name of the parameter to be added.
+ * @param nums Value of the int32_t array parameter to be added.
+ * @param arrSize Size of the parameter array to be added.
+ * @return Pointer to the parameter list that contains the parameters added.
+ * @since 8
+ * @version 1.0
+ */
+ParamList OH_HiAppEvent_AddInt32ArrayParam(ParamList list, const char* name, const int32_t* nums, int arrSize);
+
+/**
+ * @brief Adds an event parameter of the int64_t type to the parameter list.
+ *
+ * @param list Pointer to the parameter list to which parameters are to be added.
+ * @param name Name of the parameter to be added.
+ * @param num Value of the int64_t parameter to be added.
+ * @return Pointer to the parameter list that contains the parameters added.
+ * @since 8
+ * @version 1.0
+ */
+ParamList OH_HiAppEvent_AddInt64Param(ParamList list, const char* name, int64_t num);
+
+/**
+ * @brief Adds an event parameter of the int64_t array type to the parameter list.
+ *
+ * @param list Pointer to the parameter list to which parameters are to be added.
+ * @param name Name of the parameter to be added.
+ * @param nums Value of the int64_t array parameter to be added.
+ * @param arrSize Size of the parameter array to be added.
+ * @return Pointer to the parameter list that contains the parameters added.
+ * @since 8
+ * @version 1.0
+ */
+ParamList OH_HiAppEvent_AddInt64ArrayParam(ParamList list, const char* name, const int64_t* nums, int arrSize);
+
+/**
+ * @brief Adds an event parameter of the float type to the parameter list.
+ *
+ * @param list Pointer to the parameter list to which parameters are to be added.
+ * @param name Name of the parameter to be added.
+ * @param num Value of the float parameter to be added.
+ * @return Pointer to the parameter list that contains the parameters added.
+ * @since 8
+ * @version 1.0
+ */
+ParamList OH_HiAppEvent_AddFloatParam(ParamList list, const char* name, float num);
+
+/**
+ * @brief Adds an event parameter of the float array type to the parameter list.
+ *
+ * @param list Pointer to the parameter list to which parameters are to be added.
+ * @param name Name of the parameter to be added.
+ * @param nums Value of the float array parameter to be added.
+ * @param arrSize Size of the parameter array to be added.
+ * @return Pointer to the parameter list that contains the parameters added.
+ * @since 8
+ * @version 1.0
+ */
+ParamList OH_HiAppEvent_AddFloatArrayParam(ParamList list, const char* name, const float* nums, int arrSize);
+
+/**
+ * @brief Adds an event parameter of the double type to the parameter list.
+ *
+ * @param list Pointer to the parameter list to which parameters are to be added.
+ * @param name Name of the parameter to be added.
+ * @param num Value of the double parameter to be added.
+ * @return Pointer to the parameter list that contains the parameters added.
+ * @since 8
+ * @version 1.0
+ */
+ParamList OH_HiAppEvent_AddDoubleParam(ParamList list, const char* name, double num);
+
+/**
+ * @brief Adds an event parameter of the double array type to the parameter list.
+ *
+ * @param list Pointer to the parameter list to which parameters are to be added.
+ * @param name Name of the parameter to be added.
+ * @param nums Value of the double array parameter to be added.
+ * @param arrSize Size of the parameter array to be added.
+ * @return Pointer to the parameter list that contains the parameters added.
+ * @since 8
+ * @version 1.0
+ */
+ParamList OH_HiAppEvent_AddDoubleArrayParam(ParamList list, const char* name, const double* nums, int arrSize);
+
+/**
+ * @brief Adds a parameter of the string type to the parameter list.
+ *
+ * @param list Pointer to the parameter list to which parameters are to be added.
+ * @param name Name of the parameter to be added.
+ * @param str Value of the string parameter to be added.
+ * @return Pointer to the parameter list that contains the parameters added.
+ * @since 8
+ * @version 1.0
+ */
+ParamList OH_HiAppEvent_AddStringParam(ParamList list, const char* name, const char* str);
+
+/**
+ * @brief Adds a parameter of the string array type to the parameter list.
+ *
+ * @param list Pointer to the parameter list to which parameters are to be added.
+ * @param name Name of the parameter to be added.
+ * @param strs Value of the string array parameter to be added.
+ * @param arrSize Size of the parameter array to be added.
+ * @return Pointer to the parameter list that contains the parameters added.
+ * @since 8
+ * @version 1.0
+ */
+ParamList OH_HiAppEvent_AddStringArrayParam(ParamList list, const char* name, const char * const *strs, int arrSize);
+
+/**
+ * @brief Logs application events whose parameters are of the list type.
+ *
+ * Before application event logging, use this API to verify parameters of the events.
+ * If the verification is successful, the API writes the events to the event file.
+ *
+ * @param domain Event domain. You can customize event domains as required.
+ * @param name Event name. You can customize event names as required.
+ * @param type Event type, which is defined in {@link EventType}.
+ * @param list List of event parameters. Each parameter consists of a parameter name and a parameter value.
+ * @return {@code 0} if the event parameter verification is successful and the application event is written to the
+ * event file; a value greater than **0** if invalid parameters are present in the event, and the event will be written
+ * to the event file after the invalid parameters are ignored; a value smaller than **0** if the event parameter
+ * verification fails, and the event will not be written to the event file.
+ * @since 8
+ * @version 1.0
+ */
+int OH_HiAppEvent_Write(const char* domain, const char* name, enum EventType type, const ParamList list);
+
+/**
+ * @brief Configures the application event logging function.
+ *
+ * This function is used to configure the event logging function and the storage quota of the event file directory.
+ *
+ * @param name Configuration item name.
+ * @param value Configuration item value.
+ * @return Configuration result.
+ * @since 8
+ * @version 1.0
+ */
+bool OH_HiAppEvent_Configure(const char* name, const char* value);
+
+/**
+ * @brief Creates a watcher for application events.
+ *
+ * Note: If a created watcher is no longer used, you are required to destroy it by calling OH_HiAppEvent_DestroyWatcher.
+ *
+ * @SystemCapability.HiviewDFX.HiAppEvent
+ * @param name Watcher name.
+ * @return Pointer to the new watcher.
+ * @since 12
+ * @version 1.0
+ */
+HiAppEvent_Watcher* OH_HiAppEvent_CreateWatcher(const char* name);
+
+/**
+ * @brief Destroys a created watcher.
+ *
+ * Note: If a created watcher is no longer used, destroy it to release memory to prevent memory leakage.
+ * After the watcher is destroyed, set its pointer to null.
+ *
+ * @SystemCapability.HiviewDFX.HiAppEvent
+ * @param watcher Pointer to the watcher (that is, the pointer returned by OH_HiAppEvent_CreateWatcher).
+ * @since 12
+ * @version 1.0
+ */
+void OH_HiAppEvent_DestroyWatcher(HiAppEvent_Watcher* watcher);
+
+/**
+ * @brief Sets the conditions for triggering the OH_HiAppEvent_OnTrigger callback, including the number
+ * and size of newly received events and the timeout interval for triggering onTrigger.
+ * Ensure that at least one of the trigger conditions is set on the caller side.
+ *
+ * @SystemCapability.HiviewDFX.HiAppEvent
+ * @param watcher Pointer to the watcher (that is, the pointer returned by OH_HiAppEvent_CreateWatcher).
+ * @param row Row count. If the input value is greater than 0 and the number of newly received events is greater than
+ * or equal to the value of this parameter, the configured onTrigger callback is called.
+ * If the input value is less than or equal to 0, the number of received events is not used as the condition
+ * to trigger the onTrigger callback.
+ * @param size Size value. If the input value is greater than 0 and the size of the newly received event is greater than
+ * or equal to the value of this parameter, the configured onTrigger callback is called. The size of a single event is
+ * the length of the JSON string converted from the event.
+ * If the input value is less than or equal to 0, the size of received events is not used as the condition to trigger
+ * the onTrigger callback.
+ * @param timeOut Timeout value, in seconds. If the input value is greater than 0, the system checks the watcher for
+ * newly received events based on the timeout interval. If there are any newly received events, the configured onTrigger
+ * callback is triggered.
+ * After the callback is complete, the system checks the watcher for newly received events when the timeout value
+ * expires. If the input value is less than or equal to 0, the timeout interval is not used as the condition
+ * to trigger the onTrigger callback.
+ * @return {@code 0} if the setting is successful; a negative value otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int OH_HiAppEvent_SetTriggerCondition(HiAppEvent_Watcher* watcher, int row, int size, int timeOut);
+
+/**
+ * @brief Sets the type of events to be listened for.
+ *
+ * This function can be called repeatedly. You can add multiple filtering conditions instead of replacing them.
+ * The watcher will receive notifications of events that meet any of the filtering conditions.
+ *
+ * @SystemCapability.HiviewDFX.HiAppEvent
+ * @param watcher Pointer to the watcher (that is, the pointer returned by OH_HiAppEvent_CreateWatcher).
+ * @param domain Domain of events to be listened for.
+ * @param eventTypes Types of events to be listened for.
+ * @param names Array of the event names.
+ * @param namesLen Length of the event name array.
+ * @return {@code 0} If the setting is successful; a negative value otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int OH_HiAppEvent_SetAppEventFilter(HiAppEvent_Watcher* watcher, const char* domain, uint8_t eventTypes,
+ const char* const *names, int namesLen);
+
+/**
+ * @brief Sets the onTrigger callback.
+ *
+ * @SystemCapability.HiviewDFX.HiAppEvent
+ * @param watcher Pointer to the watcher (that is, the pointer returned by OH_HiAppEvent_CreateWatcher).
+ * @param onTrigger Callback to be set.
+ * @return {@code 0} if the operation is successful; a negative value otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int OH_HiAppEvent_SetWatcherOnTrigger(HiAppEvent_Watcher* watcher, OH_HiAppEvent_OnTrigger onTrigger);
+
+/**
+ * @brief Sets the onReceive callback. When the listener detects the corresponding event, the onReceive callback
+ * is called.
+ *
+ * @SystemCapability.HiviewDFX.HiAppEvent
+ * @param watcher Pointer to the watcher (that is, the pointer returned by OH_HiAppEvent_CreateWatcher).
+ * @param eventPkgCallback Pointer to the callback.
+ * @return {@code 0} if the operation is successful; a negative value otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int OH_HiAppEvent_SetWatcherOnReceive(HiAppEvent_Watcher* watcher, OH_HiAppEvent_OnReceive onReceive);
+
+/**
+ * @brief Obtains the event saved by the watcher.
+ *
+ * @SystemCapability.HiviewDFX.HiAppEvent
+ * @param watcher Pointer to the watcher (that is, the pointer returned by OH_HiAppEvent_CreateWatcher).
+ * @param eventNum Number of events.
+ * @param onTake Pointer to the callback. The event information is returned through this callback.
+ * @return {@code 0} if the operation is successful; a negative value otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int OH_HiAppEvent_TakeWatcherData(HiAppEvent_Watcher* watcher, uint32_t eventNum, OH_HiAppEvent_OnTake onTake);
+
+/**
+ * @brief Adds a watcher. Once a watcher is added, it starts to listen for system messages.
+ *
+ * @SystemCapability.HiviewDFX.HiAppEvent
+ * @param watcher Pointer to the watcher (that is, the pointer returned by OH_HiAppEvent_CreateWatcher).
+ * @return {@code 0} if the operation is successful; a negative value otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int OH_HiAppEvent_AddWatcher(HiAppEvent_Watcher* watcher);
+
+/**
+ * @brief Removes a watcher. Once a watcher is removed, it stops listening for system messages.
+ *
+ * Note: This API only enables the watcher to stop listening for system messages. It does not destroy the watcher.
+ * The watcher still resides in the memory until the OH_HiAppEvent_DestroyWatcher API is called.
+ *
+ * @SystemCapability.HiviewDFX.HiAppEvent
+ * @param watcher Pointer to the watcher (that is, the pointer returned by OH_HiAppEvent_CreateWatcher).
+ * @return {@code 0} if the operation is successful; a negative value otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int OH_HiAppEvent_RemoveWatcher(HiAppEvent_Watcher* watcher);
+
+/**
+ * @brief Clears the events saved by all watchers.
+ *
+ * @SystemCapability.HiviewDFX.HiAppEvent
+ * @since 12
+ * @version 1.0
+ */
+void OH_HiAppEvent_ClearData(void);
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif // HIVIEWDFX_HIAPPEVENT_H
diff --git a/en/native_sdk/dfx/hiappevent_cfg.h b/en/native_sdk/dfx/hiappevent_cfg.h
new file mode 100644
index 0000000000000000000000000000000000000000..b22443edaf9d0bb43918c068c303a500bf0f4c3b
--- /dev/null
+++ b/en/native_sdk/dfx/hiappevent_cfg.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HIVIEWDFX_HIAPPEVENT_CONFIG_H
+#define HIVIEWDFX_HIAPPEVENT_CONFIG_H
+
+/**
+ * @addtogroup HiAppEvent
+ * @{
+ *
+ * @brief Provides APIs for implementing the application event logging function.
+ *
+ * This function allows your application to record fault events, statistics events, security events,
+ * and user behavior events reported during system running. Based on the event information,
+ * you can analyze the operating status of your application.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiAppEvent
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file hiappevent_cfg.h
+ *
+ * @brief Defines the configuration items of the event logging configuration function.
+ *
+ * @brief If you want to configure the application event logging function,
+ * you can directly use configuration item constants.
+ *
+ * Example:
+ *
+ * bool res = OH_HiAppEvent_Configure(MAX_STORAGE, "100M");
+ *
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Event logging switch.
+ *
+ * @since 8
+ * @version 1.0
+ */
+#define DISABLE "disable"
+
+/**
+ * @brief Storage quota of the event file directory.
+ *
+ * @since 8
+ * @version 1.0
+ */
+#define MAX_STORAGE "max_storage"
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif // HIVIEWDFX_HIAPPEVENT_CONFIG_H
diff --git a/en/native_sdk/dfx/hiappevent_event.h b/en/native_sdk/dfx/hiappevent_event.h
new file mode 100644
index 0000000000000000000000000000000000000000..983b8bb18a2cff76e2922d21bf2c15ed8f0f6344
--- /dev/null
+++ b/en/native_sdk/dfx/hiappevent_event.h
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HIVIEWDFX_HIAPPEVENT_EVENT_H
+#define HIVIEWDFX_HIAPPEVENT_EVENT_H
+
+/**
+ * @addtogroup HiAppEvent
+ * @{
+ *
+ * @brief Provides APIs for implementing the application event logging function.
+ *
+ * This function allows your application to record fault events, statistics events, security events, and
+ * user behavior events reported during system running. Based on the event information, you can analyze
+ * the operating status of your application.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiAppEvent
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file hiappevent_event.h
+ *
+ * @brief Defines the names of all predefined events.
+ *
+ * In addition to custom events associated with specific applications, you can use predefined events for logging.
+ *
+ * Example:
+ *
+ * ParamList list = OH_HiAppEvent_CreateParamList();
+ * OH_HiAppEvent_AddInt32Param(list, PARAM_USER_ID, 123);
+ * int res = OH_HiAppEvent_Write("user_domain", EVENT_USER_LOGIN, BEHAVIOR, list);
+ * OH_HiAppEvent_DestroyParamList(list);
+ *
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief User login event.
+ *
+ * @since 8
+ * @version 1.0
+ */
+#define EVENT_USER_LOGIN "hiappevent.user_login"
+
+/**
+ * @brief User logout event.
+ *
+ * @since 8
+ * @version 1.0
+ */
+#define EVENT_USER_LOGOUT "hiappevent.user_logout"
+
+/**
+ * @brief Distributed service event.
+ *
+ * @since 8
+ * @version 1.0
+ */
+#define EVENT_DISTRIBUTED_SERVICE_START "hiappevent.distributed_service_start"
+
+/**
+ * @brief Application crash event.
+ *
+ * @since 12
+ * @version 1.0
+ */
+#define EVENT_APP_CRASH "APP_CRASH"
+
+/**
+ * @brief Application freeze event.
+ *
+ * @since 12
+ * @version 1.0
+ */
+#define EVENT_APP_FREEZE "APP_FREEZE"
+
+/**
+ * @brief Application loading event.
+ *
+ * @since 12
+ * @version 1.0
+ */
+#define EVENT_APP_LAUNCH "APP_LAUNCH"
+
+/**
+ * @brief Event indicating application freeze during swiping.
+ *
+ * @since 12
+ * @version 1.0
+ */
+#define EVENT_SCROLL_JANK "SCROLL_JANK"
+
+/**
+ * @brief Event indicating high CPU usage of an application.
+ *
+ * @since 12
+ * @version 1.0
+ */
+#define EVENT_CPU_USAGE_HIGH "CPU_USAGE_HIGH"
+
+/**
+ * @brief Application power usage event.
+ *
+ * @since 12
+ * @version 1.0
+ */
+#define EVENT_BATTERY_USAGE "BATTERY_USAGE"
+
+/**
+ * @brief Application resource threshold-crossing event.
+ *
+ * @since 12
+ * @version 1.0
+ */
+#define EVENT_RESOURCE_OVERLIMIT "RESOURCE_OVERLIMIT"
+
+/**
+ * @brief OS scope.
+ *
+ * @since 12
+ * @version 1.0
+ */
+#define DOMAIN_OS "OS"
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif // HIVIEWDFX_HIAPPEVENT_EVENT_H
diff --git a/en/native_sdk/dfx/hiappevent_param.h b/en/native_sdk/dfx/hiappevent_param.h
new file mode 100644
index 0000000000000000000000000000000000000000..c72b6faa6a317e0af97e700e9964bed85aeb3901
--- /dev/null
+++ b/en/native_sdk/dfx/hiappevent_param.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HIVIEWDFX_HIAPPEVENT_PARAM_H
+#define HIVIEWDFX_HIAPPEVENT_PARAM_H
+
+/**
+ * @addtogroup HiAppEvent
+ * @{
+ *
+ * @brief Provides APIs for implementing the application event logging function.
+ *
+ * This function allows your application to record fault events, statistics events, security events, and
+ * user behavior events reported during system running. Based on the event information, you can analyze
+ * the operating status of your application.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiAppEvent
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file hiappevent_param.h
+ *
+ * @brief Defines the names of all predefined event parameters.
+ *
+ * In addition to custom events associated with specific applications, you can use predefined events
+ * for logging.
+ *
+ * Example:
+ *
+ * ParamList list = OH_HiAppEvent_CreateParamList();
+ * OH_HiAppEvent_AddInt32Param(list, PARAM_USER_ID, 123);
+ * int res = OH_HiAppEvent_Write("user_domain", EVENT_USER_LOGIN, BEHAVIOR, list);
+ * OH_HiAppEvent_DestroyParamList(list);
+ *
+ *
+ * @since 8
+ * @version 1.0
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief User ID.
+ *
+ * @since 8
+ * @version 1.0
+ */
+#define PARAM_USER_ID "user_id"
+
+/**
+ * @brief Distributed service name.
+ *
+ * @since 8
+ * @version 1.0
+ */
+#define PARAM_DISTRIBUTED_SERVICE_NAME "ds_name"
+
+/**
+ * @brief Distributed service instance ID.
+ *
+ * @since 8
+ * @version 1.0
+ */
+#define PARAM_DISTRIBUTED_SERVICE_INSTANCE_ID "ds_instance_id"
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif // HIVIEWDFX_HIAPPEVENT_PARAM_H
diff --git a/en/native_sdk/dfx/hidebug.h b/en/native_sdk/dfx/hidebug.h
new file mode 100644
index 0000000000000000000000000000000000000000..2d9f0d29c07d8c8062e9d3b34881298d429d9b98
--- /dev/null
+++ b/en/native_sdk/dfx/hidebug.h
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HIVIEWDFX_HIDEBUG_H
+#define HIVIEWDFX_HIDEBUG_H
+/**
+ * @addtogroup HiDebug
+ * @{
+ *
+ * @brief Provides the debugging function.
+ *
+ * The functions of this module can be used to obtain information such as the CPU usage, memory,
+ * heap, and capture trace.
+ *
+ * @since 12
+ */
+
+/**
+ * @file hideug.h
+ *
+ * @brief Defines the debugging function of the HiDebug module.
+ *
+ * @library libohhidebug.so
+ * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
+ * @since 12
+ */
+
+#include
+#include "hidebug_type.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Obtains the CPU usage of the system.
+ *
+ * @return CPU usage of the system.
+ * @since 12
+ */
+double OH_HiDebug_GetSystemCpuUsage();
+
+/**
+ * @brief Obtains the CPU usage of a process.
+ *
+ * @return CPU usage of a process.
+ * @since 12
+ */
+double OH_HiDebug_GetAppCpuUsage();
+
+/**
+ * @brief Obtains the CPU usage of all threads of an application.
+ *
+ * @return CPU usage of all threads. For details, see {@link HiDebug_ThreadCpuUsagePtr}.
+ * @since 12
+ */
+HiDebug_ThreadCpuUsagePtr OH_HiDebug_GetAppThreadCpuUsage();
+
+/**
+ * @brief Releases the thread data structure.
+ *
+ * @param threadCpuUsage CPU usage of all threads of an application. For details,
+ * see {@link HiDebug_ThreadCpuUsagePtr}.
+ * @since 12
+ */
+void OH_HiDebug_FreeThreadCpuUsage(HiDebug_ThreadCpuUsagePtr *threadCpuUsage);
+
+/**
+ * @brief Obtains system memory information.
+ *
+ * @param systemMemInfo System memory information, which points to {@link HiDebug_SystemMemInfo}.
+ * @since 12
+ */
+void OH_HiDebug_GetSystemMemInfo(HiDebug_SystemMemInfo *systemMemInfo);
+
+/**
+ * @brief Obtains the memory information of an application process.
+ *
+ * @param nativeMemInfo Native memory information, which points to {@link HiDebug_NativeMemInfo}.
+ * @since 12
+ */
+void OH_HiDebug_GetAppNativeMemInfo(HiDebug_NativeMemInfo *nativeMemInfo);
+
+/**
+ * @brief Obtains the memory limit of an application process.
+ *
+ * @param memoryLimit Memory limit, which points to {@link HiDebug_MemoryLimit}.
+ * @since 12
+ */
+void OH_HiDebug_GetAppMemoryLimit(HiDebug_MemoryLimit *memoryLimit);
+
+/**
+ * @brief Starts application trace collection.
+ *
+ * @param flag Flag for thread trace collection.
+ * @param tags Tags for trace collection scenarios.
+ * @param limitSize Maximum size of a trace file, in bytes. The maximum size is 500 MB.
+ * @param fileName Output trace file name.
+ * @param length Length of the trace file name.
+ * @return {@code HIDEBUG_SUCCESS} if the operation is successful. For details, see {@link HiDebug_ErrorCode}.
+ * @since 12
+ */
+HiDebug_ErrorCode OH_HiDebug_StartAppTraceCapture(HiDebug_TraceFlag flag, uint64_t tags, uint32_t limitSize,
+ char* fileName, uint32_t length);
+
+/**
+ * @brief Stops application trace collection.
+ *
+ * @return {@code HIDEBUG_SUCCESS} if the operation is successful. For details, see {@link HiDebug_ErrorCode}.
+ * @since 12
+ */
+HiDebug_ErrorCode OH_HiDebug_StopAppTraceCapture();
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+
+#endif // HIVIEWDFX_HIDEBUG_H
diff --git a/en/native_sdk/dfx/hidebug_type.h b/en/native_sdk/dfx/hidebug_type.h
new file mode 100644
index 0000000000000000000000000000000000000000..2cfcceee6c9a165540ecb903998c87d5909838dd
--- /dev/null
+++ b/en/native_sdk/dfx/hidebug_type.h
@@ -0,0 +1,373 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HIVIEWDFX_HIDEBUG_TYPE_H
+#define HIVIEWDFX_HIDEBUG_TYPE_H
+/**
+ * @addtogroup HiDebug
+ * @{
+ *
+ * @brief Provides definitions for the HiDebug module.
+ *
+ * The functions of this module can be used to obtain information such as the CPU usage, memory,
+ * heap, and capture trace.
+ *
+ * @since 12
+ */
+
+/**
+ * @file hideug_type.h
+ *
+ * @brief Defines the code structure of the HiDebug module.
+ *
+ * @library libohhidebug.so
+ * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug
+ * @since 12
+ */
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Enumerates result codes.
+ *
+ * @since 12
+ */
+typedef enum HiDebug_ErrorCode {
+ /** Success */
+ HIDEBUG_SUCCESS = 0,
+ /** Invalid parameters */
+ HIDEBUG_INVALID_ARGUMENT = 401,
+ /** Repeated collection */
+ HIDEBUG_TRACE_CAPTURED_ALREADY = 11400102,
+ /** No file write permission */
+ HIDEBUG_NO_PERMISSION = 11400103,
+ /** Abnormal trace status */
+ HIDEBUG_TRACE_ABNORMAL = 11400104
+} HiDebug_ErrorCode;
+
+/**
+ * @brief Defines the structure for the CPU usage of all threads of an application.
+ *
+ * @since 12
+ */
+typedef struct HiDebug_ThreadCpuUsage {
+ /**
+ * Thread ID.
+ */
+ uint32_t threadId;
+ /**
+ * Thread CPU usage, in percentage.
+ */
+ double cpuUsage;
+ /**
+ * Usage of the next thread.
+ */
+ struct HiDebug_ThreadCpuUsage *next;
+} HiDebug_ThreadCpuUsage;
+
+/**
+ * @brief Defines the pointer to HiDebug_ThreadCpuUsage.
+ *
+ * @since 12
+ */
+typedef HiDebug_ThreadCpuUsage* HiDebug_ThreadCpuUsagePtr;
+
+/**
+ * @brief Defines the structure for the system memory information.
+ *
+ * @since 12
+ */
+typedef struct HiDebug_SystemMemInfo {
+ /**
+ * Total memory of the system, in KB.
+ */
+ uint32_t totalMem;
+ /**
+ * Free memory of the system, in KB.
+ */
+ uint32_t freeMem;
+ /**
+ * Available memory of the system, in KB.
+ */
+ uint32_t availableMem;
+} HiDebug_SystemMemInfo;
+
+/**
+ * @brief Defines the structure for the local memory information of the application process.
+ *
+ * @since 12
+ */
+typedef struct HiDebug_NativeMemInfo {
+ /**
+ * Proportional set size, in KB.
+ */
+ uint32_t pss;
+ /**
+ * Virtual memory size, in KB.
+ */
+ uint32_t vss;
+ /**
+ * Resident set size, in KB.
+ */
+ uint32_t rss;
+ /**
+ * Size of the shared dirty memory, in KB.
+ */
+ uint32_t sharedDirty;
+ /**
+ * Size of the private dirty memory, in KB.
+ */
+ uint32_t privateDirty;
+ /**
+ * Size of the shared clean memory, in KB.
+ */
+ uint32_t sharedClean;
+ /**
+ * Size of the private clean memory, in KB.
+ */
+ uint32_t privateClean;
+} HiDebug_NativeMemInfo;
+
+/**
+ * @brief Defines the structure for the memory limit of the application process.
+ *
+ * @since 12
+ */
+typedef struct HiDebug_MemoryLimit {
+ /**
+ * Limit on the resident set size, in KB.
+ */
+ uint64_t rssLimit;
+ /**
+ * Limit on the virtual memory size, in KB.
+ */
+ uint64_t vssLimit;
+} HiDebug_MemoryLimit;
+
+/**
+ * @brief Thread type for trace collection.
+ *
+ * @since 12
+ */
+typedef enum HiDebug_TraceFlag {
+ /** Only the main thread of the current application */
+ HIDEBUG_TRACE_FLAG_MAIN_THREAD = 1,
+ /** All threads of the current application */
+ HIDEBUG_TRACE_FLAG_ALL_THREADS = 2
+} HiDebug_TraceFlag;
+#ifdef __cplusplus
+}
+#endif
+
+/**
+ * @brief FFRT task tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_FFRT (1ULL << 13)
+/**
+ * @brief Public library subsystem tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_COMMON_LIBRARY (1ULL << 16)
+/**
+ * @brief HDF subsystem tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_HDF (1ULL << 18)
+/**
+ * @brief Network tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_NET (1ULL << 23)
+/**
+ * @brief NWeb tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_NWEB (1ULL << 24)
+/**
+ * @brief Distributed audio tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_DISTRIBUTED_AUDIO (1ULL << 27)
+/**
+ * @brief File management tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_FILE_MANAGEMENT (1ULL << 29)
+/**
+ * @brief OHOS universal tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_OHOS (1ULL << 30)
+/**
+ * @brief Ability Manager tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_ABILITY_MANAGER (1ULL << 31)
+/**
+ * @brief Camera module tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_CAMERA (1ULL << 32)
+/**
+ * @brief Media module tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_MEDIA (1ULL << 33)
+/**
+ * @brief Image module tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_IMAGE (1ULL << 34)
+/**
+ * @brief Audio module tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_AUDIO (1ULL << 35)
+/**
+ * @brief Distributed data manager module tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_DISTRIBUTED_DATA (1ULL << 36)
+/**
+ * @brief Image module tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_GRAPHICS (1ULL << 38)
+/**
+ * @brief ArkUI development framework tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_ARKUI (1ULL << 39)
+/**
+ * @brief Notification module tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_NOTIFICATION (1ULL << 40)
+/**
+ * @brief MISC module tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_MISC (1ULL << 41)
+/**
+ * @brief Multimodal input module tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_MULTIMODAL_INPUT (1ULL << 42)
+/**
+ * @brief RPC tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_RPC (1ULL << 46)
+/**
+ * @brief JSVM VM tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_ARK (1ULL << 47)
+/**
+ * @brief Window manager tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_WINDOW_MANAGER (1ULL << 48)
+/**
+ * @brief Distributed screen tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_DISTRIBUTED_SCREEN (1ULL << 50)
+/**
+ * @brief Distributed camera tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_DISTRIBUTED_CAMERA (1ULL << 51)
+/**
+ * @brief Distributed hardware framework tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_DISTRIBUTED_HARDWARE_FRAMEWORK (1ULL << 52)
+/**
+ * @brief Global resource manager tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_GLOBAL_RESOURCE_MANAGER (1ULL << 53)
+/**
+ * @brief Distributed hardware device manager tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_DISTRIBUTED_HARDWARE_DEVICE_MANAGER (1ULL << 54)
+/**
+ * @brief SA tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_SAMGR (1ULL << 55)
+/**
+ * @brief Power manager tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_POWER_MANAGER (1ULL << 56)
+/**
+ * @brief Distributed scheduler tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_DISTRIBUTED_SCHEDULER (1ULL << 57)
+/**
+ * @brief Distributed input tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_DISTRIBUTED_INPUT (1ULL << 59)
+/**
+ * @brief Bluetooth tag.
+ *
+ * @since 12
+ */
+#define HIDEBUG_TRACE_TAG_BLUETOOTH (1ULL << 60)
+
+/** @} */
+
+#endif // HIVIEWDFX_HIDEBUG_TYPE_H
diff --git a/en/native_sdk/dfx/trace.h b/en/native_sdk/dfx/trace.h
index 771d1c847740a1e7ec7eade7a6ecda0b5774f80f..26c69466dbd09e735dd432c97063276378725b0f 100644
--- a/en/native_sdk/dfx/trace.h
+++ b/en/native_sdk/dfx/trace.h
@@ -24,6 +24,12 @@
* You can call the APIs provided by hiTraceMeter in your own service logic to effectively
* track service processes and check the system performance.
*
+ * @brief hitraceChain provides APIs for cross-thread and cross-process distributed tracing.
+ * hiTraceChain generates a unique chain ID for a service process and passes it to various information (including
+ * application events, system events, and logs) specific to the service process.
+ * During debugging and fault locating, you can use the unique chain ID to quickly correlate various information related
+ * to the service process.
+ *
* @syscap SystemCapability.HiviewDFX.HiTrace
*
* @since 10
@@ -60,6 +66,540 @@
extern "C" {
#endif
+/**
+ * @brief Defines whether a HiTraceId instance is valid.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+typedef enum HiTraceId_Valid {
+ /**
+ * @brief Invalid HiTraceId instance.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+ HITRACE_ID_INVALID = 0,
+
+ /**
+ * @brief Valid HiTraceId instance.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+ HITRACE_ID_VALID = 1,
+} HiTraceId_Valid;
+
+/**
+ * @brief Enumerates the HiTrace version numbers.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+typedef enum HiTrace_Version {
+ /**
+ * @brief Version 1.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+ HITRACE_VER_1 = 0,
+} HiTrace_Version;
+
+/**
+ * @brief Enumerates the HiTrace flags.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+typedef enum HiTrace_Flag {
+ /**
+ * @brief Default flag.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+ HITRACE_FLAG_DEFAULT = 0,
+
+ /**
+ * @brief Both synchronous and asynchronous calls are traced. By default, only synchronous calls are traced.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+ HITRACE_FLAG_INCLUDE_ASYNC = 1 << 0,
+
+ /**
+ * @brief No spans are created. By default, spans are created.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+ HITRACE_FLAG_DONOT_CREATE_SPAN = 1 << 1,
+
+ /**
+ * @brief Trace points are automatically added to spans. By default, no trace point is added.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+ HITRACE_FLAG_TP_INFO = 1 << 2,
+
+ /**
+ * @brief Information about the start and end of the trace task is not printed. By default, information about the
+ * start and end of the trace task is printed.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+ HITRACE_FLAG_NO_BE_INFO = 1 << 3,
+
+ /**
+ * @brief The ID is not added to the log. By default, the ID is added to the log.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+ HITRACE_FLAG_DONOT_ENABLE_LOG = 1 << 4,
+
+ /**
+ * @brief Tracing is triggered by faults.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+ HITRACE_FLAG_FAULT_TRIGGER = 1 << 5,
+
+ /**
+ * @brief Trace points are added only for call chain trace between devices.
+ * By default, device-to-device trace points are not added.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+ HITRACE_FLAG_D2D_TP_INFO = 1 << 6,
+} HiTrace_Flag;
+
+/**
+ * @brief Enumerates the HiTrace trace point types.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+typedef enum HiTrace_Tracepoint_Type {
+ /**
+ * @brief CS trace point.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+ HITRACE_TP_CS = 0,
+ /**
+ * @brief CR trace point.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+ HITRACE_TP_CR = 1,
+ /**
+ * @brief SS trace point.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+ HITRACE_TP_SS = 2,
+ /**
+ * @brief SR trace point.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+ HITRACE_TP_SR = 3,
+ /**
+ * @brief General trace point.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+ HITRACE_TP_GENERAL = 4,
+} HiTrace_Tracepoint_Type;
+
+/**
+ * @brief Enumerates the HiTrace communication modes.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+typedef enum HiTrace_Communication_Mode {
+ /**
+ * @brief Default communication mode.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+ HITRACE_CM_DEFAULT = 0,
+ /**
+ * @brief Inter-thread communication.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+ HITRACE_CM_THREAD = 1,
+ /**
+ * @brief Inter-process communication.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+ HITRACE_CM_PROCESS = 2,
+ /**
+ * @brief Inter-device communication.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+ HITRACE_CM_DEVICE = 3,
+} HiTrace_Communication_Mode;
+
+/**
+ * @brief Defines a HiTraceId instance.
+ *
+ * @struct HiTraceId
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+typedef struct HiTraceId {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ /** Whether the HiTraceId instance is valid. */
+ uint64_t valid : 1;
+ /** Version number of the HiTraceId instance. */
+ uint64_t ver : 3;
+ /** Chain ID of the HiTraceId instance. */
+ uint64_t chainId : 60;
+ /** Flag of the HiTraceId instance. */
+ uint64_t flags : 12;
+ /** Span ID of the HiTraceId instance. */
+ uint64_t spanId : 26;
+ /** Parent span ID of the HiTraceId instance. */
+ uint64_t parentSpanId : 26;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ /** Chain ID of the HiTraceId instance. */
+ uint64_t chainId : 60;
+ /** Version number of the HiTraceId instance. */
+ uint64_t ver : 3;
+ /** Whether the HiTraceId instance is valid. */
+ uint64_t valid : 1;
+ /** Parent span ID of the HiTraceId instance. */
+ uint64_t parentSpanId : 26;
+ /** Span ID of the HiTraceId instance. */
+ uint64_t spanId : 26;
+ /** Flag of the HiTraceId instance. */
+ uint64_t flags : 12;
+#else
+#error "ERROR: No BIG_LITTLE_ENDIAN defines."
+#endif
+} HiTraceId;
+
+/**
+ * @brief Starts tracing of a process.
+ *
+ * This API starts tracing, creates a HiTraceId instance, and sets it to the TLS of the calling thread.
+ * This API works only when it is called for the first time.
+ *
+ * @param name Pointer to a process name.
+ * @param flags Trace flag.
+ * @return Returns the created HiTraceId instance.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+HiTraceId OH_HiTrace_BeginChain(const char *name, int flags);
+
+/**
+ * @brief Ends tracing and clears the HiTraceId instance of the calling thread from the TLS.
+ *
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+void OH_HiTrace_EndChain();
+
+/**
+ * @brief Obtains the trace ID of the calling thread from the TLS.
+ *
+ *
+ * @return Returns the trace ID of the calling thread. If the calling thread does not have a trace ID,
+ * an invalid trace ID is returned.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+HiTraceId OH_HiTrace_GetId();
+
+/**
+ * @brief Sets the trace ID of the calling thread. If the ID is invalid, no operation is performed.
+ *
+ * This API sets a HiTraceId instance to the TLS of the calling thread.
+ *
+ * @param id Trace ID to set.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+void OH_HiTrace_SetId(const HiTraceId *id);
+
+/**
+ * @brief Clears the trace ID of the calling thread and invalidates it.
+ *
+ * This API clears the HiTraceId instance in the TLS of the calling thread.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+void OH_HiTrace_ClearId(void);
+
+/**
+ * @brief Creates a span ID based on the trace ID of the calling thread.
+ *
+ * This API generates a new span and corresponding HiTraceId instance based on the HiTraceId
+ * instance in the TLS of the calling thread.
+ *
+ * @return Returns a valid span ID. If span creation is not allowed, the ID of the calling thread is traced.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+HiTraceId OH_HiTrace_CreateSpan(void);
+
+/**
+ * @brief Prints HiTrace information, including the trace ID.
+ *
+ * This API prints trace point information, including the communication mode, trace point type, timestamp, and span.
+ *
+ * @param mode Communication mode for the trace point.
+ * @param type Trace point type.
+ * @param id Trace ID.
+ * @param fmt Custom information to print.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+void OH_HiTrace_Tracepoint(
+ HiTrace_Communication_Mode mode, HiTrace_Tracepoint_Type type, const HiTraceId *id, const char *fmt, ...);
+
+/**
+ * @brief Initializes a HiTraceId structure.
+ *
+ * @param id ID of the HiTraceId structure to be initialized.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+void OH_HiTrace_InitId(HiTraceId *id);
+
+/**
+ * @brief Creates a HiTraceId structure based on a byte array.
+ *
+ * @param id ID of the HiTraceId structure to be created.
+ * @param pIdArray Byte array.
+ * @param len Length of the byte array.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+void OH_HiTrace_IdFromBytes(HiTraceId *id, const uint8_t *pIdArray, int len);
+
+/**
+ * @brief Checks whether a HiTraceId instance is valid.
+ *
+ *
+ * @param id HiTraceId instance to check.
+ * @return Returns true if the HiTraceId instance is valid; returns false otherwise.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+bool OH_HiTrace_IsIdValid(const HiTraceId *id);
+
+/**
+ * @brief Checks whether the specified trace flag in a HiTraceId instance is enabled.
+ *
+ *
+ * @param id HiTraceId instance to check.
+ * @param flag Specified trace flag.
+ * @return Returns true if the specified trace flag is enabled; returns false otherwise.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+bool OH_HiTrace_IsFlagEnabled(const HiTraceId *id, HiTrace_Flag flag);
+
+/**
+ * @brief Enables the specified trace flag in a HiTraceId instance.
+ *
+ *
+ * @param id HiTraceId instance for which you want to enable the specified trace flag.
+ * @param flag Specified trace flag.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+void OH_HiTrace_EnableFlag(const HiTraceId *id, HiTrace_Flag flag);
+
+/**
+ * @brief Obtains the trace flag set in a HiTraceId instance.
+ *
+ * @param id HiTraceId instance.
+ *
+ * @return Returns the trace flag set in the specified HiTraceId instance.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+int OH_HiTrace_GetFlags(const HiTraceId *id);
+
+/**
+ * @brief Sets the trace flag for a HiTraceId instance.
+ *
+ * @param id HiTraceId instance.
+ * @param flags Trace flag to set.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+void OH_HiTrace_SetFlags(HiTraceId *id, int flags);
+
+/**
+ * @brief Obtains the trace chain ID.
+ *
+ * @param id HiTraceId instance for which you want to obtain the trace chain ID.
+ *
+ * @return Returns the trace chain ID of the specified HiTraceId instance.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+uint64_t OH_HiTrace_GetChainId(const HiTraceId *id);
+
+/**
+ * @brief Sets the trace chain ID to a HiTraceId instance
+ *
+ * @param id HiTraceId instance.
+ * @param chainId Trace chain ID to set.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+void OH_HiTrace_SetChainId(HiTraceId *id, uint64_t chainId);
+
+/**
+ * @brief Obtains the span ID in a HiTraceId instance.
+ *
+ * @param id HiTraceId instance for which you want to obtain the span ID.
+ *
+ * @return Returns the span ID in the specified HiTraceId instance.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+uint64_t OH_HiTrace_GetSpanId(const HiTraceId *id);
+
+/**
+ * @brief Sets the span ID in a HiTraceId instance.
+ *
+ * @param id HiTraceId instance for which you want to set the span ID.
+ * @param spanId Span ID to set.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+void OH_HiTrace_SetSpanId(HiTraceId *id, uint64_t spanId);
+
+/**
+ * @brief Obtains the parent span ID in a HiTraceId instance.
+ *
+ * @param id HiTraceId instance for which you want to obtain the parent span ID.
+ *
+ * @return Returns the parent span ID in the specified HiTraceId instance.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+uint64_t OH_HiTrace_GetParentSpanId(const HiTraceId *id);
+
+/**
+ * @brief Sets the parent span ID in a HiTraceId instance.
+ *
+ * @param id HiTraceId instance for which you want to set the parent span ID.
+ * @param parentSpanId Parent span ID to set.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+void OH_HiTrace_SetParentSpanId(HiTraceId *id, uint64_t parentSpanId);
+
+/**
+ * @brief Converts a HiTraceId instance into a byte array for caching or communication.
+ *
+ * @param id HiTraceId instance to be converted.
+ * @param pIdArray Byte array.
+ * @param len Length of the byte array.
+ *
+ * @return Returns the length of the byte array after conversion.
+ *
+ * @syscap SystemCapability.HiviewDFX.HiTrace
+ *
+ * @since 12
+ */
+int OH_HiTrace_IdToBytes(const HiTraceId* id, uint8_t* pIdArray, int len);
+
/**
* @brief Marks the start of a synchronous trace task.
*
diff --git a/en/native_sdk/ffrt/cpp/condition_variable.h b/en/native_sdk/ffrt/cpp/condition_variable.h
deleted file mode 100644
index 02357c88dfd1cf1a566aedaffbfe2247e5690898..0000000000000000000000000000000000000000
--- a/en/native_sdk/ffrt/cpp/condition_variable.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2023 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file condition_variable.h
- *
- * @brief Declares the condition variable interfaces in C++.
- *
- * @since 10
- * @version 1.0
- */
-#ifndef FFRT_API_CPP_CONDITION_VARIABLE_H
-#define FFRT_API_CPP_CONDITION_VARIABLE_H
-#include
-#include
-#include "mutex.h"
-#include "c/condition_variable.h"
-
-namespace ffrt {
-enum class cv_status { no_timeout, timeout };
-
-class condition_variable : public ffrt_cond_t {
-public:
- condition_variable()
- {
- ffrt_cond_init(this, nullptr);
- }
-
- ~condition_variable() noexcept
- {
- ffrt_cond_destroy(this);
- }
-
- condition_variable(const condition_variable&) = delete;
- condition_variable& operator=(const condition_variable&) = delete;
-
- template
- bool wait_until(
- std::unique_lock& lk, const std::chrono::time_point& tp, Pred&& pred) noexcept
- {
- while (!pred()) {
- if (wait_until(lk, tp) == cv_status::timeout) {
- return pred();
- }
- }
- return true;
- }
-
- template
- cv_status wait_until(std::unique_lock& lk, const std::chrono::time_point& tp) noexcept
- {
- return _wait_for(lk, tp - Clock::now());
- }
-
- template
- cv_status wait_for(std::unique_lock& lk, const std::chrono::duration& sleep_time) noexcept
- {
- return _wait_for(lk, sleep_time);
- }
-
- template
- bool wait_for(
- std::unique_lock& lk, const std::chrono::duration& sleepTime, Pred&& pred) noexcept
- {
- return wait_until(lk, std::chrono::steady_clock::now() + sleepTime, std::forward(pred));
- }
-
- template
- void wait(std::unique_lock& lk, Pred&& pred)
- {
- while (!pred()) {
- wait(lk);
- }
- }
-
- void wait(std::unique_lock& lk)
- {
- ffrt_cond_wait(this, lk.mutex());
- }
-
- void notify_one() noexcept
- {
- ffrt_cond_signal(this);
- }
-
- void notify_all() noexcept
- {
- ffrt_cond_broadcast(this);
- }
-
-private:
- template
- cv_status _wait_for(std::unique_lock& lk, const std::chrono::duration& dur) noexcept
- {
- timespec ts;
- std::chrono::nanoseconds T0 = std::chrono::steady_clock::now().time_since_epoch();
- T0 += std::chrono::duration_cast(dur);
- ts.tv_sec = std::chrono::duration_cast(T0).count();
- T0 -= std::chrono::seconds(ts.tv_sec);
- ts.tv_nsec = static_cast(T0.count());
-
- auto ret = ffrt_cond_timedwait(this, lk.mutex(), &ts);
- if (ret == ffrt_success) {
- return cv_status::no_timeout;
- }
- return cv_status::timeout;
- }
-};
-} // namespace ffrt
-#endif
diff --git a/en/native_sdk/ffrt/cpp/queue.h b/en/native_sdk/ffrt/cpp/queue.h
deleted file mode 100644
index 5b3fc39b67737615ffc62553a186f95334a8d929..0000000000000000000000000000000000000000
--- a/en/native_sdk/ffrt/cpp/queue.h
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Copyright (c) 2023 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file queue.h
- *
- * @brief Declares the queue interfaces in C++.
- *
- * @since 10
- * @version 1.0
- */
-#ifndef FFRT_API_CPP_QUEUE_H
-#define FFRT_API_CPP_QUEUE_H
-
-#include "c/queue.h"
-#include "cpp/task.h"
-
-namespace ffrt {
-class queue_attr : public ffrt_queue_attr_t {
-public:
- queue_attr()
- {
- ffrt_queue_attr_init(this);
- }
-
- ~queue_attr()
- {
- ffrt_queue_attr_destroy(this);
- }
-
- queue_attr(const queue_attr&) = delete;
- queue_attr& operator=(const queue_attr&) = delete;
-
- /**
- * @brief Sets the QoS for this queue attribute.
- *
- * @param attr Indicates the QoS.
- * @since 10
- * @version 1.0
- */
- inline queue_attr& qos(enum qos qos)
- {
- ffrt_queue_attr_set_qos(this, static_cast(qos));
- return *this;
- }
-
- /**
- * @brief Obtains the QoS of this queue attribute.
- *
- * @return Returns the QoS.
- * @since 10
- * @version 1.0
- */
- inline enum qos qos() const
- {
- return static_cast(ffrt_queue_attr_get_qos(this));
- }
-};
-
-class queue {
-public:
- queue(const char* name, const queue_attr& attr = {})
- {
- queue_handle = ffrt_queue_create(ffrt_queue_serial, name, &attr);
- }
-
- ~queue()
- {
- ffrt_queue_destroy(queue_handle);
- }
-
- queue(queue const&) = delete;
- void operator=(queue const&) = delete;
-
- /**
- * @brief Submits a task to this queue.
- *
- * @param func Indicates a task executor function closure.
- * @since 10
- * @version 1.0
- */
- inline void submit(std::function& func)
- {
- ffrt_queue_submit(queue_handle, create_function_wrapper(func, ffrt_function_kind_queue), nullptr);
- }
-
- /**
- * @brief Submits a task with a specified attribute to this queue.
- *
- * @param func Indicates a task executor function closure.
- * @param attr Indicates a task attribute.
- * @since 10
- * @version 1.0
- */
- inline void submit(std::function& func, const task_attr& attr)
- {
- ffrt_queue_submit(queue_handle, create_function_wrapper(func, ffrt_function_kind_queue), &attr);
- }
-
- /**
- * @brief Submits a task to this queue.
- *
- * @param func Indicates a task executor function closure.
- * @since 10
- * @version 1.0
- */
- inline void submit(std::function&& func)
- {
- ffrt_queue_submit(queue_handle, create_function_wrapper(std::move(func), ffrt_function_kind_queue), nullptr);
- }
-
- /**
- * @brief Submits a task with a specified attribute to this queue.
- *
- * @param func Indicates a task executor function closure.
- * @param attr Indicates a task attribute.
- * @since 10
- * @version 1.0
- */
- inline void submit(std::function&& func, const task_attr& attr)
- {
- ffrt_queue_submit(queue_handle, create_function_wrapper(std::move(func), ffrt_function_kind_queue), &attr);
- }
-
- /**
- * @brief Submits a task to this queue, and obtains a task handle.
- *
- * @param func Indicates a task executor function closure.
- * @return Returns a non-null task handle if the task is submitted;
- returns a null pointer otherwise.
- * @since 10
- * @version 1.0
- */
- inline task_handle submit_h(std::function& func)
- {
- return ffrt_queue_submit_h(queue_handle, create_function_wrapper(func, ffrt_function_kind_queue), nullptr);
- }
-
- /**
- * @brief Submits a task with a specified attribute to this queue, and obtains a task handle.
- *
- * @param func Indicates a task executor function closure.
- * @param attr Indicates a task attribute.
- * @return Returns a non-null task handle if the task is submitted;
- returns a null pointer otherwise.
- * @since 10
- * @version 1.0
- */
- inline task_handle submit_h(std::function& func, const task_attr& attr)
- {
- return ffrt_queue_submit_h(queue_handle, create_function_wrapper(func, ffrt_function_kind_queue), &attr);
- }
-
- /**
- * @brief Submits a task to this queue, and obtains a task handle.
- *
- * @param func Indicates a task executor function closure.
- * @return Returns a non-null task handle if the task is submitted;
- returns a null pointer otherwise.
- * @since 10
- * @version 1.0
- */
- inline task_handle submit_h(std::function&& func)
- {
- return ffrt_queue_submit_h(
- queue_handle, create_function_wrapper(std::move(func), ffrt_function_kind_queue), nullptr);
- }
-
- /**
- * @brief Submits a task with a specified attribute to this queue, and obtains a task handle.
- *
- * @param func Indicates a task executor function closure.
- * @param attr Indicates a task attribute.
- * @return Returns a non-null task handle if the task is submitted;
- returns a null pointer otherwise.
- * @since 10
- * @version 1.0
- */
- inline task_handle submit_h(std::function&& func, const task_attr& attr)
- {
- return ffrt_queue_submit_h(
- queue_handle, create_function_wrapper(std::move(func), ffrt_function_kind_queue), &attr);
- }
-
- /**
- * @brief Cancels a task.
- *
- * @param handle Indicates a task handle.
- * @return Returns 0 if the task is canceled;
- returns -1 otherwise.
- * @since 10
- * @version 1.0
- */
- inline int cancel(task_handle& handle)
- {
- return ffrt_queue_cancel(handle);
- }
-
- /**
- * @brief Waits until a task is complete.
- *
- * @param handle Indicates a task handle.
- * @since 10
- * @version 1.0
- */
- inline void wait(task_handle& handle)
- {
- return ffrt_queue_wait(handle);
- }
-
-private:
- ffrt_queue_t queue_handle = nullptr;
-};
-} // namespace ffrt
-
-#endif // FFRT_API_CPP_QUEUE_H
diff --git a/en/native_sdk/ffrt/cpp/task.h b/en/native_sdk/ffrt/cpp/task.h
deleted file mode 100644
index 7f786eea9ec5f7573af9048201ddcbffb080b5fb..0000000000000000000000000000000000000000
--- a/en/native_sdk/ffrt/cpp/task.h
+++ /dev/null
@@ -1,736 +0,0 @@
-/*
- * Copyright (c) 2023 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
- /**
- * @file task.h
- *
- * @brief Declares the task interfaces in C++.
- *
- * @since 10
- * @version 1.0
- */
-#ifndef FFRT_API_CPP_TASK_H
-#define FFRT_API_CPP_TASK_H
-#include
-#include
-#include
-#include
-#include "c/task.h"
-
-namespace ffrt {
-class task_attr : public ffrt_task_attr_t {
-public:
- task_attr()
- {
- ffrt_task_attr_init(this);
- }
-
- ~task_attr()
- {
- ffrt_task_attr_destroy(this);
- }
-
- task_attr(const task_attr&) = delete;
- task_attr& operator=(const task_attr&) = delete;
-
- /**
- * @brief Sets a task name.
- *
- * @param name Indicates a pointer to the task name.
- * @since 10
- * @version 1.0
- */
- inline task_attr& name(const char* name)
- {
- ffrt_task_attr_set_name(this, name);
- return *this;
- }
-
- /**
- * @brief Obtains the task name.
- *
- * @return Returns a pointer to the task name.
- * @since 10
- * @version 1.0
- */
- inline const char* name() const
- {
- return ffrt_task_attr_get_name(this);
- }
-
- /**
- * @brief Sets the QoS for this task.
- *
- * @param qos Indicates the QoS.
- * @since 10
- * @version 1.0
- */
- inline task_attr& qos(enum qos qos)
- {
- ffrt_task_attr_set_qos(this, static_cast(qos));
- return *this;
- }
-
- /**
- * @brief Obtains the QoS of this task.
- *
- * @return Returns the QoS.
- * @since 10
- * @version 1.0
- */
- inline enum qos qos() const
- {
- return static_cast(ffrt_task_attr_get_qos(this));
- }
-
- /**
- * @brief Sets the delay time for this task.
- *
- * @param delay_us Indicates the delay time, in microseconds.
- * @since 10
- * @version 1.0
- */
- inline task_attr& delay(uint64_t delay_us)
- {
- ffrt_task_attr_set_delay(this, delay_us);
- return *this;
- }
-
- /**
- * @brief Obtains the delay time of this task.
- *
- * @return Returns the delay time.
- * @since 10
- * @version 1.0
- */
- inline uint64_t delay() const
- {
- return ffrt_task_attr_get_delay(this);
- }
-};
-
-class task_handle {
-public:
- task_handle() : p(nullptr)
- {
- }
- task_handle(ffrt_task_handle_t p) : p(p)
- {
- }
-
- ~task_handle()
- {
- if (p) {
- ffrt_task_handle_destroy(p);
- }
- }
-
- task_handle(task_handle const&) = delete;
- void operator=(task_handle const&) = delete;
-
- inline task_handle(task_handle&& h)
- {
- *this = std::move(h);
- }
-
- inline task_handle& operator=(task_handle&& h)
- {
- if (p) {
- ffrt_task_handle_destroy(p);
- }
- p = h.p;
- h.p = nullptr;
- return *this;
- }
-
- inline operator void* () const
- {
- return p;
- }
-
-private:
- ffrt_task_handle_t p = nullptr;
-};
-
-template
-struct function {
- template
- function(ffrt_function_header_t h, CT&& c) : header(h), closure(std::forward(c)) {}
- ffrt_function_header_t header;
- T closure;
-};
-
-template
-void exec_function_wrapper(void* t)
-{
- auto f = reinterpret_cast>*>(t);
- f->closure();
-}
-
-template
-void destroy_function_wrapper(void* t)
-{
- auto f = reinterpret_cast>*>(t);
- f->closure = nullptr;
-}
-
-template
-inline ffrt_function_header_t* create_function_wrapper(T&& func,
- ffrt_function_kind_t kind = ffrt_function_kind_general)
-{
- using function_type = function>;
- static_assert(sizeof(function_type) <= ffrt_auto_managed_function_storage_size,
- "size of function must be less than ffrt_auto_managed_function_storage_size");
-
- auto p = ffrt_alloc_auto_managed_function_storage_base(kind);
- auto f =
- new (p) function_type({exec_function_wrapper, destroy_function_wrapper, {0}}, std::forward(func));
- return reinterpret_cast(f);
-}
-
-/**
- * @brief Submits a task without input and output dependencies.
- *
- * @param func Indicates a task executor function closure.
- * @since 10
- * @version 1.0
- */
-static inline void submit(std::function&& func)
-{
- return ffrt_submit_base(create_function_wrapper(std::move(func)), nullptr, nullptr, nullptr);
-}
-
-/**
- * @brief Submits a task with input dependencies only.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @since 10
- * @version 1.0
- */
-static inline void submit(std::function&& func, std::initializer_list in_deps)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()};
- return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, nullptr, nullptr);
-}
-
-/**
- * @brief Submits a task with input and output dependencies.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @param out_deps Indicates a pointer to the output dependencies.
- * @since 10
- * @version 1.0
- */
-static inline void submit(std::function&& func, std::initializer_list in_deps,
- std::initializer_list out_deps)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()};
- ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()};
- return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, &out, nullptr);
-}
-
-/**
- * @brief Submits a task with a specified attribute and input and output dependencies.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @param out_deps Indicates a pointer to the output dependencies.
- * @param attr Indicates a task attribute.
- * @since 10
- * @version 1.0
- */
-static inline void submit(std::function&& func, std::initializer_list in_deps,
- std::initializer_list out_deps, const task_attr& attr)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()};
- ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()};
- return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, &out, &attr);
-}
-
-/**
- * @brief Submits a task with input dependencies only.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @since 10
- * @version 1.0
- */
-static inline void submit(std::function&& func, const std::vector& in_deps)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()};
- return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, nullptr, nullptr);
-}
-
-/**
- * @brief Submits a task with input and output dependencies.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @param out_deps Indicates a pointer to the output dependencies.
- * @since 10
- * @version 1.0
- */
-static inline void submit(std::function&& func, const std::vector& in_deps,
- const std::vector& out_deps)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()};
- ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()};
- return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, &out, nullptr);
-}
-
-/**
- * @brief Submits a task with a specified attribute and input and output dependencies.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @param out_deps Indicates a pointer to the output dependencies.
- * @param attr Indicates a task attribute.
- * @since 10
- * @version 1.0
- */
-static inline void submit(std::function&& func, const std::vector& in_deps,
- const std::vector& out_deps, const task_attr& attr)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()};
- ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()};
- return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, &out, &attr);
-}
-
-/**
- * @brief Submits a task without input and output dependencies.
- *
- * @param func Indicates a task executor function closure.
- * @since 10
- * @version 1.0
- */
-static inline void submit(const std::function& func)
-{
- return ffrt_submit_base(create_function_wrapper(func), nullptr, nullptr, nullptr);
-}
-
-/**
- * @brief Submits a task with input dependencies only.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @since 10
- * @version 1.0
- */
-static inline void submit(const std::function& func, std::initializer_list in_deps)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()};
- return ffrt_submit_base(create_function_wrapper(func), &in, nullptr, nullptr);
-}
-
-/**
- * @brief Submits a task with input and output dependencies.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @param out_deps Indicates a pointer to the output dependencies.
- * @since 10
- * @version 1.0
- */
-static inline void submit(const std::function& func, std::initializer_list in_deps,
- std::initializer_list out_deps)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()};
- ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()};
- return ffrt_submit_base(create_function_wrapper(func), &in, &out, nullptr);
-}
-
-/**
- * @brief Submits a task with a specified attribute and input and output dependencies.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @param out_deps Indicates a pointer to the output dependencies.
- * @param attr Indicates a task attribute.
- * @since 10
- * @version 1.0
- */
-static inline void submit(const std::function& func, std::initializer_list in_deps,
- std::initializer_list out_deps, const task_attr& attr)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()};
- ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()};
- return ffrt_submit_base(create_function_wrapper(func), &in, &out, &attr);
-}
-
-/**
- * @brief Submits a task with input dependencies only.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @since 10
- * @version 1.0
- */
-static inline void submit(const std::function& func, const std::vector& in_deps)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()};
- return ffrt_submit_base(create_function_wrapper(func), &in, nullptr, nullptr);
-}
-
-/**
- * @brief Submits a task with input and output dependencies.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @param out_deps Indicates a pointer to the output dependencies.
- * @since 10
- * @version 1.0
- */
-static inline void submit(const std::function& func, const std::vector& in_deps,
- const std::vector& out_deps)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()};
- ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()};
- return ffrt_submit_base(create_function_wrapper(func), &in, &out, nullptr);
-}
-
-/**
- * @brief Submits a task with a specified attribute and input and output dependencies.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @param out_deps Indicates a pointer to the output dependencies.
- * @param attr Indicates a task attribute.
- * @since 10
- * @version 1.0
- */
-static inline void submit(const std::function& func, const std::vector& in_deps,
- const std::vector& out_deps, const task_attr& attr)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()};
- ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()};
- return ffrt_submit_base(create_function_wrapper(func), &in, &out, &attr);
-}
-
-/**
- * @brief Submits a task without input and output dependencies, and obtains a task handle.
- *
- * @param func Indicates a task executor function closure.
- * @return Returns a non-null task handle if the task is submitted;
- returns a null pointer otherwise.
- * @since 10
- * @version 1.0
- */
-static inline task_handle submit_h(std::function&& func)
-{
- return ffrt_submit_h_base(create_function_wrapper(std::move(func)), nullptr, nullptr, nullptr);
-}
-
-/**
- * @brief Submits a task with input dependencies only, and obtains a task handle.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @return Returns a non-null task handle if the task is submitted;
- returns a null pointer otherwise.
- * @since 10
- * @version 1.0
- */
-static inline task_handle submit_h(std::function&& func, std::initializer_list in_deps)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()};
- return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, nullptr, nullptr);
-}
-
-/**
- * @brief Submits a task with input and output dependencies, and obtains a task handle.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @param out_deps Indicates a pointer to the output dependencies.
- * @return Returns a non-null task handle if the task is submitted;
- returns a null pointer otherwise.
- * @since 10
- * @version 1.0
- */
-static inline task_handle submit_h(std::function&& func, std::initializer_list in_deps,
- std::initializer_list out_deps)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()};
- ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()};
- return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, &out, nullptr);
-}
-
-/**
- * @brief Submits a task with a specified attribute and input and output dependencies, and obtains a task handle.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @param out_deps Indicates a pointer to the output dependencies.
- * @param attr Indicates a task attribute.
- * @return Returns a non-null task handle if the task is submitted;
- returns a null pointer otherwise.
- * @since 10
- * @version 1.0
- */
-static inline task_handle submit_h(std::function&& func, std::initializer_list in_deps,
- std::initializer_list out_deps, const task_attr& attr)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()};
- ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()};
- return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, &out, &attr);
-}
-
-/**
- * @brief Submits a task with input dependencies only, and obtains a task handle.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @return Returns a non-null task handle if the task is submitted;
- returns a null pointer otherwise.
- * @since 10
- * @version 1.0
- */
-static inline task_handle submit_h(std::function&& func, const std::vector& in_deps)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()};
- return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, nullptr, nullptr);
-}
-
-/**
- * @brief Submits a task with input and output dependencies, and obtains a task handle.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @param out_deps Indicates a pointer to the output dependencies.
- * @return Returns a non-null task handle if the task is submitted;
- returns a null pointer otherwise.
- * @since 10
- * @version 1.0
- */
-static inline task_handle submit_h(std::function&& func, const std::vector& in_deps,
- const std::vector& out_deps)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()};
- ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()};
- return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, &out, nullptr);
-}
-
-/**
- * @brief Submits a task with a specified attribute and input and output dependencies, and obtains a task handle.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @param out_deps Indicates a pointer to the output dependencies.
- * @param attr Indicates a task attribute.
- * @return Returns a non-null task handle if the task is submitted;
- returns a null pointer otherwise.
- * @since 10
- * @version 1.0
- */
-static inline task_handle submit_h(std::function&& func, const std::vector& in_deps,
- const std::vector& out_deps, const task_attr& attr)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()};
- ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()};
- return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, &out, &attr);
-}
-
-/**
- * @brief Submits a task without input and output dependencies, and obtains a task handle.
- *
- * @param func Indicates a task executor function closure.
- * @return Returns a non-null task handle if the task is submitted;
- returns a null pointer otherwise.
- * @since 10
- * @version 1.0
- */
-static inline task_handle submit_h(const std::function& func)
-{
- return ffrt_submit_h_base(create_function_wrapper(func), nullptr, nullptr, nullptr);
-}
-
-/**
- * @brief Submits a task with input dependencies only, and obtains a task handle.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @return Returns a non-null task handle if the task is submitted;
- returns a null pointer otherwise.
- * @since 10
- * @version 1.0
- */
-static inline task_handle submit_h(const std::function& func, std::initializer_list in_deps)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()};
- return ffrt_submit_h_base(create_function_wrapper(func), &in, nullptr, nullptr);
-}
-
-/**
- * @brief Submits a task with input and output dependencies, and obtains a task handle.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @param out_deps Indicates a pointer to the output dependencies.
- * @return Returns a non-null task handle if the task is submitted;
- returns a null pointer otherwise.
- * @since 10
- * @version 1.0
- */
-static inline task_handle submit_h(const std::function& func, std::initializer_list in_deps,
- std::initializer_list out_deps)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()};
- ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()};
- return ffrt_submit_h_base(create_function_wrapper(func), &in, &out, nullptr);
-}
-
-/**
- * @brief Submits a task with a specified attribute and input and output dependencies, and obtains a task handle.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @param out_deps Indicates a pointer to the output dependencies.
- * @param attr Indicates a task attribute.
- * @return Returns a non-null task handle if the task is submitted;
- returns a null pointer otherwise.
- * @since 10
- * @version 1.0
- */
-static inline task_handle submit_h(const std::function& func, std::initializer_list in_deps,
- std::initializer_list out_deps, const task_attr& attr)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()};
- ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()};
- return ffrt_submit_h_base(create_function_wrapper(func), &in, &out, &attr);
-}
-
-/**
- * @brief Submits a task with input dependencies only, and obtains a task handle.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @return Returns a non-null task handle if the task is submitted;
- returns a null pointer otherwise.
- * @since 10
- * @version 1.0
- */
-static inline task_handle submit_h(const std::function& func, const std::vector& in_deps)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()};
- return ffrt_submit_h_base(create_function_wrapper(func), &in, nullptr, nullptr);
-}
-
-/**
- * @brief Submits a task with input and output dependencies, and obtains a task handle.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @param out_deps Indicates a pointer to the output dependencies.
- * @return Returns a non-null task handle if the task is submitted;
- returns a null pointer otherwise.
- * @since 10
- * @version 1.0
- */
-static inline task_handle submit_h(const std::function& func, const std::vector& in_deps,
- const std::vector& out_deps)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()};
- ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()};
- return ffrt_submit_h_base(create_function_wrapper(func), &in, &out, nullptr);
-}
-
-/**
- * @brief Submits a task with a specified attribute and input and output dependencies, and obtains a task handle.
- *
- * @param func Indicates a task executor function closure.
- * @param in_deps Indicates a pointer to the input dependencies.
- * @param out_deps Indicates a pointer to the output dependencies.
- * @param attr Indicates a task attribute.
- * @return Returns a non-null task handle if the task is submitted;
- returns a null pointer otherwise.
- * @since 10
- * @version 1.0
- */
-static inline task_handle submit_h(const std::function& func, const std::vector& in_deps,
- const std::vector& out_deps, const task_attr& attr)
-{
- ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()};
- ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()};
- return ffrt_submit_h_base(create_function_wrapper(func), &in, &out, &attr);
-}
-
-/**
- * @brief Skips a task.
- *
- * @param handle Indicates a task handle.
- * @return Returns 0 if the task is skipped;
- returns -1 otherwise.
- * @since 10
- * @version 1.0
- */
-static inline int skip(task_handle &handle)
-{
- return ffrt_skip(handle);
-}
-
-/**
- * @brief Waits until all submitted tasks are complete.
- *
- * @since 10
- * @version 1.0
- */
-static inline void wait()
-{
- ffrt_wait();
-}
-
-/**
- * @brief Waits until dependent tasks are complete.
- *
- * @param deps Indicates a pointer to the dependent tasks.
- * @since 10
- * @version 1.0
- */
-static inline void wait(std::initializer_list deps)
-{
- ffrt_deps_t d {static_cast(deps.size()), deps.begin()};
- ffrt_wait_deps(&d);
-}
-
-/**
- * @brief Waits until dependent tasks are complete.
- *
- * @param deps Indicates a pointer to the dependent tasks.
- * @since 10
- * @version 1.0
- */
-static inline void wait(const std::vector& deps)
-{
- ffrt_deps_t d {static_cast(deps.size()), deps.data()};
- ffrt_wait_deps(&d);
-}
-
-namespace this_task {
-/**
- * @brief Obtains the ID of this task.
- *
- * @return Returns the task ID.
- * @since 10
- * @version 1.0
- */
-static inline uint64_t get_id()
-{
- return ffrt_this_task_get_id();
-}
-} // namespace this_task
-} // namespace ffrt
-#endif
diff --git a/en/native_sdk/graphic/external_window.h b/en/native_sdk/graphic/external_window.h
index d9ac4c0b17948158f19211f61481990fc78675df..4d5e24409376d09cc2527bda904e4321b33ec9b9 100644
--- a/en/native_sdk/graphic/external_window.h
+++ b/en/native_sdk/graphic/external_window.h
@@ -20,7 +20,7 @@
* @addtogroup NativeWindow
* @{
*
- * @brief Provides the native window capability for connection to the EGL.
+ * @brief Provides the NativeWindow capability for connection to the EGL.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
* @since 8
@@ -30,8 +30,10 @@
/**
* @file external_window.h
*
- * @brief Defines the functions for obtaining and using a native window.
+ * @brief Defines the functions for obtaining and using NativeWindow.
*
+ * File to include:
+ * @library libnative_window.so
* @since 8
* @version 1.0
*/
@@ -43,29 +45,41 @@
extern "C" {
#endif
+/**
+ * @brief Provides access to OHIPCParcel, which is an IPC parcelable object.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OHIPCParcel OHIPCParcel;
/**
- * @brief Defines the NativeWindow structure.
+ * @brief Defines the NativeWindow struct.
+ * @since 8
*/
struct NativeWindow;
/**
- * @brief Defines the NativeWindowBuffer structure.
+ * @brief Defines the NativeWindowBuffer struct.
+ * @since 8
*/
struct NativeWindowBuffer;
/**
- * @brief Provides the function of accessing the NativeWindow.
+ * @brief Provides access to OHNativeWindow.
+ * @since 8
*/
typedef struct NativeWindow OHNativeWindow;
/**
- * @brief Provides the function of accessing the NativeWindowBuffer.
+ * @brief Provides access to OHNativeWindowBuffer.
+ * @since 8
*/
typedef struct NativeWindowBuffer OHNativeWindowBuffer;
/**
- * @brief Defines the rectangle (dirty region) where the content is to be updated in the local native window.
+ * @brief Defines the rectangle (dirty region) where the content is to be updated in the local OHNativeWindow.
+ * @since 8
*/
typedef struct Region {
/** If rects is a null pointer, the buffer size is the same as the size of the dirty region by default. */
@@ -79,15 +93,65 @@ typedef struct Region {
int32_t rectNumber;
}Region;
+/**
+ * @brief Enumerates the error codes.
+ * @since 12
+ */
+typedef enum OHNativeErrorCode {
+ /** The operation is successful. */
+ NATIVE_ERROR_OK = 0,
+ /**
+ * An error occurs during memory manipulation.
+ * @since 14
+ */
+ NATIVE_ERROR_MEM_OPERATION_ERROR = 30001000,
+ /** An input parameter is invalid. */
+ NATIVE_ERROR_INVALID_ARGUMENTS = 40001000,
+ /** You do not have the permission to perform the operation. */
+ NATIVE_ERROR_NO_PERMISSION = 40301000,
+ /** No buffer is available. */
+ NATIVE_ERROR_NO_BUFFER = 40601000,
+ /** The consumer does not exist. */
+ NATIVE_ERROR_NO_CONSUMER = 41202000,
+ /** Not initialized. */
+ NATIVE_ERROR_NOT_INIT = 41203000,
+ /** The consumer is connected. */
+ NATIVE_ERROR_CONSUMER_CONNECTED = 41206000,
+ /** The buffer status does not meet the expectation. */
+ NATIVE_ERROR_BUFFER_STATE_INVALID = 41207000,
+ /** The buffer is already in the buffer queue. */
+ NATIVE_ERROR_BUFFER_IN_CACHE = 41208000,
+ /** The queue is full. */
+ NATIVE_ERROR_BUFFER_QUEUE_FULL = 41209000,
+ /** The buffer is not in the buffer queue. */
+ NATIVE_ERROR_BUFFER_NOT_IN_CACHE = 41210000,
+ /** The consumer is disconnected. */
+ NATIVE_ERROR_CONSUMER_DISCONNECTED = 41211000,
+ /** No listener is registered on the consumer side. */
+ NATIVE_ERROR_CONSUMER_NO_LISTENER_REGISTERED = 41212000,
+ /** The device or platform does not support the operation. */
+ NATIVE_ERROR_UNSUPPORTED = 50102000,
+ /** Unknown error. Check the log. */
+ NATIVE_ERROR_UNKNOWN = 50002000,
+ /** Failed to call the HDI. */
+ NATIVE_ERROR_HDI_ERROR = 50007000,
+ /** Cross-process communication failed. */
+ NATIVE_ERROR_BINDER_ERROR = 50401000,
+ /** The EGL environment is abnormal. */
+ NATIVE_ERROR_EGL_STATE_UNKNOWN = 60001000,
+ /** Failed to call the EGL APIs. */
+ NATIVE_ERROR_EGL_API_FAILED = 60002000,
+} OHNativeErrorCode;
/**
* @brief Enumerates the operation codes in the OH_NativeWindow_NativeWindowHandleOpt function.
+ * @since 8
*/
-enum NativeWindowOperation {
+typedef enum NativeWindowOperation {
/**
* Setting the geometry for the local window buffer.
* Variable arguments in the function:
- * [Input] int32_t height and [Input] int32_t width.
+ * [Input] int32_t width and [Input] int32_t height.
*/
SET_BUFFER_GEOMETRY,
/**
@@ -99,97 +163,167 @@ enum NativeWindowOperation {
/**
* Obtaining the format of the local window buffer.
* Variable argument in the function:
- * [Output] int32_t *format.
+ * [Output] int32_t *format. For details about the available options, see {@link OH_NativeBuffer_Format}.
*/
GET_FORMAT,
- /**
+ /**
* Setting the format for the local window buffer.
* Variable argument in the function:
- * [Input] int32_t format.
+ * [Input] int32_t format. For details about the available options, see {@link OH_NativeBuffer_Format}.
*/
SET_FORMAT,
- /**
- * Obtaining the usage mode of the local window buffer.
+ /**
+ * Obtaining the read/write mode of the local window buffer.
* Variable argument in the function:
- * [Output] int32_t *usage.
+ * [Output] uint64_t *usage. For details about the available options, see {@link OH_NativeBuffer_Usage}.
*/
GET_USAGE,
- /**
- * Setting the usage mode for the local window buffer.
+ /**
+ * Setting the read/write mode for the local window buffer.
* Variable argument in the function:
- * [Input] int32_t usage.
+ * [Input] uint64_t usage. For details about the available options, see {@link OH_NativeBuffer_Usage}.
*/
SET_USAGE,
- /**
+ /**
* Setting the stride for the local window buffer.
* Variable argument in the function:
* [Input] int32_t stride.
*/
SET_STRIDE,
- /**
+ /**
* Obtaining the stride of the local window buffer.
* Variable argument in the function:
* [Output] int32_t *stride.
*/
GET_STRIDE,
- /**
+ /**
* Setting the swap interval for the local window buffer.
* Variable argument in the function:
* [Input] int32_t interval.
*/
SET_SWAP_INTERVAL,
- /**
+ /**
* Obtaining the swap interval of the local window buffer.
* Variable argument in the function:
* [Output] int32_t *interval.
*/
GET_SWAP_INTERVAL,
- /**
- * Setting the timeout duration for requesting the local window buffer.
- * Variable argument in the function:
- * [Input] int32_t timeout.
+ /**
+ * Setting the timeout duration for requesting a buffer from the local window.
+ * The default value is 3000 ms.
+ * Variable arguments in the function:
+ * [Input] int32_t timeout (unit: ms).
*/
SET_TIMEOUT,
- /**
- * Obtaining the timeout duration for requesting the local window buffer.
- * Variable argument in the function:
- * [Output] int32_t *timeout.
+ /**
+ * Obtaining the timeout duration for requesting a buffer from the local window.
+ * The default value is 3000 ms.
+ * Variable arguments in the function:
+ * [Output] int32_t *timeout (unit: ms).
*/
GET_TIMEOUT,
- /**
+ /**
* Setting the color gamut for the local window buffer.
* Variable argument in the function:
- * [Input] int32_t colorGamut.
+ * [Input] int32_t colorGamut. For details about the available options, see {@link OH_NativeBuffer_ColorGamut}.
*/
SET_COLOR_GAMUT,
- /**
+ /**
* Obtaining the color gamut of the local window buffer.
* Variable argument in the function:
- * [out int32_t *colorGamut].
+ * [Output] int32_t *colorGamut. For details about the available options, see {@link OH_NativeBuffer_ColorGamut}.
*/
GET_COLOR_GAMUT,
- /**
+ /**
* Setting the transform for the local window buffer.
* Variable argument in the function:
- * [Input] int32_t transform.
+ * [Input] int32_t transform. For details about the available options, see {@link OH_NativeBuffer_TransformType}.
*/
SET_TRANSFORM,
- /**
+ /**
* Obtaining the transform of the local window buffer.
* Variable argument in the function:
- * [Output] int32_t *transform.
+ * [Output] int32_t *transform. For details about the available options, see {@link OH_NativeBuffer_TransformType}.
*/
GET_TRANSFORM,
- /**
+ /**
* Setting the UI timestamp for the local window buffer.
* Variable argument in the function:
* [Input] uint64_t uiTimestamp.
*/
SET_UI_TIMESTAMP,
-};
+ /**
+ * Obtaining the memory queue size.
+ * Variable arguments in the function:
+ * [Output] int32_t *size.
+ * @since 12
+ */
+ GET_BUFFERQUEUE_SIZE,
+ /**
+ * Setting the source of content displayed in the local window.
+ * Variable arguments in the function:
+ * [Input] int32_t sourceType. For details about the available options, see {@link OHSurfaceSource}.
+ * @since 12
+ */
+ SET_SOURCE_TYPE,
+ /**
+ * Obtaining the source of content displayed in the local window.
+ * Variable arguments in the function:
+ * [Output] int32_t *sourceType. For details about the available options, see {@link OHSurfaceSource}.
+ * @since 12
+ */
+ GET_SOURCE_TYPE,
+ /**
+ * Setting the application framework name of the local window.
+ * Variable arguments in the function:
+ * [Input] char* frameworkType. A maximum of 64 bytes are supported.
+ * @since 12
+ */
+ SET_APP_FRAMEWORK_TYPE,
+ /**
+ * Obtaining the application framework name of the local window.
+ * Variable arguments in the function:
+ * [Output] char* frameworkType.
+ * @since 12
+ */
+ GET_APP_FRAMEWORK_TYPE,
+ /**
+ * Setting the brightness of HDR white points.
+ * Variable arguments in the function:
+ * [Input] float brightness. The value range is [0.0f, 1.0f].
+ * @since 12
+ */
+ SET_HDR_WHITE_POINT_BRIGHTNESS,
+ /**
+ * Setting the brightness of SDR white points.
+ * Variable arguments in the function:
+ * [Input] float brightness. The value range is [0.0f, 1.0f].
+ * @since 12
+ */
+ SET_SDR_WHITE_POINT_BRIGHTNESS,
+ /**
+ * Setting a timestamp indicating when the local window buffer is expected to show on the screen.
+ * The timestamp takes effect only when RenderService is the consumer of the local window
+ * and after {@link OH_NativeWindow_NativeWindowFlushBuffer} is called.
+ * The next buffer added to the queue by the producer is consumed by RenderService
+ * and displayed on the screen only after the expected on-screen time arrives.
+ * If there are multiple buffers in the queue from various producers,
+ * all of them have set desiredPresentTimestamp, and the desired time arrives,
+ * the buffer that was enqueued earliest will be pushed back into the queue by the consumer.
+ * If the expected on-screen time exceeds the time provided by the consumer by over 1 second,
+ * the expected timestamp is ignored.
+ * Variable argument in the function:
+ * [Input] int64_t desiredPresentTimestamp. The value must be greater than 0 and should be generated by
+ * the standard library std::chrono::steady_clock, in nanoseconds.
+ * @since 13
+ */
+ SET_DESIRED_PRESENT_TIMESTAMP = 24,
+} NativeWindowOperation;
/**
* @brief Enumerates the scaling modes.
+ * @since 9
+ * @deprecated This enum is deprecated since API version 10. No substitute enum is provided.
*/
typedef enum {
/**
@@ -205,13 +339,47 @@ typedef enum {
*/
OH_SCALING_MODE_SCALE_CROP,
/**
- * The window is cropped to the size of the buffer's cropping rectangle. Pixels outside the cropping rectangle are considered completely transparent.
+ * The window is cropped to the size of the buffer's cropping rectangle.
+ * Pixels outside the cropping rectangle are considered completely transparent.
*/
OH_SCALING_MODE_NO_SCALE_CROP,
} OHScalingMode;
+/**
+ * @brief Enumerates the rendering scaling modes.
+ * @since 12
+ */
+typedef enum OHScalingModeV2 {
+ /**
+ * Freezes the window. The window content is not updated until a buffer with the same size as the window
+ * is received.
+ */
+ OH_SCALING_MODE_FREEZE_V2 = 0,
+ /**
+ * Scales the buffer to match the window size.
+ */
+ OH_SCALING_MODE_SCALE_TO_WINDOW_V2,
+ /**
+ * Scales the buffer at the original aspect ratio to enable the smaller side of the buffer to match the window,
+ * while making the excess part transparent.
+ */
+ OH_SCALING_MODE_SCALE_CROP_V2,
+ /**
+ * Crops the buffer by window size. Pixels outside the cropping rectangle are considered completely transparent.
+ */
+ OH_SCALING_MODE_NO_SCALE_CROP_V2,
+ /**
+ * Scales the buffer at the original aspect ratio to fully display the buffer content,
+ * while filling the unfilled area of the window with the background color.
+ * This mode is not available for the development board and emulator.
+ */
+ OH_SCALING_MODE_SCALE_FIT_V2,
+} OHScalingModeV2;
+
/**
* @brief Enumerates the HDR metadata keys.
+ * @since 9
+ * @deprecated This enum is deprecated since API version 10. No substitute enum is provided.
*/
typedef enum {
OH_METAKEY_RED_PRIMARY_X = 0, /**< X coordinate of the red primary color. */
@@ -225,13 +393,15 @@ typedef enum {
OH_METAKEY_MAX_LUMINANCE = 8, /**< Maximum luminance. */
OH_METAKEY_MIN_LUMINANCE = 9, /**< Minimum luminance. */
OH_METAKEY_MAX_CONTENT_LIGHT_LEVEL = 10, /**< Maximum content light level (MaxCLL). */
- OH_METAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL = 11, /**< Maximum frame average light level (MaxFALLL). */
+ OH_METAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL = 11, /**< Maximum frame average light level (MaxFALL). */
OH_METAKEY_HDR10_PLUS = 12, /**< HDR10+. */
OH_METAKEY_HDR_VIVID = 13, /**< Vivid. */
} OHHDRMetadataKey;
/**
* @brief Defines the HDR metadata.
+ * @since 9
+ * @deprecated This struct is deprecated since API version 10. No substitute struct is provided.
*/
typedef struct {
OHHDRMetadataKey key; /**< Key of the HDR metadata. */
@@ -240,64 +410,127 @@ typedef struct {
/**
* @brief Defines the extended data handle.
+ * @since 9
+ * @deprecated This struct is deprecated since API version 10. No substitute struct is provided.
*/
typedef struct {
- int32_t fd; /**< File descriptor handle. The value -1 indicates that the handle is not supported. */
+ int32_t fd; /**< File descriptor handle. The value -1 means that the handle is not supported. */
uint32_t reserveInts; /**< Number of reserved arrays. */
- int32_t reserve[0]; /**< Reserve array. */
+ int32_t reserve[0]; /**< Reserved array. */
} OHExtDataHandle;
+/**
+ * @brief Enumerates the sources of content displayed in the local window.
+ * @since 12
+ */
+typedef enum OHSurfaceSource {
+ /*
+ * Default source.
+ */
+ OH_SURFACE_SOURCE_DEFAULT = 0,
+ /*
+ * The window content comes from UIs.
+ */
+ OH_SURFACE_SOURCE_UI,
+ /*
+ * The window content comes from games.
+ */
+ OH_SURFACE_SOURCE_GAME,
+ /*
+ * The window content comes from cameras.
+ */
+ OH_SURFACE_SOURCE_CAMERA,
+ /*
+ * The window content comes from videos.
+ */
+ OH_SURFACE_SOURCE_VIDEO,
+} OHSurfaceSource;
/**
- * @brief Creates a NativeWindow instance. A new NativeWindow instance is created each time this function is called.
+ * @brief Creates an OHNativeWindow instance.
+ * A new OHNativeWindow instance is created each time this function is called.
+ * If this API is unavailable, you can create an OHNativeWindow instance by calling
+ * OH_NativeImage_AcquireNativeWindow or through the .
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
- * @param pSurface Indicates the pointer to a ProduceSurface. The type is sptr.
- * @return Returns the pointer to the NativeWindow instance created.
+ * @param pSurface Pointer to a ProduceSurface. The type is sptr.
+ * @return Returns the pointer to the OHNativeWindow instance created.
* @since 8
* @version 1.0
+ * @deprecated This API is deprecated since API version 12. No substitute API is provided.
*/
OHNativeWindow* OH_NativeWindow_CreateNativeWindow(void* pSurface);
/**
- * @brief Decreases the reference count of a NativeWindow instance by 1 and when the reference count reaches 0, destroys the instance.
+ * @brief Decreases the reference count of an OHNativeWindow instance by 1 and
+ * when the reference count reaches 0, destroys the instance.
+ * This function is not thread-safe. \n
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
- * @param window Indicates the pointer to a NativeWindow instance.
+ * @param window Pointer to an OHNativeWindow instance.
* @since 8
* @version 1.0
*/
void OH_NativeWindow_DestroyNativeWindow(OHNativeWindow* window);
/**
- * @brief Creates a NativeWindowBuffer instance. A new NativeWindowBuffer instance is created each time this function is called.
+ * @brief Creates an OHNativeWindowBuffer instance.
+ * A new OHNativeWindowBuffer instance is created each time this function is called.
+ * If this API is unavailable, you can create an OHNativeWindowBuffer instance
+ * by calling OH_NativeWindow_CreateNativeWindowBufferFromNativeBuffer.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
- * @param pSurfaceBuffer Indicates the pointer to a produce buffer. The type is sptr.
- * @return Returns the pointer to the NativeWindowBuffer instance created.
+ * @param pSurfaceBuffer Pointer to a produce buffer. The type is sptr.
+ * @return Returns the pointer to the OHNativeWindowBuffer instance created.
* @since 8
* @version 1.0
+ * @deprecated This API is deprecated from API version 12.
+ * Use OH_NativeWindow_CreateNativeWindowBufferFromNativeBuffer instead.
*/
OHNativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer(void* pSurfaceBuffer);
/**
- * @brief Decreases the reference count of a NativeWindowBuffer instance by 1 and when the reference count reaches 0, destroys the instance.
+ * @brief Creates an OHNativeWindowBuffer instance.
+ * A new OHNativeWindowBuffer instance is created each time this function is called. \n
+ * This function must be used in pair with {@link OH_NativeWindow_DestroyNativeWindowBuffer}.
+ * Otherwise, memory leak occurs. \n
+ * This function is not thread-safe. \n
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
- * @param buffer Indicates the pointer to a NativeWindowBuffer instance.
+ * @param nativeBuffer Pointer to an OH_NativeBuffer instance.
+ * @return Returns the pointer to the OHNativeWindowBuffer instance created.
+ * @since 11
+ * @version 1.0
+ */
+OHNativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromNativeBuffer(OH_NativeBuffer* nativeBuffer);
+
+/**
+ * @brief Decreases the reference count of an OHNativeWindowBuffer instance by 1
+ * and when the reference count reaches 0, destroys the instance.
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
+ * @param buffer Pointer to an OHNativeWindowBuffer instance.
* @since 8
* @version 1.0
*/
void OH_NativeWindow_DestroyNativeWindowBuffer(OHNativeWindowBuffer* buffer);
/**
- * @brief Requests a NativeWindowBuffer through a NativeWindow instance for content production.
+ * @brief Requests an OHNativeWindowBuffer through an OHNativeWindow instance for content production. \n
+ * Before calling this function, you must call {@link SET_BUFFER_GEOMETRY} to set the width and height
+ * of OHNativeWindow. \n
+ * This function must be used in pair with {@link OH_NativeWindow_NativeWindowFlushBuffer}.
+ * Otherwise, memory leak occurs. \n
+ * When fenceFd is no longer required, you must close it. \n
+ * This function is not thread-safe. \n
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
- * @param window Indicates the pointer to a NativeWindow instance.
- * @param buffer Indicates the double pointer to a NativeWindowBuffer instance.
- * @param fenceFd Indicates the pointer to a file descriptor handle.
- * @return Returns an error code defined in GSError.
+ * @param window Pointer to an OHNativeWindow instance.
+ * @param buffer Double pointer to an OHNativeWindowBuffer instance.
+ * @param fenceFd Pointer to a file descriptor handle.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
* @since 8
* @version 1.0
*/
@@ -305,14 +538,18 @@ int32_t OH_NativeWindow_NativeWindowRequestBuffer(OHNativeWindow *window,
OHNativeWindowBuffer **buffer, int *fenceFd);
/**
- * @brief Flushes the NativeWindowBuffer filled with the content to the buffer queue through a NativeWindow instance for content consumption.
+ * @brief Flushes the OHNativeWindowBuffer filled with the content to the buffer queue
+ * through an OHNativeWindow instance for content consumption.
+ * The system will close fenFd. You do not need to close it. \n
+ * This function is not thread-safe. \n
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
- * @param window Indicates the pointer to a NativeWindow instance.
- * @param buffer Indicates the pointer to a NativeWindowBuffer instance.
- * @param fenceFd Indicates a file descriptor handle, which is used for timing synchronization.
- * @param region Indicates a dirty region where content is updated.
- * @return Returns an error code defined in GSError.
+ * @param window Pointer to an OHNativeWindow instance.
+ * @param buffer Pointer to an OHNativeWindowBuffer instance.
+ * @param fenceFd File descriptor handle, which is used for timing synchronization.
+ * @param region Dirty region where content is updated.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
* @since 8
* @version 1.0
*/
@@ -320,35 +557,62 @@ int32_t OH_NativeWindow_NativeWindowFlushBuffer(OHNativeWindow *window, OHNative
int fenceFd, Region region);
/**
- * @brief Returns the NativeWindowBuffer to the buffer queue through a NativeWindow instance, without filling in any content. The NativeWindowBuffer can be used for another request.
+ * @brief Obtains the OHNativeWindowBuffer that was flushed to the buffer queue last time
+ * through an OHNativeWindow instance.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
- * @param window Indicates the pointer to a NativeWindow instance.
- * @param buffer Indicates the pointer to a NativeWindowBuffer instance.
- * @return Returns an error code defined in GSError.
+ * @param window Pointer to an OHNativeWindow instance.
+ * @param buffer Double pointer to an OHNativeWindowBuffer instance.
+ * @param fenceFd Pointer to a file descriptor handle.
+ * @param matrix Retrieved 4*4 transformation matrix.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 11
+ * @version 1.0
+ * @deprecated This API is deprecated from API version 12. Use OH_NativeWindow_GetLastFlushedBufferV2 instead.
+ */
+int32_t OH_NativeWindow_GetLastFlushedBuffer(OHNativeWindow *window, OHNativeWindowBuffer **buffer,
+ int *fenceFd, float matrix[16]);
+
+/**
+ * @brief Returns the OHNativeWindowBuffer to the buffer queue through an OHNativeWindow instance,
+ * without filling in any content. The OHNativeWindowBuffer can be used for a new request. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
+ * @param window Pointer to an OHNativeWindow instance.
+ * @param buffer Pointer to an OHNativeWindowBuffer instance.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
* @since 8
* @version 1.0
*/
int32_t OH_NativeWindow_NativeWindowAbortBuffer(OHNativeWindow *window, OHNativeWindowBuffer *buffer);
/**
- * @brief Sets or obtains the attributes of a native window, including the width, height, and content format.
+ * @brief Sets or obtains the attributes of an OHNativeWindow instance,
+ * including the width, height, and content format. \n
+ * This function is not thread-safe. \n
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
- * @param window Indicates the pointer to a NativeWindow instance.
- * @param code Indicates the operation code. For details, see {@link NativeWindowOperation}.
- * @param ... Indicates the variable argument, which must correspond to the operation code.
- * @return Returns an error code defined in GSError.
+ * @param window Pointer to an OHNativeWindow instance.
+ * @param code Operation code. For details, see {@link NativeWindowOperation}.
+ * @param ... Variable argument, which must be the same as the data type corresponding to the operation code.
+ * The number of input parameters must be the same as that of the operation code.
+ * Otherwise, undefined behavior may occur.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
* @since 8
* @version 1.0
*/
int32_t OH_NativeWindow_NativeWindowHandleOpt(OHNativeWindow *window, int code, ...);
/**
- * @brief Obtains the pointer to a BufferHandle of a NativeWindowBuffer instance.
+ * @brief Obtains the pointer to a BufferHandle of an OHNativeWindowBuffer instance. \n
+ * This function is not thread-safe. \n
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
- * @param buffer Indicates the pointer to a NativeWindowBuffer instance.
+ * @param buffer Pointer to an OHNativeWindowBuffer instance.
* @return Returns the pointer to the BufferHandle instance obtained.
* @since 8
* @version 1.0
@@ -356,11 +620,15 @@ int32_t OH_NativeWindow_NativeWindowHandleOpt(OHNativeWindow *window, int code,
BufferHandle *OH_NativeWindow_GetBufferHandleFromNative(OHNativeWindowBuffer *buffer);
/**
- * @brief Adds the reference count of a native object.
+ * @brief Adds the reference count of a native object. \n
+ * This function must be used in pair with {@link OH_NativeWindow_NativeObjectUnreference}.
+ * Otherwise, memory leak occurs. \n
+ * This function is not thread-safe. \n
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
- * @param obj Indicates the pointer to a NativeWindow or NativeWindowBuffer instance.
- * @return Returns an error code defined in GSError.
+ * @param obj Pointer to an OHNativeWindow or OHNativeWindowBuffer instance.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
* @since 8
* @version 1.0
*/
@@ -368,20 +636,23 @@ int32_t OH_NativeWindow_NativeObjectReference(void *obj);
/**
* @brief Decreases the reference count of a native object and when the reference count reaches 0, destroys this object.
+ * This function is not thread-safe. \n
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
- * @param obj Indicates the pointer to a NativeWindow or NativeWindowBuffer instance.
- * @return Returns an error code defined in GSError.
+ * @param obj Pointer to an OHNativeWindow or OHNativeWindowBuffer instance.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
* @since 8
* @version 1.0
*/
int32_t OH_NativeWindow_NativeObjectUnreference(void *obj);
/**
- * @brief Obtains the magic ID of a native object.
+ * @brief Obtains the magic ID of a native object. \n
+ * This function is not thread-safe. \n
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
- * @param obj Indicates the pointer to a NativeWindow or NativeWindowBuffer instance.
+ * @param obj Pointer to an OHNativeWindow or OHNativeWindowBuffer instance.
* @return Returns the magic ID, which is unique for each native object.
* @since 8
* @version 1.0
@@ -389,62 +660,272 @@ int32_t OH_NativeWindow_NativeObjectUnreference(void *obj);
int32_t OH_NativeWindow_GetNativeObjectMagic(void *obj);
/**
- * @brief Sets the scaling mode for a native window.
+ * @brief Sets the scaling mode for an OHNativeWindow instance.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
- * @param window Indicates the pointer to a NativeWindow instance.
- * @param sequence Indicates the sequence of the producer buffer.
- * @param scalingMode Indicates the scaling mode to set. For details, see OHScalingMode.
- * @return Returns an error code defined in GSError.
+ * @param window Pointer to an OHNativeWindow instance.
+ * @param sequence Sequence of the producer buffer.
+ * @param scalingMode Scaling mode to set. For details, see OHScalingMode.
+ * @return Returns 0 if the operation is successful.
* @since 9
* @version 1.0
+ * @deprecated This API is deprecated since API version 10. No substitute API is provided.
*/
int32_t OH_NativeWindow_NativeWindowSetScalingMode(OHNativeWindow *window, uint32_t sequence,
OHScalingMode scalingMode);
/**
- * @brief Sets the metadata for a native window.
+ * @brief Sets the metadata for an OHNativeWindow instance.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
- * @param window Indicates the pointer to a NativeWindow instance.
- * @param sequence Indicates the sequence of the producer buffer.
- * @param size Indicates the size of the OHHDRMetaData array.
- * @param metaData Indicates the pointer to the OHHDRMetaData array.
- * @return Returns an error code defined in GSError.
+ * @param window Pointer to an OHNativeWindow instance.
+ * @param sequence Sequence of the producer buffer.
+ * @param size Size of the OHHDRMetaData array.
+ * @param metaData Pointer to the OHHDRMetaData array.
+ * @return Returns 0 if the operation is successful.
* @since 9
* @version 1.0
+ * @deprecated This API is deprecated since API version 10. No substitute API is provided.
*/
int32_t OH_NativeWindow_NativeWindowSetMetaData(OHNativeWindow *window, uint32_t sequence, int32_t size,
const OHHDRMetaData *metaData);
/**
- * @brief Sets the metadata set for a native window.
+ * @brief Sets the metadata set for an OHNativeWindow instance.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
- * @param window Indicates the pointer to a NativeWindow instance.
- * @param sequence Indicates the sequence of the producer buffer.
- * @param key Indicates a metadata key. For details, see OHHDRMetadataKey.
- * @param size Indicates the size of the uint8_t vector.
- * @param metaData Indicates the pointer to the uint8_t vector.
- * @return Returns an error code defined in GSError.
+ * @param window Pointer to an OHNativeWindow instance.
+ * @param sequence Sequence of the producer buffer.
+ * @param key Metadata key. For details, see OHHDRMetadataKey.
+ * @param size Size of the uint8_t vector.
+ * @param metaData Pointer to the uint8_t vector.
+ * @return Returns 0 if the operation is successful.
* @since 9
* @version 1.0
+ * @deprecated This API is deprecated since API version 10. No substitute API is provided.
*/
int32_t OH_NativeWindow_NativeWindowSetMetaDataSet(OHNativeWindow *window, uint32_t sequence, OHHDRMetadataKey key,
int32_t size, const uint8_t *metaData);
/**
- * @brief Sets a tunnel handle for a native window.
+ * @brief Sets a tunnel handle for an OHNativeWindow instance.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
- * @param window Indicates the pointer to a NativeWindow instance.
- * @param handle Indicates the pointer to an OHExtDataHandle.
- * @return Returns an error code defined in GSError.
+ * @param window Pointer to an OHNativeWindow instance.
+ * @param handle Pointer to an OHExtDataHandle.
+ * @return Returns 0 if the operation is successful.
* @since 9
* @version 1.0
+ * @deprecated This API is deprecated since API version 10. No substitute API is provided.
*/
int32_t OH_NativeWindow_NativeWindowSetTunnelHandle(OHNativeWindow *window, const OHExtDataHandle *handle);
+/**
+ * @brief Attaches an OHNativeWindowBuffer to an OHNativeWindow instance. \n
+ * This function must be used in pair with {@link OH_NativeWindow_NativeWindowDetachBuffer}.
+ * Otherwise, memory management disorder may occur. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
+ * @param window Pointer to an OHNativeWindow instance.
+ * @param buffer Pointer to an OHNativeWindowBuffer instance.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_NativeWindow_NativeWindowAttachBuffer(OHNativeWindow *window, OHNativeWindowBuffer *buffer);
+
+/**
+ * @brief Detaches an OHNativeWindowBuffer from an OHNativeWindow instance. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
+ * @param window Pointer to an OHNativeWindow instance.
+ * @param buffer Pointer to an OHNativeWindowBuffer instance.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_NativeWindow_NativeWindowDetachBuffer(OHNativeWindow *window, OHNativeWindowBuffer *buffer);
+
+/**
+ * @brief Obtains a surface ID through an OHNativeWindow. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
+ * @param window Pointer to an OHNativeWindow instance.
+ * @param surfaceId Pointer to the surface ID.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_NativeWindow_GetSurfaceId(OHNativeWindow *window, uint64_t *surfaceId);
+
+/**
+ * @brief Creates an OHNativeWindow instance based on a surface ID. \n
+ * This function must be used in pair with {@link OH_NativeWindow_DestroyNativeWindow}.
+ * Otherwise, memory leak occurs. \n
+ * If OHNativeWindow<\b> needs to be released concurrently, call {@link OH_NativeWindow_NativeObjectReference} and
+ * {@link OH_NativeWindow_NativeObjectUnreference} to increase or decrease the reference count by 1
+ * for OHNativeWindow<\b>. \n
+ * The surface obtained by using the surface ID must be created in the current process, but not in a different process.
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
+ * @param surfaceId Pointer to the surface ID.
+ * @param window Double pointer to an OHNativeWindow instance.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_NativeWindow_CreateNativeWindowFromSurfaceId(uint64_t surfaceId, OHNativeWindow **window);
+
+/**
+ * @brief Sets a rendering scaling mode for an OHNativeWindow instance. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
+ * @param window Pointer to an OHNativeWindow instance.
+ * @param scalingMode Scaling mode. For details about the available options, see OHScalingModeV2.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_NativeWindow_NativeWindowSetScalingModeV2(OHNativeWindow* window, OHScalingModeV2 scalingMode);
+
+/**
+ * @brief Obtains the OHNativeWindowBuffer that was flushed to the buffer queue last time through
+ * an OHNativeWindow instance.
+ * The difference between this function and OH_NativeWindow_GetLastFlushedBuffer lies in the matrix. \n
+ * This function must be used in pair with {@link OH_NativeWindow_NativeObjectUnreference}.
+ * Otherwise, memory leak occurs. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
+ * @param window Pointer to an OHNativeWindow instance.
+ * @param buffer Double pointer to an OHNativeWindowBuffer instance.
+ * @param fenceFd Pointer to a file descriptor handle.
+ * @param matrix Retrieved 4*4 transformation matrix.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_NativeWindow_GetLastFlushedBufferV2(OHNativeWindow *window, OHNativeWindowBuffer **buffer,
+ int *fenceFd, float matrix[16]);
+
+/**
+ * @brief Buffers a frame in advance and holds it for the interval of a frame to offset the possible loss of
+ * subsequent oversized frames.
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
+ * @param window Pointer to an {@link OHNativeWindow} instance.
+ * @since 12
+ * @version 1.0
+ */
+void OH_NativeWindow_SetBufferHold(OHNativeWindow *window);
+
+/**
+ * @brief Writes an OHNativeWindow instance to an OHIPCParcel instance. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
+ * @param window Pointer to an {@link OHNativeWindow} instance.
+ * @param parcel Pointer to an {@link OHIPCParcel} instance.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_NativeWindow_WriteToParcel(OHNativeWindow *window, OHIPCParcel *parcel);
+
+/**
+ * @brief Reads an OHNativeWindow instance from an OHIPCParcel instance. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
+ * @param parcel Pointer to an {@link OHIPCParcel} instance.
+ * @param window Double pointer to an {@link OHNativeWindow} instance.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_NativeWindow_ReadFromParcel(OHIPCParcel *parcel, OHNativeWindow **window);
+
+/**
+ * @brief Sets the color space for an OHNativeWindow instance. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
+ * @param window Pointer to an {@link OHNativeWindow} instance.
+ * @param colorSpace Color space to set.
+ * For details about the available options, see {@link OH_NativeBuffer_ColorSpace}.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_NativeWindow_SetColorSpace(OHNativeWindow *window, OH_NativeBuffer_ColorSpace colorSpace);
+
+/**
+ * @brief Obtains the color space of an OHNativeWindow instance. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
+ * @param window Pointer to an {@link OHNativeWindow} instance.
+ * @param colorSpace Pointer to the color space.
+ * For details about the available options, see {@link OH_NativeBuffer_ColorSpace}.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_NativeWindow_GetColorSpace(OHNativeWindow *window, OH_NativeBuffer_ColorSpace *colorSpace);
+
+/**
+ * @brief Sets a metadata value for an OHNativeWindow instance. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
+ * @param window Pointer to an {@link OHNativeWindow} instance.
+ * @param metadataKey Key of the metadata.
+ * For details about the available options, see {@link OH_NativeBuffer_MetadataKey}.
+ * @param size Size of the uint8_t vector.
+ * For details about the available options, see {@link OH_NativeBuffer_MetadataKey}.
+ * @param metaData Pointer to the uint8_t vector.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_NativeWindow_SetMetadataValue(OHNativeWindow *window, OH_NativeBuffer_MetadataKey metadataKey,
+ int32_t size, uint8_t *metaData);
+
+/**
+ * @brief Obtains the metadata value of an OHNativeWindow instance. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow
+ * @param window Pointer to an {@link OHNativeWindow} instance.
+ * @param metadataKey Key of the metadata.
+ * For details about the available options, see {@link OH_NativeBuffer_MetadataKey}.
+ * @param size Pointer to the size of the uint8_t vector.
+ * For details about the available options, see {@link OH_NativeBuffer_MetadataKey}.
+ * @param metaData Double pointer to the uint8_t vector.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_NativeWindow_GetMetadataValue(OHNativeWindow *window, OH_NativeBuffer_MetadataKey metadataKey,
+ int32_t *size, uint8_t **metaData);
#ifdef __cplusplus
}
#endif
diff --git a/en/native_sdk/graphic/native_buffer.h b/en/native_sdk/graphic/native_buffer.h
index a4325f05c5b891989b01c1e1d7d36512b5b7064e..1f25a6ed2c49f9f852e4ca42a6edd3f079fcf992 100644
--- a/en/native_sdk/graphic/native_buffer.h
+++ b/en/native_sdk/graphic/native_buffer.h
@@ -20,9 +20,10 @@
* @addtogroup OH_NativeBuffer
* @{
*
- * @brief 提供NativeBuffer功能
+ * @brief Provides the capabilities of NativeBuffer. Using the functions provided by this module,
+ * you can apply for, use, and release the shared memory, and query its attributes.
*
- * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
* @since 9
* @version 1.0
*/
@@ -30,8 +31,11 @@
/**
* @file native_buffer.h
*
- * @brief 定义获取和使用NativeBuffer的相关函数
+ * @brief Declares the functions for obtaining and using NativeBuffer.
*
+ * File to include:
+ * @library libnative_buffer.so
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
* @since 9
* @version 1.0
*/
@@ -42,74 +46,781 @@
extern "C" {
#endif
+/**
+ * @brief Provides the declaration of an OH_NativeBuffer struct.
+ * @since 9
+ */
struct OH_NativeBuffer;
+
+/**
+ * @brief Provides the declaration of an OH_NativeBuffer struct.
+ * @since 9
+ */
typedef struct OH_NativeBuffer OH_NativeBuffer;
/**
- * @brief OH_NativeBuffer的属性配置,用于申请新的OH_NativeBuffer实例或查询现有实例的相关属性
+ * @brief Enumerates the OH_NativeBuffer usages.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @since 10
+ * @version 1.0
+ */
+typedef enum OH_NativeBuffer_Usage {
+ /**
+ * Read by the CPU.
+ */
+ NATIVEBUFFER_USAGE_CPU_READ = (1ULL << 0),
+ /**
+ * Write by the CPU.
+ */
+ NATIVEBUFFER_USAGE_CPU_WRITE = (1ULL << 1),
+ /**
+ * Direct memory access to the buffer.
+ */
+ NATIVEBUFFER_USAGE_MEM_DMA = (1ULL << 3),
+ /**
+ * GPU writable.
+ * @since 12
+ */
+ NATIVEBUFFER_USAGE_HW_RENDER = (1ULL << 8),
+ /**
+ * GPU readable.
+ * @since 12
+ */
+ NATIVEBUFFER_USAGE_HW_TEXTURE = (1ULL << 9),
+ /**
+ * Direct mapping of CPU.
+ * @since 12
+ */
+ NATIVEBUFFER_USAGE_CPU_READ_OFTEN = (1ULL << 16),
+ /**
+ * 512-byte alignment.
+ * @since 12
+ */
+ NATIVEBUFFER_USAGE_ALIGNMENT_512 = (1ULL << 18),
+} OH_NativeBuffer_Usage;
+
+/**
+ * @brief Enumerates the OH_NativeBuffer formats.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @since 10
+ * @version 1.0
+ */
+typedef enum OH_NativeBuffer_Format {
+ /**
+ * CLUT8.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_CLUT8 = 0,
+ /**
+ * CLUT1.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_CLUT1,
+ /**
+ * CLUT4.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_CLUT4,
+ /**
+ * RGB565.
+ */
+ NATIVEBUFFER_PIXEL_FMT_RGB_565 = 3,
+ /**
+ * RGBA5658.
+ */
+ NATIVEBUFFER_PIXEL_FMT_RGBA_5658,
+ /**
+ * RGBX4444.
+ */
+ NATIVEBUFFER_PIXEL_FMT_RGBX_4444,
+ /**
+ * RGBA4444.
+ */
+ NATIVEBUFFER_PIXEL_FMT_RGBA_4444,
+ /**
+ * RGB444.
+ */
+ NATIVEBUFFER_PIXEL_FMT_RGB_444,
+ /**
+ * RGBX5551.
+ */
+ NATIVEBUFFER_PIXEL_FMT_RGBX_5551,
+ /**
+ * RGBA5551.
+ */
+ NATIVEBUFFER_PIXEL_FMT_RGBA_5551,
+ /**
+ * RGB555.
+ */
+ NATIVEBUFFER_PIXEL_FMT_RGB_555,
+ /**
+ * RGBX8888.
+ */
+ NATIVEBUFFER_PIXEL_FMT_RGBX_8888,
+ /**
+ * RGBA8888.
+ */
+ NATIVEBUFFER_PIXEL_FMT_RGBA_8888,
+ /**
+ * RGB888.
+ */
+ NATIVEBUFFER_PIXEL_FMT_RGB_888,
+ /**
+ * BGR565.
+ */
+ NATIVEBUFFER_PIXEL_FMT_BGR_565,
+ /**
+ * BGRX4444.
+ */
+ NATIVEBUFFER_PIXEL_FMT_BGRX_4444,
+ /**
+ * BGRA4444.
+ */
+ NATIVEBUFFER_PIXEL_FMT_BGRA_4444,
+ /**
+ * BGRX5551.
+ */
+ NATIVEBUFFER_PIXEL_FMT_BGRX_5551,
+ /**
+ * BGRA5551.
+ */
+ NATIVEBUFFER_PIXEL_FMT_BGRA_5551,
+ /**
+ * BGRX8888.
+ */
+ NATIVEBUFFER_PIXEL_FMT_BGRX_8888,
+ /**
+ * BGRA8888.
+ */
+ NATIVEBUFFER_PIXEL_FMT_BGRA_8888,
+ /**
+ * YUV422 interleaved.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_YUV_422_I,
+ /**
+ * YCbCr422 semi-planar.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_YCBCR_422_SP,
+ /**
+ * YCrCb422 semi-planar.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_YCRCB_422_SP,
+ /**
+ * YCbCr420 semi-planar.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_YCBCR_420_SP,
+ /**
+ * YCrCb420 semi-planar.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_YCRCB_420_SP,
+ /**
+ * YCbCr422 planar.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_YCBCR_422_P,
+ /**
+ * YCrCb422 planar.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_YCRCB_422_P,
+ /**
+ * YCbCr420 planar.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_YCBCR_420_P,
+ /**
+ * YCrCb420 planar.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_YCRCB_420_P,
+ /**
+ * YUYV422 packed.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_YUYV_422_PKG,
+ /**
+ * UYVY422 packed.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_UYVY_422_PKG,
+ /**
+ * YVYU422 packed.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_YVYU_422_PKG,
+ /**
+ * VYUY422 packed.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_VYUY_422_PKG,
+ /**
+ * RGBA_1010102 packed.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_RGBA_1010102,
+ /**
+ * YCBCR420 semi-planar 10-bit packed.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_YCBCR_P010,
+ /**
+ * YCRCB420 semi-planar 10-bit packed.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_YCRCB_P010,
+ /**
+ * Raw 10-bit packed.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_RAW10,
+ /**
+ * Vender mask.
+ * @since 12
+ */
+ NATIVEBUFFER_PIXEL_FMT_VENDER_MASK = 0X7FFF0000,
+ /**
+ * Invalid format.
+ */
+ NATIVEBUFFER_PIXEL_FMT_BUTT = 0X7FFFFFFF
+} OH_NativeBuffer_Format;
+
+/**
+ * @brief Enumerates the color spaces of an OH_NativeBuffer instance.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @since 11
+ * @version 1.0
+ */
+typedef enum OH_NativeBuffer_ColorSpace {
+ /** No color space is available. */
+ OH_COLORSPACE_NONE,
+ /**
+ * The color gamut is BT601_P, the transfer function is BT709, the conversion matrix is BT601_P,
+ * and the data range is RANGE_FULL.
+ */
+ OH_COLORSPACE_BT601_EBU_FULL,
+ /**
+ * The color gamut is BT601_N, the transfer function is BT709, the conversion matrix is BT601_N,
+ * and the data range is RANGE_FULL.
+ */
+ OH_COLORSPACE_BT601_SMPTE_C_FULL,
+ /**
+ * The color gamut is BT709, the transfer function is BT709, the conversion matrix is BT709,
+ * and the data range is RANGE_FULL.
+ */
+ OH_COLORSPACE_BT709_FULL,
+ /**
+ * The color gamut is BT2020, the transfer function is HLG, the conversion matrix is BT2020,
+ * and the data range is RANGE_FULL.
+ */
+ OH_COLORSPACE_BT2020_HLG_FULL,
+ /**
+ * The color gamut is BT2020, the transfer function is PQ, the conversion matrix is BT2020,
+ * and the data range is RANGE_FULL.
+ */
+ OH_COLORSPACE_BT2020_PQ_FULL,
+ /**
+ * The color gamut is BT601_P, the transfer function is BT709, the conversion matrix is BT601_P,
+ * and the data range is RANGE_LIMITED.
+ */
+ OH_COLORSPACE_BT601_EBU_LIMIT,
+ /**
+ * The color gamut is BT601_N, the transfer function is BT709, the conversion matrix is BT601_N,
+ * and the data range is RANGE_LIMITED.
+ */
+ OH_COLORSPACE_BT601_SMPTE_C_LIMIT,
+ /**
+ * The color gamut is BT709, the transfer function is BT709, the conversion matrix is BT709,
+ * and the data range is RANGE_LIMITED.
+ */
+ OH_COLORSPACE_BT709_LIMIT,
+ /**
+ * The color gamut is BT2020, the transfer function is HLG, the conversion matrix is BT2020,
+ * and the data range is RANGE_LIMITED.
+ */
+ OH_COLORSPACE_BT2020_HLG_LIMIT,
+ /**
+ * The color gamut is BT2020, the transfer function is PQ, the conversion matrix is BT2020,
+ * and the data range is RANGE_LIMITED.
+ */
+ OH_COLORSPACE_BT2020_PQ_LIMIT,
+ /**
+ * The color gamut is SRGB, the transfer function is SRGB, the conversion matrix is BT601_N,
+ * and the data range is RANGE_FULL.
+ */
+ OH_COLORSPACE_SRGB_FULL,
+ /**
+ * The color gamut is P3_D65, the transfer function is SRGB, the conversion matrix is P3,
+ * and the data range is RANGE_FULL.
+ */
+ OH_COLORSPACE_P3_FULL,
+ /**
+ * The color gamut is P3_D65, the transfer function is HLG, the conversion matrix is P3,
+ * and the data range is RANGE_FULL.
+ */
+ OH_COLORSPACE_P3_HLG_FULL,
+ /**
+ * The color gamut is P3_D65, the transfer function is PQ, the conversion matrix is P3,
+ * and the data range is RANGE_FULL.
+ */
+ OH_COLORSPACE_P3_PQ_FULL,
+ /**
+ * The color gamut is ADOBERGB, the transfer function is ADOBERGB, the conversion matrix is ADOBERGB,
+ * and the data range is RANGE_FULL.
+ */
+ OH_COLORSPACE_ADOBERGB_FULL,
+ /**
+ * The color gamut is SRGB, the transfer function is SRGB, the conversion matrix is BT601_N,
+ * and the data range is RANGE_LIMITED.
+ */
+ OH_COLORSPACE_SRGB_LIMIT,
+ /**
+ * The color gamut is P3_D65, the transfer function is SRGB, the conversion matrix is P3,
+ * and the data range is RANGE_LIMITED.
+ */
+ OH_COLORSPACE_P3_LIMIT,
+ /**
+ * The color gamut is P3_D65, the transfer function is HLG, the conversion matrix is P3,
+ * and the data range is RANGE_LIMITED.
+ */
+ OH_COLORSPACE_P3_HLG_LIMIT,
+ /**
+ * The color gamut is P3_D65, the transfer function is PQ, the conversion matrix is P3,
+ * and the data range is RANGE_LIMITED.
+ */
+ OH_COLORSPACE_P3_PQ_LIMIT,
+ /**
+ * The color gamut is ADOBERGB, the transfer function is ADOBERGB, the conversion matrix is ADOBERGB,
+ * and the data range is RANGE_LIMITED.
+ */
+ OH_COLORSPACE_ADOBERGB_LIMIT,
+ /** The color gamut is SRGB, and the transfer function is LINEAR. */
+ OH_COLORSPACE_LINEAR_SRGB,
+ /** It is equivalent to OH_COLORSPACE_LINEAR_SRGB. */
+ OH_COLORSPACE_LINEAR_BT709,
+ /** The color gamut is P3_D65, and the transfer function is LINEAR. */
+ OH_COLORSPACE_LINEAR_P3,
+ /** The color gamut is BT2020, and the transfer function is LINEAR. */
+ OH_COLORSPACE_LINEAR_BT2020,
+ /** It is equivalent to OH_COLORSPACE_SRGB_FULL. */
+ OH_COLORSPACE_DISPLAY_SRGB,
+ /** It is equivalent to OH_COLORSPACE_P3_FULL. */
+ OH_COLORSPACE_DISPLAY_P3_SRGB,
+ /** It is equivalent to OH_COLORSPACE_P3_HLG_FULL.
+ OH_COLORSPACE_DISPLAY_P3_HLG,
+ /** It is equivalent to OH_COLORSPACE_P3_PQ_FULL. */
+ OH_COLORSPACE_DISPLAY_P3_PQ,
+ /**
+ * The color gamut is BT2020, the transfer function is SRGB, the conversion matrix is BT2020,
+ * and the data range is RANGE_FULL.
+ */
+ OH_COLORSPACE_DISPLAY_BT2020_SRGB,
+ /** It is equivalent to OH_COLORSPACE_BT2020_HLG_FULL. */
+ OH_COLORSPACE_DISPLAY_BT2020_HLG,
+ /** It is equivalent to OH_COLORSPACE_BT2020_PQ_FULL. */
+ OH_COLORSPACE_DISPLAY_BT2020_PQ,
+} OH_NativeBuffer_ColorSpace;
+
+/**
+ * @brief Enumerates the transform types of an OH_NativeBuffer instance.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_NativeBuffer_TransformType {
+ /** No rotation. */
+ NATIVEBUFFER_ROTATE_NONE = 0,
+ /** Rotates by 90 degrees. */
+ NATIVEBUFFER_ROTATE_90,
+ /** Rotates by 180 degrees. */
+ NATIVEBUFFER_ROTATE_180,
+ /** Rotates by 270 degrees. */
+ NATIVEBUFFER_ROTATE_270,
+ /** Flips horizontally. */
+ NATIVEBUFFER_FLIP_H,
+ /** Flips vertically. */
+ NATIVEBUFFER_FLIP_V,
+ /** Flips horizontally and rotates by 90 degrees. */
+ NATIVEBUFFER_FLIP_H_ROT90,
+ /** Flips vertically and rotates by 90 degrees. */
+ NATIVEBUFFER_FLIP_V_ROT90,
+ /** Flips horizontally and rotates by 180 degrees. */
+ NATIVEBUFFER_FLIP_H_ROT180,
+ /** Flips vertically and rotates by 180 degrees. */
+ NATIVEBUFFER_FLIP_V_ROT180,
+ /** Flips horizontally and rotates by 270 degrees. */
+ NATIVEBUFFER_FLIP_H_ROT270,
+ /** Flips vertically and rotates by 270 degrees. */
+ NATIVEBUFFER_FLIP_V_ROT270,
+} OH_NativeBuffer_TransformType;
+
+/**
+ * @brief Enumerates the color gamuts of an OH_NativeBuffer instance.
*
- * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_NativeBuffer_ColorGamut {
+ /** Default gamut. */
+ NATIVEBUFFER_COLOR_GAMUT_NATIVE = 0,
+ /** Standard BT.601 color gamut. */
+ NATIVEBUFFER_COLOR_GAMUT_STANDARD_BT601 = 1,
+ /** Standard BT.709 color gamut. */
+ NATIVEBUFFER_COLOR_GAMUT_STANDARD_BT709 = 2,
+ /** DCI P3 color gamut. */
+ NATIVEBUFFER_COLOR_GAMUT_DCI_P3 = 3,
+ /** SRGB color gamut. */
+ NATIVEBUFFER_COLOR_GAMUT_SRGB = 4,
+ /** Adobe RGB color gamut. */
+ NATIVEBUFFER_COLOR_GAMUT_ADOBE_RGB = 5,
+ /** Display P3 color gamut. */
+ NATIVEBUFFER_COLOR_GAMUT_DISPLAY_P3 = 6,
+ /** BT.2020 color gamut. */
+ NATIVEBUFFER_COLOR_GAMUT_BT2020 = 7,
+ /** BT.2100 PQ color gamut. */
+ NATIVEBUFFER_COLOR_GAMUT_BT2100_PQ = 8,
+ /** BT.2100 HLG color gamut format. */
+ NATIVEBUFFER_COLOR_GAMUT_BT2100_HLG = 9,
+ /** Display BT.2020 color gamut. */
+ NATIVEBUFFER_COLOR_GAMUT_DISPLAY_BT2020 = 10,
+} OH_NativeBuffer_ColorGamut;
+
+/**
+ * @brief Enumerates the error codes.
+ * @since 12
+ */
+typedef enum OHNativeErrorCode {
+ /** The operation is successful. */
+ NATIVE_ERROR_OK = 0,
+ /**
+ * An error occurs during memory manipulation.
+ * @since 14
+ */
+ NATIVE_ERROR_MEM_OPERATION_ERROR = 30001000,
+ /** An input parameter is invalid. */
+ NATIVE_ERROR_INVALID_ARGUMENTS = 40001000,
+ /** You do not have the permission to perform the operation. */
+ NATIVE_ERROR_NO_PERMISSION = 40301000,
+ /** No buffer is available. */
+ NATIVE_ERROR_NO_BUFFER = 40601000,
+ /** The consumer does not exist. */
+ NATIVE_ERROR_NO_CONSUMER = 41202000,
+ /** Not initialized. */
+ NATIVE_ERROR_NOT_INIT = 41203000,
+ /** The consumer is connected. */
+ NATIVE_ERROR_CONSUMER_CONNECTED = 41206000,
+ /** The buffer status does not meet the expectation. */
+ NATIVE_ERROR_BUFFER_STATE_INVALID = 41207000,
+ /** The buffer is already in the buffer queue. */
+ NATIVE_ERROR_BUFFER_IN_CACHE = 41208000,
+ /** The queue is full. */
+ NATIVE_ERROR_BUFFER_QUEUE_FULL = 41209000,
+ /** The buffer is not in the buffer queue. */
+ NATIVE_ERROR_BUFFER_NOT_IN_CACHE = 41210000,
+ /** The consumer is disconnected. */
+ NATIVE_ERROR_CONSUMER_DISCONNECTED = 41211000,
+ /** No listener is registered on the consumer side. */
+ NATIVE_ERROR_CONSUMER_NO_LISTENER_REGISTERED = 41212000,
+ /** The device or platform does not support the operation. */
+ NATIVE_ERROR_UNSUPPORTED = 50102000,
+ /** Unknown error. Check the log. */
+ NATIVE_ERROR_UNKNOWN = 50002000,
+ /** Failed to call the HDI. */
+ NATIVE_ERROR_HDI_ERROR = 50007000,
+ /** Cross-process communication failed. */
+ NATIVE_ERROR_BINDER_ERROR = 50401000,
+ /** The EGL environment is abnormal. */
+ NATIVE_ERROR_EGL_STATE_UNKNOWN = 60001000,
+ /** Failed to call the EGL APIs. */
+ NATIVE_ERROR_EGL_API_FAILED = 60002000,
+} OHNativeErrorCode;
+/**
+ * @brief Defines the OH_NativeBuffer attribute configuration, which is used when you apply for
+ * a new OH_NativeBuffer instance or query the attributes of an existing instance.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
* @since 9
* @version 1.0
*/
-typedef struct {
- int32_t width; // 宽度(像素)
- int32_t height; // 高度(像素)
- int32_t format; // 像素格式
- int32_t usage; // buffer的用途说明
+typedef struct OH_NativeBuffer_Config {
+ /**
+ * Width, in pixels.
+ */
+ int32_t width;
+ /**
+ * Height, in pixels.
+ */
+ int32_t height;
+ /**
+ * Pixel format. For details, see {@link OH_NativeBuffer_Format}.
+ */
+ int32_t format;
+ /**
+ * Description of the buffer usage. For details, see {@link OH_NativeBuffer_Usage}.
+ */
+ int32_t usage;
+ /**
+ * Output parameter. Stride of the local window buffer, in bytes.
+ * @since 10
+ */
+ int32_t stride;
} OH_NativeBuffer_Config;
/**
- * @brief 通过OH_NativeBuffer_Config创建OH_NativeBuffer实例,每次调用都会产生一个新的OH_NativeBuffer实例
+ * @brief Defines the plane information of an image.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_NativeBuffer_Plane {
+ /**
+ * Offset of the image plane, in bytes.
+ */
+ uint64_t offset;
+ /**
+ * Distance from the first value in an image row to the first value in the next row, in bytes.
+ */
+ uint32_t rowStride;
+ /**
+ * Distance from the first value in an image column to the first value in the next column, in bytes.
+ */
+ uint32_t columnStride;
+} OH_NativeBuffer_Plane;
+
+/**
+ * @brief Defines the plane information of images in an OH_NativeBuffer instance.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_NativeBuffer_Planes {
+ /**
+ * Number of planes.
+ */
+ uint32_t planeCount;
+ /**
+ * Array holding the plane information of each image.
+ */
+ OH_NativeBuffer_Plane planes[4];
+} OH_NativeBuffer_Planes;
+
+/**
+ * @brief Enumerates the OH_NativeBuffer image standards.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_NativeBuffer_MetadataType {
+ /**
+ * Video HLG.
+ */
+ OH_VIDEO_HDR_HLG,
+ /**
+ * Video HDR10.
+ */
+ OH_VIDEO_HDR_HDR10,
+ /**
+ * Video HDR Vivid.
+ */
+ OH_VIDEO_HDR_VIVID,
+ /**
+ * No metadata.
+ * @since 13
+ */
+ OH_VIDEO_NONE = -1
+} OH_NativeBuffer_MetadataType;
+
+/**
+ * @brief Defines the X and Y coordinates of the primary color.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_NativeBuffer_ColorXY {
+ /**
+ * X coordinate of the primary color.
+ */
+ float x;
+ /**
+ * Y coordinate of the primary color.
+ */
+ float y;
+} OH_NativeBuffer_ColorXY;
+
+/**
+ * @brief Defines the SMPTE ST 2086 static metadata.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_NativeBuffer_Smpte2086 {
+ /**
+ * Red primary color.
+ */
+ OH_NativeBuffer_ColorXY displaPrimaryRed;
+ /**
+ * Green primary color.
+ */
+ OH_NativeBuffer_ColorXY displaPrimaryGreen;
+ /**
+ * Blue primary color.
+ */
+ OH_NativeBuffer_ColorXY displaPrimaryBlue;
+ /**
+ * White point.
+ */
+ OH_NativeBuffer_ColorXY whitePoint;
+ /**
+ * Maximum luminance.
+ */
+ float maxLuminance;
+ /**
+ * Minimum luminance.
+ */
+ float minLuminance;
+} OH_NativeBuffer_Smpte2086;
+
+/**
+ * @brief Defines the CTA-861.3 static metadata.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_NativeBuffer_Cta861 {
+ /**
+ * Maximum content light level (MaxCLL).
+ */
+ float maxContentLightLevel;
+ /**
+ * Maximum frame average light level (MaxFALLL).
+ */
+ float maxFrameAverageLightLevel;
+} OH_NativeBuffer_Cta861;
+
+/**
+ * @brief Defines the HDR static metadata.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_NativeBuffer_StaticMetadata {
+ /**
+ * SMPTE ST 2086 static metadata.
+ */
+ OH_NativeBuffer_Smpte2086 smpte2086;
+ /**
+ * CTA-861.3 static metadata.
+ */
+ OH_NativeBuffer_Cta861 cta861;
+} OH_NativeBuffer_StaticMetadata;
+
+/**
+ * @brief Enumerates the keys that specify the HDR metadata of an OH_NativeBuffer instance.
*
- * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
- * @param config 参数是一个指向OH_NativeBuffer属性的指针,类型为OH_NativeBuffer_Config
- * @return 创建成功则返回一个指向OH_NativeBuffer结构体实例的指针,否则返回NULL
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_NativeBuffer_MetadataKey {
+ /**
+ * Metadata type. For details about the available options, see {@link OH_NativeBuffer_MetadataType}.
+ * size indicates the size of OH_NativeBuffer_MetadataType.
+ */
+ OH_HDR_METADATA_TYPE,
+ /**
+ * Static metadata. For details about the available options, see {@link OH_NativeBuffer_StaticMetadata}.
+ * size indicates the size of OH_NativeBuffer_StaticMetadata.
+ */
+ OH_HDR_STATIC_METADATA,
+ /**
+ * Dynamic metadata. For details about the available options, see the SEI byte stream in the video stream.
+ * The value range of size is 1-3000.
+ */
+ OH_HDR_DYNAMIC_METADATA
+} OH_NativeBuffer_MetadataKey;
+
+/**
+ * @brief Creates an OH_NativeBuffer instance based on an OH_NativeBuffer_Config struct.
+ * A new OH_NativeBuffer instance is created each time this function is called. \n
+ * This function must be used in pair with {@link OH_NativeBuffer_Unreference}. Otherwise, memory leak occurs. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @param config Pointer to an OH_NativeBuffer_Config instance.
+ * @return Returns the pointer to the OH_NativeBuffer instance created if the operation is successful;
+ * returns NULL otherwise.
* @since 9
* @version 1.0
*/
OH_NativeBuffer* OH_NativeBuffer_Alloc(const OH_NativeBuffer_Config* config);
/**
- * @brief 将OH_NativeBuffer对象的引用计数加1
+ * @brief Increases the reference count of an OH_NativeBuffer instance by 1. \n
+ * This function must be used in pair with {@link OH_NativeBuffer_Unreference}. Otherwise, memory leak occurs. \n
+ * This function is not thread-safe. \n
*
- * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
- * @param buffer 参数是一个指向OH_NativeBuffer实例的指针
- * @return 返回一个由GSError定义的int32_t类型的错误码
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @param buffer Pointer to an OH_NativeBuffer instance.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
* @since 9
* @version 1.0
*/
int32_t OH_NativeBuffer_Reference(OH_NativeBuffer *buffer);
/**
- * @brief 将OH_NativeBuffer对象的引用计数减1,当引用计数为0的时候,该NativeBuffer对象会被析构掉
+ * @brief Decreases the reference count of an OH_NativeBuffer instance by 1 and
+ * when the reference count reaches 0, destroys the instance. \n
+ * This function is not thread-safe. \n
*
- * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
- * @param buffer 参数是一个指向OH_NativeBuffer实例的指针
- * @return 返回一个由GSError定义的int32_t类型的错误码
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @param buffer Pointer to an OH_NativeBuffer instance.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
* @since 9
* @version 1.0
*/
int32_t OH_NativeBuffer_Unreference(OH_NativeBuffer *buffer);
/**
- * @brief 用于获取OH_NativeBuffer的属性
+ * @brief Obtains the attributes of an OH_NativeBuffer instance. \n
+ * This function is not thread-safe. \n
*
- * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
- * @param buffer 参数是一个指向OH_NativeBuffer实例的指针
- * @param config 参数是一个指向OH_NativeBuffer_Config的指针,用于接收OH_NativeBuffer的属性
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @param buffer Pointer to an OH_NativeBuffer instance.
+ * @param config Pointer to an OH_NativeBuffer_Config instance, which is used to
+ * receive the attributes of OH_NativeBuffer.
* @since 9
* @version 1.0
*/
void OH_NativeBuffer_GetConfig(OH_NativeBuffer *buffer, OH_NativeBuffer_Config* config);
/**
- * @brief 将OH_NativeBuffer对应的ION内存映射到进程空间
+ * @brief Maps the ION memory corresponding to an OH_NativeBuffer instance to the process address space. \n
+ * This function must be used in pair with {@link OH_NativeBuffer_Unmap}. \n
+ * This function is not thread-safe. \n
*
- * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
- * @param buffer 参数是一个指向OH_NativeBuffer实例的指针
- * @param virAddr 参数是一个二级指针,二级指针指向虚拟内存的地址
- * @return 返回一个由GSError定义的int32_t类型的错误码
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @param buffer Pointer to an OH_NativeBuffer instance.
+ * @param virAddr Double pointer to the address of the virtual memory.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
* @since 9
* @version 1.0
*/
@@ -117,30 +828,130 @@ void OH_NativeBuffer_GetConfig(OH_NativeBuffer *buffer, OH_NativeBuffer_Config*
int32_t OH_NativeBuffer_Map(OH_NativeBuffer *buffer, void **virAddr);
/**
- * @brief 将OH_NativeBuffer对应的ION内存从进程空间移除
+ * @brief Unmaps the ION memory corresponding to an OH_NativeBuffer instance from the process address space. \n
+ * This function is not thread-safe. \n
*
- * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
- * @param buffer 参数是一个指向OH_NativeBuffer实例的指针
- * @return 返回一个由GSError定义的int32_t类型的错误码
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @param buffer Pointer to an OH_NativeBuffer instance.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
* @since 9
* @version 1.0
*/
int32_t OH_NativeBuffer_Unmap(OH_NativeBuffer *buffer);
/**
- * @brief 获取OH_NativeBuffer的序列号
+ * @brief Obtains the sequence number of an OH_NativeBuffer instance. \n
+ * This function is not thread-safe. \n
*
- * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
- * @param buffer 参数是一个指向OH_NativeBuffer实例的指针
- * @return 返回对应OH_NativeBuffer的唯一序列号
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @param buffer Pointer to an OH_NativeBuffer instance.
+ * @return Returns the unique sequence number of the OH_NativeBuffer instance.
* @since 9
* @version 1.0
*/
uint32_t OH_NativeBuffer_GetSeqNum(OH_NativeBuffer *buffer);
+/**
+ * @brief Sets the color space for an OH_NativeBuffer instance. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @param buffer Pointer to an OH_NativeBuffer instance.
+ * @param colorSpace Color space to set.
+ * For details about the available options, see {@link OH_NativeBuffer_ColorSpace}.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 11
+ * @version 1.0
+ */
+int32_t OH_NativeBuffer_SetColorSpace(OH_NativeBuffer *buffer, OH_NativeBuffer_ColorSpace colorSpace);
+
+/**
+ * @brief Maps the multi-channel ION memory corresponding to an OH_NativeBuffer instance
+ * to the process address space. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @param buffer Pointer to an OH_NativeBuffer instance.
+ * @param virAddr Double pointer to the address of the virtual memory.
+ * @param outPlanes Pointer to the plane information of all images.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_NativeBuffer_MapPlanes(OH_NativeBuffer *buffer, void **virAddr, OH_NativeBuffer_Planes *outPlanes);
+
+/**
+ * @brief Converts an OHNativeWindowBuffer instance to an OH_NativeBuffer instance. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @param nativeWindowBuffer Pointer to an OHNativeWindowBuffer instance.
+ * @param buffer Pointer to an OH_NativeBuffer instance.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_NativeBuffer_FromNativeWindowBuffer(OHNativeWindowBuffer *nativeWindowBuffer, OH_NativeBuffer **buffer);
+
+/**
+ * @brief Obtains the color space of an OH_NativeBuffer instance. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @param buffer Pointer to an OH_NativeBuffer instance.
+ * @param colorSpace Pointer to the color space.
+ * For details about the available options, see {@link OH_NativeBuffer_ColorSpace}.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_NativeBuffer_GetColorSpace(OH_NativeBuffer *buffer, OH_NativeBuffer_ColorSpace *colorSpace);
+
+/**
+ * @brief Sets a metadata value for an OH_NativeBuffer instance. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @param buffer Pointer to an OH_NativeBuffer instance.
+ * @param metadataKey Key of the metadata.
+ * For details about the available options, see {@link OH_NativeBuffer_MetadataKey}.
+ * @param size Size of the uint8_t vector.
+ * For details about the available options, see {@link OH_NativeBuffer_MetadataKey}.
+ * @param metaData Pointer to the uint8_t vector.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_NativeBuffer_SetMetadataValue(OH_NativeBuffer *buffer, OH_NativeBuffer_MetadataKey metadataKey,
+ int32_t size, uint8_t *metaData);
+
+/**
+ * @brief Obtains the metadata value of an OH_NativeBuffer instance. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
+ * @param buffer Pointer to an OH_NativeBuffer instance.
+ * @param metadataKey Key of the metadata.
+ * For details about the available options, see {@link OH_NativeBuffer_MetadataKey}.
+ * @param size Pointer to the size of the uint8_t vector.
+ * For details about the available options, see {@link OH_NativeBuffer_MetadataKey}.
+ * @param metaData Double pointer to the uint8_t vector.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_NativeBuffer_GetMetadataValue(OH_NativeBuffer *buffer, OH_NativeBuffer_MetadataKey metadataKey,
+ int32_t *size, uint8_t **metaData);
#ifdef __cplusplus
}
#endif
/** @} */
-#endif
\ No newline at end of file
+#endif
diff --git a/en/native_sdk/graphic/native_color_space_manager.h b/en/native_sdk/graphic/native_color_space_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..992568c5bee9e04391e12b945c389e00d7b12f09
--- /dev/null
+++ b/en/native_sdk/graphic/native_color_space_manager.h
@@ -0,0 +1,283 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @addtogroup NativeColorSpaceManager
+ * @{
+ *
+ * @brief Provides the capabilities for creating a color space and obtaining its properties.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
+ * @since 13
+ * @version 1.0
+ */
+
+/**
+ * @file native_color_space_manager.h
+ *
+ * @brief Declares the functions for creating and using a color space.
+ *
+ * File to include: "native_color_space_manager/native_color_space_manager.h"
+ * @library libnative_color_space_manager.so
+ * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
+ * @since 13
+ * @version 1.0
+ */
+#ifndef C_INCLUDE_NATIVE_COLOR_SPACE_MANAGER_H_
+#define C_INCLUDE_NATIVE_COLOR_SPACE_MANAGER_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Provides the declaration of an OH_NativeColorSpaceManager struct.
+ * @since 13
+ */
+typedef struct OH_NativeColorSpaceManager OH_NativeColorSpaceManager;
+
+/**
+ * @brief Enumerates the color space names.
+ * @since 13
+ */
+typedef enum ColorSpaceName
+{
+ /** Unknown color space. */
+ NONE = 0,
+ /** Color space based on Adobe RGB. */
+ ADOBE_RGB = 1,
+ /** Color space based on SMPTE RP 431-2-2007 and IEC 61966-2.1:1999. */
+ DCI_P3 = 2,
+ /** Color space based on SMPTE RP 431-2-2007 and IEC 61966-2.1:1999. */
+ DISPLAY_P3 = 3,
+ /** Standard Red Green Blue (SRGB) color space based on IEC 61966-2.1:1999. */
+ SRGB = 4,
+ /** Color space based on ITU-R BT.709. */
+ BT709 = 6,
+ /** Color space based on ITU-R BT.601. */
+ BT601_EBU = 7,
+ /** Color space based on ITU-R BT.601. */
+ BT601_SMPTE_C = 8,
+ /** Color space based on ITU-R BT.2020. */
+ BT2020_HLG = 9,
+ /** Color space based on ITU-R BT.2020. */
+ BT2020_PQ = 10,
+ /**
+ * Color space with the color primaries of P3_D65, the transfer characteristics of Hybrid Log-Gamma (HLG),
+ * and the color range of FULL.
+ */
+ P3_HLG = 11,
+ /**
+ * Color space with the color primaries of P3_D65, the transfer characteristics of Perceptual Quantizer (PQ),
+ * and the color range of FULL.
+ */
+ P3_PQ = 12,
+ /**
+ * Color space with the color primaries of ADOBE_RGB, the transfer characteristics of ADOBE_RGB,
+ * and the color range of LIMIT.
+ */
+ ADOBE_RGB_LIMIT = 13,
+ /**
+ * Color space with the color primaries of P3_D65, the transfer characteristics of SRGB,
+ * and the color range of LIMIT.
+ */
+ DISPLAY_P3_LIMIT = 14,
+ /**
+ * Color space with the color primaries of SRGB, the transfer characteristics of SRGB,
+ * and the color range of LIMIT.
+ */
+ SRGB_LIMIT = 15,
+ /**
+ * Color space with the color primaries of BT.709, the transfer characteristics of BT.709,
+ * and the color range of LIMIT.
+ */
+ BT709_LIMIT = 16,
+ /**
+ * Color space with the color primaries of BT.601_P, the transfer characteristics of BT.709,
+ * and the color range of LIMIT.
+ */
+ BT601_EBU_LIMIT = 17,
+ /**
+ * Color space with the color primaries of BT.601_N, the transfer characteristics of BT.709,
+ * and the color range of LIMIT.
+ */
+ BT601_SMPTE_C_LIMIT = 18,
+ /**
+ * Color space with the color primaries of BT.2020, the transfer characteristics of HLG,
+ * and the color range of LIMIT.
+ */
+ BT2020_HLG_LIMIT = 19,
+ /**
+ * Color space with the color primaries of BT.2020, the transfer characteristics of PQ,
+ * and the color range of LIMIT.
+ */
+ BT2020_PQ_LIMIT = 20,
+ /**
+ * Color space with the color primaries of P3_D65, the transfer characteristics of HLG,
+ * and the color range of LIMIT.
+ */
+ P3_HLG_LIMIT = 21,
+ /**
+ * Color space with the color primaries of P3_D65, the transfer characteristics of PQ,
+ * and the color range of LIMIT.
+ */
+ P3_PQ_LIMIT = 22,
+ /** Color space with the color primaries of P3_D65 and the transfer characteristic of LINEAR. */
+ LINEAR_P3 = 23,
+ /** Color space with the color primaries of SRGB and the transfer characteristic of LINEAR. */
+ LINEAR_SRGB = 24,
+ /** Color space with the color primaries of BT.709 and the transfer characteristic of LINEAR. */
+ LINEAR_BT709 = LINEAR_SRGB,
+ /** Color space with the color primaries of BT.2020 and the transfer characteristic of LINEAR. */
+ LINEAR_BT2020 = 25,
+ /**
+ * Color space with the color primaries of SRGB, the transfer characteristics of SRGB,
+ * and the color range of FULL.
+ */
+ DISPLAY_SRGB = SRGB,
+ /**
+ * Color space with the color primaries of P3_D65, the transfer characteristics of SRGB,
+ * and the color range of FULL.
+ */
+ DISPLAY_P3_SRGB = DISPLAY_P3,
+ /**
+ * Color space with the color primaries of P3_D65, the transfer characteristics of HLG,
+ * and the color range of FULL.
+ */
+ DISPLAY_P3_HLG = P3_HLG,
+ /**
+ * Color space with the color primaries of P3_D65, the transfer characteristics of PQ,
+ * and the color range of FULL.
+ */
+ DISPLAY_P3_PQ = P3_PQ,
+ /** Custom color space. */
+ CUSTOM = 5,
+} ColorSpaceName;
+
+/**
+ * @brief Provides the declaration of a ColorSpacePrimaries struct.
+ * @since 13
+ */
+typedef struct ColorSpacePrimaries
+{
+ /** X-coordinate of the red color. */
+ float rX;
+ /** Y-coordinate of the red color. */
+ float rY;
+ /** X-coordinate of the green color. */
+ float gX;
+ /** Y-coordinate of the green color. */
+ float gY;
+ /** X-coordinate of the blue color. */
+ float bX;
+ /** Y-coordinate of the blue color. */
+ float bY;
+ /** X-coordinate of the white point. */
+ float wX;
+ /** Y-coordinate of the white point. */
+ float wY;
+} ColorSpacePrimaries;
+
+/**
+ * @brief Describes a white point array. Each white point indicates the coordinates of white in the active color space.
+ * @since 13
+ */
+typedef struct WhitePointArray
+{
+ /** White point array. */
+ float arr[2];
+} WhitePointArray;
+
+/**
+ * @brief Creates an OH_NativeColorSpaceManager instance based on a color space name.
+ * A new OH_NativeColorSpaceManager instance is created each time this function is called.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
+ * @param colorSpaceName Name of the color space.
+ * @return Returns the pointer to an OH_NativeColorSpaceManager instance.
+ * If the memory is insufficient, the OH_NativeColorSpaceManager instance fails to be created.
+ * @since 13
+ * @version 1.0
+ */
+OH_NativeColorSpaceManager* OH_NativeColorSpaceManager_CreateFromName(ColorSpaceName colorSpaceName);
+
+/**
+ * @brief Creates an OH_NativeColorSpaceManager instance based on the color primaries and gamma value.
+ * A new OH_NativeColorSpaceManager instance is created each time this function is called.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
+ * @param primaries Color primaries.
+ * @param gamma Gamma value, which is a floating-point number used to adjust the luminance range.
+ * Generally, the gamma value is positive. A negative value results in increased brightness in low-light areas and
+ * decreased brightness in high-light areas. The value 0 indicates a linear color space.
+ * @return Returns the pointer to an OH_NativeColorSpaceManager instance.
+ * If the memory is insufficient, the OH_NativeColorSpaceManager instance fails to be created.
+ * @since 13
+ * @version 1.0
+ */
+OH_NativeColorSpaceManager* OH_NativeColorSpaceManager_CreateFromPrimariesAndGamma(
+ ColorSpacePrimaries primaries, float gamma);
+
+/**
+ * @brief Destroys an OH_NativeColorSpaceManager instance.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
+ * @param nativeColorSpaceManager Pointer to an OH_NativeColorSpaceManager instance.
+ * @since 13
+ * @version 1.0
+ */
+void OH_NativeColorSpaceManager_Destroy(OH_NativeColorSpaceManager* nativeColorSpaceManager);
+
+/**
+ * @brief Obtains the color space name.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
+ * @param nativeColorSpaceManager Pointer to an OH_NativeColorSpaceManager instance.
+ * @return Returns the color space name, which is defined in {@link ColorSpaceName}.
+ * The return value 0 means that the function call fails.
+ * @since 13
+ * @version 1.0
+ */
+int OH_NativeColorSpaceManager_GetColorSpaceName(
+ OH_NativeColorSpaceManager* nativeColorSpaceManager);
+
+/**
+ * @brief Obtains the white points.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
+ * @param nativeColorSpaceManager Pointer to an OH_NativeColorSpaceManager instance.
+ * @return Returns a float array of white points. The value <0.0, 0.0> means that the function call fails.
+ * @since 13
+ * @version 1.0
+ */
+WhitePointArray OH_NativeColorSpaceManager_GetWhitePoint(
+ OH_NativeColorSpaceManager* nativeColorSpaceManager);
+
+/**
+ * @brief Obtains the gamma value.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core
+ * @param nativeColorSpaceManager Pointer to an OH_NativeColorSpaceManager instance.
+ * @return Returns a float value. The value 0.0 means that the function call fails.
+ * @since 13
+ * @version 1.0
+ */
+float OH_NativeColorSpaceManager_GetGamma(OH_NativeColorSpaceManager* nativeColorSpaceManager);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_display_soloist.h b/en/native_sdk/graphic/native_display_soloist.h
new file mode 100644
index 0000000000000000000000000000000000000000..9835120162b3fede5591a000704ddab75c706478
--- /dev/null
+++ b/en/native_sdk/graphic/native_display_soloist.h
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_NATIVE_DISPLAY_SOLOIST_H_
+#define C_INCLUDE_NATIVE_DISPLAY_SOLOIST_H_
+
+/**
+ * @addtogroup NativeDisplaySoloist
+ * @{
+ *
+ * @brief Native service that control the frame rate in threads other than the UI thread.
+ *
+ * @since 12
+ * @version 1.0
+ */
+
+/**
+ * @file native_display_soloist.h
+ *
+ * @brief Declares the functions for obtaining and using NativeDisplaySoloist.
+ *
+ * File to include: "native_display_soloist/native_display_soloist.h"
+ * @syscap SystemCapability.Graphic.Graphic2D.HyperGraphicManager
+ * @library libnative_display_soloist.so
+ * @since 12
+ * @version 1.0
+ */
+
+#include
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Provides the declaration of an OH_DisplaySoloist struct.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_DisplaySoloist OH_DisplaySoloist;
+
+/**
+ * @brief Defines the pointer to an OH_DisplaySoloist callback function.
+ *
+ * @param timestamp VSync timestamp.
+ * @param targetTimestamp Expected VSync timestamp of the next frame.
+ * @param data Pointer to the custom data.
+ * @since 12
+ * @version 1.0
+ */
+typedef void (*OH_DisplaySoloist_FrameCallback)(long long timestamp, long long targetTimestamp, void* data);
+
+/**
+ * @brief Defines the expected frame rate range.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct DisplaySoloist_ExpectedRateRange {
+ /** Minimum value of the expected frame rate range. The value range is [0,120]. */
+ int32_t min;
+ /** Maximum value of the expected frame rate range. The value range is [0,120]. */
+ int32_t max;
+ /** Expected frame rate. The value range is [0,120]. */
+ int32_t expected;
+} DisplaySoloist_ExpectedRateRange;
+
+/**
+ * @brief Creates an OH_DisplaySoloist instance.
+ * A new OH_DisplaySoloist instance is created each time this function is called.
+ *
+ * @param useExclusiveThread Whether the OH_DisplaySoloist instance exclusively occupies a thread.
+ * The value true means that the instance exclusively occupies a thread,
+ * and false means that the instance shares a thread with others.
+ * @return Returns the pointer to the {@link OH_DisplaySoloist} instance created if the operation is successful;
+ * returns a null pointer otherwise. The failure cause may be out of memory.
+ * @since 12
+ * @version 1.0
+ */
+OH_DisplaySoloist* OH_DisplaySoloist_Create(bool useExclusiveThread);
+
+/**
+ * @brief Destroys an OH_DisplaySoloist object and reclaims the memory occupied.
+ *
+ * @param displaySoloist Pointer to an {@link OH_DisplaySoloist} instance.
+ * @return Returns 0 if the operation is successful; returns -1 otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_DisplaySoloist_Destroy(OH_DisplaySoloist* displaySoloist);
+
+/**
+ * @brief Sets a callback function for each frame. The callback function is triggered each time a VSync signal arrives.
+ *
+ * @param displaySoloist Pointer to an {@link OH_DisplaySoloist} instance.
+ * @param callback Callback function to be triggered when the next VSync signal arrives.
+ * @param data Pointer to the custom data. The type is void*.
+ * @return Returns 0 if the operation is successful; returns -1 otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_DisplaySoloist_Start(
+ OH_DisplaySoloist* displaySoloist, OH_DisplaySoloist_FrameCallback callback, void* data);
+
+/**
+ * @brief Stops requesting the next VSync signal and triggering the callback function.
+ *
+ * @param displaySoloist Pointer to an {@link OH_DisplaySoloist} instance.
+ * @return Returns 0 if the operation is successful; returns -1 otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_DisplaySoloist_Stop(OH_DisplaySoloist* displaySoloist);
+
+/**
+ * @brief Sets the expected frame rate range.
+ *
+ * @param displaySoloist Pointer to an {@link OH_DisplaySoloist} instance.
+ * @param range Pointer to a {@link DisplaySoloist_ExpectedRateRange} instance.
+ * @return Returns 0 if the operation is successful; returns -1 otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_DisplaySoloist_SetExpectedFrameRateRange(
+ OH_DisplaySoloist* displaySoloist, DisplaySoloist_ExpectedRateRange* range);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/** @} */
diff --git a/en/native_sdk/graphic/native_drawing/drawing_bitmap.h b/en/native_sdk/graphic/native_drawing/drawing_bitmap.h
index 3e7fecfc64e9177174a535916fc6cceb3be63217..0976177b95ff5d1503880b22fd649b3da538129a 100644
--- a/en/native_sdk/graphic/native_drawing/drawing_bitmap.h
+++ b/en/native_sdk/graphic/native_drawing/drawing_bitmap.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
+ * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -20,8 +20,9 @@
* @addtogroup Drawing
* @{
*
- * @brief Provides functions such as 2D graphics rendering, text drawing, and image display.
- *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
*
* @since 8
@@ -31,8 +32,10 @@
/**
* @file drawing_bitmap.h
*
- * @brief Declares functions related to the bitmap object in the drawing module.
+ * @brief Declares the functions related to the bitmap in the drawing module.
*
+ * File to include: native_drawing/drawing_bitmap.h
+ * @library libnative_drawing.so
* @since 8
* @version 1.0
*/
@@ -45,14 +48,14 @@ extern "C" {
/**
* @brief Defines the pixel format of a bitmap, including the color type and alpha type.
- *
+ *
* @since 8
* @version 1.0
*/
-typedef struct {
- /** Storage format of bitmap pixels */
+typedef struct OH_Drawing_BitmapFormat {
+ /** Storage format of bitmap pixels. */
OH_Drawing_ColorFormat colorFormat;
- /** Alpha format of bitmap pixels */
+ /** Alpha format of bitmap pixels. */
OH_Drawing_AlphaFormat alphaFormat;
} OH_Drawing_BitmapFormat;
@@ -70,20 +73,43 @@ OH_Drawing_Bitmap* OH_Drawing_BitmapCreate(void);
* @brief Destroys an OH_Drawing_Bitmap object and reclaims the memory occupied by the object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object.
+ * @param OH_Drawing_Bitmap Pointer to an OH_Drawing_Bitmap object.
* @since 8
* @version 1.0
*/
void OH_Drawing_BitmapDestroy(OH_Drawing_Bitmap*);
/**
- * @brief Initializes the width and height of an OH_Drawing_Bitmap object and sets the pixel format for the bitmap.
+ * @brief Creates an OH_Drawing_Bitmap object, with the address of the memory for storing the bitmap pixels
+ * set to the memory address that you applied for.
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Image_Info or pixels is NULL or rowBytes is 0,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Image_Info Pointer to an {@link OH_Drawing_Image_Info} object.
+ * @param pixels Pointer to the start address of the memory for storing the bitmap pixels.
+ * You need to apply for the memory and ensure its validity.
+ * @param rowBytes Size of pixels per row.
+ * @return Returns the pointer to the {@link OH_Drawing_Bitmap} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Bitmap* OH_Drawing_BitmapCreateFromPixels(OH_Drawing_Image_Info*, void* pixels, uint32_t rowBytes);
+
+/**
+ * @brief Initializes the width and height of a bitmap and sets the pixel format for the bitmap.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Bitmap or OH_Drawing_BitmapFormat is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object.
- * @param width Indicates the width of the bitmap to be initialized.
- * @param height Indicates the height of the bitmap to be initialized.
- * @param OH_Drawing_BitmapFormat Indicates the pixel format of the bitmap to be initialized, including the pixel color type and alpha type.
+ * @param OH_Drawing_Bitmap Pointer to an OH_Drawing_Bitmap object.
+ * @param width Width of the bitmap to be initialized.
+ * @param height Height of the bitmap to be initialized.
+ * @param OH_Drawing_BitmapFormat Pointer to the pixel format of the bitmap to be initialized,
+ * including the pixel color type and alpha type.
* @since 8
* @version 1.0
*/
@@ -93,8 +119,11 @@ void OH_Drawing_BitmapBuild(
/**
* @brief Obtains the width of a bitmap.
*
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Bitmap is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object.
+ * @param OH_Drawing_Bitmap Pointer to an OH_Drawing_Bitmap object.
* @return Returns the width.
* @since 8
* @version 1.0
@@ -104,25 +133,99 @@ uint32_t OH_Drawing_BitmapGetWidth(OH_Drawing_Bitmap*);
/**
* @brief Obtains the height of a bitmap.
*
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Bitmap is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object.
+ * @param OH_Drawing_Bitmap Pointer to an OH_Drawing_Bitmap object.
* @return Returns the height.
* @since 8
* @version 1.0
*/
uint32_t OH_Drawing_BitmapGetHeight(OH_Drawing_Bitmap*);
+/**
+ * @brief Obtains the pixel format of a bitmap.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Bitmap is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Bitmap Pointer to an OH_Drawing_Bitmap object.
+ * @return Returns the pixel format. For details about the supported formats, see {@link OH_Drawing_ColorFormat}.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ColorFormat OH_Drawing_BitmapGetColorFormat(OH_Drawing_Bitmap*);
+
+/**
+ * @brief Obtains the alpha component of a bitmap.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Bitmap is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Bitmap Pointer to an OH_Drawing_Bitmap object.
+ * @return Returns the alpha component. For details about the supported formats, see {@link OH_Drawing_AlphaFormat}.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_AlphaFormat OH_Drawing_BitmapGetAlphaFormat(OH_Drawing_Bitmap*);
+
/**
* @brief Obtains the pixel address of a bitmap. You can use this address to obtain the pixel data of the bitmap.
*
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Bitmap is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object.
+ * @param OH_Drawing_Bitmap Pointer to an OH_Drawing_Bitmap object.
* @return Returns the pixel address.
* @since 8
* @version 1.0
*/
void* OH_Drawing_BitmapGetPixels(OH_Drawing_Bitmap*);
+/**
+ * @brief Obtains the image information of a bitmap.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Bitmap or OH_Drawing_Image_Info is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Bitmap Pointer to an {@link OH_Drawing_Bitmap} object.
+ * @param OH_Drawing_Image_Info Pointer to an {@link OH_Drawing_Image_Info} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_BitmapGetImageInfo(OH_Drawing_Bitmap*, OH_Drawing_Image_Info*);
+
+/**
+ * @brief Reads pixels of a rectangle in a bitmap to the specified buffer.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If any of OH_Drawing_Bitmap, dstInfo, and dstPixels is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Bitmap Pointer to an {@link OH_Drawing_Bitmap} object.
+ * @param OH_Drawing_Image_Info Pointer to an {@link OH_Drawing_Image_Info} object.
+ * @param dstPixels Pointer to the buffer for storing the pixels read.
+ * @param dstRowBytes Number of bytes in each row of the pixel data read.
+ * The value must be greater than or equal to the minimum number of bytes in each row in the
+ * {@link OH_Drawing_Image_Info} object.
+ * @param srcX Start X coordinate of the pixel data to read from the bitmap.
+ * The value must be less than the width of the bitmap.
+ * @param srcY Start Y coordinate of the pixel data to read from the bitmap.
+ * The value must be less than the height of the bitmap.
+ * @return Returns true if the pixels are read; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_BitmapReadPixels(OH_Drawing_Bitmap*, const OH_Drawing_Image_Info* dstInfo,
+ void* dstPixels, size_t dstRowBytes, int32_t srcX, int32_t srcY);
+
#ifdef __cplusplus
}
#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_brush.h b/en/native_sdk/graphic/native_drawing/drawing_brush.h
index e81d367e6e3bcaa0547053637bdf7bc7aeb6a4c1..f0c59e91c3288bc688e11da68c096775c3cd997f 100644
--- a/en/native_sdk/graphic/native_drawing/drawing_brush.h
+++ b/en/native_sdk/graphic/native_drawing/drawing_brush.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
+ * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -20,8 +20,9 @@
* @addtogroup Drawing
* @{
*
- * @brief Provides functions such as 2D graphics rendering, text drawing, and image display.
- *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
*
* @since 8
@@ -31,8 +32,10 @@
/**
* @file drawing_brush.h
*
- * @brief Declares functions related to the brush object in the drawing module.
+ * @brief Declares the functions related to the brush in the drawing module.
*
+ * File to include: native_drawing/drawing_brush.h
+ * @library libnative_drawing.so
* @since 8
* @version 1.0
*/
@@ -53,21 +56,40 @@ extern "C" {
*/
OH_Drawing_Brush* OH_Drawing_BrushCreate(void);
+/**
+ * @brief Copies an existing {@link OH_Drawing_Brush} object to create a new one.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If brush is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param brush Pointer to an OH_Drawing_Brush object.
+ * @return Returns the pointer to the {@link OH_Drawing_Brush} object created. If NULL is returned, the creation fails.
+ * The possible failure cause is that no memory is available or brush is NULL.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Brush* OH_Drawing_BrushCopy(OH_Drawing_Brush* brush);
+
/**
* @brief Destroys an OH_Drawing_Brush object and reclaims the memory occupied by the object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object.
+ * @param OH_Drawing_Brush Pointer to an OH_Drawing_Brush object.
* @since 8
* @version 1.0
*/
void OH_Drawing_BrushDestroy(OH_Drawing_Brush*);
/**
- * @brief Checks whether anti-aliasing is enabled for a brush. If anti-aliasing is enabled, edges will be drawn with partial transparency.
+ * @brief Checks whether anti-aliasing is enabled for a brush.
+ * Anti-aliasing makes the pixels around the shape edges semi-transparent.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Brush is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object.
+ * @param OH_Drawing_Brush Pointer to an OH_Drawing_Brush object.
* @return Returns true if anti-aliasing is enabled; returns false otherwise.
* @since 8
* @version 1.0
@@ -75,11 +97,16 @@ void OH_Drawing_BrushDestroy(OH_Drawing_Brush*);
bool OH_Drawing_BrushIsAntiAlias(const OH_Drawing_Brush*);
/**
- * @brief Enables or disables anti-aliasing for a brush. If anti-aliasing is enabled, edges will be drawn with partial transparency.
+ * @brief Enables or disables anti-aliasing for a brush.
+ * Anti-aliasing makes the pixels around the shape edges semi-transparent.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Brush is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object.
- * @param bool Specifies whether to enable anti-aliasing. The value true means to enable anti-aliasing, and false means the opposite.
+ * @param OH_Drawing_Brush Pointer to an OH_Drawing_Brush object.
+ * @param bool Whether to enable anti-aliasing. The value true means to enable anti-aliasing,
+ * and false means the opposite.
* @since 8
* @version 1.0
*/
@@ -88,8 +115,11 @@ void OH_Drawing_BrushSetAntiAlias(OH_Drawing_Brush*, bool);
/**
* @brief Obtains the color of a brush. The color is used by the brush to fill in a shape.
*
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Brush is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object.
+ * @param OH_Drawing_Brush Pointer to an OH_Drawing_Brush object.
* @return Returns a 32-bit (ARGB) variable that describes the color.
* @since 8
* @version 1.0
@@ -97,16 +127,136 @@ void OH_Drawing_BrushSetAntiAlias(OH_Drawing_Brush*, bool);
uint32_t OH_Drawing_BrushGetColor(const OH_Drawing_Brush*);
/**
- * @brief Sets the color for a brush. The color will be used by the brush to fill in a shape.
+ * @brief Sets the color for a brush. The color is used by the brush to fill in a shape.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Brush is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object.
- * @param color Indicates the color to set, which is a 32-bit (ARGB) variable.
+ * @param OH_Drawing_Brush Pointer to an OH_Drawing_Brush object.
+ * @param color Color, which is a 32-bit (ARGB) variable.
* @since 8
* @version 1.0
*/
void OH_Drawing_BrushSetColor(OH_Drawing_Brush*, uint32_t color);
+/**
+ * @brief Obtains the alpha value of a brush. This value is used by the alpha channel when the brush fills in a shape.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Brush is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Brush Pointer to an OH_Drawing_Brush object.
+ * @return Returns an 8-bit variable that describes the alpha value.
+ * @since 11
+ * @version 1.0
+ */
+uint8_t OH_Drawing_BrushGetAlpha(const OH_Drawing_Brush*);
+
+/**
+ * @brief Sets the alpha value for a brush. This value is used by the alpha channel when the brush fills in a shape.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Brush is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Brush Pointer to an OH_Drawing_Brush object.
+ * @param alpha Alpha value, which is an 8-bit variable.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_BrushSetAlpha(OH_Drawing_Brush*, uint8_t alpha);
+
+/**
+ * @brief Sets the shader effect for a brush.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Brush is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Brush Pointer to an OH_Drawing_Brush object.
+ * @param OH_Drawing_ShaderEffect Pointer to an OH_Drawing_ShaderEffect object.
+ * If NULL is passed in, the shader effect of the brush will be cleared.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_BrushSetShaderEffect(OH_Drawing_Brush*, OH_Drawing_ShaderEffect*);
+
+/**
+ * @brief Sets the shadow layer for a brush. The shadow layer effect takes effect only when text is drawn.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Brush is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Brush Pointer to an OH_Drawing_Brush object.
+ * @param OH_Drawing_ShadowLayer Pointer to an OH_Drawing_ShadowLayer object.
+ * If NULL is passed in, the shadow layer effect of the brush will be cleared.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_BrushSetShadowLayer(OH_Drawing_Brush*, OH_Drawing_ShadowLayer*);
+
+/**
+ * @brief Sets a filter for a brush. The filter is a container that holds a mask filter and color filter.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Brush is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Brush Pointer to an OH_Drawing_Brush object.
+ * @param OH_Drawing_Filter Pointer to an OH_Drawing_Filter object.
+ * If NULL is passed in, the filter of the brush will be cleared.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_BrushSetFilter(OH_Drawing_Brush*, OH_Drawing_Filter*);
+
+/**
+ * @brief Obtains the filter from a brush. The filter is a container that holds a mask filter and color filter.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Brush or OH_Drawing_Filter is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Brush Pointer to an {@link OH_Drawing_Brush} object.
+ * @param OH_Drawing_Filter Pointer to the {@link OH_Drawing_Filter} object obtained.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_BrushGetFilter(OH_Drawing_Brush*, OH_Drawing_Filter*);
+
+/**
+ * @brief Sets a blender for a brush. The blender implements the specified blend mode.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Brush is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_BlendMode is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Brush Pointer to an {@link OH_Drawing_Brush} object.
+ * @param OH_Drawing_BlendMode Blend mode. For details about the available options, see {@link OH_Drawing_BlendMode}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_BrushSetBlendMode(OH_Drawing_Brush*, OH_Drawing_BlendMode);
+
+/**
+ * @brief Resets a brush to the initial state. All configured attributes are cleared.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Brush is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Brush Pointer to an {@link OH_Drawing_Brush} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_BrushReset(OH_Drawing_Brush*);
+
#ifdef __cplusplus
}
#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_canvas.h b/en/native_sdk/graphic/native_drawing/drawing_canvas.h
index 490caa8d2104d414f8223185155cf28cebd8b7cc..3aaa32b45a3d6402ede658e8b42dd4245f1f9139 100644
--- a/en/native_sdk/graphic/native_drawing/drawing_canvas.h
+++ b/en/native_sdk/graphic/native_drawing/drawing_canvas.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
+ * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -20,8 +20,9 @@
* @addtogroup Drawing
* @{
*
- * @brief Provides functions such as 2D graphics rendering, text drawing, and image display.
- *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
*
* @since 8
@@ -31,18 +32,36 @@
/**
* @file drawing_canvas.h
*
- * @brief Declares functions related to the canvas object in the drawing module.
+ * @brief Declares the functions related to the canvas in the drawing module.
+ * By default, the canvas has a black brush with anti-aliasing enabled and without any other style.
+ * This brush takes effect only when no brush or pen is proactively set in the canvas.
*
+ * File to include: native_drawing/drawing_canvas.h
+ * @library libnative_drawing.so
* @since 8
* @version 1.0
*/
+#include "drawing_error_code.h"
#include "drawing_types.h"
#ifdef __cplusplus
extern "C" {
#endif
+/**
+ * @brief Enumerates the constraint types of the source rectangle.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_Drawing_SrcRectConstraint {
+ /** The source rectangle must be completely contained in the image. */
+ STRICT_SRC_RECT_CONSTRAINT,
+ /** The source rectangle can be partly outside the image. */
+ FAST_SRC_RECT_CONSTRAINT,
+} OH_Drawing_SrcRectConstraint;
+
/**
* @brief Creates an OH_Drawing_Canvas object.
*
@@ -57,60 +76,81 @@ OH_Drawing_Canvas* OH_Drawing_CanvasCreate(void);
* @brief Destroys an OH_Drawing_Canvas object and reclaims the memory occupied by the object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
* @since 8
* @version 1.0
*/
void OH_Drawing_CanvasDestroy(OH_Drawing_Canvas*);
/**
- * @brief Binds a bitmap to a canvas so that the content drawn on the canvas is output to the bitmap (this process is called CPU rendering).
+ * @brief Binds a bitmap to a canvas so that the content drawn on the canvas is output to the bitmap.
+ * (This process is called CPU rendering.)
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_Bitmap is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object.
- * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object.
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_Bitmap Pointer to an OH_Drawing_Bitmap object.
* @since 8
* @version 1.0
*/
void OH_Drawing_CanvasBind(OH_Drawing_Canvas*, OH_Drawing_Bitmap*);
/**
- * @brief Attaches a pen to a canvas so that the canvas will use the style and color of the pen to outline a shape.
+ * @brief Attaches a pen to a canvas so that the canvas can use the style and color of the pen to outline a shape.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_Pen is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object.
- * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object.
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object.
* @since 8
* @version 1.0
*/
void OH_Drawing_CanvasAttachPen(OH_Drawing_Canvas*, const OH_Drawing_Pen*);
/**
- * @brief Detaches the pen from a canvas so that the canvas will not use the style and color of the pen to outline a shape.
+ * @brief Detaches the pen from a canvas so that the canvas can no longer use the style and color of the pen
+ * to outline a shape.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Canvas is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
* @since 8
* @version 1.0
*/
void OH_Drawing_CanvasDetachPen(OH_Drawing_Canvas*);
/**
- * @brief Attaches a brush to a canvas so that the canvas will use the style and color of the brush to fill in a shape.
+ * @brief Attaches a brush to a canvas so that the canvas can use the style and color of the brush to fill in a shape.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_Brush is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object.
- * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object.
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_Brush Pointer to an OH_Drawing_Brush object.
* @since 8
* @version 1.0
*/
void OH_Drawing_CanvasAttachBrush(OH_Drawing_Canvas*, const OH_Drawing_Brush*);
/**
- * @brief Detaches the brush from a canvas so that the canvas will not use the style and color of the brush to fill in a shape.
+ * @brief Detaches the brush from a canvas so that the canvas can no longer use the previously set brush
+ * to fill in a shape.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Canvas is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
* @since 8
* @version 1.0
*/
@@ -119,32 +159,91 @@ void OH_Drawing_CanvasDetachBrush(OH_Drawing_Canvas*);
/**
* @brief Saves the current canvas status (canvas matrix) to the top of the stack.
*
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Canvas is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
* @since 8
* @version 1.0
*/
void OH_Drawing_CanvasSave(OH_Drawing_Canvas*);
+/**
+ * @brief Saves the matrix and cropping region, and allocates a bitmap for subsequent drawing. If you call
+ * {@link OH_Drawing_CanvasRestore}, the changes made to the matrix and clipping region are discarded,
+ * and the bitmap is drawn.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Canvas is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @param OH_Drawing_Rect Pointer to an {@link OH_Drawing_Rect} object, which is used to limit the size of
+ * the graphics layer. If NULL is passed in, the size is not limited.
+ * @param OH_Drawing_Brush Pointer to an {@link OH_Drawing_Brush} object. The alpha value, filter effect, and blend mode
+ * of the brush are applied when the bitmap is drawn. If NULL is passed in, no effect is applied.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_CanvasSaveLayer(OH_Drawing_Canvas*, const OH_Drawing_Rect*, const OH_Drawing_Brush*);
+
/**
* @brief Restores the canvas status (canvas matrix) saved on the top of the stack.
*
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Canvas is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
* @since 8
* @version 1.0
*/
void OH_Drawing_CanvasRestore(OH_Drawing_Canvas*);
+/**
+ * @brief Obtains the number of canvas statuses (canvas matrices) saved in the stack.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Canvas is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @return Returns a 32-bit value that describes the number of canvas statuses (canvas matrices).
+ * The initial number is 1.
+ * @since 11
+ * @version 1.0
+ */
+uint32_t OH_Drawing_CanvasGetSaveCount(OH_Drawing_Canvas*);
+
+/**
+ * @brief Restores to a given number of canvas statuses (canvas matrices).
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Canvas is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param saveCount Number of canvas statuses (canvas matrices).
+ * If the value is less than or equal to 1, the canvas is restored to the initial state.
+ * If the value is greater than the number of canvas statuses that have been saved, no operation is performed.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_CanvasRestoreToCount(OH_Drawing_Canvas*, uint32_t saveCount);
+
/**
* @brief Draws a line segment.
*
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Canvas is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object.
- * @param x1 Indicates the x coordinate of the start point of the line segment.
- * @param y1 Indicates the y coordinate of the start point of the line segment.
- * @param x2 Indicates the x coordinate of the end point of the line segment.
- * @param y2 Indicates the y coordinate of the end point of the line segment.
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param x1 X coordinate of the start point of the line segment.
+ * @param y1 Y coordinate of the start point of the line segment.
+ * @param x2 X coordinate of the end point of the line segment.
+ * @param y2 Y coordinate of the end point of the line segment.
* @since 8
* @version 1.0
*/
@@ -153,25 +252,814 @@ void OH_Drawing_CanvasDrawLine(OH_Drawing_Canvas*, float x1, float y1, float x2,
/**
* @brief Draws a path.
*
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_Path is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object.
- * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object.
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_Path Pointer to an OH_Drawing_Path object.
* @since 8
* @version 1.0
*/
void OH_Drawing_CanvasDrawPath(OH_Drawing_Canvas*, const OH_Drawing_Path*);
/**
- * @brief Clears a canvas by using a specified color.
+ * @brief Draws a portion of a pixel map onto a specified area of the canvas.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If any of OH_Drawing_Canvas, OH_Drawing_PixelMap, and dst is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @param OH_Drawing_PixelMap Pointer to an {@link OH_Drawing_PixelMap} object.
+ * @param src Pointer to a rectangle on the pixel map. If NULL is passed in, it refers to the entire pixel map.
+ * @param dst Pointer to a rectangle on the canvas.
+ * @param OH_Drawing_SamplingOptions Pointer to an {@link OH_Drawing_SamplingOptions} object.
+ * If NULL is passed in, the default sampling options are used.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_CanvasDrawPixelMapRect(OH_Drawing_Canvas*, OH_Drawing_PixelMap*, const OH_Drawing_Rect* src,
+ const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions*);
+
+/**
+ * @brief Draws a background filled with a brush.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_Brush is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_Brush Pointer to an OH_Drawing_Brush object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_CanvasDrawBackground(OH_Drawing_Canvas*, const OH_Drawing_Brush*);
+
+/**
+ * @brief Draws a region.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_Region is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_Region Pointer to an OH_Drawing_Region object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_CanvasDrawRegion(OH_Drawing_Canvas*, const OH_Drawing_Region*);
+
+/**
+ * @brief Enumerates the modes of drawing multiple points.
+ * The modes include discrete points, line segments, and open polygons.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_Drawing_PointMode {
+ /**
+ * Draws each point separately.
+ */
+ POINT_MODE_POINTS,
+ /**
+ * Draws every two points as a line segment.
+ */
+ POINT_MODE_LINES,
+ /**
+ * Draws an array of points as an open polygon.
+ */
+ POINT_MODE_POLYGON,
+} OH_Drawing_PointMode;
+
+/**
+ * @brief Draws a point.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @param point Pointer to an {@link OH_Drawing_Point2D} object.
+ * @return Returns either of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if either canvas or point is NULL.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_CanvasDrawPoint(OH_Drawing_Canvas* canvas, const OH_Drawing_Point2D* point);
+
+/**
+ * @brief Draws multiple points. You can draw a single point, a line segment, or an open polygon.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_Point2D is NULL or count is 0,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned. If mode is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param mode Mode of drawing multiple points.
+ * For details about the available options, see {@link OH_Drawing_PointMode}.
+ * @param count Number of vertices, that is, the number of vertices in the vertex array.
+ * @param OH_Drawing_Point2D Pointer to an array holding the vertices.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_CanvasDrawPoints(OH_Drawing_Canvas*, OH_Drawing_PointMode mode,
+ uint32_t count, const OH_Drawing_Point2D*);
+
+/**
+ * @brief Draws a bitmap. A bitmap, also referred to as a dot matrix image, a pixel map image, or a grid image,
+ * includes single points called pixels (image elements).
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_Bitmap is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_Bitmap Pointer to an OH_Drawing_Bitmap object.
+ * @param left X coordinate of the upper left corner of the bitmap.
+ * @param top Y coordinate of the upper left corner of the bitmap.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_CanvasDrawBitmap(OH_Drawing_Canvas*, const OH_Drawing_Bitmap*, float left, float top);
+
+/**
+ * @brief Draws a portion of a bitmap onto a specified area of the canvas.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If any of OH_Drawing_Canvas, OH_Drawing_Bitmap, and dst is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object.
- * @param color Indicates the color, which is a 32-bit (ARGB) variable.
+ * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @param OH_Drawing_Bitmap Pointer to an {@link OH_Drawing_Bitmap} object.
+ * @param src Pointer to a rectangle on the bitmap. If NULL is passed in, it refers to the entire bitmap.
+ * @param dst Pointer to a rectangle on the canvas.
+ * @param OH_Drawing_SamplingOptions Pointer to an {@link OH_Drawing_SamplingOptions} object.
+ * If NULL is passed in, the default sampling options are used.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_CanvasDrawBitmapRect(OH_Drawing_Canvas*, const OH_Drawing_Bitmap*, const OH_Drawing_Rect* src,
+ const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions*);
+
+/**
+ * @brief Sets the matrix status for a canvas.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_Matrix is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object,
+ * which is obtained by calling {@link OH_Drawing_MatrixCreate}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_CanvasSetMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*);
+
+/**
+ * @brief Resets the matrix of a canvas to an identity matrix.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Canvas is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_CanvasResetMatrix(OH_Drawing_Canvas*);
+
+/**
+ * @brief Draws a portion of an image onto a specified area of the canvas.
+ * The area selected by the source rectangle is scaled and translated to the destination rectangle.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If any of OH_Drawing_Canvas, OH_Drawing_Image, src, and dst is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @param OH_Drawing_Image Pointer to an {@link OH_Drawing_Image} object.
+ * @param src Pointer to a source rectangle, which is an {@link OH_Drawing_Rect} object.
+ * @param dst Pointer to a destination rectangle, which is an {@link OH_Drawing_Rect} object.
+ * @param OH_Drawing_SamplingOptions Pointer to an {@link OH_Drawing_SamplingOptions} object.
+ * If NULL is passed in, the default sampling options are used.
+ * @param OH_Drawing_SrcRectConstraint Constraint type.
+ * For details about the available options, see {@link OH_Drawing_SrcRectConstraint}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_CanvasDrawImageRectWithSrc(OH_Drawing_Canvas*, const OH_Drawing_Image*,
+ const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions*,
+ OH_Drawing_SrcRectConstraint);
+
+/**
+ * @brief Draws an image onto a specified area of the canvas.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If any of OH_Drawing_Canvas, OH_Drawing_Image, and dst is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @param OH_Drawing_Image Pointer to an {@link OH_Drawing_Image} object.
+ * @param dst Pointer to an {@link OH_Drawing_Rect} object.
+ * @param OH_Drawing_SamplingOptions Pointer to an {@link OH_Drawing_SamplingOptions} object.
+ * If NULL is passed in, the default sampling options are used.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_CanvasDrawImageRect(OH_Drawing_Canvas*, OH_Drawing_Image*,
+ OH_Drawing_Rect* dst, OH_Drawing_SamplingOptions*);
+
+/**
+ * @brief Enumerates the modes of interpreting the geometry of a given vertex.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_Drawing_VertexMode {
+ /**
+ * Draws a triangle list. Specifically, a list of isolated triangles are drawn using every three vertices.
+ * If the number of vertices is not a multiple of 3, the extra vertices will be ignored.
+ */
+ VERTEX_MODE_TRIANGLES,
+ /**
+ * Draws a triangle strip. Specifically, the first triangle is drawn between the first 3 vertices,
+ * and all subsequent triangles use the previous 2 vertices plus the next additional vertex.
+ */
+ VERTEX_MODE_TRIANGLESSTRIP,
+ /**
+ * Draws a triangle fan. A triangle fan is similar to a triangle strip, except that all the triangles share
+ * one vertex (the first vertex).
+ */
+ VERTEX_MODE_TRIANGLEFAN,
+} OH_Drawing_VertexMode;
+
+/**
+ * @brief Draws a triangular grid described by a vertex array.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or positions is null, vertexCount is less than 3,
+ * or indexCount is less than 3 but not 0, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If either vertexMmode or mode is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param vertexMmode Vertex drawing mode. For details about the available options, see {@link OH_Drawing_VertexMode}.
+ * @param vertexCount Number of elements in the vertex array. The value must be greater than or equal to 3.
+ * @param positions Pointer to the array that holds the position of every vertex. The array cannot be null and
+ * its length must be equal to the value of vertexCount.
+ * @param texs Pointer to the array that holds the texture space coordinate corresponding to each vertex.
+ * The array can be null. If the array is not null, its length must be equal to the value of vertexCount.
+ * @param colors Pointer to the array that holds the color corresponding to each vertex.
+ * It is used for interpolation in a triangle. The array can be null. If the array is not null,
+ * its length must be equal to the value of vertexCount.
+ * @param indexCount Number of indexes. The value can be 0 or a value greater than or equal to 3.
+ * @param indices Pointer to the array that holds the index of each vertex. The array can be null.
+ * If the array is not null, its length must be equal to the value of indexCount.
+ * @param mode Blend mode. For details about the available options, see {@link OH_Drawing_BlendMode}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_CanvasDrawVertices(OH_Drawing_Canvas*, OH_Drawing_VertexMode vertexMmode,
+ int32_t vertexCount, const OH_Drawing_Point2D* positions, const OH_Drawing_Point2D* texs,
+ const uint32_t* colors, int32_t indexCount, const uint16_t* indices, OH_Drawing_BlendMode mode);
+
+/**
+ * @brief Copies pixel data from a canvas to a specified address. This function cannot be used for recorded canvases.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If any of OH_Drawing_Canvas, OH_Drawing_Image_Info, and dstPixels is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @param OH_Drawing_Image_Info Pointer to an {@link OH_Drawing_Image_Info} object.
+ * @param dstPixels Pointer to the start address for storing the pixel data.
+ * @param dstRowBytes Size of pixels per row.
+ * @param srcX X-axis offset of the pixels on the canvas, in px.
+ * @param srcY Y-axis offset of the pixels on the canvas, in px.
+ * @return Returns true if the pixel data is copied to the start address of the storage;
+ * returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_CanvasReadPixels(OH_Drawing_Canvas*, OH_Drawing_Image_Info*,
+ void* dstPixels, uint32_t dstRowBytes, int32_t srcX, int32_t srcY);
+
+/**
+ * @brief Copies pixel data from a canvas to an image. This function cannot be used for recorded canvases.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_Bitmap is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @param OH_Drawing_Bitmap Pointer to an {@link OH_Drawing_Bitmap} object.
+ * @param srcX X-axis offset of the pixels on the canvas, in px.
+ * @param srcY Y-axis offset of the pixels on the canvas, in px.
+ * @return Returns true if the pixel data is copied to the image; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_CanvasReadPixelsToBitmap(OH_Drawing_Canvas*, OH_Drawing_Bitmap*, int32_t srcX, int32_t srcY);
+
+/**
+ * @brief Checks whether the region that can be drawn is empty after cropping.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @param isClipEmpty Pointer to the variable that specifies whether the region is empty.
+ * The value true means that the region is empty, and false means the opposite.
+ * @return Returns either of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if either canvas or isClipEmpty is NULL.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_CanvasIsClipEmpty(OH_Drawing_Canvas* canvas, bool* isClipEmpty);
+
+/**
+ * @brief Obtains the image information of a canvas.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @param imageInfo Pointer to an {@link OH_Drawing_Image_Info} object.
+ * @return Returns either of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if either canvas or imageInfo is NULL.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_CanvasGetImageInfo(OH_Drawing_Canvas* canvas, OH_Drawing_Image_Info* imageInfo);
+
+/**
+ * @brief Draws a rectangle.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_Rect is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_Rect Pointer to an OH_Drawing_Rect object.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_CanvasDrawRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*);
+
+/**
+ * @brief Draws a circle.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_Point is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If radius is less than or equal to 0, OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_Point Pointer to an OH_Drawing_Point object, which indicates the center of the circle.
+ * @param radius Radius of the circle.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_CanvasDrawCircle(OH_Drawing_Canvas*, const OH_Drawing_Point*, float radius);
+
+/**
+ * @brief Fills the entire canvas with the specified color and blend mode.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @param color Color.
+ * @param blendMode Blend mode.
+ * @return Returns either of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if canvas is NULL.
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE if blendMode is not set to one of the enumerated values.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_CanvasDrawColor(OH_Drawing_Canvas* canvas, uint32_t color,
+ OH_Drawing_BlendMode blendMode);
+
+/**
+ * @brief Draws an oval.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_Rect is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_Rect Pointer to an OH_Drawing_Rect object.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_CanvasDrawOval(OH_Drawing_Canvas*, const OH_Drawing_Rect*);
+
+/**
+ * @brief Draws an arc.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_Rect is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_Rect Pointer to an OH_Drawing_Rect object.
+ * @param startAngle Start angle of the arc.
+ * @param sweepAngle Sweep angle of the arc.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_CanvasDrawArc(OH_Drawing_Canvas*, const OH_Drawing_Rect*, float startAngle, float sweepAngle);
+
+/**
+ * @brief Draws a rounded rectangle.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_RoundRect is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_RoundRect Pointer to an OH_Drawing_RoundRect object.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_CanvasDrawRoundRect(OH_Drawing_Canvas*, const OH_Drawing_RoundRect*);
+
+/**
+ * @brief Draws a single character.
+ * If the typeface of the current font does not support the character to draw, the system typeface is used to
+ * draw the character.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @param str Pointer to the single character to draw. A string can be passed in, but only the first character
+ * in the string is parsed and drawn in UTF-8 encoding.
+ * @param font Pointer to an {@link OH_Drawing_Font} object.
+ * @param x X coordinate of the left point of the character baseline.
+ * @param y Y coordinate of the left point of the character baseline.
+ * @return Returns either of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if at least one of the parameters canvas, str,
+ * or font is NULL, or the length of str is 0.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_CanvasDrawSingleCharacter(OH_Drawing_Canvas* canvas, const char* str,
+ const OH_Drawing_Font* font, float x, float y);
+
+/**
+ * @brief Draws a text blob.
+ * If the typeface used to construct OH_Drawing_TextBlob does not support a character,
+ * that character will not be drawn.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_TextBlob is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_TextBlob Pointer to an OH_Drawing_TextBlob object.
+ * @param x X coordinate of the left point of the text baseline.
+ * @param y Y coordinate of the left point of the text baseline.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_CanvasDrawTextBlob(OH_Drawing_Canvas*, const OH_Drawing_TextBlob*, float x, float y);
+
+/**
+ * @brief Enumerates the canvas clipping modes.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef enum OH_Drawing_CanvasClipOp {
+ /**
+ * Clips a specified area. That is, the difference set is obtained.
+ */
+ DIFFERENCE,
+ /**
+ * Retains a specified area. That is, the intersection is obtained.
+ */
+ INTERSECT,
+} OH_Drawing_CanvasClipOp;
+
+/**
+ * @brief Clips a rectangle.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_Rect is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned. If clipOp is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_Rect Pointer to an OH_Drawing_Rect object.
+ * @param clipOp Clip mode. For details about the available options, see @{link OH_Drawing_CanvasClipOp}.
+ * @param doAntiAlias Whether to enable anti-aliasing. The value true means to enable anti-aliasing,
+ * and false means the opposite.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_CanvasClipRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*,
+ OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias);
+
+/**
+ * @brief Clips a rounded rectangle.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_RoundRect is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned. If clipOp is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_RoundRect Pointer to an OH_Drawing_RoundRect object.
+ * @param clipOp Clip mode. For details about the available options, see @{link OH_Drawing_CanvasClipOp}.
+ * @param doAntiAlias Whether to perform anti-aliasing. The value true means to perform anti-aliasing,
+ * and false means the opposite.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_CanvasClipRoundRect(OH_Drawing_Canvas*, const OH_Drawing_RoundRect*,
+ OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias);
+
+/**
+ * @brief Clips a path.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_Path is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned. If clipOp is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_Path Pointer to an OH_Drawing_Path object.
+ * @param clipOp Clip mode. For details about the available options, see @{link OH_Drawing_CanvasClipOp}.
+ * @param doAntiAlias Whether to enable anti-aliasing. The value true means to enable anti-aliasing,
+ * and false means the opposite.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_CanvasClipPath(OH_Drawing_Canvas*, const OH_Drawing_Path*,
+ OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias);
+
+/**
+ * @brief Clips a rectangle.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @param region Pointer to an {@link OH_Drawing_Region} object.
+ * @param clipOp Clipping mode.
+ * @return Returns either of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if either canvas or region is NULL.
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE if clipOp is not set to one of the enumerated values.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_CanvasClipRegion(OH_Drawing_Canvas* canvas, const OH_Drawing_Region* region,
+ OH_Drawing_CanvasClipOp clipOp);
+
+/**
+ * @brief Rotates a canvas by a given angle. A positive number indicates a clockwise rotation,
+ * and a negative number indicates a counterclockwise rotation.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Canvas is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param degrees Angle to rotate.
+ * @param px X coordinate of the rotation point.
+ * @param py Y coordinate of the rotation point.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_CanvasRotate(OH_Drawing_Canvas*, float degrees, float px, float py);
+
+/**
+ * @brief Translates a canvas by a given distance.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Canvas is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param dx Distance to translate on the X axis.
+ * @param dy Distance to translate on the Y axis.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_CanvasTranslate(OH_Drawing_Canvas*, float dx, float dy);
+
+/**
+ * @brief Scales a canvas.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Canvas is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param sx Scale factor on the X axis.
+ * @param sy Scale factor on the Y axis.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_CanvasScale(OH_Drawing_Canvas*, float sx, float sy);
+
+/**
+ * @brief Skews a canvas.
+ * This API premultiplies the current canvas matrix by a skew transformation matrix and applies the resulting matrix to
+ * the canvas. The skew transformation matrix is as follows:
+ * |1 sx 0|
+ * |sy 1 0|
+ * | 0 0 1 |
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Canvas is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param sx Amount of tilt on the X axis.
+ * A positive number tilts the drawing rightwards along the positive direction of the Y axis,
+ * and a negative number tilts the drawing leftwards along the positive direction of the Y axis.
+ * @param sy Amount of tilt on the Y axis.
+ * A positive number tilts the drawing downwards along the positive direction of the X axis,
+ * and a negative number tilts the drawing upwards along the positive direction of the X axis.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_CanvasSkew(OH_Drawing_Canvas*, float sx, float sy);
+
+/**
+ * @brief Clears a canvas by using a given color.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Canvas is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object.
+ * @param color Color, which is a 32-bit (ARGB) variable.
* @since 8
* @version 1.0
*/
void OH_Drawing_CanvasClear(OH_Drawing_Canvas*, uint32_t color);
+/**
+ * @brief Obtains the canvas width.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Canvas is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @return Returns the canvas width, in px.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_Drawing_CanvasGetWidth(OH_Drawing_Canvas*);
+
+/**
+ * @brief Obtains the canvas width.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Canvas is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @return Returns the canvas height, in px.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_Drawing_CanvasGetHeight(OH_Drawing_Canvas*);
+
+/**
+ * @brief Obtains the bounds of the cropping region of a canvas. This function cannot be used for recorded canvases.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_Rect is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @param OH_Drawing_Rect Pointer to an {@link OH_Drawing_Rect} object,
+ * which is obtained by calling {@link OH_Drawing_RectCreate}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_CanvasGetLocalClipBounds(OH_Drawing_Canvas*, OH_Drawing_Rect*);
+
+/**
+ * @brief Obtains the 3x3 matrix of a canvas.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_Matrix is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object,
+ * which is obtained by calling {@link OH_Drawing_MatrixCreate}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_CanvasGetTotalMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*);
+
+/**
+ * @brief Preconcats the existing matrix with the passed-in matrix.
+ * The drawing operation triggered before this function is called is not affected.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_Matrix is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_CanvasConcatMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*);
+
+/**
+ * @brief Enumerates the canvas shadow flags.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_Drawing_CanvasShadowFlags {
+ /**
+ * There is no shadow flag.
+ */
+ SHADOW_FLAGS_NONE,
+ /**
+ * The occluding object is transparent.
+ */
+ SHADOW_FLAGS_TRANSPARENT_OCCLUDER,
+ /**
+ * No analysis on the shadows is required.
+ */
+ SHADOW_FLAGS_GEOMETRIC_ONLY,
+ /**
+ * All the preceding shadow flags are used.
+ */
+ SHADOW_FLAGS_ALL,
+} OH_Drawing_CanvasShadowFlags;
+
+/**
+ * @brief Draws an offset spot shadow and uses a given path to outline the ambient shadow.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Canvas or OH_Drawing_Path is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned. If flag is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object, which is used to generate the shadow.
+ * @param planeParams Value of the function that returns the Z-axis of the occluding object from the canvas based on
+ * the x-axis and y-axis.
+ * @param devLightPos Position of the light relative to the canvas.
+ * @param lightRadius Radius of the light.
+ * @param ambientColor Color of the ambient shadow.
+ * @param spotColor Color of the spot shadow.
+ * @param flag Shadow flag. For details about the available options, see {@link OH_Drawing_CanvasShadowFlags}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_CanvasDrawShadow(OH_Drawing_Canvas*, OH_Drawing_Path*, OH_Drawing_Point3D planeParams,
+ OH_Drawing_Point3D devLightPos, float lightRadius, uint32_t ambientColor, uint32_t spotColor,
+ OH_Drawing_CanvasShadowFlags flag);
+
+/**
+ * @brief Draws an {@link OH_Drawing_RecordCmd} object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param canvas Pointer to an {@link OH_Drawing_Canvas} object. Only a canvas of the recording type is supported.
+ * @param recordCmd Pointer to the {@link OH_Drawing_RecordCmd} object.
+ * @return Returns either of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if either canvas or recordCmd is NULL.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_CanvasDrawRecordCmd(OH_Drawing_Canvas* canvas, OH_Drawing_RecordCmd* recordCmd);
+
#ifdef __cplusplus
}
#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_color.h b/en/native_sdk/graphic/native_drawing/drawing_color.h
index 2aef98513a80ad2d680253fcee5cb9fe0b32a6f8..e8784dff1c4746f3552224d167988fd0459baa22 100644
--- a/en/native_sdk/graphic/native_drawing/drawing_color.h
+++ b/en/native_sdk/graphic/native_drawing/drawing_color.h
@@ -20,8 +20,9 @@
* @addtogroup Drawing
* @{
*
- * @brief Provides functions such as 2D graphics rendering, text drawing, and image display.
- *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
*
* @since 8
@@ -31,8 +32,10 @@
/**
* @file drawing_color.h
*
- * @brief Declares functions related to the color object in the drawing module.
+ * @brief Declares the functions related to the color in the drawing module.
*
+ * File to include: native_drawing/drawing_color.h
+ * @library libnative_drawing.so
* @since 8
* @version 1.0
*/
@@ -47,10 +50,10 @@ extern "C" {
* @brief Converts four variables (alpha, red, green, and blue) into a 32-bit (ARGB) variable that describes a color.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param alpha Indicates a variable that describes alpha. The value ranges from 0x00 to 0xFF.
- * @param red Indicates a variable that describes red. The value ranges from 0x00 to 0xFF.
- * @param green Indicates a variable that describes green. The value ranges from 0x00 to 0xFF.
- * @param blue Indicates a variable that describes blue. The value ranges from 0x00 to 0xFF.
+ * @param alpha Alpha, which is a variable ranging from 0x00 to 0xFF.
+ * @param red Read, which is a variable ranging from 0x00 to 0xFF.
+ * @param green Green, which is a variable ranging from 0x00 to 0xFF.
+ * @param blue Blue, which is a variable ranging from 0x00 to 0xFF.
* @return Returns a 32-bit (ARGB) variable that describes the color.
* @since 8
* @version 1.0
diff --git a/en/native_sdk/graphic/native_drawing/drawing_color_filter.h b/en/native_sdk/graphic/native_drawing/drawing_color_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..17a02807f03737ab0b9a99e7f3ac863cc7f0f730
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_color_filter.h
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_COLOR_FILTER_H
+#define C_INCLUDE_DRAWING_COLOR_FILTER_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_color_filter.h
+ *
+ * @brief Declares the functions related to the color filter in the drawing module.
+ *
+ * File to include: native_drawing/drawing_color_filter.h
+ * @library libnative_drawing.so
+ * @since 11
+ * @version 1.0
+ */
+
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates an OH_Drawing_ColorFilter object with a given blend mode.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param color Color, which is a 32-bit (ARGB) variable.
+ * @param OH_Drawing_BlendMode Blend mode. For details about the available options, see {@link OH_Drawing_BlendMode}.
+ * @return Returns the pointer to the OH_Drawing_ColorFilter object created.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateBlendMode(uint32_t color, OH_Drawing_BlendMode);
+
+/**
+ * @brief Creates an OH_Drawing_ColorFilter object by combining another two color filters.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either colorFilter1 or colorFilter2 is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param colorFilter1 Pointer to the first color filter.
+ * @param colorFilter2 Pointer to the second color filter.
+ * @return Returns the pointer to the OH_Drawing_ColorFilter object created.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateCompose(OH_Drawing_ColorFilter* colorFilter1,
+ OH_Drawing_ColorFilter* colorFilter2);
+
+/**
+ * @brief Creates an OH_Drawing_ColorFilter object with a given 5x4 color matrix.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If matrix is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param matrix Matrix, which is represented by a floating-point array with a length of 20.
+ * @return Returns the pointer to the OH_Drawing_ColorFilter object created.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateMatrix(const float matrix[20]);
+
+/**
+ * @brief Creates an OH_Drawing_ColorFilter object that applies the sRGB gamma curve to the RGB channels.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the OH_Drawing_ColorFilter object created.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLinearToSrgbGamma(void);
+
+/**
+ * @brief Creates an OH_Drawing_ColorFilter object that applies the RGB channels to the sRGB gamma curve.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the OH_Drawing_ColorFilter object created.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateSrgbGammaToLinear(void);
+
+/**
+ * @brief Creates an OH_Drawing_ColorFilter object that multiplies the passed-in luma into the alpha channel
+ * and sets the RGB channels to zero.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the OH_Drawing_ColorFilter object created.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLuma(void);
+
+/**
+ * @brief Destroys an OH_Drawing_ColorFilter object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_ColorFilter Pointer to an OH_Drawing_ColorFilter object.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_ColorFilterDestroy(OH_Drawing_ColorFilter*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_color_space.h b/en/native_sdk/graphic/native_drawing/drawing_color_space.h
new file mode 100644
index 0000000000000000000000000000000000000000..84cf9e1ba0b8416e8875f4e46c42cc67a8eee0c9
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_color_space.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_COLOR_SPACE_H
+#define C_INCLUDE_DRAWING_COLOR_SPACE_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_color_space.h
+ *
+ * @brief Declares the functions related to the color space in the drawing module.
+ *
+ * File to include: native_drawing/drawing_color_space.h
+ * @library libnative_drawing.so
+ * @since 12
+ * @version 1.0
+ */
+
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates an sRGB color space.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the {@link OH_Drawing_ColorSpace} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ColorSpace* OH_Drawing_ColorSpaceCreateSrgb(void);
+
+/**
+ * @brief Creates an sRGB linear (Gamma 1.0) color space.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the {@link OH_Drawing_ColorSpace} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ColorSpace* OH_Drawing_ColorSpaceCreateSrgbLinear(void);
+
+/**
+ * @brief Destroys an OH_Drawing_ColorSpace object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_ColorSpace Pointer to an {@link OH_Drawing_ColorSpace} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_ColorSpaceDestroy(OH_Drawing_ColorSpace*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_error_code.h b/en/native_sdk/graphic/native_drawing/drawing_error_code.h
new file mode 100644
index 0000000000000000000000000000000000000000..94735ce80ade61a9c019de52341be1ec3a5f3fb0
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_error_code.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_ERROR_CODE_H
+#define C_INCLUDE_DRAWING_ERROR_CODE_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_error_code.h
+ *
+ * @brief Declares the functions related to the error code in the drawing module.
+ *
+ * File to include: native_drawing/drawing_error_code.h
+ * @library libnative_drawing.so
+ * @since 12
+ * @version 1.0
+ */
+
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Enumerates the error codes that may be generated by the module.
+ * @since 12
+ */
+typedef enum OH_Drawing_ErrorCode {
+ /**
+ * @error Operation successful.
+ */
+ OH_DRAWING_SUCCESS = 0,
+ /**
+ * @error Permission verification failed.
+ */
+ OH_DRAWING_ERROR_NO_PERMISSION = 201,
+ /**
+ * @error Invalid input parameter. For example, NULL is passed in.
+ */
+ OH_DRAWING_ERROR_INVALID_PARAMETER = 401,
+ /**
+ * @error The input parameter is not in the valid range.
+ */
+ OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE = 26200001,
+ /**
+ * @error Failed to allocate memory.
+ * @since 13
+ */
+ OH_DRAWING_ERROR_ALLOCATION_FAILED = 26200002,
+} OH_Drawing_ErrorCode;
+
+/**
+ * @brief Obtains the error code of the module.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Obtains the latest error code of the module.
+ * After the function is successfully executed, the error code returned by this function will not be modified.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_ErrorCodeGet();
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_filter.h b/en/native_sdk/graphic/native_drawing/drawing_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..506ba46dd0402c48b6d49d7628390c5bde052fea
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_filter.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_FILTER_H
+#define C_INCLUDE_DRAWING_FILTER_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_filter.h
+ *
+ * @brief Declares the functions related to the filter in the drawing module.
+ *
+ * File to include: native_drawing/drawing_filter.h
+ * @library libnative_drawing.so
+ * @since 11
+ * @version 1.0
+ */
+
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates an OH_Drawing_Filter object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the OH_Drawing_Filter object created.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_Filter* OH_Drawing_FilterCreate(void);
+
+/**
+ * @brief Sets an OH_Drawing_ImageFilter object for an OH_Drawing_Filter object.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Filter is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Filter Pointer to an {@link OH_Drawing_Filter} object.
+ * @param OH_Drawing_ImageFilter Pointer to an {@link OH_Drawing_ImageFilter} object.
+ * If NULL is passed in, the image filter effect of the object will be cleared.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_FilterSetImageFilter(OH_Drawing_Filter*, OH_Drawing_ImageFilter*);
+
+/**
+ * @brief Sets an OH_Drawing_MaskFilter object for an OH_Drawing_Filter object.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Filter is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Filter Pointer to an {@link OH_Drawing_Filter} object.
+ * @param OH_Drawing_MaskFilter Pointer to an {@link OH_Drawing_ColorFilter} object.
+ * If NULL is passed in, the mask filter effect of the object will be cleared.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_FilterSetMaskFilter(OH_Drawing_Filter*, OH_Drawing_MaskFilter*);
+
+/**
+ * @brief Sets an OH_Drawing_ColorFilter object for an OH_Drawing_Filter object.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Filter is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Filter Pointer to an {@link OH_Drawing_Filter} object.
+ * @param OH_Drawing_ColorFilter Pointer to an {@link OH_Drawing_ColorFilter} object.
+ * If NULL is passed in, the color filter effect of the object will be cleared.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_FilterSetColorFilter(OH_Drawing_Filter*, OH_Drawing_ColorFilter*);
+
+/**
+ * @brief Obtains an OH_Drawing_ColorFilter object from an OH_Drawing_Filter object.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Filter or OH_Drawing_ColorFilter is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Filter Pointer to an {@link OH_Drawing_Filter} object.
+ * @param OH_Drawing_ColorFilter Pointer to the {@link OH_Drawing_ColorFilter} object obtained.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_FilterGetColorFilter(OH_Drawing_Filter*, OH_Drawing_ColorFilter*);
+
+/**
+ * @brief Destroys an OH_Drawing_Filter object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Filter Pointer to an {@link OH_Drawing_Filter} object.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_FilterDestroy(OH_Drawing_Filter*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_font.h b/en/native_sdk/graphic/native_drawing/drawing_font.h
new file mode 100644
index 0000000000000000000000000000000000000000..7fd9b4f4483c709936da69ba68cc0f7c4316786f
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_font.h
@@ -0,0 +1,706 @@
+/*
+ * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_FONT_H
+#define C_INCLUDE_DRAWING_FONT_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_font.h
+ *
+ * @brief Declares the functions related to the font in the drawing module.
+ *
+ * File to include: native_drawing/drawing_font.h
+ * @library libnative_drawing.so
+ * @since 11
+ * @version 1.0
+ */
+
+#include "drawing_error_code.h"
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Enumerates the font edging types.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_Drawing_FontEdging {
+ /** No anti-aliasing processing is used. */
+ FONT_EDGING_ALIAS,
+ /** Uses anti-aliasing to smooth the jagged edges. */
+ FONT_EDGING_ANTI_ALIAS,
+ /** Uses sub-pixel anti-aliasing to provide a smoother effect for jagged edges. */
+ FONT_EDGING_SUBPIXEL_ANTI_ALIAS,
+} OH_Drawing_FontEdging;
+
+/**
+ * @brief Enumerates the font hinting types.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_Drawing_FontHinting {
+ /** No font hinting is used. */
+ FONT_HINTING_NONE,
+ /** Slight font hinting is used to improve contrast. */
+ FONT_HINTING_SLIGHT,
+ /** Normal font hinting is used to improve contrast. */
+ FONT_HINTING_NORMAL,
+ /** Full font hinting is used to improve contrast. */
+ FONT_HINTING_FULL,
+} OH_Drawing_FontHinting;
+
+/**
+ * @brief Sets whether to request that baselines be snapped to pixels when the current canvas matrix is axis aligned.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @param baselineSnap Whether to request that baselines be snapped to pixels.
+ * The value true means to request that baselines be snapped to pixels, and false means the opposite.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_FontSetBaselineSnap(OH_Drawing_Font*, bool baselineSnap);
+
+/**
+ * @brief Checks whether baselines are requested to be snapped to pixels when the current canvas matrix is axis aligned.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @return Returns true if baselines are requested to be snapped to pixels when the current canvas matrix is
+ * axis aligned; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_FontIsBaselineSnap(const OH_Drawing_Font*);
+
+/**
+ * @brief Sets a font edging effect.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_FontEdging is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @param OH_Drawing_FontEdging Font edging effect.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_FontSetEdging(OH_Drawing_Font*, OH_Drawing_FontEdging);
+
+/**
+ * @brief Obtains the font edging effect.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @return Returns the font edging effect.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontEdging OH_Drawing_FontGetEdging(const OH_Drawing_Font*);
+
+/**
+ * @brief Sets whether to forcibly use auto hinting, that is, whether to always hint glyphs.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @param isForceAutoHinting Whether to forcibly use auto hinting.
+ * The value true means to forcibly use auto hinting, and false means the opposite.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_FontSetForceAutoHinting(OH_Drawing_Font*, bool isForceAutoHinting);
+
+/**
+ * @brief Checks whether auto hinting is forcibly used.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @return Returns true if auto hinting is forcibly used; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_FontIsForceAutoHinting(const OH_Drawing_Font*);
+
+/**
+ * @brief Sets whether to use sub-pixel rendering for a font.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @param isSubpixel Whether to use sub-pixel rendering for the font.
+ * The value true means to use sub-pixel rendering for the font, and false means the opposite.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_FontSetSubpixel(OH_Drawing_Font*, bool isSubpixel);
+
+/**
+ * @brief Checks whether sub-pixel rendering is used for a font.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @return Returns true if sub-pixel rendering is used for the font; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_FontIsSubpixel(const OH_Drawing_Font*);
+
+/**
+ * @brief Creates an OH_Drawing_Font object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the OH_Drawing_Font object created.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_Font* OH_Drawing_FontCreate(void);
+
+/**
+ * @brief Sets the typeface for a font.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an OH_Drawing_Font object.
+ * @param OH_Drawing_Typeface Pointer to an OH_Drawing_Typeface object.
+ * If NULL is passed in, the default OH_Drawing_Typeface object is used.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_FontSetTypeface(OH_Drawing_Font*, OH_Drawing_Typeface*);
+
+/**
+ * @brief Obtains the typeface of a font.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @return Returns the pointer to the {@link OH_Drawing_Typeface} object.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Typeface* OH_Drawing_FontGetTypeface(OH_Drawing_Font*);
+
+/**
+ * @brief Sets the font size.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an OH_Drawing_Font object.
+ * @param textSize Font size.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_FontSetTextSize(OH_Drawing_Font*, float textSize);
+
+/**
+ * @brief Obtains the text size.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @return Returns a floating point number representing the text size.
+ * @since 12
+ * @version 1.0
+ */
+float OH_Drawing_FontGetTextSize(const OH_Drawing_Font*);
+
+/**
+ * @brief Obtains the number of glyphs represented by a string of text.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Font or text is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @param text Pointer to the start address for storing the text.
+ * @param byteLength Text length, in bytes.
+ * @param encoding Encoding type of the text.
+ * For details about the available options, see {@link OH_Drawing_TextEncoding}.
+ * @since 12
+ * @version 1.0
+ */
+int OH_Drawing_FontCountText(OH_Drawing_Font*, const void* text, size_t byteLength,
+ OH_Drawing_TextEncoding encoding);
+
+/**
+ * @brief Converts a string of text into glyph indices.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If any of OH_Drawing_Font, text, and glyphs is NULL, byteLength is 0,
+ * or maxGlyphCount is less than or equal to 0, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @param text Pointer to the start address for storing the text.
+ * @param byteLength Text length, in bytes.
+ * @param encoding Encoding type of the text.
+ * For details about the available options, see {@link OH_Drawing_TextEncoding}.
+ * @param glyphs Pointer to the start address for storing the glyph indices.
+ * @param maxGlyphCount Maximum number of glyphs.
+ * @return Returns the number of glyph indices.
+ * @since 12
+ * @version 1.0
+ */
+uint32_t OH_Drawing_FontTextToGlyphs(const OH_Drawing_Font*, const void* text, uint32_t byteLength,
+ OH_Drawing_TextEncoding encoding, uint16_t* glyphs, int maxGlyphCount);
+
+/**
+ * @brief Obtains the width of each glyph in a string of text.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If any of OH_Drawing_Font, glyphs, and widths is NULL or count is less than or
+ * equal to 0, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @param glyphs Pointer to the start address for storing the glyph indices.
+ * @param count Number of glyph indices.
+ * @param widths Pointer to the start address for storing the glyph widths.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_FontGetWidths(const OH_Drawing_Font*, const uint16_t* glyphs, int count, float* widths);
+
+/**
+ * @brief Measures the width of a single character.
+ * If the typeface of the current font does not support the character to measure, the system typeface is used to
+ * measure the character width.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param font Pointer to an {@link OH_Drawing_Font} object.
+ * @param str Pointer to the single character to measure. A string can be passed in, but only the first character
+ * in the string is parsed and measured in UTF-8 encoding.
+ * @param textWidth Pointer to the character width obtained.
+ * @return Returns one of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if at least one of the parameters font, str,
+ * or textWidth is NULL, or the length of str is 0.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_FontMeasureSingleCharacter(const OH_Drawing_Font* font, const char* str,
+ float* textWidth);
+
+/**
+ * @brief Obtains the text width and bounding box.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param font Pointer to an {@link OH_Drawing_Font} object.
+ * @param text Pointer to the text.
+ * @param byteLength Length of the text, in bytes.
+ * @param encoding Encoding type of the text.
+ * @param bounds Pointer to the bounding box. The value can be NULL.
+ * @param textWidth Pointer to the text width.
+ * @return Returns one of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if at least one of the parameters font, text,
+ * and textWidth is NULL, or byteLength is 0.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_FontMeasureText(const OH_Drawing_Font* font, const void* text, size_t byteLength,
+ OH_Drawing_TextEncoding encoding, OH_Drawing_Rect* bounds, float* textWidth);
+
+/**
+ * @brief Sets linear scaling for a font.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an OH_Drawing_Font object.
+ * @param isLinearText Whether to set linear scaling.
+ * The value true means to set linear scaling, and false means the opposite.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_FontSetLinearText(OH_Drawing_Font*, bool isLinearText);
+
+/**
+ * @brief Checks whether linear scaling is used for a font.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @return Returns true if linear scaling is used; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_FontIsLinearText(const OH_Drawing_Font*);
+
+/**
+ * @brief Sets a horizontal skew factor for a font.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an OH_Drawing_Font object.
+ * @param skewX Skew of the X axis relative to the Y axis.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_FontSetTextSkewX(OH_Drawing_Font*, float skewX);
+
+/**
+ * @brief Obtains the horizontal skew factor of a font.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @return Returns a floating point number representing the horizontal skew factor.
+ * @since 12
+ * @version 1.0
+ */
+float OH_Drawing_FontGetTextSkewX(const OH_Drawing_Font*);
+
+/**
+ * @brief Sets fake bold for a font by increasing the stroke width.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an OH_Drawing_Font object.
+ * @param isFakeBoldText Whether to set fake bold.
+ * The value true means to set fake bold, and false means the opposite.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_FontSetFakeBoldText(OH_Drawing_Font*, bool isFakeBoldText);
+
+/**
+ * @brief Checks whether fake bold is used for a font.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @return Returns true if fake bold is used; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_FontIsFakeBoldText(const OH_Drawing_Font*);
+
+/**
+ * @brief Sets a horizontal scale factor for a font.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @param scaleX Horizontal scale factor.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_FontSetScaleX(OH_Drawing_Font*, float scaleX);
+
+/**
+ * @brief Obtains the horizontal scale factor of a font.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @return Returns the horizontal scale factor.
+ * @since 12
+ * @version 1.0
+ */
+float OH_Drawing_FontGetScaleX(const OH_Drawing_Font*);
+
+/**
+ * @brief Sets a font hinting effect.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_FontHinting is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @param OH_Drawing_FontHinting Font hinting effect.
+ * For details about the available options, see {@link OH_Drawing_FontHinting}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_FontSetHinting(OH_Drawing_Font*, OH_Drawing_FontHinting);
+
+/**
+ * @brief Obtains the font hinting effect.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @return Returns the font hinting effect. For details about the available options, see {@link OH_Drawing_FontHinting}.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontHinting OH_Drawing_FontGetHinting(const OH_Drawing_Font*);
+
+/**
+ * @brief Sets whether to use bitmaps in a font.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @param isEmbeddedBitmaps Whether to use bitmaps in the font. The value true means to use bitmaps in the font,
+ * and false means the opposite.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_FontSetEmbeddedBitmaps(OH_Drawing_Font*, bool isEmbeddedBitmaps);
+
+/**
+ * @brief Checks whether bitmaps are used in a font.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @return Returns true if bitmaps are used; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_FontIsEmbeddedBitmaps(const OH_Drawing_Font*);
+
+/**
+ * @brief Destroys an OH_Drawing_Font object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an OH_Drawing_Font object.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_FontDestroy(OH_Drawing_Font*);
+
+/**
+ * @brief Defines a struct that describes the measurement information about a font.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_Font_Metrics {
+ /** Measurement information that is valid. */
+ uint32_t fFlags;
+ /** Maximum distance from the baseline to the highest coordinate of a character. */
+ float top;
+ /** Recommended distance from the baseline to the highest coordinate of a character. */
+ float ascent;
+ /** Recommended distance from the baseline to the lowest coordinate of a character. */
+ float descent;
+ /** Maximum distance from the baseline to the lowest coordinate of a character. */
+ float bottom;
+ /** Interline spacing. */
+ float leading;
+ /** Average character width, or zero if unknown. */
+ float avgCharWidth;
+ /** Maximum character width, or zero if unknown. */
+ float maxCharWidth;
+ /**
+ * Maximum distance to the leftmost of the font bounding box. Generally, the value is a negative value.
+ * Variable fonts are not recommended.
+ */
+ float xMin;
+ /**
+ * Maximum distance to the rightmost of the font bounding box. Generally, the value is a negative value.
+ * Variable fonts are not recommended.
+ */
+ float xMax;
+ /** Height of a lowercase letter, or zero if unknown. Generally, the value is a negative value. */
+ float xHeight;
+ /** Height of an uppercase letter, or zero if unknown. Generally, the value is a negative value. */
+ float capHeight;
+ /** Thickness of the underline. */
+ float underlineThickness;
+ /**
+ * Position of the underline, that is, vertical distance from the baseline to the top of the underline.
+ * Generally, the value is a positive value.
+ */
+ float underlinePosition;
+ /** Thickness of the strikethrough. */
+ float strikeoutThickness;
+ /**
+ * Position of the strikethrough, that is, vertical distance from the baseline to the bottom of the strikethrough.
+ * Generally, the value is a negative value.
+ */
+ float strikeoutPosition;
+} OH_Drawing_Font_Metrics;
+
+/**
+ * @brief Obtains the measurement information about a font.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Font or OH_Drawing_Font_Metrics is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @param OH_Drawing_Font_Metrics Pointer to an {@link OH_Drawing_Font_Metrics} object.
+ * @return Returns a floating-point variable that indicates the recommended interline spacing.
+ * @since 12
+ * @version 1.0
+ */
+float OH_Drawing_FontGetMetrics(OH_Drawing_Font*, OH_Drawing_Font_Metrics*);
+
+/**
+ * @brief Obtains the rectangular bounding box for each glyph in the glyph array.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param font Pointer to an {@link OH_Drawing_Font} object.
+ * @param glyphs Pointer to a glyph array.
+ * @param count Length of the glyph array.
+ * @param bounds Pointer to a rectangular bounding box array.
+ * @return Returns one of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if font, glyphs, or bounds is NULL
+ * or count is 0.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_FontGetBounds(const OH_Drawing_Font* font, const uint16_t* glyphs, uint32_t count,
+ OH_Drawing_Array* bounds);
+
+/**
+ * @brief Obtains the path of a glyph.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param font Pointer to an {@link OH_Drawing_Font} object.
+ * @param glyph Glyph index.
+ * @param path Pointer to an {@link OH_Drawing_Path} object, which is used to store the glyph path.
+ * @return Returns one of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if font or path is NULL
+ * or the specified glyph does not exist.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_FontGetPathForGlyph(const OH_Drawing_Font* font, uint16_t glyph,
+ OH_Drawing_Path* path);
+
+/**
+ * @brief Obtains the text outline path.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param font Pointer to an {@link OH_Drawing_Font} object.
+ * @param text Pointer to the text string.
+ * @param byteLength Length of the text path.
+ * If the length is greater than the length of the text string, undefined behavior occurs.
+ * @param encoding Text encoding format. UTF-8, UTF-16, UTF-32, and glyph indices are supported.
+ * @param x X coordinate of the text in the drawing area, with the origin as the start point.
+ * @param y Y coordinate of the text in the drawing area, with the origin as the start point.
+ * @param path Pointer to the text outline path.
+ * @return Returns one of the following result codes:
+ * {@link OH_DRAWING_SUCCESS} if the operation is successful.
+ * {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if any of font, text, and path is a null pointer.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_FontGetTextPath(const OH_Drawing_Font* font, const void* text, size_t byteLength,
+ OH_Drawing_TextEncoding encoding, float x, float y, OH_Drawing_Path* path);
+
+/**
+ * @brief Sets whether to follow the theme font.
+ * When followed is set to true, the theme font is used if it is enabled by the system and
+ * no typeface is set.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param font Pointer to an {@link OH_Drawing_Font} object.
+ * @param followed Whether to follow the theme font. The value true means to follow the theme font,
+ * and false means the opposite.
+ * @return Returns one of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if font is NULL.
+ * @since 16
+ */
+OH_Drawing_ErrorCode OH_Drawing_FontSetThemeFontFollowed(OH_Drawing_Font* font, bool followed);
+
+/**
+ * @brief Checks whether the font follows the theme font. By default, the theme font is not followed.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param font Pointer to an {@link OH_Drawing_Font} object.
+ * @param followed Check result. The value true means that the theme font is followed,
+ * and false means the opposite.
+ * @return Returns one of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if either font or followed is NULL.
+ * @since 16
+ */
+OH_Drawing_ErrorCode OH_Drawing_FontIsThemeFontFollowed(const OH_Drawing_Font* font, bool* followed);
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_font_collection.h b/en/native_sdk/graphic/native_drawing/drawing_font_collection.h
index 8c9b231b167ebee95943fa2cdb00bec565cc9a93..787e72192fd66d9d8efcca7729c3cb5cbbb9bd4c 100644
--- a/en/native_sdk/graphic/native_drawing/drawing_font_collection.h
+++ b/en/native_sdk/graphic/native_drawing/drawing_font_collection.h
@@ -20,7 +20,8 @@
* @addtogroup Drawing
* @{
*
- * @brief Provides the 2D drawing capability.
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
*
@@ -31,8 +32,10 @@
/**
* @file drawing_font_collection.h
*
- * @brief Declares functions related to FontCollection in the drawing module.
+ * @brief Declares the functions related to the font collection in the drawing module.
*
+ * File to include: native_drawing/drawing_font_collection.h
+ * @library libnative_drawing.so
* @since 8
* @version 1.0
*/
@@ -43,25 +46,80 @@
extern "C" {
#endif
/**
- * @brief Creates an OH_Drawing_FontCollection object.
+ * @brief Creates an {@link OH_Drawing_FontCollection} object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @return Returns the pointer to the OH_Drawing_FontCollection object created.
+ * @return Returns the pointer to the {@link OH_Drawing_FontCollection} object created.
+ * The {@link OH_Drawing_FontCollection} object created by this function can be used by only one
+ * {@link OH_Drawing_TypographyCreate} object. To share an {@link OH_Drawing_FontCollection} object among multiple
+ * {@link OH_Drawing_TypographyCreate} objects, use {@link OH_Drawing_CreateSharedFontCollection} to create it.
* @since 8
* @version 1.0
*/
OH_Drawing_FontCollection* OH_Drawing_CreateFontCollection(void);
/**
- * @brief Releases the memory occupied by an OH_Drawing_FontCollection object.
+ * @brief Destroys an OH_Drawing_FontCollection object and reclaims the memory occupied by the object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_FontCollection Indicates the pointer to an OH_Drawing_FontCollection object.
+ * @param OH_Drawing_FontCollection Pointer to an OH_Drawing_FontCollection object.
* @since 8
* @version 1.0
*/
void OH_Drawing_DestroyFontCollection(OH_Drawing_FontCollection*);
+/**
+ * @brief Disables the alternate fonts.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontCollection Pointer to an {@link OH_Drawing_FontCollection} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_DisableFontCollectionFallback(OH_Drawing_FontCollection* fontCollection);
+
+/**
+ * @brief Disables the system fonts.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontCollection Pointer to an {@link OH_Drawing_FontCollection} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_DisableFontCollectionSystemFont(OH_Drawing_FontCollection* fontCollection);
+
+/**
+ * @brief Creates an {@link OH_Drawing_FontCollection} object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the {@link OH_Drawing_FontCollection} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontCollection* OH_Drawing_CreateSharedFontCollection(void);
+
+/**
+ * @brief Clears the font cache.
+ * The font cache has a memory limit and a clearing mechanism. It occupies limited memory.
+ * You are not advised to clear it unless otherwise required.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontCollection Pointer to an {@link OH_Drawing_FontCollection} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_ClearFontCaches(OH_Drawing_FontCollection*);
+
+/**
+ * @brief Obtains the global {@link OH_Drawing_FontCollection} object,
+ * which can be used to sense the theme font information. Do not release the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the global {@link OH_Drawing_FontCollection} object obtained.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_FontCollection* OH_Drawing_GetFontCollectionGlobalInstance(void);
#ifdef __cplusplus
}
#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_font_mgr.h b/en/native_sdk/graphic/native_drawing/drawing_font_mgr.h
new file mode 100644
index 0000000000000000000000000000000000000000..75c9c3a413e2539554b0afb880c4d92d88b7cd9a
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_font_mgr.h
@@ -0,0 +1,243 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_FONT_MGR_H
+#define C_INCLUDE_DRAWING_FONT_MGR_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_font_mgr.h
+ *
+ * @brief Declares the functions related to font management in the drawing module.
+ * The functions can be used to load fonts and match available fonts in the system.
+ *
+ * File to include: native_drawing/drawing_font_mgr.h
+ * @library libnative_drawing.so
+ * @since 12
+ * @version 1.0
+ */
+
+#include
+#include "drawing_text_typography.h"
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates an OH_Drawing_FontMgr object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the {@link OH_Drawing_FontMgr} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontMgr* OH_Drawing_FontMgrCreate(void);
+
+/**
+ * @brief Destroys an OH_Drawing_FontMgr object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_FontMgr} object, which is obtained by calling
+ * {@link OH_Drawing_FontMgrCreate}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_FontMgrDestroy(OH_Drawing_FontMgr*);
+
+/**
+ * @brief Obtains the number of font families.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_FontMgr} object, which is obtained by calling
+ * {@link OH_Drawing_FontMgrCreate}.
+ * @return Returns the number of font families.
+ * @since 12
+ * @version 1.0
+ */
+int OH_Drawing_FontMgrGetFamilyCount(OH_Drawing_FontMgr*);
+
+/**
+ * @brief Obtains the font family name based on an index.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_FontMgr} object, which is obtained by calling
+ * {@link OH_Drawing_FontMgrCreate}.
+ * @param index Index of the font family name.
+ * @return Returns the font family name.
+ * @since 12
+ * @version 1.0
+ */
+char* OH_Drawing_FontMgrGetFamilyName(OH_Drawing_FontMgr*, int index);
+
+/**
+ * @brief Reclaims the memory occupied by a font family name.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param familyName Pointer to a font family name.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_FontMgrDestroyFamilyName(char* familyName);
+
+/**
+ * @brief Creates a font style set from an OH_Drawing_FontMgr object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_FontMgr} object, which is obtained by calling
+ * {@link OH_Drawing_FontMgrCreate}.
+ * @param index Index of the font style set.
+ * @return Returns the pointer to the {@link OH_Drawing_FontStyleSet} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontStyleSet* OH_Drawing_FontMgrCreateFontStyleSet(OH_Drawing_FontMgr*, int index);
+
+/**
+ * @brief Reclaims the memory occupied by a font style set.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontStyleSet Pointer to an {@link OH_Drawing_FontStyleSet} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_FontMgrDestroyFontStyleSet(OH_Drawing_FontStyleSet*);
+
+/**
+ * @brief Obtains a font style set based on a font family name.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_FontMgr} object, which is obtained by calling
+ * {@link OH_Drawing_FontMgrCreate}.
+ * @param familyName Pointer to a font family name.
+ * @return Returns the pointer to the {@link OH_Drawing_FontStyleSet} object.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily(OH_Drawing_FontMgr*, const char* familyName);
+
+/**
+ * @brief Obtains a typeface based on the font style information and font family name.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_FontMgr} object, which is obtained by calling
+ * {@link OH_Drawing_FontMgrCreate}.
+ * @param familyName Pointer to a font family name.
+ * @param OH_Drawing_FontStyleStruct Font style, including the font weight, width, and slant.
+ * @return Returns the pointer to the {@link OH_Drawing_Typeface} object.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*,
+ const char* familyName, OH_Drawing_FontStyleStruct);
+
+/**
+ * @brief Obtains a typeface for the specified character.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_FontMgr} object, which is obtained by calling
+ * {@link OH_Drawing_FontMgrCreate}.
+ * @param familyName Pointer to a font family name.
+ * @param OH_Drawing_FontStyleStruct Font style, including the font weight, width, and slant.
+ * @param bcp47 Pointer to the character language code array, which is a combination of ISO 639, 15924, and 3166-1
+ * language codes.
+ * @param bcp47Count Size of the character language code array.
+ * @param character UTF8 character used for matching.
+ * @return Returns the pointer to the {@link OH_Drawing_Typeface} object.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter(OH_Drawing_FontMgr*, const char* familyName,
+ OH_Drawing_FontStyleStruct, const char* bcp47[], int bcp47Count, int32_t character);
+
+/**
+ * @brief Creates a typeface for the specified index.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontStyleSet Pointer to an {@link OH_Drawing_FontStyleSet} object.
+ * @param index Index of the typeface.
+ * @return Returns the pointer to the {@link OH_Drawing_Typeface} object created if the operation is successful;
+ * returns a null pointer otherwise.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Typeface* OH_Drawing_FontStyleSetCreateTypeface(OH_Drawing_FontStyleSet*, int index);
+
+ /**
+ * @brief Obtains the font style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontStyleSet Pointer to an {@link OH_Drawing_FontStyleSet} object.
+ * @param index Index of the font style.
+ * @param styleName Double pointer to the string that specifies the font style name.
+ * @return Returns the font style.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontStyleStruct OH_Drawing_FontStyleSetGetStyle(OH_Drawing_FontStyleSet*, int32_t index,
+ char** styleName);
+
+ /**
+ * @brief Reclaims the memory occupied by a font style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param styleName Double pointer to the string that specifies the font style name.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_FontStyleSetFreeStyleName(char** styleName);
+
+/**
+ * @brief Obtains the typeface closest to the font style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontStyleSet Pointer to an {@link OH_Drawing_FontStyleSet} object.
+ * @param fontStyleStruct Font style, including the font weight, width, and slant.
+ * @return Returns the pointer to the {@link OH_Drawing_Typeface} object.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Typeface* OH_Drawing_FontStyleSetMatchStyle(OH_Drawing_FontStyleSet*,
+ OH_Drawing_FontStyleStruct fontStyleStruct);
+
+/**
+ * @brief Obtains the number of fonts in the font style set.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontStyleSet Pointer to an {@link OH_Drawing_FontStyleSet} object.
+ * @return Returns the number of fonts.
+ * @since 12
+ * @version 1.0
+ */
+int OH_Drawing_FontStyleSetCount(OH_Drawing_FontStyleSet*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_gpu_context.h b/en/native_sdk/graphic/native_drawing/drawing_gpu_context.h
new file mode 100644
index 0000000000000000000000000000000000000000..bbdefbc8f8e9df50306ba585d32f145200a8b4df
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_gpu_context.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_GPU_CONTEXT_H
+#define C_INCLUDE_DRAWING_GPU_CONTEXT_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_gpu_context.h
+ *
+ * @brief Declares the functions related to the GPU context in the drawing module.
+ *
+ File to include: native_drawing/drawing_gpu_context.h
+ * @library libnative_drawing.so
+ * @since 12
+ * @version 1.0
+ */
+
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Defines a struct for the options about the GPU context.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_GpuContextOptions {
+ /**
+ * Whether to allow path mask textures to be cached.
+ * The value true means to allow the path mask textures to be cached, and false means the opposite.
+ */
+ bool allowPathMaskCaching;
+} OH_Drawing_GpuContextOptions;
+
+/**
+ * @brief Creates an OH_Drawing_GpuContext object that uses OpenGL as the backend interface.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_GpuContextOptions GPU context option, which is an {@link OH_Drawing_GpuContextOptions} object.
+ * @return Returns the pointer to the [OH_Drawing_GpuContext](#oh_drawing_gpucontext) object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_GpuContext* OH_Drawing_GpuContextCreateFromGL(OH_Drawing_GpuContextOptions);
+
+/**
+ * @brief Destroys an OH_Drawing_GpuContext object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_GpuContext Pointer to an {@link OH_Drawing_GpuContext} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_GpuContextDestroy(OH_Drawing_GpuContext*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_image.h b/en/native_sdk/graphic/native_drawing/drawing_image.h
new file mode 100644
index 0000000000000000000000000000000000000000..e56854894846fc927db692c548ad9a58c925e696
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_image.h
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_IMAGE_H
+#define C_INCLUDE_DRAWING_IMAGE_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_image.h
+ *
+ * @brief Declares the functions related to the image in the drawing module.
+ *
+ * File to include: native_drawing/drawing_image.h
+ * @library libnative_drawing.so
+ * @since 12
+ * @version 1.0
+ */
+
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates an {@link OH_Drawing_Image} object that describes an array of two-dimensional pixels to draw.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the {@link OH_Drawing_Image} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Image* OH_Drawing_ImageCreate(void);
+
+/**
+ * @brief Destroys an {@link OH_Drawing_Image} object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Image Pointer to an {@link OH_Drawing_Image} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_ImageDestroy(OH_Drawing_Image*);
+
+/**
+ * @brief Builds an image from a bitmap by sharing or copying bitmap pixels. If the bitmap is marked as immutable,
+ * the pixel memory is shared, not copied.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Image or OH_Drawing_Bitmap is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Image Pointer to an {@link OH_Drawing_Image} object.
+ * @param OH_Drawing_Bitmap Pointer to an {@link OH_Drawing_Bitmap} object.
+ * @return Returns true if the image is built; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_ImageBuildFromBitmap(OH_Drawing_Image*, OH_Drawing_Bitmap*);
+
+/**
+ * @brief Obtains the image width, that is, the number of pixels in each line.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Image is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Image Pointer to an {@link OH_Drawing_Image} object.
+ * @return Returns the width.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_Drawing_ImageGetWidth(OH_Drawing_Image*);
+
+/**
+ * @brief Obtains the image height, that is, the number of pixel lines.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Image is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Image Pointer to an {@link OH_Drawing_Image} object.
+ * @return Returns the height.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_Drawing_ImageGetHeight(OH_Drawing_Image*);
+
+/**
+ * @brief Obtains the image information.
+ * After this function is called, the passed-in image information object is filled.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Image or OH_Drawing_Image_Info is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Image Pointer to an {@link OH_Drawing_Image} object.
+ * @param OH_Drawing_Image_Info Pointer to an {@link OH_Drawing_Image_Info} object,
+ * which is obtained by calling {@link OH_Drawing_Image_Info}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_ImageGetImageInfo(OH_Drawing_Image*, OH_Drawing_Image_Info*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_image_filter.h b/en/native_sdk/graphic/native_drawing/drawing_image_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..a3350de9ae2ddfb6013c160dbcb453485d07909c
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_image_filter.h
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_IMAGE_FILTER_H
+#define C_INCLUDE_DRAWING_IMAGE_FILTER_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_image_filter.h
+ *
+ * @brief Declares the functions related to the image filter in the drawing module.
+ *
+ * File to include: native_drawing/drawing_image_filter.h
+ * @library libnative_drawing.so
+ * @since 12
+ * @version 1.0
+ */
+
+#include "drawing_shader_effect.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates an OH_Drawing_ImageFilter object with a given blur type.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param sigmaX Deviation of the Gaussian blur to apply along the X axis.
+ * @param sigmaY Deviation of the Gaussian blur to apply along the Y axis.
+ * @param OH_Drawing_TileMode Tile mode of the image effect.
+ * For details about the available options, see {@link OH_Drawing_TileMode}.
+ * @param input Pointer to the filter to which the image filter will be applied. If NULL is passed in,
+ * the image filter is directly applied to the original image.
+ * @return Returns the pointer to the {@link OH_Drawing_ImageFilter} object created.
+ * If NULL is returned, the creation fails.
+ * The possible failure cause is that no memory is available.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateBlur(float sigmaX, float sigmaY, OH_Drawing_TileMode,
+ OH_Drawing_ImageFilter* input);
+
+/**
+ * @brief Creates an OH_Drawing_ImageFilter object with a color filter effect.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If colorFilter is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param colorFilter Point to an {@link OH_Drawing_ColorFilter} object.
+ * @param input Pointer to the filter to which the image filter will be applied.
+ * If NULL is passed in, the image filter is directly applied to the original image.
+ * @return Returns the pointer to the {@link OH_Drawing_ImageFilter} object created.
+ * If NULL is returned, the creation fails.
+ * The possible failure cause is that no memory is available or colorFilter is NULL.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateFromColorFilter(OH_Drawing_ColorFilter* colorFilter,
+ OH_Drawing_ImageFilter* input);
+
+/**
+ * @brief Destroys an {@link OH_Drawing_ImageFilter} object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_ImageFilter Pointer to the {@link OH_Drawing_ImageFilter} object obtained.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_ImageFilterDestroy(OH_Drawing_ImageFilter*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_mask_filter.h b/en/native_sdk/graphic/native_drawing/drawing_mask_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..4f2f3c42ae68bc3dbc8739619ab9f4f549f0b751
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_mask_filter.h
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_MASK_FILTER_H
+#define C_INCLUDE_DRAWING_MASK_FILTER_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_mask_filter.h
+ *
+ * @brief Declares the functions related to the mask filter in the drawing module.
+ *
+ * File to include: native_drawing/drawing_mask_filter.h
+ * @library libnative_drawing.so
+ * @since 11
+ * @version 1.0
+ */
+
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Enumerates the blur types.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef enum OH_Drawing_BlurType {
+ /**
+ * Blurs both inside and outside the original border.
+ */
+ NORMAL,
+ /**
+ * Draws solid inside the border, and blurs outside.
+ */
+ SOLID,
+ /**
+ * Draws nothing inside the border, and blurs outside.
+ */
+ OUTER,
+ /**
+ * Blurs inside the border, and draws nothing outside.
+ */
+ INNER,
+} OH_Drawing_BlurType;
+
+/**
+ * @brief Creates an OH_Drawing_MaskFilter object with a given blur type.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param blurType Blur type.
+ * @param sigma Standard deviation of the Gaussian blur to apply. The value must be greater than 0.
+ * @param respectCTM Whether the blur's sigma is modified by the CTM. The default value is true.
+ * @return Returns the pointer to the OH_Drawing_MaskFilter object created.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_MaskFilter* OH_Drawing_MaskFilterCreateBlur(OH_Drawing_BlurType blurType, float sigma, bool respectCTM);
+
+/**
+ * @brief Destroys an OH_Drawing_MaskFilter object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_MaskFilter Pointer to an OH_Drawing_MaskFilter object.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_MaskFilterDestroy(OH_Drawing_MaskFilter*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_matrix.h b/en/native_sdk/graphic/native_drawing/drawing_matrix.h
new file mode 100644
index 0000000000000000000000000000000000000000..b7bda70c74525a3e7f2ac8108f3bfc806eb80160
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_matrix.h
@@ -0,0 +1,606 @@
+/*
+ * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_MATRIX_H
+#define C_INCLUDE_DRAWING_MATRIX_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_matrix.h
+ *
+ * @brief Declares the functions related to the matrix in the drawing module.
+ *
+ * File to include: native_drawing/drawing_matrix.h
+ * @library libnative_drawing.so
+ * @since 11
+ * @version 1.0
+ */
+
+#include "drawing_error_code.h"
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates an OH_Drawing_Matrix object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the OH_Drawing_Matrix object created.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_Matrix* OH_Drawing_MatrixCreate(void);
+
+/**
+ * @brief Creates an OH_Drawing_Matrix with the rotation attribute.
+ * The matrix is obtained by rotating an identity matrix by a given degree around the rotation point (x, y).
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param deg Angle to rotate, in degrees. A positive number indicates a clockwise rotation,
+ * and a negative number indicates a counterclockwise rotation.
+ * @param x Coordinate point on the X axis.
+ * @param y Coordinate point on the Y axis.
+ * @return Returns the pointer to the {@link OH_Drawing_Matrix} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Matrix* OH_Drawing_MatrixCreateRotation(float deg, float x, float y);
+
+/**
+ * @brief Creates an OH_Drawing_Matrix with the scale attribute.
+ * The matrix is obtained by scaling an identity matrix with the factor (sx, sy) at the rotation point (px, py).
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param sx Horizontal scale factor.
+ * @param sy Vertical scale factor.
+ * @param px Coordinate point on the X axis.
+ * @param py Coordinate point on the Y axis.
+ * @return Returns the pointer to the {@link OH_Drawing_Matrix} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Matrix* OH_Drawing_MatrixCreateScale(float sx, float sy, float px, float py);
+
+/**
+ * @brief Creates an OH_Drawing_Matrix with the translation attribute.
+ * The matrix is obtained by translating the identity matrix by the distance (dx, dy).
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param dx Horizontal distance to translate.
+ * @param dy Vertical distance to translate.
+ * @return Returns the pointer to the {@link OH_Drawing_Matrix} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Matrix* OH_Drawing_MatrixCreateTranslation(float dx, float dy);
+
+/**
+ * @brief Sets matrix parameters for an OH_Drawing_Matrix object.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Matrix is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Pointer to an OH_Drawing_Matrix object.
+ * @param scaleX Horizontal scale factor.
+ * @param skewX Horizontal skew coefficient.
+ * @param transX Horizontal translation coefficient.
+ * @param skewY Vertical skew coefficient.
+ * @param scaleY Vertical scale factor.
+ * @param transY Vertical translation coefficient.
+ * @param persp0 Perspective coefficient of the X axis.
+ * @param persp1 Perspective coefficient of the Y axis.
+ * @param persp2 Perspective scale coefficient.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_MatrixSetMatrix(OH_Drawing_Matrix*, float scaleX, float skewX, float transX,
+ float skewY, float scaleY, float transY, float persp0, float persp1, float persp2);
+
+/**
+ * @brief Enumerates the matrix scaling modes.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_Drawing_ScaleToFit {
+ /**
+ * Scales the source rectangle both horizontally and vertically to exactly match the destination rectangle.
+ */
+ SCALE_TO_FIT_FILL,
+ /**
+ * Scales the source rectangle and aligns it to the left and top edges of the destination rectangle.
+ */
+ SCALE_TO_FIT_START,
+ /**
+ * Scales the source rectangle and aligns it to the center of the destination rectangle.
+ */
+ SCALE_TO_FIT_CENTER,
+ /**
+ * Scales the source rectangle and aligns it to the right and bottom edges of the destination rectangle.
+ */
+ SCALE_TO_FIT_END,
+} OH_Drawing_ScaleToFit;
+
+/**
+ * @brief Scales a matrix to map a source rectangle to a destination rectangle.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If any of OH_Drawing_Matrix, src, and dst is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @param src Pointer to a source rectangle, which is an {@link OH_Drawing_Rect} object.
+ * @param dst Pointer to a destination rectangle, which is an {@link OH_Drawing_Rect} object.
+ * @param stf Scaling mode. For details about the available options, see {@link OH_Drawing_ScaleToFit}.
+ * @return Returns true if the operation is successful; returns false if the operation fails;
+ * returns true and sets the matrix as follows if the passed-in matrix is empty:
+ * | 0 0 0 |
+ * | 0 0 0 |
+ * | 0 0 1 |
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_MatrixSetRectToRect(OH_Drawing_Matrix*, const OH_Drawing_Rect* src,
+ const OH_Drawing_Rect* dst, OH_Drawing_ScaleToFit stf);
+
+/**
+ * @brief Premultiplies a matrix by an identity matrix that rotates by a given degree
+ * around the rotation point (px, py).
+ * For example, if a given matrix is as follows:
+ *
+ * | A B C | | c -s dx |
+ * Matrix = | D E F |, R(degrees, px, py) = | s c dy |
+ * | G H I | | 0 0 1 |
+ *
+ * and the conditions are as follows:
+ *
+ * c = cos(degrees)
+ * s = sin(degrees)
+ * dx = s * py + (1 - c) * px
+ * dy = -s * px + (1 - c) * py
+ *
+ * then the final matrix is as follows:
+ *
+ * | A B C | | c -s dx | | Ac+Bs -As+Bc A*dx+B*dy+C |
+ * Matrix * R(degrees, px, py) = | D E F | | s c dy | = | Dc+Es -Ds+Ec D*dx+E*dy+F |
+ * | G H I | | 0 0 1 | | Gc+Hs -Gs+Hc G*dx+H*dy+I |
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Matrix is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @param degree Angle to rotate, in degrees. A positive number indicates a clockwise rotation,
+ * and a negative number indicates a counterclockwise rotation.
+ * @param px X coordinate of the rotation point.
+ * @param py Y coordinate of the rotation point.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_MatrixPreRotate(OH_Drawing_Matrix*, float degree, float px, float py);
+
+/**
+ * @brief Premultiplies a matrix by an identity matrix that scales with the factor (sx, sy) at the scale point (px, py).
+ * For example, if a given matrix is as follows:
+ *
+ * | A B C | | sx 0 dx |
+ * Matrix =| D E F |, S(sx, sy, px, py) = | 0 sy dy |
+ * | G H I | | 0 0 1 |
+ *
+ * and the conditions are as follows:
+ *
+ * dx = px - sx * px
+ * dy = py - sy * py
+ *
+ * then the final matrix is as follows:
+ *
+ * | A B C | | sx 0 dx | | A*sx B*sy A*dx+B*dy+C |
+ * Matrix * S(sx, sy, px, py) = | D E F | | 0 sy dy | = | D*sx E*sy D*dx+E*dy+F |
+ * | G H I | | 0 0 1 | | G*sx H*sy G*dx+H*dy+I |
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Matrix is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @param sx Scale factor on the X axis.
+ * @param sy Scale factor on the Y axis.
+ * @param px X coordinate of the scale point.
+ * @param py Y coordinate of the scale point.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_MatrixPreScale(OH_Drawing_Matrix*, float sx, float sy, float px, float py);
+
+/**
+ * @brief Premultiplies a matrix by an identity matrix that translates by a given distance (dx, dy).
+ * For example, if a given matrix is as follows:
+ *
+ * | A B C | | 1 0 dx |
+ * Matrix = | D E F |, T(dx, dy) = | 0 1 dy |
+ * | G H I | | 0 0 1 |
+ *
+ * then the final matrix is as follows:
+ *
+ * | A B C | | 1 0 dx | | A B A*dx+B*dy+C |
+ * Matrix * T(dx, dy) = | D E F | | 0 1 dy | = | D E D*dx+E*dy+F |
+ * | G H I | | 0 0 1 | | G H G*dx+H*dy+I |
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Matrix is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @param dx Distance to translate on the X axis.
+ * @param dy Distance to translate on the Y axis.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_MatrixPreTranslate(OH_Drawing_Matrix*, float dx, float dy);
+
+/**
+ * @brief Post multiplies a matrix by an identity matrix that rotates a given degree around the rotation point (px, py).
+ * For example, if a given matrix is as follows:
+ *
+ * | J K L | | c -s dx |
+ * Matrix = | M N O |, R(degrees, px, py) = | s c dy |
+ * | P Q R | | 0 0 1 |
+ *
+ * and the conditions are as follows:
+ *
+ * c = cos(degrees)
+ * s = sin(degrees)
+ * dx = s * py + (1 - c) * px
+ * dy = -s * px + (1 - c) * py
+ *
+ * then the final matrix is as follows:
+ *
+ * |c -s dx| |J K L| |cJ-sM+dx*P cK-sN+dx*Q cL-sO+dx+R|
+ * R(degrees, px, py) * Matrix = |s c dy| |M N O| = |sJ+cM+dy*P sK+cN+dy*Q sL+cO+dy*R|
+ * |0 0 1| |P Q R| | P Q R|
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Matrix is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @param degree Angle to rotate, in degrees. A positive number indicates a clockwise rotation,
+ * and a negative number indicates a counterclockwise rotation.
+ * @param px X coordinate of the rotation point.
+ * @param py Y coordinate of the rotation point.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_MatrixPostRotate(OH_Drawing_Matrix*, float degree, float px, float py);
+
+/**
+ * @brief Post multiplies a matrix by an identity matrix that scales with the factor (sx, sy)
+ * at the scale point (px, py).
+ * For example, if a given matrix is as follows:
+ *
+ * | J K L | | sx 0 dx |
+ * Matrix = | M N O |, S(sx, sy, px, py) = | 0 sy dy |
+ * | P Q R | | 0 0 1 |
+ *
+ * and the conditions are as follows:
+ * dx = px - sx * px
+ * dy = py - sy * py
+ *
+ * then the final matrix is as follows:
+ *
+ * | sx 0 dx | | J K L | | sx*J+dx*P sx*K+dx*Q sx*L+dx+R |
+ * S(sx, sy, px, py) * Matrix = | 0 sy dy | | M N O | = | sy*M+dy*P sy*N+dy*Q sy*O+dy*R |
+ * | 0 0 1 | | P Q R | | P Q R |
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Matrix is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @param sx Scale factor on the X axis.
+ * @param sy Scale factor on the Y axis.
+ * @param px X coordinate of the scale point.
+ * @param py Y coordinate of the scale point.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_MatrixPostScale(OH_Drawing_Matrix*, float sx, float sy, float px, float py);
+
+/**
+ * @brief Post multiplies a matrix by an identity matrix that translates by a given distance (dx, dy).
+ * For example, if a given matrix is as follows:
+ *
+ * | J K L | | 1 0 dx |
+ * Matrix = | M N O |, T(dx, dy) = | 0 1 dy |
+ * | P Q R | | 0 0 1 |
+ *
+ * then the final matrix is as follows:
+ *
+ * | 1 0 dx | | J K L | | J+dx*P K+dx*Q L+dx*R |
+ * T(dx, dy) * Matrix = | 0 1 dy | | M N O | = | M+dy*P N+dy*Q O+dy*R |
+ * | 0 0 1 | | P Q R | | P Q R |
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Matrix is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @param dx Distance to translate on the X axis.
+ * @param dy Distance to translate on the Y axis.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_MatrixPostTranslate(OH_Drawing_Matrix*, float dx, float dy);
+
+/**
+ * @brief Resets a matrix to an identity matrix.
+ * | 1 0 0 |
+ * | 0 1 0 |
+ * | 0 0 1 |
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Matrix is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_MatrixReset(OH_Drawing_Matrix*);
+
+/**
+ * @brief Multiplies two matrices to produce a new matrix.
+ * For example, if a given matrix a and a given matrix b are shown as follows:
+ * | A B C | | J K L |
+ * a = | D E F |, b = | M N O |
+ * | G H I | | P Q R |
+ * then the final matrix total is as follows:
+ * | A B C | | J K L | | AJ+BM+CP AK+BN+CQ AL+BO+CR |
+ * total = a * b = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR |
+ * | G H I | | P Q R | | GJ+HM+IP GK+HN+IQ GL+HO+IR |
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If any of total, a, and b is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param total Pointer to the new matrix, which is an {@link OH_Drawing_Matrix} object.
+ * @param a Pointer to the first matrix, which is an {@link OH_Drawing_Matrix} object.
+ * @param b Pointer to the second matrix, which is an {@link OH_Drawing_Matrix} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_MatrixConcat(OH_Drawing_Matrix* total, const OH_Drawing_Matrix* a,
+ const OH_Drawing_Matrix* b);
+
+/**
+ * @brief Obtains all element values of a matrix.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @param value Array used to store the obtained element values.
+ * @return Returns either of the following result codes:
+ * OH_DRAWING_SUCCESS if all element values of the matrix are successfully obtained.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if the matrix element values fail to be obtained.
+ * The failure cause is that matrix or value is NULL.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_MatrixGetAll(OH_Drawing_Matrix* matrix, float value[9]);
+
+/**
+ * @brief Obtains a matrix value of a given index. The index ranges from 0 to 8.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Matrix is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If index is less than 0 or greater than 8, OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @param index Index. The value ranges from 0 to 8.
+ * @return Returns the matrix value.
+ * @since 12
+ * @version 1.0
+ */
+float OH_Drawing_MatrixGetValue(OH_Drawing_Matrix*, int index);
+
+/**
+ * @brief Sets a matrix as an identity matrix and rotates it by a given degree around the rotation point (px, py).
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Matrix is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @param degree Angle to rotate, in degrees. A positive number indicates a clockwise rotation,
+ * and a negative number indicates a counterclockwise rotation.
+ * @param px Coordinate point on the X axis.
+ * @param py Coordinate point on the Y axis.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_MatrixRotate(OH_Drawing_Matrix*, float degree, float px, float py);
+
+/**
+ * @brief Sets a matrix as an identity matrix and translates it by a given distance (dx, dy).
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Matrix is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @param dx Horizontal distance to translate.
+ * @param dy Vertical distance to translate.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_MatrixTranslate(OH_Drawing_Matrix*, float dx, float dy);
+
+/**
+ * @brief Sets a matrix as an identity matrix and scales it with the factor (sx, sy) at the rotation point (px, py).
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Matrix is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @param sx Horizontal scale factor.
+ * @param sy Vertical scale factor.
+ * @param px Coordinate point on the X axis.
+ * @param py Coordinate point on the Y axis.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_MatrixScale(OH_Drawing_Matrix*, float sx, float sy, float px, float py);
+
+/**
+ * @brief Inverts a matrix and returns the result.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Matrix or inverse is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @param inverse Pointer to the matrix to invert, which is an {@link OH_Drawing_Matrix} object.
+ * The object can be created by calling {@link OH_Drawing_MatrixCreate}.
+ * @return Returns true if the matrix is reversible and the passed-in inverse is inverted;
+ * returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_MatrixInvert(OH_Drawing_Matrix*, OH_Drawing_Matrix* inverse);
+
+/**
+ * @brief Generates a transform matrix by setting source points and destination points.
+ * Both the number of source points and that of destination points must be in the range [0, 4].
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Matrix is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If count is less than 0 or greater than 4, OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @param src Array of source points. If NULL is passed in, count must be 0.
+ * @param dst Array of destination points. The number of destination points must be the same as that of source points.
+ * If NULL is passed in, count must be 0.
+ * @param count Number of source points or destination points.
+ * If 0 is passed in, the matrix is set to an identity matrix.
+ * @return Returns true if the matrix is generated; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_MatrixSetPolyToPoly(OH_Drawing_Matrix*, const OH_Drawing_Point2D* src,
+ const OH_Drawing_Point2D* dst, uint32_t count);
+
+/**
+ * @brief Maps a source point array to a destination point array by means of matrix transformation.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If any of OH_Drawing_Matrix, src, and dst is NULL or count is less than or equal to 0,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @param src Array of source points.
+ * @param dst Pointer to an array of destination points.
+ * The number of destination points must be the same as that of source points.
+ * @param count Number of source points or destination points.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_MatrixMapPoints(const OH_Drawing_Matrix*, const OH_Drawing_Point2D* src,
+ OH_Drawing_Point2D* dst, int count);
+
+/**
+ * @brief Maps a rectangle to the smallest rectangle that can enclose the vertices to which the four source vertices
+ * are mapped by means of matrix transformation.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If any of OH_Drawing_Matrix, src, and dst is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @param src Pointer to the source rectangle.
+ * @param dst Pointer to the destination rectangle.
+ * @return Returns true if the source rectangle is equal to the destination rectangle;
+ * returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_MatrixMapRect(const OH_Drawing_Matrix*, const OH_Drawing_Rect* src, OH_Drawing_Rect* dst);
+
+/**
+ * @brief Checks whether two OH_Drawing_Matrix objects are equal.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Matrix or other is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Pointer to a matrix, which is an {@link OH_Drawing_Matrix} object.
+ * @param other Pointer to the other matrix, which is an {@link OH_Drawing_Matrix} object.
+ * @return Returns true if the two matrices are equal; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_MatrixIsEqual(OH_Drawing_Matrix*, OH_Drawing_Matrix* other);
+
+/**
+ * @brief Checks whether an OH_Drawing_Matrix object is an identity matrix.
+ * The identity matrix is as follows: | 1 0 0 |
+ * | 0 1 0 |
+ * | 0 0 1 |
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Matrix is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @return Returns true if the matrix is an identity matrix; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_MatrixIsIdentity(OH_Drawing_Matrix*);
+
+/**
+ * @brief Destroys an OH_Drawing_Matrix object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Matrix Pointer to an OH_Drawing_Matrix object.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_MatrixDestroy(OH_Drawing_Matrix*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_memory_stream.h b/en/native_sdk/graphic/native_drawing/drawing_memory_stream.h
new file mode 100644
index 0000000000000000000000000000000000000000..fcdab2b7a082cfe1fc9f027d79517515a0899bdc
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_memory_stream.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_MEMORY_STREAM_H
+#define C_INCLUDE_DRAWING_MEMORY_STREAM_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_memory_stream.h
+ *
+ * @brief Declares the functions related to the memory stream in the drawing module.
+ *
+ * File to include: native_drawing/drawing_memory_stream.h
+ * @library libnative_drawing.so
+ * @since 12
+ * @version 1.0
+ */
+
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates an OH_Drawing_MemoryStream object.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If data is NULL or length is 0, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param data Pointer to the data.
+ * @param length Length of the data.
+ * @param copyData Whether to copy data.
+ * The value true means that the OH_Drawing_MemoryStream object copies the data,
+ * false means that the OH_Drawing_MemoryStream object directly uses the data without copying.
+ * @return Returns the pointer to the {@link OH_Drawing_MemoryStream} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_MemoryStream* OH_Drawing_MemoryStreamCreate(const void* data, size_t length, bool copyData);
+
+/**
+ * @brief Destroys an OH_Drawing_MemoryStream object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_MemoryStream Pointer to an {@link OH_Drawing_MemoryStream} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_MemoryStreamDestroy(OH_Drawing_MemoryStream*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_path.h b/en/native_sdk/graphic/native_drawing/drawing_path.h
index 361ab3f4165999784201e827cbf85be58f778389..aa4ef622a9831472440fa0cdd1face3f278a6c7a 100644
--- a/en/native_sdk/graphic/native_drawing/drawing_path.h
+++ b/en/native_sdk/graphic/native_drawing/drawing_path.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
+ * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -20,8 +20,9 @@
* @addtogroup Drawing
* @{
*
- * @brief Provides functions such as 2D graphics rendering, text drawing, and image display.
- *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
*
* @since 8
@@ -31,8 +32,10 @@
/**
* @file drawing_path.h
*
- * @brief Declares functions related to the path object in the drawing module.
+ * @brief Declares the functions related to the path in the drawing module.
*
+ File to include: native_drawing/drawing_path.h
+ * @library libnative_drawing.so
* @since 8
* @version 1.0
*/
@@ -43,6 +46,108 @@
extern "C" {
#endif
+/**
+ * @brief Enumerates the directions of a closed contour.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_Drawing_PathDirection {
+ /** Adds a closed contour clockwise. */
+ PATH_DIRECTION_CW,
+ /** Adds a closed contour counterclockwise. */
+ PATH_DIRECTION_CCW,
+} OH_Drawing_PathDirection;
+
+/**
+ * @brief Enumerates the fill types of a path.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_Drawing_PathFillType {
+ /** Specifies that "inside" is computed by a non-zero sum of signed edge crossings.
+ * Specifically, draws a point and emits a ray in any direction. A count is used to record the number of
+ * intersection points of the ray and path, and the initial count is 0.
+ * When encountering a clockwise intersection point (the path passes from the left to the right of the ray),
+ * the count increases by 1. When encountering a counterclockwise intersection point (the path passes from the
+ * right to the left of the ray), the count decreases by 1. If the final count is not 0, the point is inside
+ * the path and needs to be colored. If the final count is 0, the point is not colored. */
+ PATH_FILL_TYPE_WINDING,
+ /** Specifies that "inside" is computed by an odd number of edge crossings.
+ * Specifically, draws a point and emits a ray in any direction. If the number of intersection points of the ray
+ * and path is an odd number, the point is considered to be inside the path and needs to be colored.
+ * If the number is an even number, the point is not colored. */
+ PATH_FILL_TYPE_EVEN_ODD,
+ /** Same as PATH_FILL_TYPE_WINDING, but draws outside of the path, rather than inside. */
+ PATH_FILL_TYPE_INVERSE_WINDING,
+ /** Same as PATH_FILL_TYPE_EVEN_ODD, but draws outside of the path, rather than inside. */
+ PATH_FILL_TYPE_INVERSE_EVEN_ODD,
+} OH_Drawing_PathFillType;
+
+/**
+ * @brief Enumerates the path adding modes.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_Drawing_PathAddMode {
+ /** Adds a path in append mode. */
+ PATH_ADD_MODE_APPEND,
+ /** Adds a line segment to close the path if the previous path is not closed. */
+ PATH_ADD_MODE_EXTEND,
+} OH_Drawing_PathAddMode;
+
+/**
+ * @brief Enumerates the operation modes available for a path.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_Drawing_PathOpMode {
+ /**
+ * Difference operation.
+ */
+ PATH_OP_MODE_DIFFERENCE,
+ /**
+ * Intersection operation.
+ */
+ PATH_OP_MODE_INTERSECT,
+ /**
+ * Union operation.
+ */
+ PATH_OP_MODE_UNION,
+ /**
+ * XOR operation.
+ */
+ PATH_OP_MODE_XOR,
+ /**
+ * Reverse difference operation.
+ */
+ PATH_OP_MODE_REVERSE_DIFFERENCE,
+} OH_Drawing_PathOpMode;
+
+/**
+ * @brief Enumerates the types of matrix information obtained during path measurement.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_Drawing_PathMeasureMatrixFlags {
+ /**
+ * Obtains the matrix corresponding to the location information.
+ */
+ GET_POSITION_MATRIX,
+ /**
+ * Obtains the matrix corresponding to the tangent information.
+ */
+ GET_TANGENT_MATRIX,
+ /**
+ * Obtains the matrix corresponding to the location and tangent information.
+ */
+ GET_POSITION_AND_TANGENT_MATRIX,
+} OH_Drawing_PathMeasureMatrixFlags;
+
/**
* @brief Creates an OH_Drawing_Path object.
*
@@ -53,11 +158,25 @@ extern "C" {
*/
OH_Drawing_Path* OH_Drawing_PathCreate(void);
+/**
+ * @brief Copies an existing {@link OH_Drawing_Path} object to create a new one.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Path is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object.
+ * @return Returns the pointer to the {@link OH_Drawing_Path} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Path* OH_Drawing_PathCopy(OH_Drawing_Path*);
+
/**
* @brief Destroys an OH_Drawing_Path object and reclaims the memory occupied by the object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object.
+ * @param OH_Drawing_Path Pointer to an OH_Drawing_Path object.
* @since 8
* @version 1.0
*/
@@ -66,10 +185,13 @@ void OH_Drawing_PathDestroy(OH_Drawing_Path*);
/**
* @brief Sets the start point of a path.
*
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Path is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object.
- * @param x Indicates the x coordinate of the start point.
- * @param y Indicates the y coordinate of the start point.
+ * @param OH_Drawing_Path Pointer to an OH_Drawing_Path object.
+ * @param x X coordinate of the start point.
+ * @param y Y coordinate of the start point.
* @since 8
* @version 1.0
*/
@@ -77,28 +199,38 @@ void OH_Drawing_PathMoveTo(OH_Drawing_Path*, float x, float y);
/**
* @brief Draws a line segment from the last point of a path to the target point.
+ * If the path is empty, the start point (0, 0) is used.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Path is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object.
- * @param x Indicates the x coordinate of the target point.
- * @param y Indicates the y coordinate of the target point.
+ * @param OH_Drawing_Path Pointer to an OH_Drawing_Path object.
+ * @param x X coordinate of the target point.
+ * @param y Y coordinate of the target point.
* @since 8
* @version 1.0
*/
void OH_Drawing_PathLineTo(OH_Drawing_Path*, float x, float y);
/**
- * @brief Draws an arc to a path. This is done by using angle arc mode. In this mode, a rectangle that encloses an ellipse is specified first,
- * and then a start angle and a sweep angle are specified. The arc is a portion of the ellipse defined by the start angle and the sweep angle. By default, a line segment from the last point of the path to the start point of the arc is also added.
+ * @brief Draws an arc to a path. This is done by using angle arc mode. In this mode, a rectangle is specified first,
+ * and then a start angle and scanning degree are specified. The inscribed ellipse of the rectangle will be used to
+ * intercept the arc. The arc is a portion of the ellipse defined by the start angle and the sweep angle.
+ * If the path is empty, a line segment from the last point of the path to the start point of the arc is also added.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Path is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object.
- * @param x1 Indicates the x coordinate of the upper left corner of the rectangle.
- * @param y1 Indicates the y coordinate of the upper left corner of the rectangle.
- * @param x2 Indicates the x coordinate of the lower right corner of the rectangle.
- * @param y2 Indicates the y coordinate of the lower right corner of the rectangle.
- * @param startDeg Indicates the start angle, in degrees.
- * @param sweepDeg Indicates the angle to sweep, in degrees.
+ * @param OH_Drawing_Path Pointer to an OH_Drawing_Path object.
+ * @param x1 X coordinate of the upper left corner of the rectangle.
+ * @param y1 Y coordinate of the upper left corner of the rectangle.
+ * @param x2 X coordinate of the lower right corner of the rectangle.
+ * @param y2 Y coordinate of the lower right corner of the rectangle.
+ * @param startDeg Start angle. The start direction (0°) of the angle is the positive direction of the X axis.
+ * @param sweepDeg Sweep degree. A positive value indicates a clockwise swipe, and a negative value indicates a
+ * counterclockwise swipe. The actual swipe degree is the modulo operation result of the input parameter by 360.
* @since 8
* @version 1.0
*/
@@ -106,29 +238,59 @@ void OH_Drawing_PathArcTo(OH_Drawing_Path*, float x1, float y1, float x2, float
/**
* @brief Draws a quadratic Bezier curve from the last point of a path to the target point.
+ * If the path is empty, the start point (0, 0) is used.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Path is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object.
- * @param ctrlX Indicates the x coordinate of the control point.
- * @param ctrlY Indicates the y coordinate of the control point.
- * @param endX Indicates the x coordinate of the target point.
- * @param endY Indicates the y coordinate of the target point.
+ * @param OH_Drawing_Path Pointer to an OH_Drawing_Path object.
+ * @param ctrlX X coordinate of the control point.
+ * @param ctrlY Y coordinate of the control point.
+ * @param endX X coordinate of the target point.
+ * @param endY Y coordinate of the target point.
* @since 8
* @version 1.0
*/
void OH_Drawing_PathQuadTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float endX, float endY);
+/**
+ * @brief Draws a conic curve from the last point of a path to the target point.
+ * If the path is empty, the start point (0, 0) is used.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Path is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object.
+ * @param ctrlX X coordinate of the control point.
+ * @param ctrlY Y coordinate of the control point.
+ * @param endX X coordinate of the target point.
+ * @param endY Y coordinate of the target point.
+ * @param weight Weight of the curve, which determines its shape. The larger the value, the closer of the curve to the
+ * control point. If the value is less than or equal to 0, this function is equivalent to {@link OH_Drawing_PathLineTo},
+ * that is, adding a line segment from the last point of the path to the target point.
+ * If the value is 1, this function is equivalent to {@link OH_Drawing_PathQuadTo}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathConicTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float endX, float endY, float weight);
+
/**
* @brief Draws a cubic Bezier curve from the last point of a path to the target point.
+ * If the path is empty, the start point (0, 0) is used.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Path is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object.
- * @param ctrlX1 Indicates the x coordinate of the first control point.
- * @param ctrlY1 Indicates the y coordinate of the first control point.
- * @param ctrlX2 Indicates the x coordinate of the second control point.
- * @param ctrlY2 Indicates the y coordinate of the second control point.
- * @param endX Indicates the x coordinate of the target point.
- * @param endY Indicates the y coordinate of the target point.
+ * @param OH_Drawing_Path Pointer to an OH_Drawing_Path object.
+ * @param ctrlX1 X coordinate of the first control point.
+ * @param ctrlY1 Y coordinate of the first control point.
+ * @param ctrlX2 X coordinate of the second control point.
+ * @param ctrlY2 Y coordinate of the second control point.
+ * @param endX X coordinate of the target point.
+ * @param endY Y coordinate of the target point.
* @since 8
* @version 1.0
*/
@@ -136,20 +298,580 @@ void OH_Drawing_PathCubicTo(
OH_Drawing_Path*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY);
/**
- * @brief Closes a path. A line segment from the start point to the last point of the path is added.
+ * @brief Sets the start position relative to the last point of a path.
+ * If the path is empty, the start point (0, 0) is used.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Path is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object.
+ * @param x X offset relative to the last point, which is used to specify the X coordinate of the start point.
+ * @param y Y offset relative to the last point, which is used to specify the Y coordinate of the start point.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathRMoveTo(OH_Drawing_Path*, float x, float y);
+
+/**
+ * @brief Draws a line segment from the last point of a path to a point relative to the last point.
+ * If the path is empty, the start point (0, 0) is used.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Path is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object.
+ * @param x X offset relative to the last point, which is used to specify the X coordinate of the target point.
+ * @param y Y offset relative to the last point, which is used to specify the X coordinate of the target point.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathRLineTo(OH_Drawing_Path*, float x, float y);
+
+/**
+ * @brief Draws a quadratic Bezier curve from the last point of a path to a point relative to the last point.
+ * If the path is empty, the start point (0, 0) is used.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Path is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object.
+ * @param ctrlX X offset relative to the last point, which is used to specify the X coordinate of the control point.
+ * @param ctrlY Y offset relative to the last point, which is used to specify the Y coordinate of the control point.
+ * @param endX X offset relative to the last point, which is used to specify the X coordinate of the target point.
+ * @param endY Y offset relative to the last point, which is used to specify the Y coordinate of the target point.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathRQuadTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float endX, float endY);
+
+/**
+ * @brief Draws a conic curve from the last point of a path to a point relative to the last point.
+ * If the path is empty, the start point (0, 0) is used.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Path is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object.
+ * @param ctrlX X offset relative to the last point, which is used to specify the X coordinate of the control point.
+ * @param ctrlY Y offset relative to the last point, which is used to specify the Y coordinate of the control point.
+ * @param endX X offset relative to the last point, which is used to specify the X coordinate of the target point.
+ * @param endY Y offset relative to the last point, which is used to specify the Y coordinate of the target point.
+ * @param weight Weight of the curve, which determines its shape. The larger the value, the closer of the curve to
+ * the control point. If the value is less than or equal to 0, this function is equivalent to
+ * {@link OH_Drawing_PathRLineTo}, that is, adding a line segment from the last point of the path to the target point.
+ * If the value is 1, this function is equivalent to {@link OH_Drawing_PathRQuadTo}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathRConicTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float endX, float endY, float weight);
+
+/**
+ * @brief Draws a cubic Bezier curve from the last point of a path to a point relative to the last point.
+ * If the path is empty, the start point (0, 0) is used.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Path is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object.
+ * @param ctrlX1 X offset relative to the last point, which is used to specify the X coordinate of
+ * the first control point.
+ * @param ctrlY1 Y offset relative to the last point, which is used to specify the Y coordinate of
+ * the first control point.
+ * @param ctrlX2 X offset relative to the last point, which is used to specify the X coordinate of
+ * the second control point.
+ * @param ctrlY2 Y offset relative to the last point, which is used to specify the Y coordinate of
+ * the second control point.
+ * @param endX X offset relative to the last point, which is used to specify the X coordinate of the target point.
+ * @param endY Y offset relative to the last point, which is used to specify the Y coordinate of the target point.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathRCubicTo(
+ OH_Drawing_Path*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY);
+
+/**
+ * @brief Adds a rectangle contour to a path in the specified direction.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Path is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_PathDirection is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object.
+ * @param left X coordinate of the upper left corner of the rectangle.
+ * @param top Y coordinate of the upper left corner of the rectangle.
+ * @param right X coordinate of the lower right corner of the rectangle.
+ * @param bottom Y coordinate of the lower right corner of the rectangle.
+ * @param OH_Drawing_PathDirection Path direction.
+ For details about the available options, see {@link OH_Drawing_PathDirection}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathAddRect(OH_Drawing_Path*, float left, float top,
+ float right, float bottom, OH_Drawing_PathDirection);
+
+/**
+ * @brief Adds a rectangle contour to a path in the specified direction.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Path or OH_Drawing_Rect is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_PathDirection is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object.
+ * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object.
+ * @param OH_Drawing_Rect Pointer to an {@link OH_Drawing_Rect} object.
+ * @param OH_Drawing_PathDirection Path direction.
+ * For details about the available options, see {@link OH_Drawing_PathDirection}.
+ * @param start Start point, indicating the corner of the rectangle from which the path is drawn.
+ * The value 0 means the upper left corner, 1 means the upper right corner,
+ * 2 means the lower right corner, and 3 means the lower left corner.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathAddRectWithInitialCorner(OH_Drawing_Path*, const OH_Drawing_Rect*,
+ OH_Drawing_PathDirection, uint32_t start);
+
+/**
+ * @brief Adds a rounded rectangle contour to a path in the specified direction.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Path or roundRect is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_PathDirection is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object.
+ * @param roundRect Pointer to an {@link OH_Drawing_RoundRect} object.
+ * @param OH_Drawing_PathDirection Path direction.
+ * For details about the available options, see {@link OH_Drawing_PathDirection}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathAddRoundRect(OH_Drawing_Path*, const OH_Drawing_RoundRect* roundRect, OH_Drawing_PathDirection);
+
+/**
+ * @brief Adds an oval to a path. OH_Drawing_Rect specifies the outer tangent rectangle of the oval,
+ * and OH_Drawing_PathDirection specifies whether the drawing is clockwise or anticlockwise.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Path or OH_Drawing_Rect is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_PathDirection is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object.
+ * @param OH_Drawing_Rect Pointer to an {@link OH_Drawing_Rect} object.
+ * @param start Start point of the oval.
+ * @param OH_Drawing_PathDirection Path direction.
+ * For details about the available options, see {@link OH_Drawing_PathDirection}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathAddOvalWithInitialPoint(OH_Drawing_Path*, const OH_Drawing_Rect*,
+ uint32_t start, OH_Drawing_PathDirection);
+
+/**
+ * @brief Adds an arc to a path as the start of a new contour. The arc added is part of the inscribed ellipse
+ * of the rectangle, from the start angle through the sweep angle. If the sweep angle is less than or equal to -360°,
+ * or if the sweep angle is greater than or equal to 360°, and start angle modulo 90 is nearly zero,
+ * an oval instead of an ellipse is added.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Path or OH_Drawing_Rect is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object.
+ * @param OH_Drawing_Rect Pointer to an {@link OH_Drawing_Rect} object.
+ * @param startAngle Start angle of the arc, in degrees.
+ * @param sweepAngle Angle to sweep, in degrees. A positive number indicates a clockwise sweep,
+ * and a negative number indicates a counterclockwise sweep.
+ * The actual swipe degree is the modulo operation result of the input parameter by 360.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathAddArc(OH_Drawing_Path*, const OH_Drawing_Rect*, float startAngle, float sweepAngle);
+
+/**
+ * @brief Transforms the points in a src path by a matrix and adds the new one to the current path.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Path or src is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Path Pointer to the current path, which is an {@link OH_Drawing_Path} object.
+ * @param src Pointer to a source path, which is an {@link OH_Drawing_Path} object.
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * If NULL is passed in, it is the identity matrix.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathAddPath(OH_Drawing_Path*, const OH_Drawing_Path* src, const OH_Drawing_Matrix*);
+
+/**
+ * @brief Transforms the points in a src path by a matrix and adds the new one to the current path
+ * with the specified adding mode.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either path or src is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_PathAddMode is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Pointer to the current path, which is an {@link OH_Drawing_Path} object.
+ * @param src Pointer to a source path, which is an {@link OH_Drawing_Path} object.
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * If NULL is passed in, it is the identity matrix.
+ * @param OH_Drawing_PathAddMode Path adding mode.
+ * For details about the available options, see {@link OH_Drawing_PathAddMode}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathAddPathWithMatrixAndMode(OH_Drawing_Path* path, const OH_Drawing_Path* src,
+ const OH_Drawing_Matrix*, OH_Drawing_PathAddMode);
+
+/**
+ * @brief Adds a src path to the current path with the specified adding mode.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either path or src is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_PathAddMode is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Pointer to the current path, which is an {@link OH_Drawing_Path} object.
+ * @param src Pointer to a source path, which is an {@link OH_Drawing_Path} object.
+ * @param OH_Drawing_PathAddMode Path adding mode.
+ * For details about the available options, see {@link OH_Drawing_PathAddMode}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathAddPathWithMode(OH_Drawing_Path* path, const OH_Drawing_Path* src, OH_Drawing_PathAddMode);
+
+/**
+ * @brief Translates a src path by an offset and adds the new one to the current path
+ * with the specified adding mode.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either path or src is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_PathAddMode is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Pointer to the current path, which is an {@link OH_Drawing_Path} object.
+ * @param src Pointer to a source path, which is an {@link OH_Drawing_Path} object.
+ * @param dx X offset.
+ * @param dy Y offset.
+ * @param OH_Drawing_PathAddMode Path adding mode.
+ * For details about the available options, see {@link OH_Drawing_PathAddMode}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathAddPathWithOffsetAndMode(OH_Drawing_Path* path, const OH_Drawing_Path* src,
+ float dx, float dy, OH_Drawing_PathAddMode);
+
+/**
+ * @brief Adds a polygon to a path.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either path or points is NULL or count is 0,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Pointer to the current path, which is an {@link OH_Drawing_Path} object.
+ * @param points Pointer to an array that holds the vertex coordinates of the polygon.
+ * @param count Size of the array.
+ * @param isClosed Whether the path is closed.
+ * The value true means that the path is closed, and false means the opposite.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathAddPolygon(OH_Drawing_Path* path, const OH_Drawing_Point2D* points, uint32_t count, bool isClosed);
+
+/**
+ * @brief Adds a circle to a path in the specified direction.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If path is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If radius is less than or equal to 0, OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ * If OH_Drawing_PathDirection is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Pointer to an {@link OH_Drawing_Path} object.
+ * @param x X coordinate of the circle center.
+ * @param y Y coordinate of the circle center.
+ * @param radius Radius of the circle.
+ * @param OH_Drawing_PathDirection Path direction.
+ * For details about the available options, see {@link OH_Drawing_PathDirection}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathAddCircle(OH_Drawing_Path* path, float x, float y, float radius, OH_Drawing_PathDirection);
+
+/**
+ * @brief Adds an oval to a path in the specified direction.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Path or OH_Drawing_Rect is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_PathDirection is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object.
+ * @param OH_Drawing_Rect Pointer to an {@link OH_Drawing_Rect} object.
+ * @param OH_Drawing_PathDirection Path direction.
+ * For details about the available options, see {@link OH_Drawing_PathDirection}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathAddOval(OH_Drawing_Path*, const OH_Drawing_Rect*, OH_Drawing_PathDirection);
+
+/**
+ * @brief Parses the path represented by an SVG string.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either path or str is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Pointer to an {@link OH_Drawing_Path} object.
+ * @param str Pointer to the SVG string.
+ * @return Returns true if the SVG string is parsed successfully; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_PathBuildFromSvgString(OH_Drawing_Path* path, const char* str);
+
+/**
+ * @brief Checks whether a coordinate point is included in a path. For details, see {@link OH_Drawing_PathFillType}.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Path is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object.
+ * @param x Coordinate point on the X axis.
+ * @param y Coordinate point on the Y axis.
+ * @return Returns true if the coordinate point is included in the path; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_PathContains(OH_Drawing_Path*, float x, float y);
+
+/**
+ * @brief Transforms the points in a path by a matrix.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Path or OH_Drawing_Matrix is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object.
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathTransform(OH_Drawing_Path*, const OH_Drawing_Matrix*);
+
+/**
+ * @brief Transforms the points in a src path by a matrix and uses the new one to replace the dst path.
+ * If dst is NULL, the src path is replaced.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either src or OH_Drawing_Matrix is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param src Pointer to a source path, which is an {@link OH_Drawing_Path} object.
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * @param dst Pointer to a destination path, which is an {@link OH_Drawing_Path} object.
+ * @param applyPerspectiveClip Whether to apply perspective cropping to the new path.
+ * The value true means to apply perspective cropping, and false means the opposite.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathTransformWithPerspectiveClip(OH_Drawing_Path* src, const OH_Drawing_Matrix*,
+ OH_Drawing_Path* dst, bool applyPerspectiveClip);
+
+/**
+ * @brief Sets the fill type for a path.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Path is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_PathFillType is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object.
+ * @param OH_Drawing_PathFillType Fill type of the path.
+ * For details about the available options, see {@link OH_Drawing_PathFillType}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathSetFillType(OH_Drawing_Path*, OH_Drawing_PathFillType);
+
+/**
+ * @brief Obtains the length of a path.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Path is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object.
+ * @param forceClosed Whether the path can be modified or deleted freely after the function is called.
+ * The value true means that the path can be modified or deleted freely, and false means the opposite.
+ * @return Returns the length of the path.
+ * @since 12
+ * @version 1.0
+ */
+float OH_Drawing_PathGetLength(OH_Drawing_Path*, bool forceClosed);
+
+/**
+ * @brief Obtains the minimum bounds that enclose a path.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Path or OH_Drawing_Rect is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object.
+ * @param OH_Drawing_Rect Pointer to an {@link OH_Drawing_Rect} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathGetBounds(OH_Drawing_Path*, OH_Drawing_Rect*);
+
+/**
+ * @brief Closes a path by drawing a line segment from the current point to the start point of the path.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Path is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object.
* @since 8
* @version 1.0
*/
void OH_Drawing_PathClose(OH_Drawing_Path*);
+/**
+ * @brief Checks whether a path is closed.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If path is NULL, {@link OH_DRAWING_ERROR_INVALID_PARAMETER} is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Pointer to an {@link OH_Drawing_Path} object.
+ * @param forceClosed Whether the path is measured as a closed path. The value true means that the path is
+ * considered closed during measurement, and false means that the path is measured
+ * based on the actual closed status.
+ * @return Returns true if the path is closed; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_PathIsClosed(OH_Drawing_Path* path, bool forceClosed);
+
+/**
+ * @brief Obtains the coordinates and tangent at a distance from the start point of a path.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If any of path, position, or tangent is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Pointer to an {@link OH_Drawing_Path} object.
+ * @param forceClosed Whether the path is measured as a closed path. The value true means that the path is
+ * considered closed during measurement, and false means that the path is measured
+ * based on the actual closed status.
+ * @param distance Distance from the start point. If the distance is less than 0, it is considered as 0.
+ * If the distance is greater than the path length, it is considered as the path length.
+ * @param position Pointer to the coordinates.
+ * @param tangent Pointer to the tangent.
+ * @return Returns true if the operation is successful; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_PathGetPositionTangent(OH_Drawing_Path* path, bool forceClosed,
+ float distance, OH_Drawing_Point2D* position, OH_Drawing_Point2D* tangent);
+
+/**
+ * @brief Combines two paths based on the specified operation mode.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either path or srcPath is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If op is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Pointer to an {@link OH_Drawing_Path} object, in which the resulting path is saved.
+ * @param other Pointer to an {@link OH_Drawing_Path} object.
+ * @param op Operation mode of the path. For details about the available options, see {@link OH_Drawing_PathOpMode}.
+ * @return Returns true if the resulting path is not empty; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_PathOp(OH_Drawing_Path* path, const OH_Drawing_Path* other, OH_Drawing_PathOpMode op);
+
+/**
+ * @brief Obtains a transformation matrix at a distance from the start point of a path.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either path or matrix is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If flag is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Pointer to an {@link OH_Drawing_Path} object.
+ * @param forceClosed Whether the path is measured as a closed path. The value true means that the path is
+ * considered closed during measurement, and false means that the path is measured
+ * based on the actual closed status.
+ * @param distance Distance from the start point. If the distance is less than 0, it is considered as 0.
+ * If the distance is greater than the path length, it is considered as the path length.
+ * @param matrix Pointer to the transformation matrix.
+ * @param flag Type of the matrix information.
+ * For details about the available options, see {@link OH_Drawing_PathMeasureMatrixFlags}.
+ * @return Returns true if the transformation matrix is obtained successfully; returns false otherwise.
+ * The possible failure cause is that path is NULL or the path length is 0.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_PathGetMatrix(OH_Drawing_Path* path, bool forceClosed,
+ float distance, OH_Drawing_Matrix* matrix, OH_Drawing_PathMeasureMatrixFlags flag);
+
+/**
+ * @brief Translates a path by an offset along the X axis and Y axis and adds the new one to the dst path.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If path is NULL, {@link OH_DRAWING_ERROR_INVALID_PARAMETER} is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Pointer to the current path, which is an {@link OH_Drawing_Path} object.
+ * @param dst Pointer to a destination path, which is an {@link OH_Drawing_Path} object.
+ * If NULL is passed in, the result is stored in the current path.
+ * @param dx X offset.
+ * @param dy Y offset.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathOffset(OH_Drawing_Path* path, OH_Drawing_Path* dst, float dx, float dy);
+
/**
* @brief Resets path data.
*
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Path is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object.
+ * @param OH_Drawing_Path Pointer to an OH_Drawing_Path object.
* @since 8
* @version 1.0
*/
diff --git a/en/native_sdk/graphic/native_drawing/drawing_path_effect.h b/en/native_sdk/graphic/native_drawing/drawing_path_effect.h
new file mode 100644
index 0000000000000000000000000000000000000000..4baff4c6e60eb2ee36d0f7bf530eba3d33b856f8
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_path_effect.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_PATH_EFFECT_H
+#define C_INCLUDE_DRAWING_PATH_EFFECT_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_path_effect.h
+ *
+ * @brief Declares the functions related to the path effect in the drawing module.
+ *
+ * File to include: native_drawing/drawing_path_effect.h
+ * @library libnative_drawing.so
+ * @since 12
+ * @version 1.0
+ */
+
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates an OH_Drawing_PathEffect object with a dotted line effect.
+ * The dashed line effect is determined by a group of "on" and "off" intervals.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If intervals is NULL or count is less than or equal to 0,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param intervals Pointer to the start address of the dashed line interval array.
+ * In the array, an even entry indicates an "on" interval and an odd entry indicates an "off" interval.
+ * The unit is px.
+ * @param count Number of entries in the dashed line interval array. The value must be an even number greater than 0.
+ * @param phase Offset in the dashed line interval array.
+ * @return Returns the pointer to the {@link OH_Drawing_PathEffect} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_PathEffect* OH_Drawing_CreateDashPathEffect(float* intervals, int count, float phase);
+
+/**
+ * @brief Destroys an OH_Drawing_PathEffect object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_PathEffect Pointer to an {@link OH_Drawing_PathEffect} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PathEffectDestroy(OH_Drawing_PathEffect*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_pen.h b/en/native_sdk/graphic/native_drawing/drawing_pen.h
index 5d781bf6f881d1ea8de216040a38bb8c42d92df7..be8cb76e633413ea57d97487c77f4d74ce0a21da 100644
--- a/en/native_sdk/graphic/native_drawing/drawing_pen.h
+++ b/en/native_sdk/graphic/native_drawing/drawing_pen.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
+ * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -20,8 +20,9 @@
* @addtogroup Drawing
* @{
*
- * @brief Provides functions such as 2D graphics rendering, text drawing, and image display.
- *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
*
* @since 8
@@ -31,8 +32,10 @@
/**
* @file drawing_pen.h
*
- * @brief Declares functions related to the pen object in the drawing module.
+ * @brief Declares the functions related to the pen the drawing module.
*
+ * File to include: native_drawing/drawing_pen.h
+ * @library libnative_drawing.so
* @since 8
* @version 1.0
*/
@@ -53,21 +56,40 @@ extern "C" {
*/
OH_Drawing_Pen* OH_Drawing_PenCreate(void);
+/**
+ * @brief Copies an existing {@link OH_Drawing_Pen} object to create a new one.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param pen Pointer to an OH_Drawing_Pen object.
+ * @return Returns the pointer to the {@link OH_Drawing_Pen} object created. If NULL is returned, the creation fails.
+ * The possible failure cause is that no memory is available or pen is NULL.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Pen* OH_Drawing_PenCopy(OH_Drawing_Pen* pen);
+
/**
* @brief Destroys an OH_Drawing_Pen object and reclaims the memory occupied by the object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object.
+ * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object.
* @since 8
* @version 1.0
*/
void OH_Drawing_PenDestroy(OH_Drawing_Pen*);
/**
- * @brief Checks whether anti-aliasing is enabled for a pen. If anti-aliasing is enabled, edges will be drawn with partial transparency.
+ * @brief Checks whether anti-aliasing is enabled for a pen.
+ * Anti-aliasing makes the pixels around the shape edges semi-transparent.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object.
+ * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object.
* @return Returns true if anti-aliasing is enabled; returns false otherwise.
* @since 8
* @version 1.0
@@ -75,11 +97,16 @@ void OH_Drawing_PenDestroy(OH_Drawing_Pen*);
bool OH_Drawing_PenIsAntiAlias(const OH_Drawing_Pen*);
/**
- * @brief Enables or disables anti-aliasing for a pen. If anti-aliasing is enabled, edges will be drawn with partial transparency.
+ * @brief Enables or disables anti-aliasing for a pen.
+ * Anti-aliasing makes the pixels around the shape edges semi-transparent.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object.
- * @param bool Specifies whether to enable anti-aliasing. The value true means to enable anti-aliasing, and false means the opposite.
+ * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object.
+ * @param bool Whether to enable anti-aliasing. The value true means to enable anti-aliasing,
+ * and false means the opposite.
* @since 8
* @version 1.0
*/
@@ -88,8 +115,11 @@ void OH_Drawing_PenSetAntiAlias(OH_Drawing_Pen*, bool);
/**
* @brief Obtains the color of a pen. The color is used by the pen to outline a shape.
*
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object.
+ * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object.
* @return Returns a 32-bit (ARGB) variable that describes the color.
* @since 8
* @version 1.0
@@ -99,19 +129,54 @@ uint32_t OH_Drawing_PenGetColor(const OH_Drawing_Pen*);
/**
* @brief Sets the color for a pen. The color is used by the pen to outline a shape.
*
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object.
- * @param color Indicates the color to set, which is a 32-bit (ARGB) variable.
+ * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object.
+ * @param color Color, which is a 32-bit (ARGB) variable.
* @since 8
* @version 1.0
*/
void OH_Drawing_PenSetColor(OH_Drawing_Pen*, uint32_t color);
+/**
+ * @brief Obtains the alpha value of a pen. This value is used by the alpha channel when the pen outlines a shape.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object.
+ * @return Returns an 8-bit variable that describes the alpha value.
+ * @since 11
+ * @version 1.0
+ */
+uint8_t OH_Drawing_PenGetAlpha(const OH_Drawing_Pen*);
+
+/**
+
+ * @brief Sets the alpha value for a pen. This value is used by the alpha channel when the pen outlines a shape.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object.
+ * @param alpha Alpha value, which is an 8-bit variable.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_PenSetAlpha(OH_Drawing_Pen*, uint8_t alpha);
+
/**
* @brief Obtains the thickness of a pen. This thickness determines the width of the outline of a shape.
*
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object.
+ * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object.
* @return Returns the thickness.
* @since 8
* @version 1.0
@@ -121,19 +186,26 @@ float OH_Drawing_PenGetWidth(const OH_Drawing_Pen*);
/**
* @brief Sets the thickness for a pen. This thickness determines the width of the outline of a shape.
*
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object.
- * @param width Indicates the thickness to set, which is a variable.
+ * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object.
+ * @param width Thickness, which is a variable.
* @since 8
* @version 1.0
*/
void OH_Drawing_PenSetWidth(OH_Drawing_Pen*, float width);
/**
- * @brief Obtains the stroke miter limit of a polyline drawn by a pen. When the corner type is bevel, a beveled corner is displayed if the miter limit is exceeded, and a mitered corner is displayed if the miter limit is not exceeded.
+ * @brief Obtains the stroke miter limit of a polyline drawn by a pen. When the corner type is bevel, a beveled corner
+ * is displayed if the miter limit is exceeded, and a mitered corner is displayed if the miter limit is not exceeded.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object.
+ * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object.
* @return Returns the miter limit.
* @since 8
* @version 1.0
@@ -141,36 +213,50 @@ void OH_Drawing_PenSetWidth(OH_Drawing_Pen*, float width);
float OH_Drawing_PenGetMiterLimit(const OH_Drawing_Pen*);
/**
- * @brief Sets the stroke miter limit for a polyline drawn by a pen. When the corner type is bevel, a beveled corner is displayed if the miter limit is exceeded, and a mitered corner is displayed if the miter limit is not exceeded.
+ * @brief Sets the stroke miter limit for a polyline drawn by a pen. When the corner type is bevel, a beveled corner
+ * is displayed if the miter limit is exceeded, and a mitered corner is displayed if the miter limit is not exceeded.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object.
- * @param miter Indicates a variable that describes the miter limit.
+ * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object.
+ * @param miter Stroke miter limit, which is a variable.
* @since 8
* @version 1.0
*/
void OH_Drawing_PenSetMiterLimit(OH_Drawing_Pen*, float miter);
/**
- * @brief Enumerates line cap styles of a pen. The line cap style defines the style of both ends of a line segment drawn by the pen.
- *
+ * @brief Enumerates the line cap styles of a pen. The line cap style defines the style of both ends of a line segment
+ * drawn by the pen.
+ *
* @since 8
* @version 1.0
*/
-typedef enum {
+typedef enum OH_Drawing_PenLineCapStyle {
/** There is no cap style. Both ends of the line segment are cut off square. */
LINE_FLAT_CAP,
- /** Square cap style. Both ends have a square, the height of which is half of the width of the line segment, with the same width. */
+ /**
+ * Square cap style. Both ends have a square, the height of which is half of the width of the line segment,
+ * with the same width.
+ */
LINE_SQUARE_CAP,
- /** Round cap style. Both ends have a semicircle centered, the diameter of which is the same as the width of the line segment. */
+ /**
+ * Round cap style. Both ends have a semicircle centered, the diameter of which is the same as the width of
+ * the line segment.
+ */
LINE_ROUND_CAP
} OH_Drawing_PenLineCapStyle;
/**
* @brief Obtains the line cap style of a pen.
*
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object.
+ * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object.
* @return Returns the line cap style.
* @since 8
* @version 1.0
@@ -180,22 +266,31 @@ OH_Drawing_PenLineCapStyle OH_Drawing_PenGetCap(const OH_Drawing_Pen*);
/**
* @brief Sets the line cap style for a pen.
*
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_PenLineCapStyle is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object.
- * @param OH_Drawing_PenLineCapStyle Indicates a variable that describes the line cap style.
+ * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object.
+ * @param OH_Drawing_PenLineCapStyle Line cap style, which is a variable.
* @since 8
* @version 1.0
*/
void OH_Drawing_PenSetCap(OH_Drawing_Pen*, OH_Drawing_PenLineCapStyle);
/**
- * @brief Enumerates pen line join styles. The line join style defines the shape of the joints of a polyline segment drawn by the pen.
- *
+ * @brief Enumerates the line join styles of a pen. The line join style defines the shape of the joints of a polyline
+ * segment drawn by the pen.
+ *
* @since 8
* @version 1.0
*/
-typedef enum {
- /** Mitered corner. If the angle of a polyline is small, its miter length may be inappropriate. In this case, you need to use the miter limit to limit the miter length. */
+typedef enum OH_Drawing_PenLineJoinStyle {
+ /**
+ * Mitered corner. If the angle of a polyline is small, its miter length may be inappropriate. In this case,
+ * you need to use the miter limit to limit the miter length.
+ */
LINE_MITER_JOIN,
/** Round corner. */
LINE_ROUND_JOIN,
@@ -206,8 +301,11 @@ typedef enum {
/**
* @brief Obtains the line join style of a pen.
*
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object.
+ * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object.
* @return Returns the line join style.
* @since 8
* @version 1.0
@@ -217,14 +315,144 @@ OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin(const OH_Drawing_Pen*);
/**
* @brief Sets the line join style for a pen.
*
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_PenLineJoinStyle is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object.
- * @param OH_Drawing_PenLineJoinStyle Indicates a variable that describes the line join style.
+ * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object.
+ * @param OH_Drawing_PenLineJoinStyle Line join style.
* @since 8
* @version 1.0
*/
void OH_Drawing_PenSetJoin(OH_Drawing_Pen*, OH_Drawing_PenLineJoinStyle);
+/**
+ * @brief Sets the shader effect for a pen.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Pen Pointer to an {@link OH_Drawing_Pen} object.
+ * @param OH_Drawing_ShaderEffect Pointer to an {@link OH_Drawing_ShaderEffect} object.
+ * If NULL is passed in, the shader effect will be cleared.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_PenSetShaderEffect(OH_Drawing_Pen*, OH_Drawing_ShaderEffect*);
+
+/**
+ * @brief Sets the shadow layer for a pen. The shadow layer effect takes effect only when text is drawn.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Pen Pointer to an {@link OH_Drawing_Pen} object.
+ * @param OH_Drawing_ShadowLayer Pointer to an {@link OH_Drawing_ShadowLayer} object.
+ * If NULL is passed in, the shadow layer effect will be cleared.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PenSetShadowLayer(OH_Drawing_Pen*, OH_Drawing_ShadowLayer*);
+
+/**
+ * @brief Sets the path effect for a pen.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Pen Pointer to an {@link OH_Drawing_Pen} object.
+ * @param OH_Drawing_PathEffect Pointer to an {@link OH_Drawing_PathEffect} object.
+ * If NULL is passed in, the path effect will be cleared.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PenSetPathEffect(OH_Drawing_Pen*, OH_Drawing_PathEffect*);
+
+/**
+ * @brief Sets a filter for a pen.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Pen Pointer to an {@link OH_Drawing_Pen} object.
+ * @param OH_Drawing_Filter Pointer to an {@link OH_Drawing_Filter} object.
+ * If NULL is passed in, the filter will be cleared.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_PenSetFilter(OH_Drawing_Pen*, OH_Drawing_Filter*);
+
+/**
+ * @brief Obtains the filter from a pen. The filter is a container that holds a mask filter and color filter.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Pen or OH_Drawing_Filter is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Pen Pointer to an {@link OH_Drawing_Pen} object.
+ * @param OH_Drawing_Filter Pointer to the {@link OH_Drawing_Filter} object obtained.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PenGetFilter(OH_Drawing_Pen*, OH_Drawing_Filter*);
+
+/**
+ * @brief Sets a blender for a pen. The blender implements the specified blend mode.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_BlendMode is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Pen Pointer to an {@link OH_Drawing_Pen} object.
+ * @param OH_Drawing_BlendMode Blend mode. For details about the available options, see {@link OH_Drawing_BlendMode}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PenSetBlendMode(OH_Drawing_Pen*, OH_Drawing_BlendMode);
+
+/**
+ * @brief Obtains the source path outline drawn using a pen and represents it using a destination path.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If any of OH_Drawing_Pen, src, and dst is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Pen Pointer to an {@link OH_Drawing_Pen} object.
+ * @param src Pointer to a source path, which is an {@link OH_Drawing_Path} object.
+ * @param dst Pointer to a destination path, which is an {@link OH_Drawing_Path} object.
+ * @param OH_Drawing_Rect Pointer to an {@link OH_Drawing_Rect} object. NULL is recommended.
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object. NULL is recommended.
+ * The default value is an identity matrix.
+ * @return Returns true if the destination path is obtained; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_PenGetFillPath(OH_Drawing_Pen*, const OH_Drawing_Path* src, OH_Drawing_Path* dst,
+ const OH_Drawing_Rect*, const OH_Drawing_Matrix*);
+
+/**
+ * @brief Resets a pen to the initial state.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Pen is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Pen Pointer to an {@link OH_Drawing_Pen} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PenReset(OH_Drawing_Pen*);
+
#ifdef __cplusplus
}
#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_pixel_map.h b/en/native_sdk/graphic/native_drawing/drawing_pixel_map.h
new file mode 100644
index 0000000000000000000000000000000000000000..2b7a64676aacb7a4c75e0eb32724df4e0272f208
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_pixel_map.h
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_PIXEL_MAP_H
+#define C_INCLUDE_DRAWING_PIXEL_MAP_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_pixel_map.h
+ *
+ * @brief Declares the functions related to the pixel map in the drawing module.
+ *
+ * File to include: native_drawing/drawing_pixel_map.h
+ * @library libnative_drawing.so
+ * @since 12
+ * @version 1.0
+ */
+
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Defines a pixel map defined by the image framework.
+ * @since 12
+ * @version 1.0
+ */
+struct NativePixelMap_;
+
+/**
+ * @brief Defines a pixel map defined by the image framework.
+ * @since 12
+ * @version 1.0
+ */
+struct OH_PixelmapNative;
+
+/**
+ * @brief Obtains the pixel map defined by this module from a pixel map defined by the image framework.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param NativePixelMap_ Pointer to a {@link NativePixelMap_} object, which is the pixel map defined by
+ * the image framework.
+ * @return Returns the pointer to an {@link OH_Drawing_PixelMap} object, which is the pixel map defined by this module.
+ * If NULL is returned, the creation fails.
+ * The possible failure cause is that NativePixelMap_ is NULL.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromNativePixelMap(NativePixelMap_*);
+
+/**
+ * @brief Obtains the pixel map defined by this module from a pixel map defined by the image framework.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_PixelmapNative Pointer to an {@link OH_PixelmapNative} object, which is the pixel map defined by
+ * the image framework.
+ * @return Returns the pointer to an {@link OH_Drawing_PixelMap} object, which is the pixel map defined by this module.
+ * If NULL is returned, the creation fails.
+ * The possible failure cause is that OH_PixelmapNative is NULL.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromOhPixelMapNative(OH_PixelmapNative*);
+
+/**
+ * @brief Removes the relationship between a pixel map defined by this module and a pixel map defined by
+ * the image framework. The relationship is established by calling
+ * {@link OH_Drawing_PixelMapGetFromNativePixelMap} or {@link OH_Drawing_PixelMapGetFromOhPixelMapNative}.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_PixelMap Pointer to an {@link OH_Drawing_PixelMap} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_PixelMapDissolve(OH_Drawing_PixelMap*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_point.h b/en/native_sdk/graphic/native_drawing/drawing_point.h
new file mode 100644
index 0000000000000000000000000000000000000000..ed5c325fd6ee54ec05a4d7f65f8a8eda500fef9d
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_point.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_POINT_H
+#define C_INCLUDE_DRAWING_POINT_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_point.h
+ *
+ * @brief Declares the functions related to the coordinate point in the drawing module.
+ *
+ * File to include: native_drawing/drawing_point.h
+ * @library libnative_drawing.so
+ * @since 11
+ * @version 1.0
+ */
+
+#include "drawing_error_code.h"
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates an OH_Drawing_Point object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param x X coordinate of the point.
+ * @param y Y coordinate of the point.
+ * @return Returns the pointer to the OH_Drawing_Point object created.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_Point* OH_Drawing_PointCreate(float x, float y);
+
+/**
+ * @brief Obtains the X coordinate of a point.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param point Pointer to an {@link OH_Drawing_Point} object.
+ * @param x Pointer to the X coordinate.
+ * @return Returns either of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if either point or x is NULL.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_PointGetX(const OH_Drawing_Point* point, float* x);
+
+/**
+ * @brief Obtains the Y coordinate of a point.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param point Pointer to an {@link OH_Drawing_Point} object.
+ * @param y Pointer to the Y coordinate.
+ * @return Returns either of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if either point or y is NULL.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_PointGetY(const OH_Drawing_Point* point, float* y);
+
+/**
+ * @brief Sets the X and Y coordinates of a point.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param point Pointer to an {@link OH_Drawing_Point} object.
+ * @param x Pointer to the X coordinate.
+ * @param y Pointer to the Y coordinate.
+ * @return Returns either of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if point is NULL.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_PointSet(OH_Drawing_Point* point, float x, float y);
+
+/**
+ * @brief Destroys an OH_Drawing_Point object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Point Pointer to an OH_Drawing_Point object.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_PointDestroy(OH_Drawing_Point*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_record_cmd.h b/en/native_sdk/graphic/native_drawing/drawing_record_cmd.h
new file mode 100644
index 0000000000000000000000000000000000000000..1f1a2669163e9cafc01a0108d8afefc4ba49f553
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_record_cmd.h
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_RECORD_CMD_H
+#define C_INCLUDE_DRAWING_RECORD_CMD_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 13
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_record_cmd.h
+ *
+ * @brief Declares the functions related to a recording command object.
+ *
+ * File to include: native_drawing/drawing_record_cmd.h
+ * @library libnative_drawing.so
+ * @since 13
+ * @version 1.0
+ */
+
+#include "drawing_types.h"
+#include "drawing_error_code.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates an OH_Drawing_RecordCmdUtils object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the OH_Drawing_RecordCmdUtils object created.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_RecordCmdUtils* OH_Drawing_RecordCmdUtilsCreate(void);
+
+/**
+ * @brief Destroys an OH_Drawing_RecordCmdUtils object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param recordCmdUtils Pointer to an {@link OH_Drawing_RecordCmdUtils} object.
+ * @return Returns either of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if recordCmdUtils is NULL.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsDestroy(OH_Drawing_RecordCmdUtils* recordCmdUtils);
+
+/**
+ * @brief Starts recording. This function must be used in pair with {@link OH_Drawing_RecordCmdUtilsFinishRecording}. \n
+ * The OH_Drawing_RecordCmdUtils object generates a canvas object of the recording type and
+ * calls the interface of the drawing object to record all drawing commands.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param recordCmdUtils Pointer to an {@link OH_Drawing_RecordCmdUtils} object.
+ * @param width Width of the canvas.
+ * @param height Height of the canvas.
+ * @param canvas Double pointer to the {@link OH_Drawing_Canvas} object. You do not need to release this pointer.
+ * This object does not support nested calling of {@link OH_Drawing_CanvasDrawRecordCmd}.
+ * @return Returns one of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if either recordCmdUtils or canvas is NULL.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if either width or height is less than 0.
+ * OH_DRAWING_ERROR_ALLOCATION_FAILED if the system memory is insufficient.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsBeginRecording(OH_Drawing_RecordCmdUtils* recordCmdUtils,
+ int32_t width, int32_t height, OH_Drawing_Canvas** canvas);
+
+/**
+ * @brief Ends recording. This function must be called after {@link OH_Drawing_RecordCmdUtilsBeginRecording}. \n
+ * The OH_Drawing_RecordCmdUtils object ends recording and stores the drawing commands recorded
+ * by the canvas object of the recording type into the generated {@link OH_Drawing_RecordCmd} object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param recordCmdUtils Pointer to an {@link OH_Drawing_RecordCmdUtils} object.
+ * @param recordCmd Double pointer to the {@link OH_Drawing_RecordCmd} object.
+ * You need to call {@link OH_Drawing_CanvasDrawRecordCmd} to draw the object,
+ * and call {@link OH_Drawing_RecordCmdDestroy} to release it.
+ * @return Returns one of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if either recordCmdUtils or recordCmd is NULL.
+ * OH_DRAWING_ERROR_ALLOCATION_FAILED if the system memory is insufficient.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsFinishRecording(OH_Drawing_RecordCmdUtils* recordCmdUtils,
+ OH_Drawing_RecordCmd** recordCmd);
+
+/**
+ * @brief Destroys an OH_Drawing_RecordCmd object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param recordCmd Pointer to an {@link OH_Drawing_RecordCmd} object.
+ * @return Returns either of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if recordCmd is NULL.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_RecordCmdDestroy(OH_Drawing_RecordCmd* recordCmd);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_rect.h b/en/native_sdk/graphic/native_drawing/drawing_rect.h
new file mode 100644
index 0000000000000000000000000000000000000000..4be7ae3631a443bad3d63ff5f0c97e903fca73ae
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_rect.h
@@ -0,0 +1,328 @@
+/*
+ * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_RECT_H
+#define C_INCLUDE_DRAWING_RECT_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_rect.h
+ *
+ * @brief Declares the functions related to the rectangle in the drawing module.
+ *
+ * File to include: native_drawing/drawing_rect.h
+ * @library libnative_drawing.so
+ * @since 11
+ * @version 1.0
+ */
+
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates an OH_Drawing_Rect object, without sorting the coordinates passed in.
+ * This means that the coordinates of the upper left corner of the rectangle can be greater than those of
+ * the lower right corner.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param left X coordinate of the upper left corner of the rectangle.
+ * @param top Y coordinate of the upper left corner of the rectangle.
+ * @param right X coordinate of the lower right corner of the rectangle.
+ * @param bottom Y coordinate of the lower right corner of the rectangle.
+ * @return Returns the pointer to the OH_Drawing_Rect object created.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_Rect* OH_Drawing_RectCreate(float left, float top, float right, float bottom);
+
+/**
+ * @brief Obtains the height of a rectangle.
+ * The height is calculated by using the Y coordinate of the lower right corner of the rectangle minus
+ * the Y coordinate of the upper left corner.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Rect is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Rect Pointer to an OH_Drawing_Rect object.
+ * @return Returns the height.
+ * @since 12
+ * @version 1.0
+ */
+float OH_Drawing_RectGetHeight(OH_Drawing_Rect*);
+
+/**
+ * @brief Obtains the width of a rectangle.
+ * The width is calculated by using the X coordinate of the lower right corner of the rectangle minus
+ * the X coordinate of the upper left corner.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Rect is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Rect Pointer to an OH_Drawing_Rect object.
+ * @return Returns the width.
+ * @since 12
+ * @version 1.0
+ */
+float OH_Drawing_RectGetWidth(OH_Drawing_Rect*);
+
+/**
+ * @brief Obtains the X coordinate of the upper left corner of a rectangle.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Rect is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Rect Pointer to an OH_Drawing_Rect object.
+ * @return Returns the X coordinate of the upper left corner of the rectangle.
+ * @since 12
+ * @version 1.0
+ */
+float OH_Drawing_RectGetLeft(OH_Drawing_Rect*);
+
+/**
+ * @brief Obtains the Y coordinate of the upper left corner of a rectangle.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Rect is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Rect Pointer to an OH_Drawing_Rect object.
+ * @return Returns the Y coordinate of the upper left corner of the rectangle.
+ * @since 12
+ * @version 1.0
+ */
+float OH_Drawing_RectGetTop(OH_Drawing_Rect*);
+
+/**
+ * @brief Obtains the X coordinate of the lower right corner of a rectangle.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Rect is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Rect Pointer to an OH_Drawing_Rect object.
+ * @return Returns the X coordinate of the lower right corner of the rectangle.
+ * @since 12
+ * @version 1.0
+ */
+float OH_Drawing_RectGetRight(OH_Drawing_Rect*);
+
+/**
+ * @brief Obtains the Y coordinate of the lower right corner of a rectangle.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Rect is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Rect Pointer to an OH_Drawing_Rect object.
+ * @return Returns the Y coordinate of the lower right corner of the rectangle.
+ * @since 12
+ * @version 1.0
+ */
+float OH_Drawing_RectGetBottom(OH_Drawing_Rect*);
+
+/**
+ * @brief Checks whether two rectangles intersect and if yes, sets rect to the area of intersection.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either rect or other is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param rect Pointer to the first rectangle, which is an OH_Drawing_Rect object.
+ * @param other Pointer to the second rectangle, which is an OH_Drawing_Rect object.
+ * @return Returns true if they intersect (rect is set to the intersection area);
+ * returns false otherwise (rect remains unchanged).
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_RectIntersect(OH_Drawing_Rect* rect, const OH_Drawing_Rect* other);
+
+/**
+ * @brief Obtains the union of two rectangles.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either rect or other is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param rect Pointer to the first rectangle, which is an OH_Drawing_Rect object.
+ * @param other Pointer to the second rectangle, which is an OH_Drawing_Rect object.
+ * @return Returns true if the union is obtained; returns false otherwise.
+ * The possible failure cause is that at least one of the parameters rect and other is NULL
+ * or the size of the rectangle specified by other is empty.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_RectJoin(OH_Drawing_Rect* rect, const OH_Drawing_Rect* other);
+
+/**
+ * @brief Sets the horizontal coordinate of the upper left corner of a rectangle.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If rect is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param rect Pointer to an OH_Drawing_Rect object.
+ * @param left X coordinate of the upper left corner of the rectangle.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_RectSetLeft(OH_Drawing_Rect* rect, float left);
+
+/**
+ * @brief Sets the vertical coordinate of the upper left corner of a rectangle.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If rect is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param rect Pointer to an OH_Drawing_Rect object.
+ * @param top Y coordinate of the upper left corner of the rectangle.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_RectSetTop(OH_Drawing_Rect* rect, float top);
+
+/**
+ * @brief Sets the horizontal coordinate of the lower right corner of a rectangle.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If rect is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param rect Pointer to an OH_Drawing_Rect object.
+ * @param right X coordinate of the lower right corner of the rectangle.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_RectSetRight(OH_Drawing_Rect* rect, float right);
+
+/**
+ * @brief Sets the vertical coordinate of the lower right corner of a rectangle.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If rect is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param rect Pointer to an OH_Drawing_Rect object.
+ * @param bottom Y coordinate of the lower right corner of the rectangle.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_RectSetBottom(OH_Drawing_Rect* rect, float bottom);
+
+/**
+ * @brief Copies a source rectangle to create a new one.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either sRect or dRect is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param sRect Pointer to a source rectangle, which is an OH_Drawing_Rect object.
+ * @param dRect Pointer to a destination rectangle, which is an OH_Drawing_Rect object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_RectCopy(OH_Drawing_Rect* sRect, OH_Drawing_Rect* dRect);
+
+/**
+ * @brief Destroys an OH_Drawing_Rect object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Rect Pointer to an OH_Drawing_Rect object.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_RectDestroy(OH_Drawing_Rect*);
+
+/**
+ * @brief Creates a rectangle array object to store multiple rectangle objects.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param size Size of the rectangle array. The value cannot exceed 65536, which is the maximum number of glyph indices.
+ * @return Returns the pointer to the {@link OH_Drawing_Array} object created.
+ * If the returned object pointer is null, the creation fails.
+ * Possible causes are that no memory is available or an input parameter is incorrect.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_Array* OH_Drawing_RectCreateArray(size_t size);
+
+/**
+ * @brief Obtains the size of a rectangle array object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param rectArray Pointer to an {@link OH_Drawing_Array} object.
+ * @param pSize Pointer to the size_t type, which is used as an output parameter to
+ * store the size of the rectangle array.
+ * @return Returns one of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if either rectArray or pSize is NULL.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_RectGetArraySize(OH_Drawing_Array* rectArray, size_t* pSize);
+
+/**
+ * @brief Obtains the rectangle with the specified index in a rectangle array.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param rectArray Pointer to an {@link OH_Drawing_Array}.
+ * @param index Index of the rectangle in the rectangle array.
+ * @param rect Double pointer to {@link OH_Drawing_Rect}, which is returned to the caller as an output parameter.
+ * @return Returns one of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if rectArray or rect is null
+ * or index is out of range.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_RectGetArrayElement(OH_Drawing_Array* rectArray, size_t index,
+ OH_Drawing_Rect** rect);
+
+/**
+ * @brief Destroys an OH_Drawing_Array object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param rectArray Pointer to an {@link OH_Drawing_Array}.
+ * @return Returns one of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if rectArray is NULL.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_RectDestroyArray(OH_Drawing_Array* rectArray);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_region.h b/en/native_sdk/graphic/native_drawing/drawing_region.h
new file mode 100644
index 0000000000000000000000000000000000000000..7b0bd6a09c048571120f07a27a2d0d42cea462f6
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_region.h
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_REGION_H
+#define C_INCLUDE_DRAWING_REGION_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_region.h
+ *
+ * @brief Declares the functions related to the region in the drawing module, including creating a region,
+ * setting the boundary, and destroying a region.
+ *
+ * @since 12
+ * @version 1.0
+ */
+
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Enumerates the operation modes available for a region.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_Drawing_RegionOpMode {
+ /**
+ * Difference operation.
+ */
+ REGION_OP_MODE_DIFFERENCE,
+ /**
+ * Intersection operation.
+ */
+ REGION_OP_MODE_INTERSECT,
+ /**
+ * Union operation.
+ */
+ REGION_OP_MODE_UNION,
+ /**
+ * XOR operation.
+ */
+ REGION_OP_MODE_XOR,
+ /**
+ * Reverse difference operation.
+ */
+ REGION_OP_MODE_REVERSE_DIFFERENCE,
+ /**
+ * Replacement operation.
+ */
+ REGION_OP_MODE_REPLACE,
+} OH_Drawing_RegionOpMode;
+
+/**
+ * @brief Creates an OH_Drawing_Region object for more accurate graphical control.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the {@link OH_Drawing_Region} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Region* OH_Drawing_RegionCreate(void);
+
+/**
+ * @brief Checks whether a region contains the specified point.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If region is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param region Pointer to an {@link OH_Drawing_Region} object.
+ * @param x X coordinate of the point.
+ * @param y Y coordinate of the point.
+ * @return Returns true if the region contains the specified point; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_RegionContains(OH_Drawing_Region* region, int32_t x, int32_t y);
+
+/**
+ * @brief Combines two regions based on the specified operation mode.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either region or dst is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If op is not set to one of the enumerated values, OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param region Pointer to an {@link OH_Drawing_Region} object, in which the resulting region is saved.
+ * @param other Pointer to an {@link OH_Drawing_Region} object.
+ * @param op Operation mode of the region. For details about the available options, see {@link OH_Drawing_RegionOpMode}.
+ * @return Returns true if the resulting region is not empty; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_RegionOp(OH_Drawing_Region* region, const OH_Drawing_Region* other, OH_Drawing_RegionOpMode op);
+
+/**
+ * @brief Sets the boundary for an OH_Drawing_Region object.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either region or rect is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param region Pointer to an {@link OH_Drawing_Region} object.
+ * @param rect Pointer to an OH_Drawing_Rect object.
+ * @return Returns true if the setting is successful; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_RegionSetRect(OH_Drawing_Region* region, const OH_Drawing_Rect* rect);
+
+/**
+ * @brief Sets a region to the area described by the path.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If region, path, or clip is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param region Pointer to an {@link OH_Drawing_Region} object.
+ * @param path Pointer to an {@link OH_Drawing_Path} object.
+ * @param clip Pointer to an {@link OH_Drawing_Region} object.
+ * @return Returns true if the resulting region is not empty; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_RegionSetPath(OH_Drawing_Region* region, const OH_Drawing_Path* path, const OH_Drawing_Region* clip);
+
+/**
+ * @brief Destroys an OH_Drawing_Region object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Region Pointer to an {@link OH_Drawing_Region} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_RegionDestroy(OH_Drawing_Region*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_register_font.h b/en/native_sdk/graphic/native_drawing/drawing_register_font.h
new file mode 100644
index 0000000000000000000000000000000000000000..001b4174b465f6dbdf0d3122dc1c5a2131283302
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_register_font.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_REGISTER_FONT_H
+#define C_INCLUDE_DRAWING_REGISTER_FONT_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_register_font.h
+ *
+ * @brief Declares the functions related to the font manager in the drawing module.
+ *
+ * File to include: native_drawing/drawing_register_font.h
+ * @library libnative_drawing.so
+ * @since 11
+ * @version 1.0
+ */
+
+#include "drawing_text_declaration.h"
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @brief Registers a custom font with the font manager. The supported font file formats are .ttf and .otf.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontCollection Pointer to an OH_Drawing_FontCollection object.
+ * @param fontFamily Pointer to the family name of the font to register.
+ * @param familySrc Pointer to the path of the font file.
+ * @return Returns 0 if the font is registered; returns 1 if the file does not exist;
+ * returns 2 if opening the file fails; returns 3 if reading the file fails;
+ * returns 4 if the file is not found; returns 5 if the file size is not obtained;
+ * returns 9 if the file is damaged.
+ * @since 11
+ * @version 1.0
+ */
+uint32_t OH_Drawing_RegisterFont(OH_Drawing_FontCollection*, const char* fontFamily, const char* familySrc);
+
+/**
+ * @brief Registers a font buffer with the font manager.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontCollection Pointer to an OH_Drawing_FontCollection object.
+ * @param fontFamily Pointer to the family name of the font to register.
+ * @param fontBuffer Pointer to the buffer of the font file.
+ * @param length Length of the font file.
+ * @return Returns 0 if the font is registered; returns 6 if the buffer size is zero;
+ * returns 7 if the font set is empty; returns 9 if the file is damaged.
+ * @since 11
+ * @version 1.0
+ */
+uint32_t OH_Drawing_RegisterFontBuffer(OH_Drawing_FontCollection*, const char* fontFamily, uint8_t* fontBuffer,
+ size_t length);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_round_rect.h b/en/native_sdk/graphic/native_drawing/drawing_round_rect.h
new file mode 100644
index 0000000000000000000000000000000000000000..ff0da7270d8ec798ceef283337720cc6a94d2690
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_round_rect.h
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_ROUND_RECT_H
+#define C_INCLUDE_DRAWING_ROUND_RECT_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_round_rect.h
+ *
+ * @brief Declares the functions related to the rounded rectangle in the drawing module.
+ *
+ * File to include: native_drawing/drawing_round_rect.h
+ * @library libnative_drawing.so
+ * @since 11
+ * @version 1.0
+ */
+
+#include "drawing_error_code.h"
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Enumerates the corner positions of a rounded rectangle.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_Drawing_CornerPos {
+ /**
+ * Top left corner of the rounded rectangle.
+ */
+ CORNER_POS_TOP_LEFT,
+ /**
+ * Top right corner of the rounded rectangle.
+ */
+ CORNER_POS_TOP_RIGHT,
+ /**
+ * Bottom right corner of the rounded rectangle.
+ */
+ CORNER_POS_BOTTOM_RIGHT,
+ /**
+ * Bottom left corner of the rounded rectangle.
+ */
+ CORNER_POS_BOTTOM_LEFT,
+} OH_Drawing_CornerPos;
+
+/**
+ * @brief Creates an OH_Drawing_RoundRect object.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Rect is NULL, {@link OH_DRAWING_ERROR_INVALID_PARAMETER} is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Rect Pointer to an OH_Drawing_Rect object.
+ * @param xRad Radius of the rounded corner on the X axis.
+ * @param yRad Radius of the rounded corner on the Y axis.
+ * @return Returns the pointer to the OH_Drawing_RoundRect object created.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_RoundRect* OH_Drawing_RoundRectCreate(const OH_Drawing_Rect*, float xRad, float yRad);
+
+/**
+ * @brief Sets the radii of the specified rounded corner in a rounded rectangle.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_RoundRect is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_RoundRect Pointer to an OH_Drawing_RoundRect object.
+ * @param pos Position of the rounded corner. For details about the available options, see {@link OH_Drawing_CornerPos}.
+ * @param OH_Drawing_Corner_Radii {@link OH_Drawing_Corner_Radii} struct, including the radii on the X axis and Y axis.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_RoundRectSetCorner(OH_Drawing_RoundRect*, OH_Drawing_CornerPos pos, OH_Drawing_Corner_Radii);
+
+/**
+ * @brief Obtains the radii of the specified rounded corner in a rounded rectangle.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_RoundRect is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_RoundRect Pointer to an OH_Drawing_RoundRect object.
+ * @param pos Position of the rounded corner. For details about the available options, see {@link OH_Drawing_CornerPos}.
+ * @return Returns an {@link OH_Drawing_Corner_Radii} struct, including the radii on the X axis and Y axis.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Corner_Radii OH_Drawing_RoundRectGetCorner(OH_Drawing_RoundRect*, OH_Drawing_CornerPos pos);
+
+/**
+ * @brief Destroys an OH_Drawing_RoundRect object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_RoundRect Pointer to an OH_Drawing_RoundRect object.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_RoundRectDestroy(OH_Drawing_RoundRect*);
+
+/**
+ * @brief Translates a rounded rectangle by an offset along the X axis and Y axis.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param roundRect Pointer to an {@link OH_Drawing_Point2D} object.
+ * @param dx X offset.
+ * @param dy Y offset.
+ * @return Returns either of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if roundRect is NULL.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_RoundRectOffset(OH_Drawing_RoundRect* roundRect, float dx, float dy);
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_sampling_options.h b/en/native_sdk/graphic/native_drawing/drawing_sampling_options.h
new file mode 100644
index 0000000000000000000000000000000000000000..76b0ae4ff4021250e123a3f97b4e42a9d7ec6356
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_sampling_options.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_SAMPLING_OPTIONS_H
+#define C_INCLUDE_DRAWING_SAMPLING_OPTIONS_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_sampling_options.h
+ *
+ * @brief Declares the functions related to the sampling options in the drawing module.
+ * It is used for image or texture sampling.
+ *
+ * File to include: native_drawing/drawing_sampling_options.h
+ * @library libnative_drawing.so
+ * @since 12
+ * @version 1.0
+ */
+
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Enumerates the filter modes.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_Drawing_FilterMode {
+ /** Nearest filter mode. */
+ FILTER_MODE_NEAREST,
+ /** Linear filter mode. */
+ FILTER_MODE_LINEAR,
+} OH_Drawing_FilterMode;
+
+/**
+ * @brief Enumerates the mipmap modes.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_Drawing_MipmapMode {
+ /** Mipmap level ignored. */
+ MIPMAP_MODE_NONE,
+ /** Nearest sampling from two adjacent mipmap levels. */
+ MIPMAP_MODE_NEAREST,
+ /** Linear interpolation sampling between two adjacent mipmap levels. */
+ MIPMAP_MODE_LINEAR,
+} OH_Drawing_MipmapMode;
+
+/**
+ * @brief Creates an OH_Drawing_SamplingOptions object.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_MipmapMode is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FilterMode Filter mode.
+ * For details about the available options, see {@link OH_Drawing_FilterMode} object.
+ * @param OH_Drawing_MipmapMode Mipmap mode.
+ * For details about the available options, see {@link OH_Drawing_MipmapMode}.
+ * @return Returns the pointer to the {@link OH_Drawing_SamplingOptions} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_SamplingOptions* OH_Drawing_SamplingOptionsCreate(OH_Drawing_FilterMode, OH_Drawing_MipmapMode);
+
+/**
+ * @brief Destroys an OH_Drawing_SamplingOptions object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_SamplingOptions Pointer to an {@link OH_Drawing_SamplingOptions} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SamplingOptionsDestroy(OH_Drawing_SamplingOptions*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_shader_effect.h b/en/native_sdk/graphic/native_drawing/drawing_shader_effect.h
new file mode 100644
index 0000000000000000000000000000000000000000..8f06c8e1eb23cb7294e93bb6fbf56f7bc8ac2eee
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_shader_effect.h
@@ -0,0 +1,296 @@
+/*
+ * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_SHADER_EFFECT_H
+#define C_INCLUDE_DRAWING_SHADER_EFFECT_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_shader_effect.h
+ *
+ * @brief Declares the functions related to the shader effect in the drawing module.
+ *
+ * File to include: native_drawing/drawing_shader_effect.h
+ * @library libnative_drawing.so
+ * @since 11
+ * @version 1.0
+ */
+
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Enumerates the tile modes of the shader effect.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef enum OH_Drawing_TileMode {
+ /**
+ * Replicates the edge color if the shader effect draws outside of its original boundary.
+ */
+ CLAMP,
+ /**
+ * Repeats the shader effect's image in both horizontal and vertical directions.
+ */
+ REPEAT,
+ /**
+ * Repeats the shader effect's image in both horizontal and vertical directions, alternating mirror images.
+ */
+ MIRROR,
+ /**
+ * Renders the shader effect's image only within the original boundary, and returns transparent black elsewhere.
+ */
+ DECAL,
+} OH_Drawing_TileMode;
+
+/**
+ * @brief Creates an OH_Drawing_ShaderEffect object with a single color.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param color Color of the shader.
+ * @return Returns the pointer to the {@link OH_Drawing_ShaderEffect} object created.
+ * If NULL is returned, the creation fails. The possible failure cause is that no memory is available.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateColorShader(const uint32_t color);
+
+/**
+ * @brief Creates an OH_Drawing_ShaderEffect object that generates a linear gradient between two points.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If any of startPt, endPt, and colors is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_TileMode is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param startPt Start point.
+ * @param endPt End point.
+ * @param colors Colors to distribute between the two points.
+ * @param pos Relative position of each color in the color array. The array length must be the same as that of
+ * colors. If pos is NULL, colors are evenly distributed between the start point and end point.
+ * @param size Number of colors and positions (if pos is not NULL).
+ * @param OH_Drawing_TileMode Tile mode of the shader effect.
+ * For details about the available options, see {@link OH_Drawing_TileMode}.
+ * @return Returns the pointer to the OH_Drawing_ShaderEffect object created.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateLinearGradient(const OH_Drawing_Point* startPt,
+ const OH_Drawing_Point* endPt, const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode);
+
+/**
+ * @brief Creates an OH_Drawing_ShaderEffect object that generates a linear gradient between two points.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If any of startPt, endPt, and colors is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_TileMode is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param startPt Start point.
+ * @param endPt End point.
+ * @param colors Colors to distribute between the two points.
+ * @param pos Relative position of each color in the color array. The array length must be the same as that of
+ * colors. If pos is NULL, colors are evenly distributed between the start point and end point.
+ * @param size Number of colors and positions (if pos is not NULL).
+ * @param OH_Drawing_TileMode Tile mode of the shader effect.
+ * For details about the available options, see {@link OH_Drawing_TileMode}.
+ * @param OH_Drawing_Matrix Matrix applied on the shader effect.
+ * If matrix is NULL, an identity matrix is applied by default.
+ * @return Returns the pointer to the {@link OH_Drawing_ShaderEffect} object created.
+ * If NULL is returned, the creation fails.
+ * The possible failure cause is that no memory is available or at least one of the parameters startPt,
+ * endPt, and colors is NULL.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateLinearGradientWithLocalMatrix(
+ const OH_Drawing_Point2D* startPt, const OH_Drawing_Point2D* endPt, const uint32_t* colors, const float* pos,
+ uint32_t size, OH_Drawing_TileMode, const OH_Drawing_Matrix*);
+
+/**
+ * @brief Creates an OH_Drawing_ShaderEffect object that generates a radial gradient based on the center and
+ * radius of a circle. The radial gradient transitions colors from the center to the ending shape in a radial manner.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either centerPt or colors is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER} is returned.
+ * If OH_Drawing_TileMode is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param centerPt Center of the circle.
+ * @param radius Radius of the gradient.
+ * @param colors Colors to distribute in the radial direction.
+ * @param pos Relative position of each color in the color array. The array length must be the same as that of
+ * colors. If pos is NULL, colors are evenly distributed in the radial direction.
+ * @param size Number of colors and positions (if pos is not NULL).
+ * @param OH_Drawing_TileMode Tile mode of the shader effect.
+ * For details about the available options, see {@link OH_Drawing_TileMode}.
+ * @return Returns the pointer to the OH_Drawing_ShaderEffect object created.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateRadialGradient(const OH_Drawing_Point* centerPt, float radius,
+ const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode);
+
+/**
+ * @brief Creates an OH_Drawing_ShaderEffect object that generates a radial gradient based on the center and
+ * radius of a circle. The radial gradient transitions colors from the center to the ending shape in a radial manner.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either centerPt or colors is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER} is returned.
+ * If OH_Drawing_TileMode is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param centerPt Center of the circle.
+ * @param radius Radius of the gradient.
+ * @param colors Colors to distribute in the radial direction.
+ * @param pos Relative position of each color in the color array. The array length must be the same as that of
+ * colors. If pos is NULL, colors are evenly distributed in the radial direction.
+ * @param size Number of colors and positions (if pos is not NULL).
+ * @param OH_Drawing_TileMode Tile mode of the shader effect.
+ * For details about the available options, see {@link OH_Drawing_TileMode}.
+ * @param OH_Drawing_Matrix Matrix applied on the shader effect.
+ * If matrix is NULL, an identity matrix is applied by default.
+ * @return Returns the pointer to the {@link OH_Drawing_ShaderEffect} object created.
+ * If NULL is returned, the creation fails.
+ * The possible failure cause is that no memory is available or at least one of the parameters
+ * centerPt and colors is NULL.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateRadialGradientWithLocalMatrix(
+ const OH_Drawing_Point2D* centerPt, float radius, const uint32_t* colors, const float* pos, uint32_t size,
+ OH_Drawing_TileMode, const OH_Drawing_Matrix*);
+
+/**
+ * @brief Creates an OH_Drawing_ShaderEffect object that generates a sweep gradient based on the center.
+ * A sweep gradient paints a gradient in a sweeping arc ranging from 0° to 360°.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either centerPt or colors is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER} is returned.
+ * If OH_Drawing_TileMode is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param centerPt Center of the circle.
+ * @param colors Colors to distribute between the two points.
+ * @param pos Relative position of each color in the color array. The array length must be the same as that of
+ * colors. If pos is NULL, colors are evenly distributed between the start angle (0°) and
+ * end angle (360°).
+ * @param size Number of colors and positions (if pos is not NULL).
+ * @param OH_Drawing_TileMode Tile mode of the shader effect.
+ * For details about the available options, see {@link OH_Drawing_TileMode}.
+ * @return Returns the pointer to the OH_Drawing_ShaderEffect object created.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateSweepGradient(const OH_Drawing_Point* centerPt,
+ const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode);
+
+/**
+ * @brief Creates an OH_Drawing_ShaderEffect object for an image shader.
+ * You are advised not to use the function for the canvas of the capture type because it affects the performance.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_Image or OH_Drawing_SamplingOptions is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If either tileX or tileY is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Image Pointer to an {@link OH_Drawing_Image} object.
+ * @param tileX Tile mode of the shader effect in the horizontal direction.
+ * For details about the available options, see {@link OH_Drawing_TileMode}.
+ * @param tileY Tile mode of the shader effect in the vertical direction.
+ * For details about the available options, see {@link OH_Drawing_TileMode}.
+ * @param OH_Drawing_SamplingOptions Pointer to an {@link OH_Drawing_SamplingOptions} object.
+ * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object.
+ * If the pointer array is empty, the identity matrix is passed in.
+ * @return Returns the pointer to the OH_Drawing_ShaderEffect object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateImageShader(OH_Drawing_Image*,
+ OH_Drawing_TileMode tileX, OH_Drawing_TileMode tileY, const OH_Drawing_SamplingOptions*, const OH_Drawing_Matrix*);
+
+/**
+ * @brief Creates an OH_Drawing_ShaderEffect object that generates a gradient between two given circles.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If any of startPt, endPt, and colors is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_TileMode is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param startPt Pointer to the center of the start circle.
+ * @param startRadius Radius of the start circle.
+ * @param endPt Pointer to the center of the end circle.
+ * @param endRadius Radius of the end circle.
+ * @param colors Colors to distribute between the two circles.
+ * @param pos Relative position of each color in the color array. The array length must be the same as that of
+ * colors. If pos is NULL, colors are evenly distributed between the two circles.
+ * @param size Number of colors and positions (if pos is not NULL).
+ * @param OH_Drawing_TileMode Tile mode of the shader effect.
+ * For details about the available options, see {@link OH_Drawing_TileMode}.
+ * @param OH_Drawing_Matrix Matrix applied on the shader effect.
+ * If matrix is NULL, an identity matrix is applied by default.
+ * @return Returns the pointer to the {@link OH_Drawing_ShaderEffect} object created.
+ * If NULL is returned, the creation fails.
+ * The possible failure cause is that no memory is available or at least one of the parameters startPt,
+ * endPt, and colors is NULL.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateTwoPointConicalGradient(const OH_Drawing_Point2D* startPt,
+ float startRadius, const OH_Drawing_Point2D* endPt, float endRadius, const uint32_t* colors, const float* pos,
+ uint32_t size, OH_Drawing_TileMode, const OH_Drawing_Matrix*);
+
+/**
+ * @brief Destroys an OH_Drawing_ShaderEffect object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_ShaderEffect Pointer to an OH_Drawing_ShaderEffect object.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_ShaderEffectDestroy(OH_Drawing_ShaderEffect*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_shadow_layer.h b/en/native_sdk/graphic/native_drawing/drawing_shadow_layer.h
new file mode 100644
index 0000000000000000000000000000000000000000..88911a2ad1986331c04b2c734e4b2a0c1d87407b
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_shadow_layer.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_SHADOW_LAYER_H
+#define C_INCLUDE_DRAWING_SHADOW_LAYER_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_shadow_layer.h
+ *
+ * @brief Declares the functions related to the shadow in the drawing module.
+ *
+ * File to include: native_drawing/drawing_shadow_layer.h
+ * @library libnative_drawing.so
+ * @since 12
+ * @version 1.0
+ */
+
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates an OH_Drawing_ShadowLayer object.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If blurRadius is less than or equal to 0, OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param blurRadius Radius of the shadow layer. The value must be greater than 0.
+ * @param x Offset on the X axis.
+ * @param y Offset on the Y axis.
+ * @param color Color of the shadow.
+ * @return Returns the pointer to the OH_Drawing_ShadowLayer object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_ShadowLayer* OH_Drawing_ShadowLayerCreate(float blurRadius, float x, float y, uint32_t color);
+
+/**
+ * @brief Destroys an OH_Drawing_ShadowLayer object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_ShadowLayer Pointer to the shadow layer.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_ShadowLayerDestroy(OH_Drawing_ShadowLayer*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_surface.h b/en/native_sdk/graphic/native_drawing/drawing_surface.h
new file mode 100644
index 0000000000000000000000000000000000000000..75804101dadd1acb18885b198d3815e49f3385e9
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_surface.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_GPU_SURFACE_H
+#define C_INCLUDE_DRAWING_GPU_SURFACE_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_surface.h
+ *
+ * @brief Declares the functions related to the surface in the drawing module,
+ * including creating, destroying, and using the surface.
+ *
+ * File to include: native_drawing/drawing_surface.h
+ * @library libnative_drawing.so
+ * @since 12
+ * @version 1.0
+ */
+
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates an OH_Drawing_Surface object using the GPU context to manage the content drawn on the canvas.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_GpuContext is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_GpuContext Pointer to an {@link OH_Drawing_GpuContext} object.
+ * @param budgeted Whether memory allocation is included in the cache budget.
+ * The value true means that memory allocation is included in the cache budget,
+ * and false means the opposite.
+ * @param OH_Drawing_Image_Info {@link OH_Drawing_Image_Info} object.
+ * @return Returns the pointer to the {@link OH_Drawing_Surface} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Surface* OH_Drawing_SurfaceCreateFromGpuContext(
+ OH_Drawing_GpuContext*, bool budgeted, OH_Drawing_Image_Info);
+
+/**
+ * @brief Obtains a canvas from an OH_Drawing_Surface object.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_Surface is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Surface Pointer to an OH_Drawing_Surface object.
+ * @return Returns the pointer to the {@link OH_Drawing_Canvas} object obtained.
+ * The pointer returned does not need to be managed by the caller.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Canvas* OH_Drawing_SurfaceGetCanvas(OH_Drawing_Surface*);
+
+/**
+ * @brief Destroys an OH_Drawing_Surface object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Surface Pointer to an OH_Drawing_Surface object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SurfaceDestroy(OH_Drawing_Surface*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_text_blob.h b/en/native_sdk/graphic/native_drawing/drawing_text_blob.h
new file mode 100644
index 0000000000000000000000000000000000000000..46016a5dbfd940497d740011809f999af445f856
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_text_blob.h
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_TEXT_BLOB_H
+#define C_INCLUDE_DRAWING_TEXT_BLOB_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_text_blob.h
+ *
+ * @brief Declares the functions related to the text blob in the drawing module.
+ *
+ * File to include: native_drawing/drawing_text_blob.h
+ * @library libnative_drawing.so
+ * @since 11
+ * @version 1.0
+ */
+
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates an OH_Drawing_TextBlobBuilder object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the OH_Drawing_TextBlobBuilder object created.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_TextBlobBuilder* OH_Drawing_TextBlobBuilderCreate(void);
+
+/**
+ * @brief Creates an OH_Drawing_TextBlob object from the text.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either text or OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_TextEncoding is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param text Pointer to the text.
+ * @param byteLength Length of the text, in bytes.
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @param OH_Drawing_TextEncoding Encoding type of the text.
+ * For details about the available options, see {@link OH_Drawing_TextEncoding}.
+ * @return Returns the pointer to the {@link OH_Drawing_TextBlob} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromText(const void* text, size_t byteLength,
+ const OH_Drawing_Font*, OH_Drawing_TextEncoding);
+
+/**
+ * @brief Creates an OH_Drawing_TextBlob object from the text.
+ * The coordinates of each character in the OH_Drawing_TextBlob object are determined by the coordinate
+ * information in the OH_Drawing_Point2D array.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If any of text, OH_Drawing_Point2D, and OH_Drawing_Font is NULL or
+ * byteLength is 0, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_TextEncoding is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param text Pointer to the text.
+ * @param byteLength Length of the text, in bytes.
+ * @param OH_Drawing_Point2D Pointer to the start address of an {@link OH_Drawing_Point2D} array.
+ * The number of entries in the array is the value obtained by calling {@link OH_Drawing_FontCountText}.
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @param OH_Drawing_TextEncoding Encoding type of the text.
+ * For details about the available options, see {@link OH_Drawing_TextEncoding}.
+ * @return Returns the pointer to the {@link OH_Drawing_TextBlob} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromPosText(const void* text, size_t byteLength,
+ OH_Drawing_Point2D*, const OH_Drawing_Font*, OH_Drawing_TextEncoding);
+
+/**
+ * @brief Creates an OH_Drawing_TextBlob object from a string.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either str or OH_Drawing_Font is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ * If OH_Drawing_TextEncoding is not set to one of the enumerated values,
+ * OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param str Pointer to a string.
+ * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object.
+ * @param OH_Drawing_TextEncoding Encoding type of the text.
+ * For details about the available options, see {@link OH_Drawing_TextEncoding}.
+ * @return Returns the pointer to the {@link OH_Drawing_TextBlob} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromString(const char* str,
+ const OH_Drawing_Font*, OH_Drawing_TextEncoding);
+
+/**
+ * @brief Obtains the bounds of an OH_Drawing_TextBlob object.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_TextBlob or OH_Drawing_Rect is NULL,
+ * OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextBlob Pointer to an {@link OH_Drawing_TextBlob} object.
+ * @param OH_Drawing_Rect Pointer to an {@link OH_Drawing_Rect} object,
+ * which is obtained by calling {@link OH_Drawing_Rect}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TextBlobGetBounds(OH_Drawing_TextBlob*, OH_Drawing_Rect*);
+
+/**
+ * @brief Obtains the unique identifier of a text blob. The identifier is a non-zero value.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_TextBlob is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextBlob Pointer to an {@link OH_Drawing_TextBlob} object.
+ * @return Returns the unique identifier of the text blob.
+ * @since 12
+ * @version 1.0
+ */
+uint32_t OH_Drawing_TextBlobUniqueID(const OH_Drawing_TextBlob*);
+
+/**
+ * @brief Describes a run, which provides storage for glyphs and positions.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct OH_Drawing_RunBuffer {
+ /** Storage for glyph indexes in the run. */
+ uint16_t* glyphs;
+ /** Storage for glyph positions in the run. */
+ float* pos;
+ /** Storage for UTF-8 encoded text units in the run. */
+ char* utf8text;
+ /** Storage for glyph clusters (index of the UTF-8 encoded text unit) in the run. */
+ uint32_t* clusters;
+} OH_Drawing_RunBuffer;
+
+/**
+ * @brief Allocates a run to store glyphs and positions. The pointer returned does not need to be managed by the caller.
+ * It can no longer be used after {@link OH_Drawing_TextBlobBuilderMake} is called.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If either OH_Drawing_TextBlobBuilder or OH_Drawing_Font is NULL or count is less than or
+ * equal to 0, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextBlobBuilder Pointer to an OH_Drawing_TextBlobBuilder object.
+ * @param OH_Drawing_Font Pointer to an OH_Drawing_Font object.
+ * @param count Number of text blobs.
+ * @param OH_Drawing_Rect Rectangle of the text blob. The value NULL means that no rectangle is set.
+ * @since 11
+ * @version 1.0
+ */
+const OH_Drawing_RunBuffer* OH_Drawing_TextBlobBuilderAllocRunPos(OH_Drawing_TextBlobBuilder*, const OH_Drawing_Font*,
+ int32_t count, const OH_Drawing_Rect*);
+
+/**
+ * @brief Makes an OH_Drawing_TextBlob object from an OH_Drawing_TextBlobBuilder.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_TextBlobBuilder is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextBlobBuilder Pointer to an OH_Drawing_TextBlobBuilder object.
+ * @return Returns the pointer to the OH_Drawing_TextBlob object created.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_TextBlob* OH_Drawing_TextBlobBuilderMake(OH_Drawing_TextBlobBuilder*);
+
+/**
+ * @brief Destroys an OH_Drawing_TextBlob object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextBlob Pointer to an OH_Drawing_TextBlob object.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_TextBlobDestroy(OH_Drawing_TextBlob*);
+
+/**
+ * @brief Destroys an OH_Drawing_TextBlobBuilder object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextBlobBuilder Pointer to an OH_Drawing_TextBlobBuilder object.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_TextBlobBuilderDestroy(OH_Drawing_TextBlobBuilder*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_text_declaration.h b/en/native_sdk/graphic/native_drawing/drawing_text_declaration.h
index d885623317a9033f7edc1eb574a2e01c7cbfe60a..bab3b072877349f93327cdefb8eb19fe3af12030 100644
--- a/en/native_sdk/graphic/native_drawing/drawing_text_declaration.h
+++ b/en/native_sdk/graphic/native_drawing/drawing_text_declaration.h
@@ -20,7 +20,8 @@
* @addtogroup Drawing
* @{
*
- * @brief Provides the 2D drawing capability.
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
*
@@ -31,8 +32,10 @@
/**
* @file drawing_text_declaration.h
*
- * @brief Declares the data structure related to text in 2D drawing.
+ * @brief Declares the structs related to text in 2D drawing.
*
+ * File to include: native_drawing/drawing_text_declaration.h
+ * @library libnative_drawing.so
* @since 8
* @version 1.0
*/
@@ -42,7 +45,7 @@ extern "C" {
#endif
/**
- * @brief Defines an OH_Drawing_FontCollection, which is used to load fonts.
+ * @brief Defines a struct used to load fonts.
*
* @since 8
* @version 1.0
@@ -50,7 +53,7 @@ extern "C" {
typedef struct OH_Drawing_FontCollection OH_Drawing_FontCollection;
/**
- * @brief Defines an OH_Drawing_Typography, which is used to manage the typography layout and display.
+ * @brief Defines a struct used to manage the typography layout and display.
*
* @since 8
* @version 1.0
@@ -58,7 +61,7 @@ typedef struct OH_Drawing_FontCollection OH_Drawing_FontCollection;
typedef struct OH_Drawing_Typography OH_Drawing_Typography;
/**
- * @brief Defines an OH_Drawing_TextStyle, which is used to manage text colors and decorations.
+ * @brief Defines a struct used to manage text colors and decorations.
*
* @since 8
* @version 1.0
@@ -66,7 +69,7 @@ typedef struct OH_Drawing_Typography OH_Drawing_Typography;
typedef struct OH_Drawing_TextStyle OH_Drawing_TextStyle;
/**
- * @brief Defines an OH_Drawing_TypographyStyle, which is used to manage the typography style, such as the text direction.
+ * @brief Defines a struct used to manage the typography style, such as the text direction.
*
* @since 8
* @version 1.0
@@ -74,13 +77,69 @@ typedef struct OH_Drawing_TextStyle OH_Drawing_TextStyle;
typedef struct OH_Drawing_TypographyStyle OH_Drawing_TypographyStyle;
/**
- * @brief Defines an OH_Drawing_TypographyCreate, which is used to create an OH_Drawing_Typography object.
+ * @brief Defines a struct used to extract a single line of data from a piece of text for typography.
+ *
+ * @since 14
+ * @version 1.0
+ */
+typedef struct OH_Drawing_LineTypography OH_Drawing_LineTypography;
+
+/**
+ * @brief Creates an {@link OH_Drawing_Typography}.
*
* @since 8
* @version 1.0
*/
typedef struct OH_Drawing_TypographyCreate OH_Drawing_TypographyCreate;
+/**
+ * @brief Defines a struct for a text box, which is used to receive the rectangle size, direction, and quantity.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct OH_Drawing_TextBox OH_Drawing_TextBox;
+
+/**
+ * @brief Defines a struct used to receive the position and affinity of the graph.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct OH_Drawing_PositionAndAffinity OH_Drawing_PositionAndAffinity;
+
+/**
+ * @brief Defines a struct for a range, which is used to receive the start position and end position of the font.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct OH_Drawing_Range OH_Drawing_Range;
+
+/**
+ * @brief Defines a struct used to manage text shadows.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_TextShadow OH_Drawing_TextShadow;
+
+/**
+ * @brief Defines a struct used to parse system font files.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_FontParser OH_Drawing_FontParser;
+
+/**
+ * @brief Defines a struct used to manage text tabs.
+ *
+ * @since 14
+ * @version 1.0
+ */
+typedef struct OH_Drawing_TextTab OH_Drawing_TextTab;
+
#ifdef __cplusplus
}
#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_text_font_descriptor.h b/en/native_sdk/graphic/native_drawing/drawing_text_font_descriptor.h
new file mode 100644
index 0000000000000000000000000000000000000000..1c1fa101c6727d600a254437e91d3a2842826e64
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_text_font_descriptor.h
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef DRAWING_TEXT_FONT_DESCRIPTOR_H
+#define DRAWING_TEXT_FONT_DESCRIPTOR_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_text_font_descriptor.h
+ *
+ * @brief Declares the capabilities of font information, such as obtaining font information and searching for a font.
+ *
+ * File to include: "native_drawing/drawing_text_font_descriptor.h"
+ * @library libnative_drawing.so
+ * @since 14
+ * @version 1.0
+ */
+
+#include "drawing_text_typography.h"
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Defines an enum for the system font types.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @since 14
+ */
+typedef enum OH_Drawing_SystemFontType {
+ /** All font types. */
+ ALL = 1 << 0,
+ /** System font type. */
+ GENERIC = 1 << 1,
+ /** Style font type. */
+ STYLISH = 1 << 2,
+ /** User-installed font type. */
+ INSTALLED = 1 << 3,
+} OH_Drawing_SystemFontType;
+
+/**
+ * @brief Obtains all system font descriptors that match a font descriptor.
+ * In the {@link OH_Drawing_FontDescriptor} struct, the path field is not used for matching,
+ * and other fields are valid only when they are not set to their default values.
+ * If all fields in {@link OH_Drawing_FontDescriptor} are set to their default values,
+ * all system font descriptors are returned. If no matching is found, NULL is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontDescriptor Pointer to {@link OH_Drawing_FontDescriptor}. You are advised to use
+ * {@link OH_Drawing_CreateFontDescriptor} to obtain a valid {@link OH_Drawing_FontDescriptor} instance.
+ * If you want to create an {@link OH_Drawing_FontDescriptor} instance, maintain the default values
+ * for the fields that are not used for matching.
+ * @param size_t Pointer to the number of elements in the array.
+ * @return Returns an {@link OH_Drawing_FontDescriptor} array, which must be released by calling
+ * {@link OH_Drawing_DestroyFontDescriptors}.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_FontDescriptor* OH_Drawing_MatchFontDescriptors(OH_Drawing_FontDescriptor*, size_t*);
+
+/**
+ * @brief Releases an array of {@link OH_Drawing_FontDescriptor} objects.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontDescriptor Pointer to an array of {@link OH_Drawing_FontDescriptor} objects.
+ * @param size_t Number of {@link OH_Drawing_FontDescriptor} objects in the array.
+ * @since 14
+ * @version 1.0
+ */
+void OH_Drawing_DestroyFontDescriptors(OH_Drawing_FontDescriptor*, size_t);
+
+/**
+ * @brief Obtains a font descriptor based on the font name and type.
+ * System fonts, style fonts, and user-installed fonts are supported.
+ * A font descriptor is a data structure that describes font features.
+ * It contains details of the font appearance and properties.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_String Pointer to the font name, which is {@link OH_Drawing_String}.
+ * @param OH_Drawing_SystemFontType Font type, which is defined in {@link OH_Drawing_SystemFontType}.
+ * @return Returns the pointer to an {@link OH_Drawing_FontDescriptor} object.
+ * @since 14
+ */
+OH_Drawing_FontDescriptor* OH_Drawing_GetFontDescriptorByFullName(const OH_Drawing_String*, OH_Drawing_SystemFontType);
+
+/**
+ * @brief Obtains an array of font names by font type.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_SystemFontType Font type, which is defined in {@link OH_Drawing_SystemFontType}.
+ * @return Returns the pointer to an {@link OH_Drawing_Array}, which holds the font names.
+ * @since 14
+ */
+OH_Drawing_Array* OH_Drawing_GetSystemFontFullNamesByType(OH_Drawing_SystemFontType);
+
+/**
+ * @brief Obtains the font name with the specified index in the font name array.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Array Pointer to an {@link OH_Drawing_Array} that holds the font names.
+ * @param size_t Index of the font in the array.
+ * @return Returns the pointer to the font name, which is an {@link OH_Drawing_String} object.
+ * @since 14
+ */
+const OH_Drawing_String* OH_Drawing_GetSystemFontFullNameByIndex(OH_Drawing_Array*, size_t);
+
+/**
+ * @brief Releases the memory occupied by the font name array obtained by font type.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Array Pointer to an {@link OH_Drawing_Array} that holds the font names.
+ * @since 14
+ */
+void OH_Drawing_DestroySystemFontFullNames(OH_Drawing_Array*);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_text_line.h b/en/native_sdk/graphic/native_drawing/drawing_text_line.h
new file mode 100644
index 0000000000000000000000000000000000000000..29dc0dc6ea3cfd5011c6f463544a621a299bf1d7
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_text_line.h
@@ -0,0 +1,309 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_TEXT_LINE_H
+#define C_INCLUDE_DRAWING_TEXT_LINE_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_text_line.h
+ *
+ * @brief Declares the capabilities for obtaining the character position in a text line, obtaining the run information,
+ * and truncating text by line.
+ *
+ * File to include: "native_drawing/drawing_text_line.h"
+ * @library libnative_drawing.so
+ * @since 14
+ * @version 1.0
+ */
+
+#include "drawing_text_declaration.h"
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Obtains the array of text lines in a typography object. This array contains one or more text line objects.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param typography Pointer to an {@link OH_Drawing_Typography} object.
+ * @return Returns the pointer to the {@link OH_Drawing_Array} object obtained.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_Array* OH_Drawing_TypographyGetTextLines(OH_Drawing_Typography* typography);
+
+/**
+ * @brief Releases the memory occupied by a text line array.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param lines Pointer to an {@link OH_Drawing_Array} object.
+ * @since 14
+ * @version 1.0
+ */
+void OH_Drawing_DestroyTextLines(OH_Drawing_Array* lines);
+
+/**
+ * @brief Releases the memory occupied by a text line object.
+ * This is applicable only to text line objects that have requested memory on their own and
+ * not to a particular text line object within a text line array.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Pointer to an {@link OH_Drawing_TextLine} object.
+ * @since 14
+ * @version 1.0
+ */
+void OH_Drawing_DestroyTextLine(OH_Drawing_TextLine* line);
+
+/**
+ * @brief Obtains the text line object with the specified index in a text line array.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param lines Pointer to an {@link OH_Drawing_Array} object.
+ * @param index Index in the text line array.
+ * @return Returns the pointer to the {@link OH_Drawing_TextLine} object obtained.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_TextLine* OH_Drawing_GetTextLineByIndex(OH_Drawing_Array* lines, size_t index);
+
+/**
+ * @brief Obtains the number of glyphs in a text line object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Pointer to an {@link OH_Drawing_TextLine} object.
+ * @return Returns the number of glyphs in the text line object.
+ * @since 14
+ * @version 1.0
+ */
+double OH_Drawing_TextLineGetGlyphCount(OH_Drawing_TextLine* line);
+
+/**
+ * @brief Obtains the range of the text in a text line object in the entire paragraph.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Pointer to an {@link OH_Drawing_TextLine} object.
+ * @param start Pointer to the start of the range.
+ * @param end Pointer to the end of the range.
+ * @since 14
+ * @version 1.0
+ */
+void OH_Drawing_TextLineGetTextRange(OH_Drawing_TextLine* line, size_t* start, size_t* end);
+
+/**
+ * @brief Obtains the array of glyph runs in a text line object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Pointer to an {@link OH_Drawing_TextLine} object.
+ * @return Returns the pointer to the {@link OH_Drawing_Array}, which holds multiple {@link OH_Drawing_Run} objects.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_Array* OH_Drawing_TextLineGetGlyphRuns(OH_Drawing_TextLine* line);
+
+/**
+ * @brief Releases the memory occupied by a glyph run array.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param runs Pointer to an {@link OH_Drawing_Run}, which holds multiple {@link OH_Drawing_Array} objects.
+ * @since 14
+ * @version 1.0
+ */
+void OH_Drawing_DestroyRuns(OH_Drawing_Array* runs);
+
+/**
+ * @brief Obtains the glyph run object with the specified index in a glyph run array.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param runs Pointer to an {@link OH_Drawing_Run}, which holds multiple {@link OH_Drawing_Array} objects.
+ * @param index Index in the glyph run array.
+ * @return Returns the pointer to the {@link OH_Drawing_Run} object obtained.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_Run* OH_Drawing_GetRunByIndex(OH_Drawing_Array* runs, size_t index);
+
+/**
+ * @brief Paints a text line on the canvas with the coordinate point (x, y) as the upper left corner.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Pointer to an {@link OH_Drawing_TextLine} object.
+ * @param canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @param x Horizontal coordinate of the upper left corner, in px.
+ * @param y Vertical coordinate of the upper left corner, in px.
+ * @since 14
+ * @version 1.0
+ */
+void OH_Drawing_TextLinePaint(OH_Drawing_TextLine* line, OH_Drawing_Canvas* canvas, double x, double y);
+
+/**
+ * @brief Creates a truncated text line object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Pointer to an {@link OH_Drawing_TextLine} object.
+ * @param width Line width after truncation.
+ * @param mode Truncation type. The value is an enumerated value of {@link OH_Drawing_EllipsisModal}.
+ * Currently, only ELLIPSIS_MODAL_HEAD and ELLIPSIS_MODAL_TAIL are supported.
+ * @param ellipsis String used to mark a truncation.
+ * @return Returns the pointer to the {@link OH_Drawing_TextLine} object created.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_TextLine* OH_Drawing_TextLineCreateTruncatedLine(OH_Drawing_TextLine* line, double width, int mode,
+ const char* ellipsis);
+
+/**
+ * @brief Obtains the typographic boundary of a text line object.
+ * The typographic boundary is related to the font and font size used for typography,
+ * but not the characters within the text.
+ * For example, for the string " a b " (which has a space before "a" and a space after "b"),
+ * the typographic boundary encompasses the spaces at the beginning and end. For the strings "j" and "E",
+ * the typographic boundaries are the same, indicating that they are irrelevant to specific characters.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Pointer to an {@link OH_Drawing_TextLine} object. height = ascent + descent + leading.
+ * @param ascent Pointer to the ascent of the text line object.
+ * @param descent Pointer to the descent of the text line object.
+ * @param leading Pointer to the leading of the text line object.
+ * @return Returns the total width of the layout boundary.
+ * @since 14
+ * @version 1.0
+ */
+double OH_Drawing_TextLineGetTypographicBounds(OH_Drawing_TextLine* line, double* ascent, double* descent,
+ double* leading);
+
+/**
+ * @brief Obtains the image boundary of a text line object.
+ * The image boundary, equivalent to a visual boundary, is related to the font, font size, and characters.
+ * For example, for the string " a b " (which has a space before "a" and a space after "b"), only "a b" are visible
+ * to users, and therefore the image boundary does not include these spaces at the beginning and end.
+ * For the strings "j" and "E", their image boundaries are different.
+ * Specifically, the width of the boundary for "j" is narrower than that for "E",
+ * and the height of the boundary for "j" is taller than that for "E".
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Pointer to an {@link OH_Drawing_TextLine} object.
+ * @return Returns the pointer to the {@link OH_Drawing_Rect} of the text line object.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_Rect* OH_Drawing_TextLineGetImageBounds(OH_Drawing_TextLine* line);
+
+/**
+ * @brief Obtains the width of the spaces at the end of a text line object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Pointer to an {@link OH_Drawing_TextLine} object.
+ * @return Returns the pointer to the width of the spaces.
+ * @since 14
+ * @version 1.0
+ */
+double OH_Drawing_TextLineGetTrailingSpaceWidth(OH_Drawing_TextLine* line);
+
+/**
+ * @brief Obtains the index of a character at a specified position in a text line object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Pointer to an {@link OH_Drawing_TextLine} object.
+ * @param point Pointer to the position, which is an {@link OH_Drawing_Point} object.
+ * @return Returns the index of the character.
+ * For example, for the string "abc", the index of "a" is 0, the index of "b" is 1, and the index of "c" is 2.
+ * If the specified position is at "a", then 0 is returned.
+ * @since 14
+ * @version 1.0
+ */
+int32_t OH_Drawing_TextLineGetStringIndexForPosition(OH_Drawing_TextLine* line, OH_Drawing_Point* point);
+
+/**
+ * @brief Obtains the offset of a character with the specified index in a text line object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Pointer to an {@link OH_Drawing_TextLine} object.
+ * @param index Index of the character.
+ * @return Returns the offset.
+ * @since 14
+ * @version 1.0
+ */
+double OH_Drawing_TextLineGetOffsetForStringIndex(OH_Drawing_TextLine* line, int32_t index);
+
+/**
+ * @brief Defines a custom callback used to receive the offset and index of each character in a text line object
+ * as its parameters.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param offset Offset of each character in the text line object.
+ * @param index Index of each character in the text line object.
+ * @param leadingEdge Whether the cursor is located at the front of the character.
+ * The value true means that the cursor is located at the front of the character, that is,
+ * the offset does not contain the character width. The value false means that the cursor is located at the rear
+ * of the character, that is, the offset contains the character width.
+ * @return Returns the result indicating whether to stop calling the callback.
+ * The value true means to stop calling the callback, and false means to continue calling the callback.
+ * @since 14
+ * @version 1.0
+ */
+typedef bool (*Drawing_CaretOffsetsCallback)(double offset, int32_t index, bool leadingEdge);
+
+/**
+ * @brief Enumerates the offset and index of each character in a text line object and
+ * passes them to a custom callback function. You can use the offset and index array for other operations.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Pointer to an {@link OH_Drawing_TextLine} object.
+ * @param callback User-defined function, which is {@link Drawing_CaretOffsetsCallback}.
+ * @since 14
+ * @version 1.0
+ */
+void OH_Drawing_TextLineEnumerateCaretOffsets(OH_Drawing_TextLine* line, Drawing_CaretOffsetsCallback callback);
+
+/**
+ * @brief Obtains the offset of a text line object after alignment based on the alignment factor and alignment width.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Pointer to an {@link OH_Drawing_TextLine} object.
+ * @param alignmentFactor Alignment factor, which determines how text is aligned.
+ * A value less than or equal to 0.0 means that the text is left-aligned;
+ * a value between 0.0 and 0.5 means that the text is slightly left-aligned;
+ * the value 0.5 means that is text is centered;
+ * a value between 0.5 and 1 means that the text is slightly right-aligned;
+ * a value greater than or equal to 1.0 means that the text is right-aligned.
+ * @param alignmentWidth Alignment width, that is, the offset of the lower right corner of the text line object
+ * relative to the start position. If the specified alignment width is less than the actual width of
+ * the text line object, 0 is returned.
+ * @return Returns the offset.
+ * @since 14
+ * @version 1.0
+ */
+double OH_Drawing_TextLineGetAlignmentOffset(OH_Drawing_TextLine* line, double alignmentFactor, double alignmentWidth);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif // C_INCLUDE_DRAWING_TEXT_LINE_H
diff --git a/en/native_sdk/graphic/native_drawing/drawing_text_run.h b/en/native_sdk/graphic/native_drawing/drawing_text_run.h
new file mode 100644
index 0000000000000000000000000000000000000000..2c98008f505ab54d3354424efe3a70ff3cd4de24
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_text_run.h
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_TEXT_RUN_H
+#define C_INCLUDE_DRAWING_TEXT_RUN_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_text_run.h
+ *
+ * @brief Declares the capabilities of runs, such as obtaining the typographic boundary and drawing.
+ * File to include: "native_drawing/drawing_text_run.h"
+ * @library libnative_drawing.so
+ * @since 14
+ * @version 1.0
+ */
+
+#include "drawing_text_declaration.h"
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @brief Obtains an array of character indices for glyphs within a specified range of a run,
+ * where the indices are offsets relative to the entire paragraph.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param run Pointer to an {@link OH_Drawing_Run} object.
+ * @param start Start position in the run. If a negative number is passed, a null pointer is returned.
+ * @param length Length of the range in the run. If the length is 0, all character indexes of the run are obtained.
+ * If the length is less than 0, a null pointer is returned.
+ * @return Returns the character index array.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_Array* OH_Drawing_GetRunStringIndices(OH_Drawing_Run* run, int64_t start, int64_t length);
+
+/**
+ * @brief Obtains character indices of glyphs in a run by index.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param stringIndices Pointer to a character index array.
+ * @param index Index in the character index array.
+ * @return Returns the character indices.
+ * @since 14
+ * @version 1.0
+ */
+uint64_t OH_Drawing_GetRunStringIndicesByIndex(OH_Drawing_Array* stringIndices, size_t index);
+
+/**
+ * @brief Releases the pointer to a character index array object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param stringIndices Pointer to a character index array.
+ * @since 14
+ * @version 1.0
+ */
+void OH_Drawing_DestroyRunStringIndices(OH_Drawing_Array* stringIndices);
+
+/**
+ * @brief Obtains the range of glyphs generated by a run.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param run Pointer to an {@link OH_Drawing_Run} object.
+ * @param location Start position of the range in the run, which is an offset relative to the entire paragraph.
+ * @param length Length of the range.
+ * @since 14
+ * @version 1.0
+ */
+void OH_Drawing_GetRunStringRange(OH_Drawing_Run* run, uint64_t* location, uint64_t* length);
+
+/**
+ * @brief Obtains the typographic boundary of a run.
+ * The typographic boundary is related to the font and font size used for typography,
+ * but not the characters within the text.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param run Pointer to an {@link OH_Drawing_Run} object.
+ * @param ascent Distance from the top of the tallest character to the baseline in the run.
+ * @param descent Distance from the bottom of the lowest character to the baseline in the run.
+ * @param leading Vertical space between lines in the run.
+ * @return Returns the layout width of the run.
+ * @since 14
+ * @version 1.0
+ */
+float OH_Drawing_GetRunTypographicBounds(OH_Drawing_Run* run, float* ascent, float* descent, float* leading);
+
+/**
+ * @brief Paints the text contained in a run on the canvas.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param canvas Pointer to an {@link OH_Drawing_Canvas} object.
+ * @param run Pointer to an {@link OH_Drawing_Run} object.
+ * @param x X coordinate of the run.
+ * @param y Y coordinate of the run.
+ * @since 14
+ * @version 1.0
+ */
+void OH_Drawing_RunPaint(OH_Drawing_Canvas* canvas, OH_Drawing_Run* run, double x, double y);
+
+/**
+ * @brief Obtains the image boundary of a run.
+ * The image boundary is related to characters and is equivalent to the visual boundary.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param run Pointer to an {@link OH_Drawing_Run} object.
+ * @return Returns the pointer to an {@link OH_Drawing_Rect} object, which describes the image boundary of the run.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_Rect* OH_Drawing_GetRunImageBounds(OH_Drawing_Run* run);
+
+/**
+ * @brief Releases the pointer to an image boundary object of a run.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param rect Pointer to the image boundary, which is an {@link OH_Drawing_Rect} object.
+ * @since 14
+ * @version 1.0
+ */
+void OH_Drawing_DestroyRunImageBounds(OH_Drawing_Rect* rect);
+
+/**
+ * @brief Obtains an array of glyphs within the specified range of a run.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param run Pointer to an {@link OH_Drawing_Run} object.
+ * @param start Start position in the run. If a negative number is passed, a null pointer is returned.
+ * @param length Length of the range in the run.
+ * If the length is 0, all character indexes of the run are obtained.
+ * If the length is less than 0, a null pointer is returned.
+ * @return Returns the pointer to an {@link OH_Drawing_Array} object, which holds the glyphs.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_Array* OH_Drawing_GetRunGlyphs(OH_Drawing_Run* run, int64_t start, int64_t length);
+
+/**
+ * @brief Obtains individual glyphs in a run by index.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param glyphs Pointer to the glyph array, which is an {@link OH_Drawing_Array} object.
+ * @param index Index in the glyph array.
+ * @return Returns the individual glyphs.
+ * @since 14
+ * @version 1.0
+ */
+uint16_t OH_Drawing_GetRunGlyphsByIndex(OH_Drawing_Array* glyphs, size_t index);
+
+/**
+ * @brief Releases the pointer to a glyph array in a run.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param glyphs Pointer to the glyph array, which is an {@link OH_Drawing_Array} object.
+ * @since 14
+ * @version 1.0
+ */
+void OH_Drawing_DestroyRunGlyphs(OH_Drawing_Array* glyphs);
+
+/**
+ * @brief Obtains the positions of glyphs within the specified range of a run.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param run Pointer to an {@link OH_Drawing_Run} object.
+ * @param start Start position in the run. If a negative number is passed, a null pointer is returned.
+ * @param length Length of the range in the run.
+ * If the length is 0, all character indexes of the run are obtained.
+ * If the length is less than 0, a null pointer is returned.
+ * @return Returns the pointer to an {@link OH_Drawing_Array} object, which holds the glyph positions.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_Array* OH_Drawing_GetRunPositions(OH_Drawing_Run* run, int64_t start, int64_t length);
+
+/**
+ * @brief Obtains the positions of individual glyphs in a run by index.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param positions Pointer to the glyph position array, which is an {@link OH_Drawing_Array} object.
+ * @param index Index of the glyph position array in the run.
+ * @return Returns the pointer to an {@link OH_Drawing_Point} object,
+ * which holds the positions of individual glyphs in the run.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_Point* OH_Drawing_GetRunPositionsByIndex(OH_Drawing_Array* positions, size_t index);
+
+/**
+ * @brief Releases the pointer to a glyph position array in a run.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param positions Pointer to the glyph position array, which is an {@link OH_Drawing_Array} object.
+ * @since 14
+ * @version 1.0
+ */
+void OH_Drawing_DestroyRunPositions(OH_Drawing_Array* positions);
+
+/**
+ * @brief Obtains the number of glyphs in a run.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param run Pointer to an {@link OH_Drawing_Run} object.
+ * @return Returns the number of glyphs.
+ * @since 14
+ * @version 1.0
+ */
+uint32_t OH_Drawing_GetRunGlyphCount(OH_Drawing_Run* run);
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_text_typography.h b/en/native_sdk/graphic/native_drawing/drawing_text_typography.h
index 4fcd20c29ea1168531d6bbda153510463e4f006e..5bf64e5614b6e3a896f5e740af41dcd2c79e615a 100644
--- a/en/native_sdk/graphic/native_drawing/drawing_text_typography.h
+++ b/en/native_sdk/graphic/native_drawing/drawing_text_typography.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
+ * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -20,7 +20,8 @@
* @addtogroup Drawing
* @{
*
- * @brief Provides the 2D drawing capability.
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
*
@@ -31,14 +32,17 @@
/**
* @file drawing_text_typography.h
*
- * @brief Declares functions related to typography in the drawing module.
+ * @brief Declares the functions related to the typography in the drawing module.
*
+ * File to include: native_drawing/drawing_text_typography.h
+ * @library libnative_drawing.so
* @since 8
* @version 1.0
*/
#include "drawing_canvas.h"
#include "drawing_color.h"
+#include "drawing_font.h"
#include "drawing_text_declaration.h"
#include "drawing_types.h"
@@ -49,24 +53,24 @@ extern "C" {
#endif
/**
- * @brief Enumerates text directions.
+ * @brief Enumerates the text directions.
*/
enum OH_Drawing_TextDirection {
- /** Right to left (RTL) */
+ /** Right to left (RTL). */
TEXT_DIRECTION_RTL,
- /** Left to right (LTR) */
+ /** Left to right (LTR). */
TEXT_DIRECTION_LTR,
};
/**
- * @brief Enumerates text alignment modes.
+ * @brief Enumerates the text alignment modes.
*/
enum OH_Drawing_TextAlign {
- /** Left-aligned */
+ /** Left-aligned. */
TEXT_ALIGN_LEFT,
- /** Right-aligned */
+ /** Right-aligned. */
TEXT_ALIGN_RIGHT,
- /** Center-aligned */
+ /** Center-aligned. */
TEXT_ALIGN_CENTER,
/**
* Justified, which means that each line (except the last line) is stretched so that every line has equal width,
@@ -90,31 +94,31 @@ enum OH_Drawing_TextAlign {
};
/**
- * @brief Enumerates font weights.
+ * @brief Enumerates the font weights.
*/
enum OH_Drawing_FontWeight {
- /** Thin */
+ /** Thin. */
FONT_WEIGHT_100,
- /** Extra-light */
+ /** Extra-light. */
FONT_WEIGHT_200,
- /** Light */
+ /** Light. */
FONT_WEIGHT_300,
- /** Normal/Regular */
+ /** Normal/Regular. */
FONT_WEIGHT_400,
- /** Medium*/
+ /** Medium. */
FONT_WEIGHT_500,
- /** Semi-bold */
+ /** Semi-bold. */
FONT_WEIGHT_600,
- /** Bold */
+ /** Bold. */
FONT_WEIGHT_700,
- /** Extra-bold */
+ /** Extra-bold. */
FONT_WEIGHT_800,
- /** Black */
+ /** Black. */
FONT_WEIGHT_900,
};
/**
- * @brief Enumerates text baselines.
+ * @brief Enumerates the text baselines.
*/
enum OH_Drawing_TextBaseline {
/** Alphabetic, where the letters in alphabets like English sit on. */
@@ -124,7 +128,7 @@ enum OH_Drawing_TextBaseline {
};
/**
- * @brief Enumerates text decorations.
+ * @brief Enumerates the text decorations.
*/
enum OH_Drawing_TextDecoration {
/** No decoration. */
@@ -138,15 +142,489 @@ enum OH_Drawing_TextDecoration {
};
/**
- * @brief Enumerates font styles.
+ * @brief Enumerates the font styles.
*/
enum OH_Drawing_FontStyle {
- /** Normal style */
+ /** Normal style. */
FONT_STYLE_NORMAL,
- /** Italic style */
+ /** Italic. */
FONT_STYLE_ITALIC,
+ /**
+ * Oblique.
+ *
+ * @since 12
+ */
+ FONT_STYLE_OBLIQUE,
+};
+
+/**
+ * @brief Enumerates the vertical alignment modes of placeholders.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef enum OH_Drawing_PlaceholderVerticalAlignment {
+ /** Aligned to the baseline. */
+ ALIGNMENT_OFFSET_AT_BASELINE,
+ /** Aligned above the baseline. */
+ ALIGNMENT_ABOVE_BASELINE,
+ /** Aligned below the baseline. */
+ ALIGNMENT_BELOW_BASELINE,
+ /** Aligned to the top of the row box. */
+ ALIGNMENT_TOP_OF_ROW_BOX,
+ /** Aligned to the bottom of the row box. */
+ ALIGNMENT_BOTTOM_OF_ROW_BOX,
+ /** Aligned to the center of the row box. */
+ ALIGNMENT_CENTER_OF_ROW_BOX,
+} OH_Drawing_PlaceholderVerticalAlignment;
+
+/**
+ * @brief Describes a placeholder that acts as a span.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct OH_Drawing_PlaceholderSpan {
+ /** Width of the placeholder. */
+ double width;
+ /** Height of the placeholder. */
+ double height;
+ /** Alignment mode of the placeholder. */
+ OH_Drawing_PlaceholderVerticalAlignment alignment;
+ /** Baseline of the placeholder. */
+ OH_Drawing_TextBaseline baseline;
+ /** Baseline offset of the placeholder. */
+ double baselineOffset;
+} OH_Drawing_PlaceholderSpan;
+
+/**
+ * @brief Enumerates the text decoration styles.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef enum OH_Drawing_TextDecorationStyle {
+ /** Solid style. */
+ TEXT_DECORATION_STYLE_SOLID,
+ /** Double style. */
+ TEXT_DECORATION_STYLE_DOUBLE,
+ /** Dotted style. */
+ TEXT_DECORATION_STYLE_DOTTED,
+ /** Dashed style. */
+ TEXT_DECORATION_STYLE_DASHED,
+ /** Wavy style. */
+ TEXT_DECORATION_STYLE_WAVY,
+} OH_Drawing_TextDecorationStyle;
+
+/**
+ * @brief Enumerates the ellipsis styles.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef enum OH_Drawing_EllipsisModal {
+ /** Places the ellipsis in the text header. */
+ ELLIPSIS_MODAL_HEAD = 0,
+ /** Places the ellipsis in the middle of the text. */
+ ELLIPSIS_MODAL_MIDDLE = 1,
+ /** Places the ellipsis at the end of the text. */
+ ELLIPSIS_MODAL_TAIL = 2,
+} OH_Drawing_EllipsisModal;
+
+/**
+ * @brief Enumerates the text break strategies.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef enum OH_Drawing_BreakStrategy {
+ /** Each line is filled as much as possible during line break. */
+ BREAK_STRATEGY_GREEDY = 0,
+ /** Text continuity is preferentially considered during line break. */
+ BREAK_STRATEGY_HIGH_QUALITY = 1,
+ /** Line breaks are performed at the word boundary. */
+ BREAK_STRATEGY_BALANCED = 2,
+} OH_Drawing_BreakStrategy;
+
+/**
+ * @brief Enumerates the word break types.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef enum OH_Drawing_WordBreakType {
+ /** Normal mode. */
+ WORD_BREAK_TYPE_NORMAL = 0,
+ /** Breaks the words at any character to prevent overflow. */
+ WORD_BREAK_TYPE_BREAK_ALL = 1,
+ /** Breaks the words at arbitrary points to prevent overflow. */
+ WORD_BREAK_TYPE_BREAK_WORD = 2,
+} OH_Drawing_WordBreakType;
+
+/**
+ * @brief Enumerates the rectangle height styles.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef enum OH_Drawing_RectHeightStyle {
+ /** Tight style. */
+ RECT_HEIGHT_STYLE_TIGHT,
+ /** Maximum style. */
+ RECT_HEIGHT_STYLE_MAX,
+ /** Middle style that includes the line spacing. */
+ RECT_HEIGHT_STYLE_INCLUDELINESPACEMIDDLE,
+ /** Top style that includes the line spacing. */
+ RECT_HEIGHT_STYLE_INCLUDELINESPACETOP,
+ /** Bottom style that includes the line spacing. */
+ RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM,
+ /** Structure style. */
+ RECT_HEIGHT_STYLE_STRUCT,
+} OH_Drawing_RectHeightStyle;
+
+/**
+ * @brief Enumerates the rectangle width styles.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef enum OH_Drawing_RectWidthStyle {
+ /** Tight style. */
+ RECT_WIDTH_STYLE_TIGHT,
+ /** Maximum style. */
+ RECT_WIDTH_STYLE_MAX,
+} OH_Drawing_RectWidthStyle;
+
+/**
+* @brief Enumerates the error codes that may be used during the obtaining of system font configurations.
+*
+* @since 12
+* @version 1.0
+*/
+enum OH_Drawing_FontConfigInfoErrorCode {
+ /** Operation successful. */
+ SUCCESS_FONT_CONFIG_INFO = 0,
+ /** Unknown error. */
+ ERROR_FONT_CONFIG_INFO_UNKNOWN = 1,
+ /** Failed to parse the system configuration file. */
+ ERROR_FONT_CONFIG_INFO_PARSE_FILE = 2,
+ /** Failed to apply for a buffer. */
+ ERROR_FONT_CONFIG_INFO_ALLOC_MEMORY = 3,
+ /** Failed to copy the string data. */
+ ERROR_FONT_CONFIG_INFO_COPY_STRING_DATA = 4,
+};
+
+/**
+ * @brief Defines a struct that describes the detailed information about a system font.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_FontDescriptor {
+ /** File path of the system font. */
+ char* path;
+ /** PostScript name that uniquely identifies the system font. */
+ char* postScriptName;
+ /** Full name of the system font. */
+ char* fullName;
+ /** Family of the system font. */
+ char* fontFamily;
+ /** Subfamily of the system font. */
+ char* fontSubfamily;
+ /** Weight of the system font. */
+ int weight;
+ /** Width of the system font. */
+ int width;
+ /** Slope of the system font. */
+ int italic;
+ /**
+ * Whether the system font is monospaced.
+ * The value true means that the system font is monospaced, and false means the opposite.
+ */
+ bool monoSpace;
+ /**
+ * Whether the system font supports symbols.
+ * The value true means that the system font supports symbols, and false means the opposite.
+ */
+ bool symbolic;
+} OH_Drawing_FontDescriptor;
+
+/**
+ * @brief Defines a struct that describes the measurement information about a line of text.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_LineMetrics {
+ /** Part of a lowercase letter that extends beyond the meanline. */
+ double ascender;
+ /** Part of a lowercase letter that extends below the baseline. */
+ double descender;
+ /** Height of an uppercase letter above the baseline. */
+ double capHeight;
+ /** Height of a lowercase letter, specifically the lowercase x, not including ascenders and descenders. */
+ double xHeight;
+ /** Horizontal space taken up by a character. */
+ double width;
+ /** Line height. */
+ double height;
+ /**
+ * Distance from the left edge of the leftmost character to the left edge of the container.
+ * For left alignment, the value is 0. For right alignment, the value is the container width minus the text width.
+ */
+ double x;
+ /**
+ * Height from the top edge of the character to the top of the container.
+ * The first line is 0, and the second line is the height of the first line.
+ */
+ double y;
+ /** Index of the first character in the line. */
+ size_t startIndex;
+ /** Index of the last character in the line. */
+ size_t endIndex;
+ /** Measurement information of the first character. */
+ OH_Drawing_Font_Metrics firstCharMetrics;
+} OH_Drawing_LineMetrics;
+
+/**
+ * @brief Describes the information about a font fallback.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_FontFallbackInfo {
+ /** Pointer to the language supported by the font fallback. The language format is bcp47. */
+ char* language;
+ /** Pointer to the name of a font family. */
+ char* familyName;
+} OH_Drawing_FontFallbackInfo;
+
+/**
+ * @brief Describes the information about a font fallback group.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_FontFallbackGroup {
+ /**
+ * Pointer to the name of the group corresponding to the font fallback group.
+ * If null is passed in, all fonts in the font fallback group can be used.
+ */
+ char* groupName;
+ /** Number of font fallbacks. */
+ size_t fallbackInfoSize;
+ /** Pointer to the set of font fallbacks. */
+ OH_Drawing_FontFallbackInfo* fallbackInfoSet;
+} OH_Drawing_FontFallbackGroup;
+
+/**
+ * @brief Describes the information about a font weight mapping. */
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_FontAdjustInfo {
+ /** Original font weight.
+ int weight;
+ /** Font weight displayed in the application. */
+ int to;
+} OH_Drawing_FontAdjustInfo;
+
+/**
+ * @brief Describes the information about a font alias.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_FontAliasInfo {
+ /** Pointer to the name of a font family. */
+ char* familyName;
+ /**
+ * Font weight. If the value is greater than 0, only the fonts with the specified weight in the font family are
+ * contained. If the value is 0, all the fonts in the font family are contained.
+ */
+ int weight;
+} OH_Drawing_FontAliasInfo;
+
+/**
+ * @brief Describes the information about generic fonts supported by the system.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_FontGenericInfo {
+ /** Pointer to the name of a font family. */
+ char* familyName;
+ /** Number of font aliases. */
+ size_t aliasInfoSize;
+ /** Number of font weight mappings. */
+ size_t adjustInfoSize;
+ /** Pointer to a set of font aliases. */
+ OH_Drawing_FontAliasInfo* aliasInfoSet;
+ /** Pointer to a set of font weight mappings. */
+ OH_Drawing_FontAdjustInfo* adjustInfoSet;
+} OH_Drawing_FontGenericInfo;
+
+/**
+ * @brief Describes the information about a system font configuration.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_FontConfigInfo {
+ /** Number of system font file paths. */
+ size_t fontDirSize;
+ /** Number of generic fonts. */
+ size_t fontGenericInfoSize;
+ /** Number of font fallback groups. */
+ size_t fallbackGroupSize;
+ /** Double pointer to the system font file paths. */
+ char** fontDirSet;
+ /** Pointer to a set of generic fonts. */
+ OH_Drawing_FontGenericInfo* fontGenericInfoSet;
+ /** Pointer to a set of font fallback groups. */
+ OH_Drawing_FontFallbackGroup* fallbackGroupSet;
+} OH_Drawing_FontConfigInfo;
+
+/**
+ * @brief Enumerates the font widths.
+ *
+ * @since 12
+ * @version 1.0
+ */
+enum OH_Drawing_FontWidth {
+ /* Ultra condensed font. */
+ ULTRA_CONDENSED_WIDTH = 1,
+ /* Extra condensed font. */
+ EXTRA_CONDENSED_WIDTH = 2,
+ /* Condensed font. */
+ CONDENSED_WIDTH = 3,
+ /* Semi-condensed font. */
+ SEMI_CONDENSED_WIDTH = 4,
+ /* Normal font. */
+ NORMAL_WIDTH = 5,
+ /* Semi-expanded font. */
+ SEMI_EXPANDED_WIDTH = 6,
+ /* Expanded font. */
+ EXPANDED_WIDTH = 7,
+ /* Extra expanded font. */
+ EXTRA_EXPANDED_WIDTH = 8,
+ /* Ultra expanded font. */
+ ULTRA_EXPANDED_WIDTH = 9,
+};
+
+/**
+ * @brief Describes a font style.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_FontStyleStruct {
+ /** Font weight. */
+ OH_Drawing_FontWeight weight;
+ /** Font width. */
+ OH_Drawing_FontWidth width;
+ /** Font slant. */
+ OH_Drawing_FontStyle slant;
+} OH_Drawing_FontStyleStruct;
+
+/**
+ * @brief Describes a font feature.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct {
+ /** Tag of the font feature. */
+ char* tag;
+ /** Value of the font feature. */
+ int value;
+} OH_Drawing_FontFeature;
+
+/**
+ * @brief Enumerates the text height modifier patterns.
+ *
+ * @since 12
+ * @version 1.0
+ */
+enum OH_Drawing_TextHeightBehavior {
+ /** Enables ascent for the first and last rows of a paragraph. */
+ TEXT_HEIGHT_ALL = 0x0,
+ /** Disables ascent for the first row of a paragraph. */
+ TEXT_HEIGHT_DISABLE_FIRST_ASCENT = 0x1,
+ /** Disables ascent for the last row of a paragraph. */
+ TEXT_HEIGHT_DISABLE_LAST_ASCENT = 0x2,
+ /** Disables ascent for the first and last rows of a paragraph. */
+ TEXT_HEIGHT_DISABLE_ALL = 0x1 | 0x2,
+};
+
+/**
+ * @brief Enumerates the text style types.
+ *
+ * @since 12
+ * @version 1.0
+ */
+enum OH_Drawing_TextStyleType {
+ /** No text style. */
+ TEXT_STYLE_NONE,
+ /** All text styles. */
+ TEXT_STYLE_ALL_ATTRIBUTES,
+ /* Font style. */
+ TEXT_STYLE_FONT,
+ /** Text foreground style. */
+ TEXT_STYLE_FOREGROUND,
+ /** Text background style. */
+ TEXT_STYLE_BACKGROUND,
+ /** Text shadow style. */
+ TEXT_STYLE_SHADOW,
+ /** Text decoration style. */
+ TEXT_STYLE_DECORATIONS,
+ /** Text letter spacing style. */
+ TEXT_STYLE_LETTER_SPACING,
+ /** Text word spacing style. */
+ TEXT_STYLE_WORD_SPACING
};
+/**
+ * @brief Describes a strut style. The strut style determines the line spacing, baseline alignment mode, and
+ * other properties related to the line height when drawing texts.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_StrutStyle {
+ /** Font weight used for calculating the strut. */
+ OH_Drawing_FontWeight weight;
+ /** Font style used for calculating the strut. */
+ OH_Drawing_FontStyle style;
+ /** Size of the ascent plus descent in the logical pixels. */
+ double size;
+ /** Line height. */
+ double heightScale;
+ /**
+ * Whether to enable the feature to override the height.
+ * The value true means to enable the feature, and false means the opposite.
+ */
+ bool heightOverride;
+ /**
+ * Whether to enable half leading. The value true means to enable half leading,
+ * and false means the opposite.
+ */
+ bool halfLeading;
+ /** Custom leading to be applied to the strut. */
+ double leading;
+ /**
+ * Whether to forcibly use the strut height for all rows.
+ * The value true means to forcibly use the strut height for all rows,
+ * and false means the opposite.
+ */
+ bool forceStrutHeight;
+ /** Number of font families. */
+ size_t familiesSize;
+ /** Double pointer to the font families used for calculating the strut. */
+ char** families;
+} OH_Drawing_StrutStyle;
+
/**
* @brief Creates an OH_Drawing_TypographyStyle object.
*
@@ -158,10 +636,11 @@ enum OH_Drawing_FontStyle {
OH_Drawing_TypographyStyle* OH_Drawing_CreateTypographyStyle(void);
/**
- * @brief Releases the memory occupied by an OH_Drawing_TypographyStyle object.
+ * @brief Destroys an OH_Drawing_TypographyStyle object and reclaims the memory occupied by the object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object.
+ * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
* @since 8
* @version 1.0
*/
@@ -171,8 +650,9 @@ void OH_Drawing_DestroyTypographyStyle(OH_Drawing_TypographyStyle*);
* @brief Sets the text direction.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object.
- * @param int Indicates the text direction to set. For details, see the enum OH_Drawing_TextDirection.
+ * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param int Text direction. For details about the available options, see {@link OH_Drawing_TextDirection}.
* @since 8
* @version 1.0
*/
@@ -182,19 +662,33 @@ void OH_Drawing_SetTypographyTextDirection(OH_Drawing_TypographyStyle*, int /* O
* @brief Sets the text alignment mode.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object.
- * @param int Indicates the text alignment mode to set. For details, see the enum OH_Drawing_TextAlign.
+ * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param int Text alignment mode. For details about the available options, see {@link OH_Drawing_TextAlign}.
* @since 8
* @version 1.0
*/
void OH_Drawing_SetTypographyTextAlign(OH_Drawing_TypographyStyle*, int /* OH_Drawing_TextAlign */);
/**
- * @brief Sets the maximum number of lines in a text file.
+ * @brief Obtains the text alignment mode.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns the text alignment mode.
+ * @since 12
+ * @version 1.0
+ */
+int OH_Drawing_TypographyGetEffectiveAlignment(OH_Drawing_TypographyStyle* style);
+
+/**
+ * @brief Sets the maximum number of lines in the text.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object.
- * @param int Indicates the maximum number of lines to set.
+ * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param int Maximum number of lines.
* @since 8
* @version 1.0
*/
@@ -211,10 +705,23 @@ void OH_Drawing_SetTypographyTextMaxLines(OH_Drawing_TypographyStyle*, int /* ma
OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle(void);
/**
- * @brief Releases the memory occupied by an OH_Drawing_TextStyle object.
+ * @brief Obtains the text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns the pointer to the {@link OH_Drawing_TextStyle} object.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_TextStyle* OH_Drawing_TypographyGetTextStyle(OH_Drawing_TypographyStyle* style);
+
+/**
+ * @brief Destroys an OH_Drawing_TextStyle object and reclaims the memory occupied by the object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
* @since 8
* @version 1.0
*/
@@ -224,8 +731,9 @@ void OH_Drawing_DestroyTextStyle(OH_Drawing_TextStyle*);
* @brief Sets the text color.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
- * @param uint32_t Indicates the color to set.
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param uint32_t Color.
* @since 8
* @version 1.0
*/
@@ -235,8 +743,9 @@ void OH_Drawing_SetTextStyleColor(OH_Drawing_TextStyle*, uint32_t /* color */);
* @brief Sets the font size.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
- * @param double Indicates the font size to set.
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param double Font size.
* @since 8
* @version 1.0
*/
@@ -244,10 +753,15 @@ void OH_Drawing_SetTextStyleFontSize(OH_Drawing_TextStyle*, double /* fontSize *
/**
* @brief Sets the font weight.
+ * Currently, only the default system font supports font weight adjustment.
+ * For other fonts, if the weight is less than semi-bold, there is no variation in stroke thickness.
+ * If the weight is greater than or equal to semi-bold, it might result in a fake bold effect.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
- * @param int Indicates the font weight to set. For details, see the enum OH_Drawing_FontWeight.
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param int Font weight.
+ * For details about the available options, see {@link OH_Drawing_FontWeight}.
* @since 8
* @version 1.0
*/
@@ -257,8 +771,9 @@ void OH_Drawing_SetTextStyleFontWeight(OH_Drawing_TextStyle*, int /* OH_Drawing_
* @brief Sets the text baseline.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
- * @param int Indicates the text baseline to set. For details, see the enum OH_Drawing_TextBaseline.
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param int Text baseline. For details about the available options, see {@link OH_Drawing_TextBaseline}.
* @since 8
* @version 1.0
*/
@@ -268,30 +783,65 @@ void OH_Drawing_SetTextStyleBaseLine(OH_Drawing_TextStyle*, int /* OH_Drawing_Te
* @brief Sets the text decoration.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
- * @param int Indicates the text decoration to set. For details, see the enum OH_Drawing_TextDecoration.
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param int Text decoration. For details about the available options, see {@link OH_Drawing_TextDecoration}.
* @since 8
* @version 1.0
*/
void OH_Drawing_SetTextStyleDecoration(OH_Drawing_TextStyle*, int /* OH_Drawing_TextDecoration */);
+/**
+ * @brief Adds the decoration for a text style. Multiple decoration lines can be displayed.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param int Decoration to add. The value 1 means to add an underline, 2 means to add an overline,
+ * and 4 means to add a strikethrough.
+ * You can add various text decorations in a single operation using bitwise OR.
+ * If you set decoration styles that are not defined in {@link OH_Drawing_TextDecoration},
+ * the existing decorations remain unchanged.
+ * @since 14
+ * @version 1.0
+ */
+void OH_Drawing_AddTextStyleDecoration(OH_Drawing_TextStyle*, int /* OH_Drawing_TextDecoration */);
+
+/**
+ * @brief Removes the decoration for a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param int Decoration to remove. The value 1 means to remove an underline,
+ * 2 means to remove an overline, and 4 means to remove a strikethrough.
+ * You can remove various text decorations in a single operation using bitwise OR.
+ * If you set decoration styles that are not defined in {@link OH_Drawing_TextDecoration},
+ * the existing decorations remain unchanged.
+ * @since 14
+ * @version 1.0
+ */
+void OH_Drawing_RemoveTextStyleDecoration(OH_Drawing_TextStyle*, int /* OH_Drawing_TextDecoration */);
+
/**
* @brief Sets the color for the text decoration.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
- * @param uint32_t Indicates the color to set.
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param uint32_t Color.
* @since 8
* @version 1.0
*/
void OH_Drawing_SetTextStyleDecorationColor(OH_Drawing_TextStyle*, uint32_t /* color */);
/**
- * @brief Sets the font height.
+ * @brief Sets the line height based on the multiple of the font size.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
- * @param double Indicates the font height to set.
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param double Multiple of the font size.
* @since 8
* @version 1.0
*/
@@ -301,9 +851,10 @@ void OH_Drawing_SetTextStyleFontHeight(OH_Drawing_TextStyle*, double /* fontHeig
* @brief Sets the font families.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
- * @param int Indicates the number of font families to set.
- * @param char Indicates the pointer to the font families to set.
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param int Number of font families.
+ * @param char Pointer to the font families.
* @since 8
* @version 1.0
*/
@@ -314,30 +865,139 @@ void OH_Drawing_SetTextStyleFontFamilies(OH_Drawing_TextStyle*,
* @brief Sets the font style.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
- * @param int Indicates the font style to set. For details, see the enum OH_Drawing_FontStyle.
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param int Font style. For details about the available options, see {@link OH_Drawing_FontStyle}.
* @since 8
* @version 1.0
*/
void OH_Drawing_SetTextStyleFontStyle(OH_Drawing_TextStyle*, int /* OH_Drawing_FontStyle */);
/**
- * @brief Sets the locale.
+ * @brief Sets the locale for a text style.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
- * @param char Indicates the pointer to the locale to set.
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param char Pointer to the locale. For example, 'en' indicates English, 'zh-Hans' indicates Simplified
+ * Chinese, and 'zh-Hant' indicates Traditional Chinese.
* @since 8
* @version 1.0
*/
void OH_Drawing_SetTextStyleLocale(OH_Drawing_TextStyle*, const char*);
/**
- * @brief Creates a pointer to an OH_Drawing_TypographyCreate object.
+ * @brief Sets the foreground brush.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param OH_Drawing_Brush Pointer to an {@link OH_Drawing_Brush} object, which is obtained by calling
+ * {@link OH_Drawing_BrushCreate}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTextStyleForegroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*);
+
+/**
+ * @brief Obtains the foreground brush.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param OH_Drawing_Brush Pointer to an {@link OH_Drawing_Brush} object, which is obtained by calling
+ * {@link OH_Drawing_BrushCreate}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TextStyleGetForegroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*);
+
+/**
+ * @brief Sets the foreground pen.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param OH_Drawing_Pen Pointer to an {@link OH_Drawing_Pen} object, which is obtained by calling
+ * {@link OH_Drawing_PenCreate}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTextStyleForegroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*);
+
+/**
+ * @brief Obtains the foreground pen.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param OH_Drawing_Pen Pointer to an {@link OH_Drawing_Pen} object, which is obtained by calling
+ * {@link OH_Drawing_PenCreate}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TextStyleGetForegroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*);
+
+/**
+ * @brief Sets the background brush.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param OH_Drawing_Brush Pointer to an {@link OH_Drawing_Brush} object, which is obtained by calling
+ * {@link OH_Drawing_BrushCreate}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTextStyleBackgroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*);
+
+/**
+ * @brief Obtains the background brush.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param OH_Drawing_Brush Pointer to an {@link OH_Drawing_Brush} object, which is obtained by calling
+ * {@link OH_Drawing_BrushCreate}.
+ * @since 12
+ * @version 1.0
+ */
+ void OH_Drawing_TextStyleGetBackgroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*);
+
+/**
+ * @brief Sets the background pen.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param OH_Drawing_Pen Pointer to an {@link OH_Drawing_Pen} object, which is obtained by calling
+ * {@link OH_Drawing_PenCreate}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTextStyleBackgroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*);
+
+/**
+ * @brief Obtains the background pen.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param OH_Drawing_Pen Pointer to an {@link OH_Drawing_Pen} object, which is obtained by calling
+ * {@link OH_Drawing_PenCreate}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TextStyleGetBackgroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*);
+
+/**
+ * @brief Creates an OH_Drawing_TypographyCreate object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object.
- * @param OH_Drawing_FontCollection Indicates the pointer to an OH_Drawing_FontCollection object.
+ * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param OH_Drawing_FontCollection Pointer to an OH_Drawing_FontCollection object, which is obtained by
+ * calling {@link OH_Drawing_CreateFontCollection}.
* @return Returns the pointer to the OH_Drawing_TypographyCreate object created.
* @since 8
* @version 1.0
@@ -346,10 +1006,11 @@ OH_Drawing_TypographyCreate* OH_Drawing_CreateTypographyHandler(OH_Drawing_Typog
OH_Drawing_FontCollection*);
/**
- * @brief Releases the memory occupied by an OH_Drawing_TypographyCreate object.
+ * @brief Destroys an OH_Drawing_TypographyCreate object and reclaims the memory occupied by the object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object.
+ * @param OH_Drawing_TypographyCreate Pointer to an OH_Drawing_TypographyCreate object. The pointer is obtained
+ * by calling {@link OH_Drawing_CreateTypographyHandler}.
* @since 8
* @version 1.0
*/
@@ -359,8 +1020,10 @@ void OH_Drawing_DestroyTypographyHandler(OH_Drawing_TypographyCreate*);
* @brief Sets the text style.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object.
- * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
+ * @param OH_Drawing_TypographyCreate Pointer to an OH_Drawing_TypographyCreate object. The pointer is obtained
+ * by calling {@link OH_Drawing_CreateTypographyHandler}.
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
* @since 8
* @version 1.0
*/
@@ -370,8 +1033,9 @@ void OH_Drawing_TypographyHandlerPushTextStyle(OH_Drawing_TypographyCreate*, OH_
* @brief Sets the text content.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object.
- * @param char Indicates the pointer to the text content to set.
+ * @param OH_Drawing_TypographyCreate Pointer to an OH_Drawing_TypographyCreate object. The pointer is obtained
+ * by calling {@link OH_Drawing_CreateTypographyHandler}.
+ * @param char Pointer to the text content.
* @since 8
* @version 1.0
*/
@@ -381,7 +1045,8 @@ void OH_Drawing_TypographyHandlerAddText(OH_Drawing_TypographyCreate*, const cha
* @brief Removes the topmost style in the stack, leaving the remaining styles in effect.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object.
+ * @param OH_Drawing_TypographyCreate Pointer to an OH_Drawing_TypographyCreate object. The pointer is obtained
+ * by calling {@link OH_Drawing_CreateTypographyHandler}.
* @since 8
* @version 1.0
*/
@@ -391,7 +1056,8 @@ void OH_Drawing_TypographyHandlerPopTextStyle(OH_Drawing_TypographyCreate*);
* @brief Creates an OH_Drawing_Typography object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object.
+ * @param OH_Drawing_TypographyCreate Pointer to an OH_Drawing_TypographyCreate object. The pointer is obtained
+ * by calling {@link OH_Drawing_CreateTypographyHandler}.
* @return Returns the pointer to the OH_Drawing_Typography object created.
* @since 8
* @version 1.0
@@ -399,10 +1065,11 @@ void OH_Drawing_TypographyHandlerPopTextStyle(OH_Drawing_TypographyCreate*);
OH_Drawing_Typography* OH_Drawing_CreateTypography(OH_Drawing_TypographyCreate*);
/**
- * @brief Releases the memory occupied by an OH_Drawing_Typography object.
+ * @brief Destroys an OH_Drawing_Typography object and reclaims the memory occupied by the object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object.
+ * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
* @since 8
* @version 1.0
*/
@@ -412,8 +1079,9 @@ void OH_Drawing_DestroyTypography(OH_Drawing_Typography*);
* @brief Lays out the typography.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object.
- * @param double Indicates the maximum text width to set.
+ * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @param double Maximum text width.
* @since 8
* @version 1.0
*/
@@ -423,21 +1091,44 @@ void OH_Drawing_TypographyLayout(OH_Drawing_Typography*, double /* maxWidth */);
* @brief Paints text on the canvas.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object.
- * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object.
- * @param double Indicates the x coordinate.
- * @param double Indicates the y coordinate.
+ * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object, which is obtained by calling
+ * {@link OH_Drawing_CanvasCreate()}.
+ * @param double X coordinate.
+ * @param double Y coordinate.
* @since 8
* @version 1.0
*/
void OH_Drawing_TypographyPaint(OH_Drawing_Typography*, OH_Drawing_Canvas*,
double /* potisionX */, double /* potisionY */);
+/**
+ * @brief Draws text along a path.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object,
+ * which is obtained by calling {@link OH_Drawing_CreateTypography}.
+ * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object, which is obtained by calling
+ * {@link OH_Drawing_CanvasCreate}.
+ * @param OH_Drawing_Path Pointer to an OH_Drawing_Path object, which is obtained by calling
+ * {@link OH_Drawing_PathCreate}.
+ * @param double Horizontal offset along the path direction. A positive number indicates a position that is ahead along
+ * the path from its start point, and a negative number indicates a position that is behind from the start point.
+ * @param double Vertical offset along the path direction. A positive number indicates a position on the left side of
+ * the path, and a negative number indicates a position on the right side of the path.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TypographyPaintOnPath(OH_Drawing_Typography*, OH_Drawing_Canvas*, OH_Drawing_Path*,
+ double /* hOffset */, double /* vOffset */);
+
/**
* @brief Obtains the maximum width.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object.
+ * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
* @return Returns the maximum width.
* @since 9
* @version 1.1
@@ -448,7 +1139,8 @@ double OH_Drawing_TypographyGetMaxWidth(OH_Drawing_Typography*);
* @brief Obtains the height.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object.
+ * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
* @return Returns the height.
* @since 9
* @version 1.1
@@ -456,21 +1148,38 @@ double OH_Drawing_TypographyGetMaxWidth(OH_Drawing_Typography*);
double OH_Drawing_TypographyGetHeight(OH_Drawing_Typography*);
/**
- * @brief Obtains the longest line.
+ * @brief Obtains the width of the longest line. You are advised to round up the return value in actual use.
+ * When the text content is empty, the minimum float value,
+ * that is, -340282346638528859811704183484516925440.000000, is returned.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object.
- * @return Returns the longest line.
+ * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @return Returns the width of the longest row.
* @since 9
* @version 1.1
*/
double OH_Drawing_TypographyGetLongestLine(OH_Drawing_Typography*);
+/**
+ * @brief Obtains the width of the longest line, including its indentation.
+ * You are advised to round up the return value in actual use. If the text content is empty, 0.0 is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an {@link OH_Drawing_Typography} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @return Returns the width of the longest line, including its indentation, in px.
+ * @since 13
+ * @version 1.1
+ */
+double OH_Drawing_TypographyGetLongestLineWithIndent(OH_Drawing_Typography*);
+
/**
* @brief Obtains the minimum intrinsic width.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object.
+ * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
* @return Returns the minimum intrinsic width.
* @since 9
* @version 1.1
@@ -481,7 +1190,8 @@ double OH_Drawing_TypographyGetMinIntrinsicWidth(OH_Drawing_Typography*);
* @brief Obtains the maximum intrinsic width.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object.
+ * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
* @return Returns the maximum intrinsic width.
* @since 9
* @version 1.1
@@ -492,7 +1202,8 @@ double OH_Drawing_TypographyGetMaxIntrinsicWidth(OH_Drawing_Typography*);
* @brief Obtains the alphabetic baseline.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object.
+ * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
* @return Returns the alphabetic baseline.
* @since 9
* @version 1.1
@@ -503,13 +1214,1935 @@ double OH_Drawing_TypographyGetAlphabeticBaseline(OH_Drawing_Typography*);
* @brief Obtains the ideographic baseline.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
- * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object.
+ * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
* @return Returns the ideographic baseline.
* @since 9
* @version 1.1
*/
double OH_Drawing_TypographyGetIdeographicBaseline(OH_Drawing_Typography*);
+/**
+ * @brief Adds a placeholder.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyCreate Pointer to an OH_Drawing_TypographyCreate object. The pointer is obtained
+ * by calling {@link OH_Drawing_CreateTypographyHandler}.
+ * @param OH_Drawing_PlaceholderSpan Pointer to an OH_Drawing_PlaceholderSpan object.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_TypographyHandlerAddPlaceholder(OH_Drawing_TypographyCreate*, OH_Drawing_PlaceholderSpan*);
+
+/**
+ * @brief Checks whether the maximum number of lines is exceeded.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @return Returns true if the maximum number of lines is exceeded; returns false otherwise.
+ * @since 11
+ * @version 1.0
+ */
+bool OH_Drawing_TypographyDidExceedMaxLines(OH_Drawing_Typography*);
+
+/**
+ * @brief Obtains text boxes in a given range.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @param size_t Start position.
+ * @param size_t End position.
+ * @param OH_Drawing_RectHeightStyle Height style. For details about the available options,
+ * see {@link OH_Drawing_RectHeightStyle}.
+ * @param OH_Drawing_RectWidthStyle Width style. For details about the available options,
+ * see {@link OH_Drawing_RectWidthStyle}.
+ * @return Returns the {@link OH_Drawing_TextBox} struct that holds the text boxes.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange(OH_Drawing_Typography*,
+ size_t, size_t, OH_Drawing_RectHeightStyle, OH_Drawing_RectWidthStyle);
+
+/**
+ * @brief Obtains text boxes for placeholders.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @return Returns the {@link OH_Drawing_TextBox} struct that holds the text boxes.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders(OH_Drawing_Typography*);
+
+/**
+ * @brief Obtains the left position of a text box.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by calling
+ * {@link OH_Drawing_TypographyGetRectsForRange} or {@link OH_Drawing_TypographyGetRectsForPlaceholders}.
+ * @param int Index of the text box.
+ * @return Returns the left position.
+ * @since 11
+ * @version 1.0
+ */
+float OH_Drawing_GetLeftFromTextBox(OH_Drawing_TextBox*, int);
+
+/**
+ * @brief Obtains the right position of a text box.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by calling
+ * {@link OH_Drawing_TypographyGetRectsForRange} or {@link OH_Drawing_TypographyGetRectsForPlaceholders}.
+ * @param int Index of the text box.
+ * @return Returns the right position.
+ * @since 11
+ * @version 1.0
+ */
+float OH_Drawing_GetRightFromTextBox(OH_Drawing_TextBox*, int);
+
+/**
+ * @brief Obtains the top position of a text box.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by calling
+ * {@link OH_Drawing_TypographyGetRectsForRange} or {@link OH_Drawing_TypographyGetRectsForPlaceholders}.
+ * @param int Index of the text box.
+ * @return Returns the top position.
+ * @since 11
+ * @version 1.0
+ */
+float OH_Drawing_GetTopFromTextBox(OH_Drawing_TextBox*, int);
+
+/**
+ * @brief Obtains the bottom position of a text box.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by calling
+ * {@link OH_Drawing_TypographyGetRectsForRange} or {@link OH_Drawing_TypographyGetRectsForPlaceholders}.
+ * @param int Index of the text box.
+ * @return Returns the bottom position.
+ * @since 11
+ * @version 1.0
+ */
+float OH_Drawing_GetBottomFromTextBox(OH_Drawing_TextBox*, int);
+
+/**
+ * @brief Obtains the text direction of a text box.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by calling
+ * {@link OH_Drawing_TypographyGetRectsForRange} or {@link OH_Drawing_TypographyGetRectsForPlaceholders}.
+ * @param int Index of the text box.
+ * @return Returns the text direction.
+ * @since 11
+ * @version 1.0
+ */
+int OH_Drawing_GetTextDirectionFromTextBox(OH_Drawing_TextBox*, int);
+
+/**
+ * @brief Obtains the number of text boxes.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by calling
+ * {@link OH_Drawing_TypographyGetRectsForRange} or {@link OH_Drawing_TypographyGetRectsForPlaceholders}.
+ * @return Returns the number of text boxes.
+ * @since 11
+ * @version 1.0
+ */
+size_t OH_Drawing_GetSizeOfTextBox(OH_Drawing_TextBox*);
+
+/**
+ * @brief Obtains the position and affinity of the glyph at the given coordinates.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @param double X coordinate.
+ * @param double Y coordinate.
+ * @return Returns the {@link OH_Drawing_PositionAndAffinity} struct that holds the position and affinity of the glyph.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinate(OH_Drawing_Typography*,
+ double, double);
+
+/**
+ * @brief Obtains the position and affinity of the glyph cluster to which the glyph at the given coordinates belongs.
+ * The glyph cluster is a container that holds one or more glyphs.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @param double X coordinate.
+ * @param double Y coordinate.
+ * @return Returns the {@link OH_Drawing_PositionAndAffinity} struct that holds the position and affinity
+ * of the glyph cluster.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster(OH_Drawing_Typography*,
+ double, double);
+
+/**
+ * @brief Obtains the position attribute of an OH_Drawing_PositionAndAffinity object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_PositionAndAffinity Pointer to an OH_Drawing_PositionAndAffinity object,
+ * which is obtained by calling {@link OH_Drawing_TypographyGetGlyphPositionAtCoordinate} or
+ * {@link OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster}.
+ * @return Returns the position attribute.
+ * @since 11
+ * @version 1.0
+ */
+size_t OH_Drawing_GetPositionFromPositionAndAffinity(OH_Drawing_PositionAndAffinity*);
+
+/**
+ * @brief Obtains the affinity attribute of an OH_Drawing_PositionAndAffinity object.
+ * The affinity determines whether the font is close to the front text or rear text.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_PositionAndAffinity Pointer to an OH_Drawing_PositionAndAffinity object,
+ * which is obtained by calling {@link OH_Drawing_TypographyGetGlyphPositionAtCoordinate} or
+ * {@link OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster}.
+ * @return Returns the affinity attribute.
+ * @since 11
+ * @version 1.0
+ */
+int OH_Drawing_GetAffinityFromPositionAndAffinity(OH_Drawing_PositionAndAffinity*);
+
+/**
+ * @brief Obtains the word boundary.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @param size_t Index of the word.
+ * @return Returns the {@link OH_Drawing_Range} struct that holds the word boundary.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_Range* OH_Drawing_TypographyGetWordBoundary(OH_Drawing_Typography*, size_t);
+
+/**
+ * @brief Obtains the start position of an OH_Drawing_Range object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Range Pointer to an OH_Drawing_Range object, which is obtained by calling
+ * {@link OH_Drawing_TypographyGetWordBoundary}.
+ * @return Returns the start position.
+ * @since 11
+ * @version 1.0
+ */
+size_t OH_Drawing_GetStartFromRange(OH_Drawing_Range*);
+
+/**
+ * @brief Obtains the end position of an OH_Drawing_Range object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Range Pointer to an OH_Drawing_Range object, which is obtained by calling
+ * {@link OH_Drawing_TypographyGetWordBoundary}.
+ * @return Returns the end position.
+ * @since 11
+ * @version 1.0
+ */
+size_t OH_Drawing_GetEndFromRange(OH_Drawing_Range*);
+
+/**
+ * @brief Obtains the number of lines.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @return Returns the number of lines.
+ * @since 11
+ * @version 1.0
+ */
+size_t OH_Drawing_TypographyGetLineCount(OH_Drawing_Typography*);
+
+/**
+ * @brief Sets the text decoration style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param int Text decoration style. For details about the available options,
+ * see {@link OH_Drawing_TextDecorationStyle}.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_SetTextStyleDecorationStyle(OH_Drawing_TextStyle*, int);
+
+/**
+ * @brief Sets the thickness scale factor of the text decoration line.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param double Scale factor.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_SetTextStyleDecorationThicknessScale(OH_Drawing_TextStyle*, double);
+
+/**
+ * @brief Sets the letter spacing for a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param double Letter spacing.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_SetTextStyleLetterSpacing(OH_Drawing_TextStyle*, double);
+
+/**
+ * @brief Sets the word spacing for a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param double Letter spacing.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_SetTextStyleWordSpacing(OH_Drawing_TextStyle*, double);
+
+/**
+ * @brief Sets whether to enable half leading for a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param bool Whether to enable half leading. The value true means to enable half lading,
+ * and false means the opposite.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_SetTextStyleHalfLeading(OH_Drawing_TextStyle*, bool);
+
+/**
+ * @brief Sets the ellipsis content for a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param char* Pointer to the ellipsis content. The data type is a pointer pointing to char.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_SetTextStyleEllipsis(OH_Drawing_TextStyle*, const char*);
+
+/**
+ * @brief Sets the ellipsis style for a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param int Ellipsis style. For details about the available options, see {@link OH_Drawing_EllipsisModal}.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_SetTextStyleEllipsisModal(OH_Drawing_TextStyle*, int);
+
+/**
+ * @brief Sets the text break strategy.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param int Text break strategy. For details about the available options, see {@link OH_Drawing_BreakStrategy}.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextBreakStrategy(OH_Drawing_TypographyStyle*, int);
+
+/**
+ * @brief Sets the word break type.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param int Word break type. For details about the available options, see {@link OH_Drawing_WordBreakType}.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextWordBreakType(OH_Drawing_TypographyStyle*, int);
+
+/**
+ * @brief Sets the ellipsis style for text.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param int Ellipsis style. For details about the available options, see {@link OH_Drawing_EllipsisModal}.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextEllipsisModal(OH_Drawing_TypographyStyle*, int);
+
+/**
+ * @brief Sets the ellipsis style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param char Pinter to an ellipsis style.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextEllipsis(OH_Drawing_TypographyStyle* style, const char* ellipsis);
+
+/**
+ * @brief Obtains the height of a line.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @param int Target line.
+ * @return Returns the height.
+ * @since 11
+ * @version 1.0
+ */
+double OH_Drawing_TypographyGetLineHeight(OH_Drawing_Typography*, int);
+
+/**
+ * @brief Obtains the width of a line.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @param int Target line.
+ * @return Returns the width.
+ * @since 11
+ * @version 1.0
+ */
+double OH_Drawing_TypographyGetLineWidth(OH_Drawing_Typography*, int);
+
+/**
+ * @brief Sets the text split ratio.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param float Text split ratio.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextSplitRatio(OH_Drawing_TypographyStyle* style, float textSplitRatio);
+
+/**
+ * @brief Checks whether the maximum number of lines is limited.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns true if that the maximum number of lines is limited; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TypographyIsLineUnlimited(OH_Drawing_TypographyStyle* style);
+
+/**
+ * @brief Checks whether the text has an ellipsis.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns true if the text has an ellipsis; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TypographyIsEllipsized(OH_Drawing_TypographyStyle* style);
+
+/**
+ * @brief Sets the locale for a typography style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param char Pointer to the locale. For example, 'en' indicates English, 'zh-Hans' indicates Simplified
+ * Chinese, and 'zh-Hant' indicates Traditional Chinese.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextLocale(OH_Drawing_TypographyStyle* style, const char* locale);
+
+/**
+ * @brief Obtains the font metrics.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an {@link OH_Drawing_Typography} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypography}.
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTextStyle}.
+ * @param OH_Drawing_Font_Metrics Pointer to an {@link OH_Drawing_Font_Metrics} object, which is obtained by
+ * calling {@link OH_Drawing_Font_Metrics}.
+ * @return Returns true if the font metrics are obtained; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TextStyleGetFontMetrics(OH_Drawing_Typography*, OH_Drawing_TextStyle*, OH_Drawing_Font_Metrics*);
+
+/**
+ * @brief Sets the text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTextStyle}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextStyle(OH_Drawing_TypographyStyle*,OH_Drawing_TextStyle*);
+
+/**
+ * @brief Creates an OH_Drawing_FontDescriptor object to describe the detailed information about a system font.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the {@link OH_Drawing_FontDescriptor} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontDescriptor* OH_Drawing_CreateFontDescriptor(void);
+
+/**
+ * @brief Destroys an OH_Drawing_FontDescriptor object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontDescriptor Pointer to an {@link OH_Drawing_FontDescriptor} object, which is obtained by
+ * calling {@link OH_Drawing_CreateFontDescriptor}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_DestroyFontDescriptor(OH_Drawing_FontDescriptor*);
+
+/**
+ * @brief Creates an OH_Drawing_FontParser object to parse a system font.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the {@link OH_Drawing_FontParser} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontParser* OH_Drawing_CreateFontParser(void);
+
+/**
+ * @brief Destroys an OH_Drawing_FontParser object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontParser Pointer to an {@link OH_Drawing_FontParser} object, which is obtained by calling
+ * {@link OH_Drawing_CreateFontParser}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_DestroyFontParser(OH_Drawing_FontParser*);
+
+/**
+ * @brief Obtains the list of system fonts. This function can be used only on 2-in-1 devices.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontParser Pointer to an {@link OH_Drawing_FontParser} object, which is obtained by calling
+ * {@link OH_Drawing_CreateFontParser}.
+ * @param size_t Pointer to the number of system font names.
+ * @return Returns the system font list.
+ * @since 12
+ * @version 1.0
+ */
+char** OH_Drawing_FontParserGetSystemFontList(OH_Drawing_FontParser*, size_t*);
+
+/**
+ * @brief Reclaims the memory occupied by the system font list.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param char** Double pointer to the list of system font names.
+ * @param size_t* Number of system font names.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_DestroySystemFontList(char**, size_t);
+
+/**
+ * @brief Obtains information about a system font based on the font name.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontParser Pointer to an {@link OH_Drawing_FontParser} object, which is obtained by calling
+ * {@link OH_Drawing_CreateFontParser}.
+ * @param char* Pointer to the system font name.
+ * @return Returns the system font.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontDescriptor* OH_Drawing_FontParserGetFontByName(OH_Drawing_FontParser*, const char*);
+
+/**
+ * @brief Obtains the line metrics.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an {@link OH_Drawing_Typography} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @return Returns the pointer to the {@link OH_Drawing_LineMetrics} object.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetrics(OH_Drawing_Typography*);
+
+/**
+ * @brief Obtains the number of lines.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_LineMetrics Pointer to an {@link OH_Drawing_LineMetrics} object, which is obtained by calling
+ * {@link OH_Drawing_LineMetrics}.
+ * @return Returns the number of lines.
+ * @since 12
+ * @version 1.0
+ */
+size_t OH_Drawing_LineMetricsGetSize(OH_Drawing_LineMetrics*);
+
+/**
+ * @brief Destroys an OH_Drawing_LineMetrics object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_LineMetrics Pointer to an {@link OH_Drawing_LineMetrics} object, which is obtained by calling
+ * {@link OH_Drawing_LineMetrics}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_DestroyLineMetrics(OH_Drawing_LineMetrics*);
+
+/**
+ * @brief Obtains the metrics of a given line.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an {@link OH_Drawing_Typography} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @param int Line No.
+ * @param OH_Drawing_LineMetrics Pointer to an {@link OH_Drawing_LineMetrics} object, which is obtained by calling
+ * {@link OH_Drawing_LineMetrics}.
+ * @return Returns true if the metrics of the given line are obtained; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TypographyGetLineMetricsAt(OH_Drawing_Typography*, int, OH_Drawing_LineMetrics*);
+
+/**
+ * @brief Obtains the metrics of a given line or the metrics of the first character in a given line.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an {@link OH_Drawing_Typography} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @param int Line No.
+ * @param bool Whether to obtain the metrics of the entire line. The value true means to obtain the metrics of
+ * the entire line, and false means to obtain the metrics of the first character in the line.
+ * @param bool Whether whitespace characters are included in the text width. The value true means that
+ * whitespace characters are not included, false means the opposite.
+ * @param OH_Drawing_LineMetrics Pointer to an {@link OH_Drawing_LineMetrics} object, which is obtained by calling
+ * {@link OH_Drawing_LineMetrics}.
+ * @return Returns true if the metrics of the given line or the metrics of the first character in the given line
+ * is obtained; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TypographyGetLineInfo(OH_Drawing_Typography*, int, bool, bool, OH_Drawing_LineMetrics*);
+
+/**
+ * @brief Sets the font weight for text.
+ * Currently, only the default system font supports font weight adjustment.
+ * For other fonts, if the weight is less than semi-bold, there is no variation in stroke thickness.
+ * If the weight is greater than or equal to semi-bold, it might result in a fake bold effect.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param int Font weight.
+ * For details about the available options, see {@link OH_Drawing_FontWeight}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextFontWeight(OH_Drawing_TypographyStyle*, int);
+
+/**
+ * @brief Sets the font style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param int Font style. For details about the available options, see {@link OH_Drawing_FontStyle}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextFontStyle(OH_Drawing_TypographyStyle*, int);
+
+/**
+ * @brief Sets the font family name for text.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param char Pointer to the name of the font family.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextFontFamily(OH_Drawing_TypographyStyle*, const char*);
+
+/**
+ * @brief Sets the font size for text.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param double Font size, which must be greater than 0.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextFontSize(OH_Drawing_TypographyStyle*, double);
+
+/**
+ * @brief Sets the font height for text.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param double Font height.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextFontHeight(OH_Drawing_TypographyStyle*, double);
+
+/**
+ * @brief Sets whether half leading is used for text.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param bool Whether to enable half leading. The value true means to enable half lading,
+ * and false means the opposite.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextHalfLeading(OH_Drawing_TypographyStyle*, bool);
+
+/**
+ * @brief Sets whether to enable the text line style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param bool Whether to enable the text line style. The value true means to enable the text line style,
+ * and false means the opposite.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextUseLineStyle(OH_Drawing_TypographyStyle*, bool);
+
+/**
+ * @brief Sets the font weight for a text line style.
+ * Currently, only the default system font supports font weight adjustment.
+ * For other fonts, if the weight is less than semi-bold, there is no variation in stroke thickness.
+ * If the weight is greater than or equal to semi-bold, it might result in a fake bold effect.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param int Font weight.
+ * For details about the available options, see {@link OH_Drawing_FontWeight}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextLineStyleFontWeight(OH_Drawing_TypographyStyle*, int);
+
+/**
+ * @brief Sets the font style for a text line style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param int Font style. For details about the available options, see {@link OH_Drawing_FontStyle}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextLineStyleFontStyle(OH_Drawing_TypographyStyle*, int);
+
+/**
+ * @brief Sets the font families for a text line style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param int Number of font families.
+ * @param char Pointer to the font families.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextLineStyleFontFamilies(OH_Drawing_TypographyStyle*,
+ int, const char* fontFamilies[]);
+
+/**
+ * @brief Sets the font size for a text line style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param double Font size, which must be greater than 0.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextLineStyleFontSize(OH_Drawing_TypographyStyle*, double);
+
+/**
+ * @brief Sets the font height for a text line style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param double Font height.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextLineStyleFontHeight(OH_Drawing_TypographyStyle*, double);
+
+/**
+ * @brief Sets whether half leading is used for the text line style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param bool Whether to enable half leading. The value true means to enable half lading,
+ * and false means the opposite.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextLineStyleHalfLeading(OH_Drawing_TypographyStyle*, bool);
+
+/**
+ * @brief Sets the spacing scale factor for a text line style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param double Spacing ratio.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextLineStyleSpacingScale(OH_Drawing_TypographyStyle*, double);
+
+/**
+ * @brief Sets whether to enable the text line style only.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param bool Whether to enable the text line style only. The value true means to enable the text line style
+ * only, and false means the opposite.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextLineStyleOnly(OH_Drawing_TypographyStyle*, bool);
+
+/**
+ * @brief Creates an OH_Drawing_TextShadow object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the OH_Drawing_TextShadow object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_TextShadow* OH_Drawing_CreateTextShadow(void);
+
+/**
+ * @brief Destroys an OH_Drawing_TextShadow object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextShadow Pointer to an {@link OH_Drawing_TextShadow} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextShadow}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_DestroyTextShadow(OH_Drawing_TextShadow*);
+
+/**
+ * @brief Obtains a text shadow container.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @return Returns the pointer to the {@link OH_Drawing_TextShadow} object.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadows(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Obtains the size of a text shadow container.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @return Returns the size.
+ * @since 12
+ * @version 1.0
+ */
+int OH_Drawing_TextStyleGetShadowCount(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Adds a shadow to a text shadow container.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param OH_Drawing_TextShadow Pointer to an {@link OH_Drawing_TextShadow} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextShadow}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TextStyleAddShadow(OH_Drawing_TextStyle*, const OH_Drawing_TextShadow*);
+
+/**
+ * @brief Clears all shadows in a text shadow container.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TextStyleClearShadows(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Obtains a shadow with a given index in a text shadow container.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param int Index.
+ * @return Returns the pointer to the {@link OH_Drawing_TextShadow} object.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadowWithIndex(OH_Drawing_TextStyle*, int);
+
+/**
+ * @brief Sets indents for typography. If this function is not called, texts will have no indentation applied.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an {@link OH_Drawing_Typography} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @param int Number of indents. The value must be less than or equal to the length of the indents array to
+ * avoid display exceptions caused by access to the out-of-bounds array.
+ * @param float Pointer to a floating-point array, in which each element indicates an indentation width, in px.
+ * Before using {@link OH_Drawing_Typography}, you must declare and initialize the floating-point array.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TypographySetIndents(OH_Drawing_Typography*, int, const float indents[]);
+
+/**
+ * @brief Obtains indents with a given index.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an {@link OH_Drawing_Typography} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @param int Index.
+ * @return Returns the indents.
+ * @since 12
+ * @version 1.0
+ */
+float OH_Drawing_TypographyGetIndentsWithIndex(OH_Drawing_Typography*, int);
+
+/**
+ * @brief Obtains the line bounds.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an {@link OH_Drawing_Typography} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @param int Row index.
+ * @param bool Whether the returned bounds contain spaces. The value true means that the bounds contain spaces,
+ * and false means the opposite.
+ * @return Returns the pointer to the {@link OH_Drawing_Range} object.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Range* OH_Drawing_TypographyGetLineTextRange(OH_Drawing_Typography*, int, bool);
+
+/**
+ * @brief Reclaims the memory occupied by the vector consisting of the OH_Drawing_TextShadow objects.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextShadow Pointer to an {@link OH_Drawing_TextShadow} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextShadow}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_DestroyTextShadows(OH_Drawing_TextShadow*);
+
+/**
+ * @brief Obtains the system font configuration.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontConfigJsonInfoCode Pointer to the error code.
+ * For details about the available options, see {@link OH_Drawing_FontConfigInfoErrorCode}.
+ * @return Returns the pointer to the system font configuration.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontConfigInfo* OH_Drawing_GetSystemFontConfigInfo(OH_Drawing_FontConfigInfoErrorCode*);
+
+/**
+ * @brief Reclaims the memory occupied by the system font configuration.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontConfigInfo Pointer to an {@link OH_Drawing_FontConfigInfo} object,
+ * which is obtained by calling {@link OH_Drawing_GetSystemFontConfigInfo}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_DestroySystemFontConfigInfo(OH_Drawing_FontConfigInfo*);
+
+/**
+ * @brief Sets the font style, including the font weight, width, and slant, for a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param OH_Drawing_FontStyleStruct Font style, including the font weight, width, and slant.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTextStyleFontStyleStruct(OH_Drawing_TextStyle* drawingTextStyle,
+ OH_Drawing_FontStyleStruct fontStyle);
+
+/**
+ * @brief Obtains the font style, including the font weight, width, and slant, of a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @return Returns the font style, including the font weight, width, and slant.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontStyleStruct OH_Drawing_TextStyleGetFontStyleStruct(OH_Drawing_TextStyle* drawingTextStyle);
+
+/**
+ * @brief Sets the font style, including the font weight, width, and slant, for a typography style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param OH_Drawing_FontStyleStruct Font style, including the font weight, width, and slant.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyStyleFontStyleStruct(OH_Drawing_TypographyStyle* drawingStyle,
+ OH_Drawing_FontStyleStruct fontStyle);
+
+/**
+ * @brief Obtains the font style, including the font weight, width, and slant, of a typography style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns the font style, including the font weight, width, and slant.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontStyleStruct OH_Drawing_TypographyStyleGetFontStyleStruct(OH_Drawing_TypographyStyle* drawingStyle);
+
+/**
+ * @brief Sets a background rectangle and style ID for a text style.
+ * The style ID is valid only when the background box is a rounded rectangle.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param OH_Drawing_RectStyle_Info Pointer to an {@link OH_Drawing_RectStyle_Info} object.
+ * @param int Style ID. The style ID is valid only when the background box is a rounded rectangle.
+ * Text processing is divided into multiple segments. Each segment has its own text style.
+ * id indicates the sequence number of the background box in which the segment is drawn.
+ * If the ID of each segment in a row is 0, all segments are drawn in the same background box.
+ * If the IDs in a row are 0 and 1, the segment whose ID is 0 is drawn in a background box, the segment
+ * whose ID is 1 is drawn in another background box. Other cases can be deduced in the same way.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TextStyleSetBackgroundRect(OH_Drawing_TextStyle*, const OH_Drawing_RectStyle_Info*, int styleId);
+
+/**
+ * @brief Adds the symbol to use in the typography creation process.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyCreate Pointer to an OH_Drawing_TypographyCreate object.
+ * The pointer is obtained by calling {@link OH_Drawing_CreateTypographyHandler}.
+ * @param uint32_t Symbol. For details about the supported symbols, see the value in the JSON file.
+ * https://gitee.com/openharmony/global_system_resources/blob/master/systemres/main/resources/base/element/symbol.json
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TypographyHandlerAddSymbol(OH_Drawing_TypographyCreate*, uint32_t symbol);
+
+/**
+ * @brief Adds a font feature for a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param char Pointer to the string identified by the keyword in the font feature key-value pair.
+ * @param int Value of the font feature key-value pair.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TextStyleAddFontFeature(OH_Drawing_TextStyle*, const char* tag, int value);
+
+/**
+ * @brief Adds a font variation.
+ * This function takes effect only when the corresponding font file (.ttf file) supports variable adjustment.
+ * Otherwise, calling this function does not take effect.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param char* Pointer to the key in the font variation key-value pair.
+ * Currently, only 'wght' is supported, indicating the font weight.
+ * @param float Value of the font variation key-value pair.
+ * Currently, the value range of 'wght' for the default font is \[0,900\].
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TextStyleAddFontVariation(OH_Drawing_TextStyle*, const char* /* axis */, const float /* value */);
+
+/**
+ * @brief Obtains all the contents in a font feature map container.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @return Returns the pointer to the OH_Drawing_FontFeature struct, which stores all the contents obtained.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontFeature* OH_Drawing_TextStyleGetFontFeatures(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Reclaims the memory occupied by the struct array that holds all the font features.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontFeature Pointer to the struct array that holds all the font features. The pointer is obtained
+ * by calling {@link OH_Drawing_TextStyleGetFontFeatures}.
+ * @param fontFeatureSize Size of the struct array that holds all the font features.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TextStyleDestroyFontFeatures(OH_Drawing_FontFeature*, size_t fontFeatureSize);
+
+/**
+ * @brief Obtains the size of a font feature map container.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @return Returns the size.
+ * @since 12
+ * @version 1.0
+ */
+size_t OH_Drawing_TextStyleGetFontFeatureSize(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Clears all the contents in a font feature map container.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TextStyleClearFontFeature(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Obtains the baseline drift of a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @return Returns the baseline drift.
+ * @since 12
+ * @version 1.0
+ */
+double OH_Drawing_TextStyleGetBaselineShift(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Sets a baseline drift for a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param double Baseline drift of the text style.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TextStyleSetBaselineShift(OH_Drawing_TextStyle*, double lineShift);
+
+/**
+ * @brief Sets a text height modifier pattern.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param heightMode Text height modifier pattern.
+ * For details about the available options, see {@link OH_Drawing_TextHeightBehavior}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TypographyTextSetHeightBehavior(OH_Drawing_TypographyStyle*, OH_Drawing_TextHeightBehavior heightMode);
+
+/**
+ * @brief Obtains the text height modifier pattern.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns the text height modifier pattern.
+ * For details about the available options, see {@link OH_Drawing_TextHeightBehavior}.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_TextHeightBehavior OH_Drawing_TypographyTextGetHeightBehavior(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Obtains all font metrics from a given line.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an {@link OH_Drawing_Typography} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @param lineNumber Line number, which is an integer. The minimum value is 1, and the maximum value depends on
+ * the number of lines parsed by the font engine after text input.
+ * If a value greater than the maximum number is passed in, an error value is returned and an error message is printed.
+ * @param fontMetricsSize Pointer to the size of the struct.
+ * @return Returns all the font metrics.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Font_Metrics* OH_Drawing_TypographyGetLineFontMetrics(OH_Drawing_Typography*,
+ size_t lineNumber, size_t* fontMetricsSize);
+
+/**
+ * @brief Reclaims the memory occupied by the struct array that holds all the font metrics of a given line.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font_Metrics Pointer to the first address of the struct array.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TypographyDestroyLineFontMetrics(OH_Drawing_Font_Metrics*);
+
+/**
+ * @brief Checks whether two text styles are equal.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param style Pointer to the first text style.
+ * @param comparedStyle Pointer to the second text style.
+ * @return Returns true if the two are equal; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TextStyleIsEqual(const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle);
+
+/**
+ * @brief Checks whether the font style properties of two text styles are equal.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param style Pointer to the first text style.
+ * @param comparedStyle Pointer to the second text style.
+ * @return Returns true if the two are equal; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TextStyleIsEqualByFont(const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle);
+
+/**
+ * @brief Checks whether two text styles have the same text style type.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param style Pointer to the first text style.
+ * @param comparedStyle Pointer to the second text style.
+ * @param textStyleType Text style type. For details about the available options, see {@link OH_Drawing_TextStyleType}.
+ * @return Returns true if the two are the same; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TextStyleIsAttributeMatched(const OH_Drawing_TextStyle* style,
+ const OH_Drawing_TextStyle* comparedStyle, OH_Drawing_TextStyleType textStyleType);
+
+/**
+ * @brief Adds a placeholder.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TextStyleSetPlaceholder(OH_Drawing_TextStyle* style);
+
+/**
+ * @brief Checks whether a placeholder is set for a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @return Returns true if a placeholder is set; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TextStyleIsPlaceholder(OH_Drawing_TextStyle* style);
+
+/**
+ * @brief Obtains the text alignment mode.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns the text alignment mode. For details about the available options, see {@link OH_Drawing_TextAlign}.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_TextAlign OH_Drawing_TypographyStyleGetEffectiveAlignment(OH_Drawing_TypographyStyle* style);
+
+/**
+ * @brief Checks whether font hinting is enabled for a typography style. Font hinting is used to improve the readability
+ * and appearance of small-sized text when rendering it.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns true if font hinting is enabled; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TypographyStyleIsHintEnabled(OH_Drawing_TypographyStyle* style);
+
+/**
+ * @brief Sets the strut style for a typography style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param OH_Drawing_StrutStyle Pointer to an {@link OH_Drawing_StrutStyle} object, which is obtained by calling
+ * {@link OH_Drawing_TypographyStyleGetStrutStyle}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyStyleTextStrutStyle(OH_Drawing_TypographyStyle*, OH_Drawing_StrutStyle*);
+
+/**
+ * @brief Obtains the strut style of a typography style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns the pointer to the {@link OH_Drawing_StrutStyle} object obtained.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_StrutStyle* OH_Drawing_TypographyStyleGetStrutStyle(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Reclaims the memory occupied by a strut style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_StrutStyle Pointer to an {@link OH_Drawing_StrutStyle} object, which is obtained by calling
+ * {@link OH_Drawing_TypographyStyleGetStrutStyle}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TypographyStyleDestroyStrutStyle(OH_Drawing_StrutStyle*);
+
+/**
+ * @brief Checks whether two strut styles are equal.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param from Pointer to the first strut style.
+ * @param to Pointer to the second strut style.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TypographyStyleStrutStyleEquals(OH_Drawing_StrutStyle* from, OH_Drawing_StrutStyle* to);
+
+/**
+ * @brief Sets whether to enable font hinting for a typography style. Font hinting is used to improve the readability
+ * and appearance of small-sized text when rendering it.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @param hintsEnabled Whether to enable font hinting. The value true means to enable font hinting,
+ * and false means the opposite.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TypographyStyleSetHintsEnabled(OH_Drawing_TypographyStyle* style, bool hintsEnabled);
+
+/**
+ * @brief Marks a typography object as dirty data. This function is used to initialize the typography state.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an {@link OH_Drawing_Typography} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TypographyMarkDirty(OH_Drawing_Typography*);
+
+/**
+ * @brief Obtains the number of unresolved glyphs in a typography object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an {@link OH_Drawing_Typography} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @return Returns the number of unresolved glyphs.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_Drawing_TypographyGetUnresolvedGlyphsCount(OH_Drawing_Typography*);
+
+/**
+ * @brief Updates the font size in a typography object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Pointer to an {@link OH_Drawing_Typography} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTypography}.
+ * @param from Original font size.
+ * @param to New font size.
+ * @param fontSize Font size.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TypographyUpdateFontSize(OH_Drawing_Typography*, size_t from, size_t to, float fontSize);
+
+/**
+ * @brief Checks whether the text line style is enabled for a typography style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns true if the text line style is enabled; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TypographyTextGetLineStyle(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Obtains the font weight of a text line style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns the font weight.
+ *
+ * For details about the available options, see {@link OH_Drawing_FontWeight}.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontWeight OH_Drawing_TypographyTextlineStyleGetFontWeight(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Obtains the font style of a text line style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns the font style. For details about the available options, see {@link OH_Drawing_FontStyle}.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontStyle OH_Drawing_TypographyTextlineStyleGetFontStyle(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Obtains the font families of a text line style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns the font families.
+ * @since 12
+ * @version 1.0
+ */
+char** OH_Drawing_TypographyTextlineStyleGetFontFamilies(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Reclaims the memory occupied by the font families.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param fontFamilies Double pointer to the font families.
+ * @param fontFamiliesNum Number of font families.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TypographyTextlineStyleDestroyFontFamilies(char** fontFamilies, size_t fontFamiliesNum);
+
+/**
+ * @brief Obtains the font size of a text line style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns the font size.
+ * @since 12
+ * @version 1.0
+ */
+double OH_Drawing_TypographyTextlineStyleGetFontSize(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Obtains the height scale factor of a text line style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns the font height scale factor.
+ * @since 12
+ * @version 1.0
+ */
+double OH_Drawing_TypographyTextlineStyleGetHeightScale(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Checks whether only the font height is used for a text line style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns true if only the font height is used; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TypographyTextlineStyleGetHeightOnly(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Checks whether half leading is enabled for a text line style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns true if half leading is enabled; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TypographyTextlineStyleGetHalfLeading(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Obtains the spacing scale factor of a text line style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns the spacing scale factor.
+ * @since 12
+ * @version 1.0
+ */
+double OH_Drawing_TypographyTextlineStyleGetSpacingScale(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Checks whether only the text line style is enabled for a typography style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns true if only the text line style is enabled; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TypographyTextlineGetStyleOnly(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Obtains the text alignment mode.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns the text alignment mode.
+ * For details about the available options, see {@link OH_Drawing_TextAlign}.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_TextAlign OH_Drawing_TypographyGetTextAlign(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Obtains the text direction.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns the text direction. For details about the available options, see {@link OH_Drawing_TextDirection}.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_TextDirection OH_Drawing_TypographyGetTextDirection(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Obtains the maximum number of lines in the text.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns the maximum number of lines.
+ * @since 12
+ * @version 1.0
+ */
+size_t OH_Drawing_TypographyGetTextMaxLines(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Obtains the text ellipsis content.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by
+ * calling {@link OH_Drawing_CreateTypographyStyle}.
+ * @return Returns the pointer to the text ellipsis content obtained.
+ * @since 12
+ * @version 1.0
+ */
+char* OH_Drawing_TypographyGetTextEllipsis(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Reclaims the memory occupied by the text ellipsis names.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param ellipsis Pointer to the text ellipsis names.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TypographyDestroyEllipsis(char* ellipsis);
+
+/**
+ * @brief Checks whether two typography styles are the same.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param from Pointer to the first typography style.
+ * @param to Pointer to the second typography style.
+ * @return Returns true if the two are the same; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TypographyStyleEquals(OH_Drawing_TypographyStyle* from, OH_Drawing_TypographyStyle* to);
+
+/**
+ * @brief Obtains the color of a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @return Returns the text color.
+ * @since 12
+ * @version 1.0
+ */
+uint32_t OH_Drawing_TextStyleGetColor(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Obtains the decoration style of a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @return Returns the text decoration style.
+ * For details about the available options, see {@link OH_Drawing_TextDecorationStyle}.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_TextDecorationStyle OH_Drawing_TextStyleGetDecorationStyle(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Obtains the font weight of a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @return Returns the word weight. For details about the available options, see {@link OH_Drawing_FontWeight}.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontWeight OH_Drawing_TextStyleGetFontWeight(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Obtains the font style of a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @return Returns the font style. For details about the available options, see {@link OH_Drawing_FontStyle}.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontStyle OH_Drawing_TextStyleGetFontStyle(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Obtains the baseline of a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @return Returns the text baseline. For details about the available options, see {@link OH_Drawing_TextBaseline}.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_TextBaseline OH_Drawing_TextStyleGetBaseline(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Obtains the font families of a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @param size_t Pointer to the number of font families.
+ * @return Returns the font families.
+ * @since 12
+ * @version 1.0
+ */
+char** OH_Drawing_TextStyleGetFontFamilies(OH_Drawing_TextStyle*, size_t* num);
+
+/**
+ * @brief Reclaims the memory occupied by the font families.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param char** Double pointer to the font families.
+ * @param size_t Number of font families.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TextStyleDestroyFontFamilies(char** fontFamilies, size_t num);
+
+/**
+ * @brief Obtains the font size of a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @return Returns the font size.
+ * @since 12
+ * @version 1.0
+ */
+double OH_Drawing_TextStyleGetFontSize(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Obtains the letter spacing of a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @return Returns the letter spacing.
+ * @since 12
+ * @version 1.0
+ */
+double OH_Drawing_TextStyleGetLetterSpacing(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Obtains the word spacing of a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @return Returns the word spacing.
+ * @since 12
+ * @version 1.0
+ */
+double OH_Drawing_TextStyleGetWordSpacing(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Obtains the font height of a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @return Returns the font height.
+ * @since 12
+ * @version 1.0
+ */
+double OH_Drawing_TextStyleGetFontHeight(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Checks whether half leading is enabled for a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @return Returns true if half leading is enabled; returns false otherwise.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TextStyleGetHalfLeading(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Obtains the locale of a text style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextStyle}.
+ * @return Returns the pointer to the locale, in the format of language-country.
+ * For example, zh-CN indicates Chinese (China), and en-US indicates English (United States). For details, see BCP 47.
+ * @since 12
+ * @version 1.0
+ */
+const char* OH_Drawing_TextStyleGetLocale(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Release the memory occupied by a text box.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextBox Pointer to an {@link OH_Drawing_TextBox} object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TypographyDestroyTextBox(OH_Drawing_TextBox*);
+
+/**
+ * @brief Sets a text shadow.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextShadow Pointer to an {@link OH_Drawing_TextShadow} object, which is obtained by calling
+ * {@link OH_Drawing_CreateTextShadow}.
+ * @param color Color of the text shadow. For example, if the input parameter is 0xAABBCCDD, AA indicates opacity,
+ * BB indicates the value of the red component, CC indicates the value of the green component,
+ * and DD indicates the value of the blue component.
+ * @param OH_Drawing_Point Pointer to an {@link OH_Drawing_Point} object, which is the position of the text shadow
+ * relative to the text.
+ * @param blurRadius Blur radius. The value is a floating point number and has no unit.
+ * The value 0.0 means that there is no blur effect.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTextShadow(OH_Drawing_TextShadow* shadow, uint32_t color, OH_Drawing_Point* offset,
+ double blurRadius);
+
+/**
+ * @brief Creates a pointer to an {@link OH_Drawing_LineTypography} object, which stores the text content and style
+ * can be used to compute typography details for individual lines of text.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param handler Pointer to an {@link OH_Drawing_TypographyCreate} object.
+ * The pointer is obtained by calling {@link OH_Drawing_CreateTypographyHandler}.
+ * @return Returns a pointer to an {@link OH_Drawing_LineTypography} object.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_LineTypography* OH_Drawing_CreateLineTypography(OH_Drawing_TypographyCreate* handler);
+
+/**
+ * @brief Releases the memory occupied by an {@link OH_Drawing_LineTypography} object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param lineTypography Pointer to an {@link OH_Drawing_LineTypography} object, which is obtained by calling
+ * {@link OH_Drawing_CreateLineTypography}.
+ * @since 14
+ * @version 1.0
+ */
+void OH_Drawing_DestroyLineTypography(OH_Drawing_LineTypography* lineTypography);
+
+/**
+ * @brief Obtains the number of characters that can fit in the layout from the specified position
+ * within a limited layout width.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param lineTypography Pointer to an {@link OH_Drawing_LineTypography} object, which is obtained by calling
+ * {@link OH_Drawing_CreateLineTypography}.
+ * @param startIndex Start position (inclusive) for layout calculation.
+ * The value must be an integer in the range [0, total number of text characters].
+ * @param width Layout width. The value is a floating point number greater than 0, in px.
+ * @return Returns the number of characters.
+ * @since 14
+ * @version 1.0
+ */
+size_t OH_Drawing_LineTypographyGetLineBreak(OH_Drawing_LineTypography* lineTypography,
+ size_t startIndex, double width);
+
+/**
+ * @brief Creates a pointer to an {@link OH_Drawing_TextLine} object based on the text content in a specified range.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param lineTypography Pointer to an {@link OH_Drawing_LineTypography} object, which is obtained by calling
+ * {@link OH_Drawing_CreateLineTypography}.
+ * @param startIndex Start position for layout calculation.
+ * The value is an integer in the range [0, total number of text characters).
+ * @param count Number of characters from the specified start position.
+ * The value is an integer in the range [0, total number of text characters).
+ * The sum of startIndex and count cannot be greater than the total number of text characters.
+ * You can use {@link OH_Drawing_LineTypographyGetLineBreak} to obtain the number of characters
+ * that can fit in the layout. If the value is set to 0, a null pointer is returned.
+ * @return Returns the pointer to the {@link OH_Drawing_TextLine} object created.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_TextLine* OH_Drawing_LineTypographyCreateLine(OH_Drawing_LineTypography* lineTypography,
+ size_t startIndex, size_t count);
+
+/**
+ * @brief Creates a text tab object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param alignment Alignment mode of the text following the tab character. The value 1 means right alignment,
+ * 2 means center alignment, and 0 or other values mean left alignment.
+ * @param float Alignment position of the text following the tab character. The unit is px. The minimum value is 1.0.
+ * @return Returns the pointer to the OH_Drawing_TextTab object created.
+ * If a null pointer is returned, the creation fails. A possible cause is that no memory is available.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_TextTab* OH_Drawing_CreateTextTab(OH_Drawing_TextAlign alignment, float location);
+
+/**
+ * @brief Releases the memory occupied by a text tab object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextTab Pointer to an OH_Drawing_TextTab object.
+ * @since 14
+ * @version 1.0
+ */
+void OH_Drawing_DestroyTextTab(OH_Drawing_TextTab*);
+
+/**
+ * @brief Obtains the alignment mode of a text tab.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextTab Pointer to an OH_Drawing_TextTab object.
+ * @return Returns the text alignment mode. The value 1 means right alignment, 2 means center alignment,
+ * and 0 or other values mean left alignment.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_TextAlign OH_Drawing_GetTextTabAlignment(OH_Drawing_TextTab*);
+
+/**
+ * @brief Obtains the location of a text tab.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextTab Pointer to an OH_Drawing_TextTab object.
+ * @return Returns the position of the text tab.
+ * @since 14
+ * @version 1.0
+ */
+float OH_Drawing_GetTextTabLocation(OH_Drawing_TextTab*);
+
+/**
+ * @brief Sets the alignment mode and location of a text tab. When the text alignment mode or ellipsis style is set,
+ * the tab does not take effect. When the tab location is less than 1.0, the tab is replaced with a space.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object.
+ * @param OH_Drawing_TextTab Pointer to an OH_Drawing_TextTab object.
+ * @since 14
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextTab(OH_Drawing_TypographyStyle*, OH_Drawing_TextTab* TextTab);
+
+/**
+ * @brief Obtains the number of objects in an {@link OH_Drawing_Array}.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param drawingArray Pointer to an {@link OH_Drawing_Array}.
+ * @return Returns the number of objects in the array.
+ * @since 14
+ * @version 1.0
+ */
+size_t OH_Drawing_GetDrawingArraySize(OH_Drawing_Array* drawingArray);
#ifdef __cplusplus
}
#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_typeface.h b/en/native_sdk/graphic/native_drawing/drawing_typeface.h
new file mode 100644
index 0000000000000000000000000000000000000000..a73507a7b27d2ecd129358b6f999d607b1c0c68d
--- /dev/null
+++ b/en/native_sdk/graphic/native_drawing/drawing_typeface.h
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_TYPEFACE_H
+#define C_INCLUDE_DRAWING_TYPEFACE_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_typeface.h
+ *
+ * @brief Declares the functions related to the typeface in the drawing module.
+ * Different platforms have their own default typefaces. You can also parse the .ttf file to obtain the typefaces
+ * specified by the third party, such as SimSun and SimHei.
+ *
+ * File to include: native_drawing/drawing_typeface.h
+ * @library libnative_drawing.so
+ * @since 11
+ * @version 1.0
+ */
+
+#include "drawing_error_code.h"
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates an OH_Drawing_Typeface object, which defines the default font.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the OH_Drawing_Typeface object created.
+ * @since 11
+ * @version 1.0
+ */
+OH_Drawing_Typeface* OH_Drawing_TypefaceCreateDefault(void);
+
+/**
+ * @brief Creates an OH_Drawing_Typeface object through a file.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If path is NULL, {@link OH_DRAWING_ERROR_INVALID_PARAMETER} is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Pointer to the file path.
+ * @param index File index.
+ * @return Returns the pointer to the {@link OH_Drawing_Typeface} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFile(const char* path, int index);
+
+/**
+ * @brief Creates an OH_Drawing_Typeface object with font arguments through a file.
+ * If the OH_Drawing_Typeface object does not support the variation described in the font arguments,
+ * this function creates an OH_Drawing_Typeface object with the default font arguments.
+ * In this case, this function provides the same capability as {@link OH_Drawing_TypefaceCreateFromFile}.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Pointer to the file path.
+ * @param fontArguments Pointer to an {@link OH_Drawing_FontArguments} object.
+ * @return Returns the pointer to the {@link OH_Drawing_Typeface} object created.
+ * If a null pointer is returned, the creation fails. Possible causes are that no memory is available,
+ * the passed-in path or fontArguments is NULL, or the path is invalid.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFileWithArguments(const char* path,
+ const OH_Drawing_FontArguments* fontArguments);
+
+/**
+ * @brief Creates an OH_Drawing_Typeface object with font arguments based on an existing
+ * OH_Drawing_Typeface object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param current Pointer to an existing {@link OH_Drawing_Typeface} object.
+ * @param fontArguments Pointer to an {@link OH_Drawing_FontArguments} object.
+ * @return Returns the pointer to the {@link OH_Drawing_Typeface} object created.
+ * If a null pointer is returned, the creation fails. Possible causes are that no memory is available,
+ * the passed-in path or fontArguments is null, or the existing OH_Drawing_FontArguments object
+ * does not support the variation described in the font arguments.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromCurrent(const OH_Drawing_Typeface* current,
+ const OH_Drawing_FontArguments* fontArguments);
+
+/**
+ * @brief Creates an OH_Drawing_Typeface object through a memory stream.
+ * If the memory stream is an invalid font file, a null pointer is returned.
+ * After the memory stream is passed in, the ownership is transferred and you cannot release it.
+ *
+ * Error codes may be generated in the call. You can view the error code by calling {@link OH_Drawing_ErrorCodeGet}.
+ * If OH_Drawing_MemoryStream is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_MemoryStream Pointer to an {@link OH_Drawing_MemoryStream} object.
+ * @param index Index of the memory stream.
+ * @return Returns the pointer to the {@link OH_Drawing_Typeface} object created.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromStream(OH_Drawing_MemoryStream*, int32_t index);
+
+/**
+ * @brief Destroys an OH_Drawing_Typeface object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typeface Pointer to an OH_Drawing_Typeface object.
+ * @since 11
+ * @version 1.0
+ */
+void OH_Drawing_TypefaceDestroy(OH_Drawing_Typeface*);
+
+/**
+ * @brief Creates an OH_Drawing_FontArguments object.
+ * The font arguments are used to create an OH_Drawing_Typeface object with custom attributes.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the OH_Drawing_FontArguments object created.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_FontArguments* OH_Drawing_FontArgumentsCreate(void);
+
+/**
+ * @brief Adds a variation to an OH_Drawing_FontArguments object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param fontArguments Pointer to an {@link OH_Drawing_FontArguments} object.
+ * @param axis Pointer to the label of the variation. The value must contain four ASCII characters.
+ * The supported labels depend on the loaded font file. For example, 'wght' is the font weight label.
+ * @param value Value of the variation label.
+ * @return Returns either of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if either fontArguments or axis is NULL
+ * or the length of axis is not 4.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_FontArgumentsAddVariation(OH_Drawing_FontArguments* fontArguments,
+ const char* axis, float value);
+
+/**
+ * @brief Destroys an OH_Drawing_FontArguments object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param fontArguments Pointer to an {@link OH_Drawing_FontArguments} object.
+ * @return Returns either of the following result codes:
+ * OH_DRAWING_SUCCESS if the operation is successful.
+ * OH_DRAWING_ERROR_INVALID_PARAMETER if fontArguments is NULL.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_FontArgumentsDestroy(OH_Drawing_FontArguments* fontArguments);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_drawing/drawing_types.h b/en/native_sdk/graphic/native_drawing/drawing_types.h
index 24280237a3c15b42200a00c7afb2a0dc0efc4ed0..e331e8ad4df38985c7f2fb5fd8b65e7223869d3d 100644
--- a/en/native_sdk/graphic/native_drawing/drawing_types.h
+++ b/en/native_sdk/graphic/native_drawing/drawing_types.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
+ * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -20,8 +20,9 @@
* @addtogroup Drawing
* @{
*
- * @brief Provides functions such as 2D graphics rendering, text drawing, and image display.
- *
+ * @brief Provides the functions for 2D graphics rendering, text drawing, and image display.
+ * This module uses the physical pixel unit, px.
+ *
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
*
* @since 8
@@ -31,8 +32,10 @@
/**
* @file drawing_types.h
*
- * @brief Declares the data types for drawing 2D graphics, including the canvas, brush, pen, bitmap, and path.
+ * @brief Declares the data types of the canvas, brush, pen, bitmap, and path used to draw 2D graphics.
*
+ * File to include: native_drawing/drawing_types.h
+ * @library libnative_drawing.so
* @since 8
* @version 1.0
*/
@@ -44,73 +47,316 @@ extern "C" {
#endif
/**
- * @brief Defines a rectangular canvas on which various shapes, images, and texts can be drawn by using the brush and pen.
- *
+ * @brief Defines a struct for a rectangular canvas on which various shapes, images, and texts can be drawn
+ * by using the brush and pen.
+ *
* @since 8
* @version 1.0
*/
typedef struct OH_Drawing_Canvas OH_Drawing_Canvas;
/**
- * @brief Defines a pen, which is used to describe the style and color to outline a shape.
- *
+ * @brief Defines a struct for a pen, which is used to describe the style and color to outline a shape.
+ *
* @since 8
* @version 1.0
*/
typedef struct OH_Drawing_Pen OH_Drawing_Pen;
/**
- * @brief Defines as a brush, which is used to describe the style and color to fill in a shape.
- *
+ * @brief Defines a struct for a region, which represents a closed area on the canvas for more accurate graphic control.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_Region OH_Drawing_Region;
+
+/**
+ * @brief Defines a struct for a brush, which is used to describe the style and color to fill in a shape.
+ *
* @since 8
* @version 1.0
*/
typedef struct OH_Drawing_Brush OH_Drawing_Brush;
/**
- * @brief Defines a path, which is used to customize various shapes.
- *
+ * @brief Defines a struct for a path, which is used to customize various shapes.
+ *
* @since 8
* @version 1.0
*/
typedef struct OH_Drawing_Path OH_Drawing_Path;
/**
- * @brief Defines a bitmap, which is a memory that contains the pixel data of a shape.
- *
+ * @brief Defines a struct for a pixel map, which is used to wrap the real pixel map supported by the image framework.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_PixelMap OH_Drawing_PixelMap;
+
+/**
+ * @brief Defines a struct for a bitmap, which is a memory area that contains the pixel data of a shape.
+ *
* @since 8
* @version 1.0
*/
typedef struct OH_Drawing_Bitmap OH_Drawing_Bitmap;
/**
- * @brief Enumerates storage formats of bitmap pixels.
+ * @brief Defines a struct for a coordinate point.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct OH_Drawing_Point OH_Drawing_Point;
+
+/**
+ * @brief Defines a struct for a color space, which is used to describe the color information.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_ColorSpace OH_Drawing_ColorSpace;
+
+/**
+ * @brief Defines a struct for a two-dimensional coordinate point.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_Point2D {
+ /** X-coordinate. */
+ float x;
+ /** Y-coordinate. */
+ float y;
+} OH_Drawing_Point2D;
+
+/**
+ * @brief Defines a struct for the radii of a rounded corner.
+ * The radii consist of the radius in the x-axis direction and that in the y-axis direction.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef OH_Drawing_Point2D OH_Drawing_Corner_Radii;
+
+/**
+ * @brief Defines a struct for a three-dimensional coordinate point.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_Point3D {
+ /** X-coordinate. */
+ float x;
+ /** Y-coordinate. */
+ float y;
+ /** Z-coordinate. */
+ float z;
+} OH_Drawing_Point3D;
+
+/**
+ * @brief Defines a struct for a path effect that affects the stroke.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_PathEffect OH_Drawing_PathEffect;
+
+/**
+ * @brief Defines a struct for a rectangle.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct OH_Drawing_Rect OH_Drawing_Rect;
+
+/**
+ * @brief Defines a struct for a rounded rectangle.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct OH_Drawing_RoundRect OH_Drawing_RoundRect;
+
+/**
+ * @brief Defines a struct for a matrix, which is used to describe coordinate transformation.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct OH_Drawing_Matrix OH_Drawing_Matrix;
+
+/**
+ * @brief Defines a struct for a shader effect, which is used to describe the source color of the drawn content.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct OH_Drawing_ShaderEffect OH_Drawing_ShaderEffect;
+
+/**
+ * @brief Defines a struct for a shadow, which is used to describe the shadow layer of the drawn content.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_ShadowLayer OH_Drawing_ShadowLayer;
+
+/**
+ * @brief Defines a struct for a filter, which consists of a color filter, mask filter, and image filter.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct OH_Drawing_Filter OH_Drawing_Filter;
+
+/**
+ * @brief Defines a struct for a mask filter, which is used to convert a mask into a new one.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct OH_Drawing_MaskFilter OH_Drawing_MaskFilter;
+
+/**
+ * @brief Defines a struct for a color filter, which is used to convert a color into a new one.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct OH_Drawing_ColorFilter OH_Drawing_ColorFilter;
+
+/**
+ * @brief Defines a struct for an image filter, which is used to operate all color bits that make up image pixels.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_ImageFilter OH_Drawing_ImageFilter;
+
+/**
+ * @brief Defines a struct for a font.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct OH_Drawing_Font OH_Drawing_Font;
+
+/**
+ * @brief Defines a struct for a memory stream.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_MemoryStream OH_Drawing_MemoryStream;
+
+/**
+ * @brief Describes the font arguments.
+ *
+ * @since 13
+ * @version 1.0
+ */
+typedef struct OH_Drawing_FontArguments OH_Drawing_FontArguments;
+
+/**
+ * @brief Defines a struct for a typeface.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct OH_Drawing_Typeface OH_Drawing_Typeface;
+
+/**
+ * @brief Defines a struct for a text blob, which is an immutable container that holds multiple texts.
+ * Each text blob consists of glyphs and position.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct OH_Drawing_TextBlob OH_Drawing_TextBlob;
+
+/**
+ * @brief Defines a struct for an image that describes a two-dimensional pixel array.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_Image OH_Drawing_Image;
+
+/**
+ * @brief Defines a struct for sampling options, which describe the sampling methods for images and bitmaps.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_SamplingOptions OH_Drawing_SamplingOptions;
+
+/**
+ * @brief Defines a struct for a text blob builder, which is used to build a text blob.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct OH_Drawing_TextBlobBuilder OH_Drawing_TextBlobBuilder;
+
+/**
+ * @brief Defines a struct for the GPU context, which is used to describe the GPU backend context.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_GpuContext OH_Drawing_GpuContext;
+
+/**
+ * @brief Defines a struct for a surface, which is used to manage the content drawn on the canvas.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_Surface OH_Drawing_Surface;
+
+/**
+ * @brief Enumerates the storage formats of bitmap pixels.
*
* @since 8
* @version 1.0
*/
-typedef enum {
+typedef enum OH_Drawing_ColorFormat {
/** Unknown format. */
COLOR_FORMAT_UNKNOWN,
/** Each pixel is represented by 8 bits, which together indicate alpha. */
COLOR_FORMAT_ALPHA_8,
- /** Each pixel is represented by 16 bits. From the most significant bit to the least significant bit, the first 5 bits indicate red, the subsequent 6 bits indicate green, and the last 5 bits indicate blue. */
+ /**
+ * Each pixel is represented by 16 bits. From the most significant bit to the least significant bit,
+ * the first 5 bits indicate red, the subsequent 6 bits indicate green, and the last 5 bits indicate blue.
+ */
COLOR_FORMAT_RGB_565,
- /** Each pixel is represented by 16 bits. From the most significant bit to the least significant bit, every 4 bits indicate alpha, red, green, and blue, respectively. */
+ /**
+ * Each pixel is represented by 16 bits. From the most significant bit to the least significant bit,
+ * every 4 bits indicate alpha, red, green, and blue, respectively.
+ */
COLOR_FORMAT_ARGB_4444,
- /** Each pixel is represented by 32 bits. From the most significant bit to the least significant bit, every 8 bits indicate alpha, red, green, and blue, respectively. */
+ /**
+ * Each pixel is represented by 32 bits. From the most significant bit to the least significant bit,
+ * every 8 bits indicate alpha, red, green, and blue, respectively.
+ */
COLOR_FORMAT_RGBA_8888,
- /** Each pixel is represented by 32 bits. From the most significant bit to the least significant bit, every 8 bits indicate blue, green, red, and alpha, respectively. */
+ /**
+ * Each pixel is represented by 32 bits. From the most significant bit to the least significant bit,
+ * every 8 bits indicate blue, green, red, and alpha, respectively.
+ */
COLOR_FORMAT_BGRA_8888
} OH_Drawing_ColorFormat;
/**
- * @brief Enumerates alpha formats of bitmap pixels.
- *
+ * @brief Enumerates the alpha formats of bitmap pixels.
+ *
* @since 8
* @version 1.0
*/
-typedef enum {
+typedef enum OH_Drawing_AlphaFormat {
/** Unknown format. */
ALPHA_FORMAT_UNKNOWN,
/** The bitmap does not have the alpha component. */
@@ -121,6 +367,210 @@ typedef enum {
ALPHA_FORMAT_UNPREMUL
} OH_Drawing_AlphaFormat;
+/**
+ * @brief Enumerates the blend modes. In blend mode, each operation generates a new color from two colors
+ * (source color and target color).
+ * These operations are the same on the four channels (red, green, blue, and alpha).
+ * The operations for the alpha channel are used as examples.
+ *
+ * For brevity, the following abbreviations are used:
+ *
+ * s: source.
+ *
+ * d: destination.
+ *
+ * sa: source alpha.
+ *
+ * da: destination alpha.
+ *
+ * The following abbreviations are used in the calculation result:
+ *
+ * r: The calculation methods of the four channels are the same.
+ *
+ * ra: Only the alpha channel is manipulated.
+ *
+ * rc: The other three color channels are manipulated.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef enum OH_Drawing_BlendMode {
+ /** Clear mode. r = 0. */
+ BLEND_MODE_CLEAR,
+ /**
+ * r = s (The four channels of result are equal to the four channels of source, that is,
+ * the result is equal to the source.)
+ */
+ BLEND_MODE_SRC,
+ /**
+ * r = d (The four channels of result are equal to the four channels of destination, that is,
+ * the result is equal to the destination.)
+ */
+ BLEND_MODE_DST,
+ /** r = s + (1 - sa) * d. */
+ BLEND_MODE_SRC_OVER,
+ /** r = d + (1 - da) * s. */
+ BLEND_MODE_DST_OVER,
+ /** r = s * da. */
+ BLEND_MODE_SRC_IN,
+ /** r = d * sa. */
+ BLEND_MODE_DST_IN,
+ /** r = s * (1 - da). */
+ BLEND_MODE_SRC_OUT,
+ /** r = d * (1 - sa). */
+ BLEND_MODE_DST_OUT,
+ /** r = s * da + d * (1 - sa). */
+ BLEND_MODE_SRC_ATOP,
+ /** r = d * sa + s * (1 - da). */
+ BLEND_MODE_DST_ATOP,
+ /** r = s * (1 - da) + d * (1 - sa). */
+ BLEND_MODE_XOR,
+ /** r = min(s + d, 1). */
+ BLEND_MODE_PLUS,
+ /** r = s * d. */
+ BLEND_MODE_MODULATE,
+ /** Screen mode. r = s + d - s \* d */
+ BLEND_MODE_SCREEN,
+ /** Overlay mode. */
+ BLEND_MODE_OVERLAY,
+ /** Darken mode. rc = s + d - max(s \* da, d \* sa), ra = s + (1 - sa) \* d */
+ BLEND_MODE_DARKEN,
+ /** Lighten mode. rc = s + d - min(s \* da, d \* sa), ra = s + (1 - sa) \* d */
+ BLEND_MODE_LIGHTEN,
+ /** Color dodge mode. */
+ BLEND_MODE_COLOR_DODGE,
+ /** Color burn mode. */
+ BLEND_MODE_COLOR_BURN,
+ /** Hard light mode. */
+ BLEND_MODE_HARD_LIGHT,
+ /** Soft light mode. */
+ BLEND_MODE_SOFT_LIGHT,
+ /** Difference mode. rc = s + d - 2 \* (min(s \* da, d \* sa)), ra = s + (1 - sa) \* d */
+ BLEND_MODE_DIFFERENCE,
+ /** Exclusion mode. rc = s + d - two(s \* d), ra = s + (1 - sa) \* d */
+ BLEND_MODE_EXCLUSION,
+ /** Multiply mode. r = s \* (1 - da) + d \* (1 - sa) + s \* d */
+ BLEND_MODE_MULTIPLY,
+ /** Hue mode. */
+ BLEND_MODE_HUE,
+ /** Saturation mode. */
+ BLEND_MODE_SATURATION,
+ /** Color mode. */
+ BLEND_MODE_COLOR,
+ /** Luminosity mode. */
+ BLEND_MODE_LUMINOSITY,
+} OH_Drawing_BlendMode;
+
+/**
+ * @brief Defines a struct for the image information.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_Image_Info {
+ /** Width, in px. */
+ int32_t width;
+ /** Height, in px. */
+ int32_t height;
+ /** Color format. For details, see {@link OH_Drawing_ColorFormat}. */
+ OH_Drawing_ColorFormat colorType;
+ /** Alpha format. For details, see {@link OH_Drawing_AlphaFormat}. */
+ OH_Drawing_AlphaFormat alphaType;
+} OH_Drawing_Image_Info;
+
+/**
+ * @brief Defines a struct for the style of a rectangle. */
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_RectStyle_Info {
+ /** Color of the rectangle. */
+ uint32_t color;
+ /** Left top radius of the rectangle. */
+ double leftTopRadius;
+ /** Right top radius of the rectangle. */
+ double rightTopRadius;
+ /** Right bottom radius of the rectangle. */
+ double rightBottomRadius;
+ /** Left bottom radius of the rectangle. */
+ double leftBottomRadius;
+} OH_Drawing_RectStyle_Info;
+
+/**
+ * @brief Defines a struct for a string of characters encoded in UTF-16.
+ *
+ * @since 14
+ * @version 1.0
+ */
+typedef struct OH_Drawing_String {
+ /** Pointer to a byte array that stores characters in the UTF-16 encoding format. */
+ uint8_t* strData;
+ /** Actual length of the string that strData points to, in bytes. */
+ uint32_t strLen;
+} OH_Drawing_String;
+
+/**
+ * @brief Enumerates the text encoding types.
+ * @since 12
+ * @version 1.0
+ */
+typedef enum OH_Drawing_TextEncoding {
+ /** One byte used to indicate UTF-8 or ASCII characters. */
+ TEXT_ENCODING_UTF8,
+ /** Two bytes used to indicate most Unicode characters. */
+ TEXT_ENCODING_UTF16,
+ /** Four bytes used to indicate all Unicode characters. */
+ TEXT_ENCODING_UTF32,
+ /** Two bytes used to indicate the glyph index. */
+ TEXT_ENCODING_GLYPH_ID,
+} OH_Drawing_TextEncoding;
+
+/**
+ * @brief Defines a struct for the font manager, which is used for font management.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_FontMgr OH_Drawing_FontMgr;
+
+/**
+ * @brief Defines a struct for a font style set, which is used for font style family matching.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_FontStyleSet OH_Drawing_FontStyleSet;
+
+/**
+ * @brief Defines the recording command tool, which is used to generate recording commands.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 13
+ * @version 1.0
+ */
+typedef struct OH_Drawing_RecordCmdUtils OH_Drawing_RecordCmdUtils;
+
+/**
+ * @brief Defines the recording command class, which is used to store the set of recording commands.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 13
+ * @version 1.0
+ */
+typedef struct OH_Drawing_RecordCmd OH_Drawing_RecordCmd;
+
+/**
+ * @brief Defines a struct for an array object, which is used to store multiple objects of the same type.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 14
+ * @version 1.0
+ */
+typedef struct OH_Drawing_Array OH_Drawing_Array;
#ifdef __cplusplus
}
#endif
diff --git a/en/native_sdk/graphic/native_effect/effect_filter.h b/en/native_sdk/graphic/native_effect/effect_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..6a8a84a8124a42749c3658ac7109ceb6d17be11b
--- /dev/null
+++ b/en/native_sdk/graphic/native_effect/effect_filter.h
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_EFFECT_FILTER_H
+#define C_INCLUDE_EFFECT_FILTER_H
+
+/**
+ * @addtogroup effectKit
+ * @{
+ *
+ * @brief Provides the basic image processing capabilities, including brightness adjustment, blurring,
+ * and grayscale adjustment.
+ *
+ * @since 12
+ * @version 1.0
+ */
+
+/**
+ * @file effect_filter.h
+ *
+ * @brief Declares the APIs of an image effect filter.
+ *
+ * File to include:
+ * @library libnative_effect.so
+ * @syscap SystemCapability.Multimedia.Image.Core
+ * @since 12
+ */
+
+#include "effect_types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates an OH_Filter object based on a pixel map.
+ *
+ * @param pixelmap Pointer to the pixel map.
+ * @param filter Double pointer to the filter created.
+ * @return Returns a status code defined in {@link EffectErrorCode}.
+ * @since 12
+ */
+EffectErrorCode OH_Filter_CreateEffect(OH_PixelmapNative* pixelmap, OH_Filter** filter);
+
+/**
+ * @brief Releases an OH_Filter object.
+ *
+ * @param filter Pointer to the filter.
+ * @return Returns a status code defined in {@link EffectErrorCode}.
+ * @since 12
+ */
+EffectErrorCode OH_Filter_Release(OH_Filter* filter);
+
+/**
+ * @brief Creates the frosted glass effect and adds it to a filter.
+ *
+ * @param filter Pointer to the filter.
+ * @param radius Blur radius of the frosted glass effect, in px.
+ * @return Returns a status code defined in {@link EffectErrorCode}.
+ * @since 12
+ */
+EffectErrorCode OH_Filter_Blur(OH_Filter* filter, float radius);
+
+/**
+ * @brief Creates the frosted glass effect and adds it to a filter.
+ *
+ * @param filter Pointer to the filter.
+ * @param radius Blur radius of the frosted glass effect, in px.
+ * @param tileMode Tile mode of the shader effect. For details about the available options, see {@link EffectTileMode}.
+ * @return Returns a status code defined in {@link EffectErrorCode}.
+ * @since 14
+ */
+EffectErrorCode OH_Filter_BlurWithTileMode(OH_Filter* filter, float radius, EffectTileMode tileMode);
+
+/**
+ * @brief Creates the brightening effect and adds it to a filter.
+ *
+ * @param filter Pointer to the filter.
+ * @param brightness Luminance of the brightening effect. The value ranges from 0 to 1.
+ * When the value is 0, the image remains unchanged.
+ * @return Returns a status code defined in {@link EffectErrorCode}.
+ * @since 12
+ */
+EffectErrorCode OH_Filter_Brighten(OH_Filter* filter, float brightness);
+
+/**
+ * @brief Creates the grayscale effect and adds it to a filter.
+ *
+ * @param filter Pointer to the filter.
+ * @return Returns a status code defined in {@link EffectErrorCode}.
+ * @since 12
+ */
+EffectErrorCode OH_Filter_GrayScale(OH_Filter* filter);
+
+/**
+ * @brief Creates the inverted color effect and adds it to a filter.
+ *
+ * @param filter Pointer to the filter.
+ * @return Returns a status code defined in {@link EffectErrorCode}.
+ * @since 12
+ */
+EffectErrorCode OH_Filter_Invert(OH_Filter* filter);
+
+/**
+ * @brief Creates a custom effect through a matrix and adds it to a filter.
+ *
+ * @param filter Pointer to the filter.
+ * @param matrix Pointer to a custom matrix, which is an {@link OH_Filter_ColorMatrix} object.
+ * @return Returns a status code defined in {@link EffectErrorCode}.
+ * @since 12
+ */
+EffectErrorCode OH_Filter_SetColorMatrix(OH_Filter* filter, OH_Filter_ColorMatrix* matrix);
+
+/**
+ * @brief Obtains the pixel map used to create a filter.
+ *
+ * @param filter Pointer to the filter.
+ * @param pixelmap Double pointer to the pixel map obtained.
+ * @return Returns a status code defined in {@link EffectErrorCode}.
+ * @since 12
+ */
+EffectErrorCode OH_Filter_GetEffectPixelMap(OH_Filter* filter, OH_PixelmapNative** pixelmap);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_effect/effect_types.h b/en/native_sdk/graphic/native_effect/effect_types.h
new file mode 100644
index 0000000000000000000000000000000000000000..b347fc07133773c8a38fe34dd77208402521c4bc
--- /dev/null
+++ b/en/native_sdk/graphic/native_effect/effect_types.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_EFFECT_TYPES_H
+#define C_INCLUDE_EFFECT_TYPES_H
+
+/**
+ * @addtogroup effectKit
+ * @{
+ *
+ * @brief Provides the basic image processing capabilities, including brightness adjustment, blurring,
+ * and grayscale adjustment.
+ *
+ * @since 12
+ * @version 1.0
+ */
+
+/**
+ * @file effect_types.h
+ *
+ * @brief Declares the data types of the image effect filter.
+ *
+ * File to include:
+ * @library libnative_effect.so
+ * @syscap SystemCapability.Multimedia.Image.Core
+ * @since 12
+ */
+
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Describes a filter, which is used to generate a filter bitmap.
+ *
+ * @since 12
+ */
+typedef struct OH_Filter {
+ /** Container for storing the pointer to the filter object. */
+ std::vector > skFilters_;
+}
+
+/**
+ * @brief Describes a bitmap.
+ *
+ * @since 12
+ */
+typedef struct OH_PixelmapNative {
+ /** Smart pointer to the pixelMap object. */
+ std::shared_ptr pixelMap;
+};
+
+/**
+ * @brief Describes a matrix used to create an effect filter.
+ *
+ * @since 12
+ */
+struct OH_Filter_ColorMatrix {
+ /** Custom color matrix. The value is a 5 x 4 array. */
+ float val[20];
+};
+
+/**
+ * @brief Enumerates the status codes that may be used by the effect filter.
+ *
+ * @since 12
+ */
+typedef enum EffectErrorCode {
+ /** Success. */
+ EFFECT_SUCCESS = 0,
+ /** Invalid parameter. */
+ EFFECT_BAD_PARAMETER = 401,
+ /** Unsupported operation. */
+ EFFECT_UNSUPPORTED_OPERATION = 7600201,
+ /** Unknown error. */
+ EFFECT_UNKNOWN_ERROR = 7600901,
+} EffectErrorCode;
+
+/**
+ * @brief Enumerates the tile modes of the shader effect.
+ *
+ * @since 14
+ */
+typedef enum {
+ /** Replicates the edge color if the shader effect draws outside of its original boundary. */
+ CLAMP = 0,
+ /** Repeats the shader effect in both horizontal and vertical directions. */
+ REPEAT,
+ /** Repeats the shader effect in both horizontal and vertical directions, alternating mirror images. */
+ MIRROR,
+ /** Renders the shader effect only within the original boundary. */
+ DECAL,
+} EffectTileMode;
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/en/native_sdk/graphic/native_image.h b/en/native_sdk/graphic/native_image.h
index 126da9417341301a52f90dfc45d0fc0647d22edc..aa2e6be4a66f6aff5fcd04e2fb3fcc22a7725e55 100644
--- a/en/native_sdk/graphic/native_image.h
+++ b/en/native_sdk/graphic/native_image.h
@@ -20,9 +20,10 @@
* @addtogroup OH_NativeImage
* @{
*
- * @brief 提供NativeImage功能.
+ * @brief Provides the capabilities of NativeImage. Functioning as a data consumer, this module is used to
+ * associate data with the OpenGL texture. It is used in the OpenGL environment.
*
- * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
* @since 9
* @version 1.0
*/
@@ -30,29 +31,128 @@
/**
* @file native_image.h
*
- * @brief 定义获取和使用NativeImage的相关函数.
+ * @brief Defines the functions for obtaining and using NativeImage.
*
+ * File to include: <native_image/native_image.h>
+ * @library libnative_image.so
* @since 9
* @version 1.0
*/
#include
-#include "native_window.h"
#ifdef __cplusplus
extern "C" {
#endif
+/**
+ * @brief Defines the OH_NativeImage struct.
+ * @since 9
+ */
struct OH_NativeImage;
+
+/**
+ * @brief Defines the OH_NativeImage struct.
+ * @since 9
+ */
typedef struct OH_NativeImage OH_NativeImage;
/**
- * @brief 创建一个OH_NativeImage实例,该实例与OPENGL ES的纹理ID和纹理目标相关联.
+ * @brief Provides access to NativeWindow.
+ * @since 9
+ */
+typedef struct NativeWindow OHNativeWindow;
+
+/**
+ * @brief Provides the declaration of a NativeWindowBuffer struct.
+ * @since 12
+ */
+typedef struct NativeWindowBuffer OHNativeWindowBuffer;
+
+/**
+ * @brief Defines the callback function triggered when a frame is available.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
+ * @param context Defines user-defined context information, which is returned when the callback is triggered.
+ * @since 11
+ * @version 1.0
+ */
+typedef void (*OH_OnFrameAvailable)(void *context);
+
+/**
+ * @brief Defines an OH_NativeImage listener, which is registered through
+ * {@link OH_NativeImage_SetOnFrameAvailableListener}.
+ * The listener triggers a callback when a frame is available.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct OH_OnFrameAvailableListener {
+ /** User-defined context information, which is returned when the callback is triggered. */
+ void *context;
+ /** Defines the callback function triggered when a frame is available. */
+ OH_OnFrameAvailable onFrameAvailable;
+} OH_OnFrameAvailableListener;
+
+/**
+ * @brief Enumerates the error codes.
+ * @since 12
+ */
+typedef enum OHNativeErrorCode {
+ /** The operation is successful. */
+ NATIVE_ERROR_OK = 0,
+ /**
+ * An error occurs during memory manipulation.
+ * @since 14
+ */
+ NATIVE_ERROR_MEM_OPERATION_ERROR = 30001000,
+ /** An input parameter is invalid. */
+ NATIVE_ERROR_INVALID_ARGUMENTS = 40001000,
+ /** You do not have the permission to perform the operation. */
+ NATIVE_ERROR_NO_PERMISSION = 40301000,
+ /** No buffer is available. */
+ NATIVE_ERROR_NO_BUFFER = 40601000,
+ /** The consumer does not exist. */
+ NATIVE_ERROR_NO_CONSUMER = 41202000,
+ /** Not initialized. */
+ NATIVE_ERROR_NOT_INIT = 41203000,
+ /** The consumer is connected. */
+ NATIVE_ERROR_CONSUMER_CONNECTED = 41206000,
+ /** The buffer status does not meet the expectation. */
+ NATIVE_ERROR_BUFFER_STATE_INVALID = 41207000,
+ /** The buffer is already in the buffer queue. */
+ NATIVE_ERROR_BUFFER_IN_CACHE = 41208000,
+ /** The queue is full. */
+ NATIVE_ERROR_BUFFER_QUEUE_FULL = 41209000,
+ /** The buffer is not in the buffer queue. */
+ NATIVE_ERROR_BUFFER_NOT_IN_CACHE = 41210000,
+ /** The consumer is disconnected. */
+ NATIVE_ERROR_CONSUMER_DISCONNECTED = 41211000,
+ /** No listener is registered on the consumer side. */
+ NATIVE_ERROR_CONSUMER_NO_LISTENER_REGISTERED = 41212000,
+ /** The device or platform does not support the operation. */
+ NATIVE_ERROR_UNSUPPORTED = 50102000,
+ /** Unknown error. Check the log. */
+ NATIVE_ERROR_UNKNOWN = 50002000,
+ /** Failed to call the HDI. */
+ NATIVE_ERROR_HDI_ERROR = 50007000,
+ /** Cross-process communication failed. */
+ NATIVE_ERROR_BINDER_ERROR = 50401000,
+ /** The EGL environment is abnormal. */
+ NATIVE_ERROR_EGL_STATE_UNKNOWN = 60001000,
+ /** Failed to call the EGL APIs. */
+ NATIVE_ERROR_EGL_API_FAILED = 60002000,
+} OHNativeErrorCode;
+
+/**
+ * @brief Creates an OH_NativeImage instance to be associated with the OpenGL ES texture ID and target. \n
+ * This function must be used in pair with {@link OH_NativeImage_Destroy}. Otherwise, memory leak occurs. \n
+ * This function is not thread-safe. \n
*
- * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
- * @param textureId参数是OPENGL ES的纹理ID,OH_NativeImage实例会与之相关联.
- * @param textureTarget 参数是OPENGL ES的纹理目标.
- * @return 返回一个指向OH_NativeImage实例的指针.
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
+ * @param textureId OpenGL ES texture ID.
+ * @param textureTarget OpenGL ES texture target.
+ * @return Returns the pointer to the OH_NativeImage instance created;
* returns NULL otherwise.
* @since 9
* @version 1.0
@@ -60,36 +160,45 @@ typedef struct OH_NativeImage OH_NativeImage;
OH_NativeImage* OH_NativeImage_Create(uint32_t textureId, uint32_t textureTarget);
/**
- * @brief 获取与OH_NativeImage相关联的OHNativeWindow指针. 该OHNativeWindow后续不再需要时需要调用\n
- * OH_NativeWindow_DestroyNativeWindow释放.
+ * @brief Obtains an OHNativeWindow instance associated with an OH_NativeImage instance. \n
+ * This function is not thread-safe. \n
+ * When OH_NativeImage is being destructed, the corresponding OHNativeWindow instance is released.
+ * If the OHNativeWindow pointer is obtained by using this function, set the pointer to null
+ * when releasing the OH_NativeImage instance, so as to prevent subsequent wild pointers. \n
*
- * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
- * @param image是指向OH_NativeImage实例的指针.
- * @return 成功则返回一个指向OHNativeWindow实例的指针,否则返回NULL.
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
+ * @param image Pointer to an OH_NativeImage instance.
+ * @return Returns a pointer to the OHNativeWindow instance if the operation is successful;
+ * returns NULL otherwise.
* @since 9
* @version 1.0
*/
OHNativeWindow* OH_NativeImage_AcquireNativeWindow(OH_NativeImage* image);
/**
- * @brief 将OH_NativeImage实例附加到当前OPENGL ES上下文, 且该OPENGL ES纹理会绑定到 \n
- * GL_TEXTURE_EXTERNAL_OES, 并通过OH_NativeImage进行更新.
+ * @brief Attaches an OH_NativeImage instance to the current OpenGL ES context.
+ * The OpenGL ES texture will be bound to an GL_TEXTURE_EXTERNAL_OES instance and updated
+ * through the OH_NativeImage instance. \n
+ * This function is not thread-safe. \n
*
- * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
- * @param image是指向OH_NativeImage实例的指针.
- * @param textureId是OH_NativeImage要附加到的OPENGL ES纹理的id.
- * @return 返回一个由SurfaceError定义的int32_t类型的错误码.
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
+ * @param image Pointer to an OH_NativeImage instance.
+ * @param textureId ID of the OpenGL ES texture to which the OH_NativeImage instance is to be attached.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
* @since 9
* @version 1.0
*/
int32_t OH_NativeImage_AttachContext(OH_NativeImage* image, uint32_t textureId);
/**
- * @brief 将OH_NativeImage实例从当前OPENGL ES上下文分离.
+ * @brief Detaches an OH_NativeImage instance from the current OpenGL ES context. \n
+ * This function is not thread-safe. \n
*
- * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
- * @param image是指向OH_NativeImage实例的指针.
- * @return 返回一个由SurfaceError定义的int32_t类型的错误码.
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
+ * @param image Pointer to an OH_NativeImage instance.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
* @since 9
* @version 1.0
*/
@@ -97,53 +206,234 @@ int32_t OH_NativeImage_AttachContext(OH_NativeImage* image, uint32_t textureId);
int32_t OH_NativeImage_DetachContext(OH_NativeImage* image);
/**
- * @brief 通过OH_NativeImage获取最新帧更新相关联的OPENGL ES纹理.
+ * @brief Updates the OpenGL ES texture associated with the latest frame through an OH_NativeImage instance. \n
+ * This function must be called in a thread of the OpenGL ES context. \n
+ * This function must be called after the {@link OH_OnFrameAvailableListener} callback is triggered. \n
+ * This function is not thread-safe. \n
*
- * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
- * @param image是指向OH_NativeImage实例的指针.
- * @return 返回一个由SurfaceError定义的int32_t类型的错误码.
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
+ * @param image Pointer to an OH_NativeImage instance.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
* @since 9
* @version 1.0
*/
int32_t OH_NativeImage_UpdateSurfaceImage(OH_NativeImage* image);
/**
- * @brief 获取最近调用OH_NativeImage_UpdateSurfaceImage的纹理图像的相关时间戳.
+ * @brief Obtains the timestamp of the texture image
+ * that recently called the OH_NativeImage_UpdateSurfaceImage function.
+ * This function is not thread-safe. \n
*
- * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
- * @param image是指向OH_NativeImage实例的指针.
- * @return 返回纹理图像的相关时间戳.
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
+ * @param image Pointer to an OH_NativeImage instance.
+ * @return Returns the timestamp of the texture image.
* @since 9
* @version 1.0
*/
int64_t OH_NativeImage_GetTimestamp(OH_NativeImage* image);
/**
- * @brief 获取最近调用OH_NativeImage_UpdateSurfaceImage的纹理图像的变化矩阵.
+ * @brief Obtains the transformation matrix of the texture image
+ * that recently called the OH_NativeImage_UpdateSurfaceImage function.
*
- * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
- * @param image是指向OH_NativeImage实例的指针.
- * @param matrix用来存储要获取的4*4的变化矩阵.
- * @return 返回一个由SurfaceError定义的int32_t类型的错误码.
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
+ * @param image Pointer to an OH_NativeImage instance.
+ * @param matrix Buffer used to store the 4 x 4 transformation matrix obtained.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
* @since 9
* @version 1.0
+ * @deprecated This API is deprecated from API version 12. Use OH_NativeImage_GetTransformMatrixV2 instead.
*/
int32_t OH_NativeImage_GetTransformMatrix(OH_NativeImage* image, float matrix[16]);
/**
- * @brief 销毁通过OH_NativeImage_Create创建的OH_NativeImage实例, 销毁后该\n
- * OH_NativeImage指针会被赋值为空.
+ * @brief Obtains the surface ID of an OH_NativeImage instance. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
+ * @param image Pointer to an OH_NativeImage instance.
+ * @param surfaceId Pointer to the surface ID.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 11
+ * @version 1.0
+ */
+int32_t OH_NativeImage_GetSurfaceId(OH_NativeImage* image, uint64_t* surfaceId);
+
+/**
+ * @brief Registers a listener to listen for frame availability events. \n
+ * Do not call other functions of this module in the callback. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
+ * @param image Pointer to an OH_NativeImage instance.
+ * @param listener Listener to register.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 11
+ * @version 1.0
+ */
+int32_t OH_NativeImage_SetOnFrameAvailableListener(OH_NativeImage* image, OH_OnFrameAvailableListener listener);
+
+/**
+ * @brief Deregisters the listener used to listen for frame availability events. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
+ * @param image Pointer to an OH_NativeImage instance.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 11
+ * @version 1.0
+ */
+int32_t OH_NativeImage_UnsetOnFrameAvailableListener(OH_NativeImage* image);
+
+/**
+ * @brief Destroys an OH_NativeImage instance created by calling OH_NativeImage_Create.
+ * After the instance is destroyed, the pointer to the OH_NativeImage instance is assigned NULL. \n
+ * This function is not thread-safe. \n
*
- * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
- * @param image是指向OH_NativeImage实例的指针.
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
+ * @param image Pointer to an OH_NativeImage instance.
* @since 9
* @version 1.0
*/
void OH_NativeImage_Destroy(OH_NativeImage** image);
+/**
+ * @brief Obtains, based on the rotation angle set by the producer, the transformation matrix of the texture image
+ * that recently called the OH_NativeImage_UpdateSurfaceImage function. \n
+ * The matrix is updated only after {@link OH_NativeImage_UpdateSurfaceImage} is called. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
+ * @param image Pointer to an OH_NativeImage instance.
+ * @param matrix Buffer used to store the 4 x 4 transformation matrix obtained.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_NativeImage_GetTransformMatrixV2(OH_NativeImage* image, float matrix[16]);
+
+/**
+ * @brief Obtains the transformation matrix calculated based on the rotation angle set by the producer and
+ * the actual valid content area of the buffer.
+ *
+ * This function returns a transformation matrix that is determined by the buffer's rotation angle and
+ * actual valid content area during the consumption of the buffer by {@link OH_NativeImage}, specifically when
+ * invoking the functions {@link OH_NativeImage_UpdateSurfaceImage} or {@link OH_NativeImage_AcquireNativeWindowBuffer}.
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
+ * @param image Pointer to the {@link OH_NativeImage} instance.
+ * @param matrix Buffer used to store the 4 x 4 transformation matrix obtained.
+ * @return Returns NATIVE_ERROR_OK if the operation is successful. \n
+ * Returns NATIVE_ERROR_INVALID_ARGUMENTS (error code: 40001000) if image is a null pointer. \n
+ * Returns NATIVE_ERROR_MEM_OPERATION_ERROR (error code: 30001000) if the transformation matrix fails
+ * to be obtained due to a memory manipulation error.
+ * @since 14
+ * @version 1.0
+ */
+int32_t OH_NativeImage_GetBufferMatrix(OH_NativeImage* image, float matrix[16]);
+
+/**
+ * @brief Obtain an OHNativeWindowBuffer instance through an OH_NativeImage instance on the consumer side.
+ * This API cannot be used together with {@link OH_NativeImage_UpdateSurfaceImage}. \n
+ * This API creates an OHNativeWindowBuffer. \n
+ * When using the OHNativeWindowBuffer, call {@link OH_NativeWindow_NativeObjectReference} to
+ * increase its reference count by one. \n
+ * When finishing using the OHNativeWindowBuffer, call {@link OH_NativeWindow_NativeObjectUnreference} to
+ * decrease the reference count by one. \n
+ * This API must be used in pair with {@link OH_NativeImage_ReleaseNativeWindowBuffer}. Otherwise, memory leak occurs.
+ * When fenceFd is used up, you must close it. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
+ * @param image Pointer to an OH_NativeImage instance.
+ * @param nativeWindowBuffer Double pointer to the OHNativeWindowBuffer instance obtained.
+ * @param fenceFd Pointer to the file descriptor handle.
+ * @return Returns NATIVE_ERROR_OK if the operation is successful. \n
+ * Returns NATIVE_ERROR_INVALID_ARGUMENTS if image, nativeWindowBuffer, or fenceFd
+ * is a null pointer. \n
+ * Returns NATIVE_ERROR_NO_BUFFER if no buffer is available for consumption. \n
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_NativeImage_AcquireNativeWindowBuffer(OH_NativeImage* image,
+ OHNativeWindowBuffer** nativeWindowBuffer, int* fenceFd);
+
+/**
+ * @brief Releases an OHNativeWindowBuffer instance through an OH_NativeImage instance. \n
+ * The system will close fenFd. You do not need to close it. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
+ * @param image Pointer to an OH_NativeImage instance.
+ * @param nativeWindowBuffer Pointer to an OHNativeWindowBuffer instance.
+ * @param fenceFd File descriptor handle, which is used for concurrent synchronization control.
+ * @return Returns NATIVE_ERROR_OK if the operation is successful. \n
+ * Returns NATIVE_ERROR_INVALID_ARGUMENTS if image or nativeWindowBuffer is a null pointer. \n
+ * Returns NATIVE_ERROR_BUFFER_STATE_INVALID if the status of nativeWindowBuffer is invalid. \n
+ * Returns NATIVE_ERROR_BUFFER_NOT_IN_CACHE if nativeWindowBuffer is not in the cache. \n
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_NativeImage_ReleaseNativeWindowBuffer(OH_NativeImage* image,
+ OHNativeWindowBuffer* nativeWindowBuffer, int fenceFd);
+
+/**
+ * @brief Creates an OH_NativeImage instance to serve as the consumer of the surface. \n
+ * This function is used only for memory cycling of the surface consumer.
+ * Memory rendering is not proactively performed in the created OH_NativeImage instance. \n
+ * This function cannot be used together with {@link OH_NativeImage_UpdateSurfaceImage}. \n
+ * This function must be used in pair with {@link OH_NativeImage_AcquireNativeWindowBuffer} and
+ * {@link OH_NativeImage_ReleaseNativeWindowBuffer}. \n
+ * This function must be used in pair with {@link OH_NativeImage_Destroy}. Otherwise, memory leak occurs. \n
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
+ * @return Returns a pointer to the OH_NativeImage instance if the operation is successful;
+ * returns NULL otherwise.
+ * @since 12
+ * @version 1.0
+ */
+OH_NativeImage* OH_ConsumerSurface_Create();
+
+/**
+ * @brief Sets the default read/write mode.
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
+ * @param image Pointer to an OH_NativeImage instance.
+ * @param usage Read/write mode. For details about the available options, see {@link OH_NativeBuffer_Usage}.
+ * @return Returns NATIVE_ERROR_OK if the operation is successful. \n
+ * Returns NATIVE_ERROR_INVALID_ARGUMENTS if image is a null pointer. \n
+ * @since 13
+ * @version 1.0
+ */
+int32_t OH_ConsumerSurface_SetDefaultUsage(OH_NativeImage* image, uint64_t usage);
+
+/**
+ * @brief Sets the default size of a geometric shape.
+ * This function is not thread-safe. \n
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeImage
+ * @param image Pointer to an OH_NativeImage instance.
+ * @param width Width of the geometric shape. The value is greater than 0, in pixels.
+ * @param height Height of the geometric shape. The value is greater than 0, in pixels.
+ * @return Returns NATIVE_ERROR_OK if the operation is successful. \n
+ * Returns NATIVE_ERROR_INVALID_ARGUMENTS if image is a null pointer or
+ * width or height is less than 0. \n
+ * @since 13
+ * @version 1.0
+ */
+int32_t OH_ConsumerSurface_SetDefaultSize(OH_NativeImage* image, int32_t width, int32_t height);
#ifdef __cplusplus
}
#endif
/** @} */
-#endif
\ No newline at end of file
+#endif
diff --git a/en/native_sdk/graphic/native_vsync.h b/en/native_sdk/graphic/native_vsync.h
index b17473e5e16a74512a8670432dc936a4cd48c47c..2fee73d448e490a86b5bfb8732ce3f559f280ea6 100644
--- a/en/native_sdk/graphic/native_vsync.h
+++ b/en/native_sdk/graphic/native_vsync.h
@@ -20,19 +20,20 @@
* @addtogroup NativeVsync
* @{
*
- * @brief 提供NativeVsync功能
+ * @brief Provides the capabilities of native virtual synchronization (VSync).
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeVsync
- * @since 8
+ * @since 9
* @version 1.0
*/
/**
* @file native_vsync.h
*
- * @brief 定义获取和使用NativeVsync的相关函数
+ * @brief Declares the functions for obtaining and using NativeVSync.
*
- * @since 8
+ * @library libnative_vsync.so
+ * @since 9
* @version 1.0
*/
@@ -40,46 +41,198 @@
extern "C" {
#endif
+/**
+ * @brief Provides the declaration of an OH_NativeVSync struct.
+ * @since 9
+ */
struct OH_NativeVSync;
+
+/**
+ * @brief Enumerates the error codes.
+ * @since 12
+ */
+typedef enum OHNativeErrorCode {
+ /** The operation is successful. */
+ NATIVE_ERROR_OK = 0,
+ /**
+ * An error occurs during memory manipulation.
+ * @since 14
+ */
+ NATIVE_ERROR_MEM_OPERATION_ERROR = 30001000,
+ /** An input parameter is invalid. */
+ NATIVE_ERROR_INVALID_ARGUMENTS = 40001000,
+ /** You do not have the permission to perform the operation. */
+ NATIVE_ERROR_NO_PERMISSION = 40301000,
+ /** No buffer is available. */
+ NATIVE_ERROR_NO_BUFFER = 40601000,
+ /** The consumer does not exist. */
+ NATIVE_ERROR_NO_CONSUMER = 41202000,
+ /** Not initialized. */
+ NATIVE_ERROR_NOT_INIT = 41203000,
+ /** The consumer is connected. */
+ NATIVE_ERROR_CONSUMER_CONNECTED = 41206000,
+ /** The buffer status does not meet the expectation. */
+ NATIVE_ERROR_BUFFER_STATE_INVALID = 41207000,
+ /** The buffer is already in the buffer queue. */
+ NATIVE_ERROR_BUFFER_IN_CACHE = 41208000,
+ /** The queue is full. */
+ NATIVE_ERROR_BUFFER_QUEUE_FULL = 41209000,
+ /** The buffer is not in the buffer queue. */
+ NATIVE_ERROR_BUFFER_NOT_IN_CACHE = 41210000,
+ /** The consumer is disconnected. */
+ NATIVE_ERROR_CONSUMER_DISCONNECTED = 41211000,
+ /** No listener is registered on the consumer side. */
+ NATIVE_ERROR_CONSUMER_NO_LISTENER_REGISTERED = 41212000,
+ /** The device or platform does not support the operation. */
+ NATIVE_ERROR_UNSUPPORTED = 50102000,
+ /** Unknown error. Check the log. */
+ NATIVE_ERROR_UNKNOWN = 50002000,
+ /** Failed to call the HDI. */
+ NATIVE_ERROR_HDI_ERROR = 50007000,
+ /** Cross-process communication failed. */
+ NATIVE_ERROR_BINDER_ERROR = 50401000,
+ /** The EGL environment is abnormal. */
+ NATIVE_ERROR_EGL_STATE_UNKNOWN = 60001000,
+ /** Failed to call the EGL APIs. */
+ NATIVE_ERROR_EGL_API_FAILED = 60002000,
+} OHNativeErrorCode;
+
+/**
+ * @brief Provides the declaration of an OH_NativeVSync struct.
+ * @since 9
+ */
typedef struct OH_NativeVSync OH_NativeVSync;
+
+/**
+ * @brief Defines the pointer to a VSync callback function.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync
+ * @param timestamp System timestamp obtained by VSync using CLOCK_MONOTONIC, in nanoseconds.
+ * @param data Custom data.
+ * @since 9
+ * @version 1.0
+ */
typedef void (*OH_NativeVSync_FrameCallback)(long long timestamp, void *data);
/**
- * @brief 创建一个OH_NativeVSync实例,每次调用都会产生一个新的实例
+ * @brief Creates an OH_NativeVSync instance.
+ * A new OH_NativeVSync instance is created each time this function is called.
+ * This function must be used in pair with {@link OH_NativeVSync_Destroy}. Otherwise, memory leak occurs. \n
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeVsync
- * @param name 参数表示一个vsync连接的名字
- * @param length 参数是name的长度
- * @return 返回一个指向OH_NativeVSync实例的指针
- * @since 8
+ * @param name Pointer to the name that associates with an OH_NativeVSync instance.
+ * @param length Length of the name.
+ * @return Returns the pointer to an OH_NativeVSync instance.
+ * @since 9
* @version 1.0
*/
OH_NativeVSync* OH_NativeVSync_Create(const char* name, unsigned int length);
/**
- * @brief 销毁OH_NativeVSync实例
+ * @brief Creates an OH_NativeVSync instance to bind with a window.
+ * A new OH_NativeVSync instance is created each time this function is called.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync
+ * @param windowID Window ID, which is the index identifier of the window child process and
+ * can be obtained through {@link OH_NativeWindow_GetSurfaceId}.
+ * @param name Pointer to the name that associates with an OH_NativeVSync instance.
+ * @param length Length of the name.
+ * @return Returns the pointer to an OH_NativeVSync instance.
+ * @since 14
+ * @version 1.0
+ */
+OH_NativeVSync* OH_NativeVSync_Create_ForAssociatedWindow(uint64_t windowID, const char* name, unsigned int length);
+
+/**
+ * @brief Destroys an OH_NativeVSync instance.
+ * Once the OH_NativeVSync pointer is destroyed, it must not be used to prevent dangling pointer problems.
+ * Pay special attention to the management of the OH_NativeVSync pointer in concurrent multithreaded scenarios.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeVsync
- * @param nativeVsync 参数是一个指向OH_NativeVSync实例的指针
- * @since 8
+ * @param nativeVsync Pointer to an OH_NativeVSync instance.
+ * @since 9
* @version 1.0
*/
void OH_NativeVSync_Destroy(OH_NativeVSync* nativeVsync);
/**
- * @brief 请求下一次vsync信号,当信号到来时,调用回调函数callback
+ * @brief Requests the next VSync signal. When the signal arrives, a callback function is invoked.
+ * If this API is called for multiple times in the same frame, only the last callback function is invoked.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeVsync
- * @param nativeVsync 参数是一个指向OH_NativeVSync实例的指针
- * @param callback 参数是一个OH_NativeVSync_FrameCallback类型的函数指针,当下一次vsync信号到来时会被调用
- * @param data 参数是一个指向用户自定义数据结构的指针,类型是void*
- * @return 返回一个由GSError定义的int32_t类型的错误码
- * @since 8
+ * @param nativeVsync Pointer to an OH_NativeVSync instance.
+ * @param callback Function pointer of the OH_NativeVSync_FrameCallback type.
+ * This function pointer will be called when the next VSync signal arrives.
+ * @param data Pointer to the custom data struct. The type is void*.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 9
* @version 1.0
*/
int OH_NativeVSync_RequestFrame(OH_NativeVSync* nativeVsync, OH_NativeVSync_FrameCallback callback, void* data);
+
+/**
+ * @brief Requests the next VSync signal. When the signal arrives, a callback function is invoked.
+ * If this API is called for multiple times in the same frame, every callback function is invoked.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync
+ * @param nativeVsync Pointer to an OH_NativeVSync instance.
+ * @param callback Function pointer of the OH_NativeVSync_FrameCallback type.
+ * This function pointer will be called when the next VSync signal arrives.
+ * @param data Pointer to the custom data struct. The type is void*.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 12
+ * @version 1.0
+ */
+int OH_NativeVSync_RequestFrameWithMultiCallback(
+ OH_NativeVSync* nativeVsync, OH_NativeVSync_FrameCallback callback, void* data);
+
+/**
+ * @brief Obtains the VSync period.
+ * The VSync period is refreshed only when the OH_NativeVSync_FrameCallback callback is received
+ * following a request for a VSync signal via OH_NativeVSync_RequestFrame.
+ * To obtain the VSync period for the first time using this function,
+ * you need to call OH_NativeVSync_RequestFrame to request a VSync signal.
+ * Once the OH_NativeVSync_FrameCallback callback is received, the vsync period can be obtained.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync
+ * @param nativeVsync Pointer to an OH_NativeVSync instance.
+ * @param period Pointer to the VSync period.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 10
+ * @version 1.0
+ */
+int OH_NativeVSync_GetPeriod(OH_NativeVSync* nativeVsync, long long* period);
+
+/**
+ * @brief Enables DVSync to improve the smoothness of self-drawing animations.
+ * DVSync, short for Decoupled VSync, is a frame timing management policy that is decoupled from the hardware's VSync.
+ * DVSync drives the early rendering of upcoming animation frames by sending VSync signals with future timestamps.
+ * These frames are stored in a frame buffer queue.
+ * This helps DVSync reduce potential frame drop and therefore enhances the smoothness of animations.
+ * DVSync requires free self-drawing frame buffers to store these pre-rendered animation frames.
+ * Therefore, you must ensure that at least one free frame buffer is available. Otherwise, do not enable DVSync.
+ * After DVSync is enabled, you must correctly respond to the early VSync signals and request the subsequent VSync
+ * after the animation frame associated with the previous VSync is complete.
+ * In addition, the self-drawing frames must carry timestamps that align with VSync.
+ * After the animation ends, disable DVSync.
+ * On a platform that does not support DVSync or if another application has enabled DVSync,
+ * the attempt to enable it will not take effect, and the application still receives normal VSync signals.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync
+ * @param nativeVsync Pointer to an OH_NativeVSync instance.
+ * @param enable Whether to enable DVSync.
+ * The value true means to enable DVSync, and false means the opposite.
+ * @return Returns 0 if the operation is successful;
+ * returns an error code defined in {@link OHNativeErrorCode} otherwise.
+ * @since 14
+ * @version 1.0
+ */
+int OH_NativeVSync_DVSyncSwitch(OH_NativeVSync* nativeVsync, bool enable);
#ifdef __cplusplus
}
#endif
-#endif
\ No newline at end of file
+#endif
diff --git a/en/native_sdk/graphic/vulkan_ohos.h b/en/native_sdk/graphic/vulkan_ohos.h
new file mode 100644
index 0000000000000000000000000000000000000000..ad983019f4fbd05319d73d16703d60789d524db7
--- /dev/null
+++ b/en/native_sdk/graphic/vulkan_ohos.h
@@ -0,0 +1,472 @@
+#ifndef VULKAN_OHOS_H_
+#define VULKAN_OHOS_H_ 1
+
+/*
+** Copyright 2015-2022 The Khronos Group Inc.
+**
+** SPDX-License-Identifier: Apache-2.0
+*/
+
+/*
+** This header is generated from the Khronos Vulkan XML API Registry.
+**
+*/
+
+
+/**
+ * @addtogroup Vulkan
+ * @{
+ *
+ * @brief Provides Vulkan capabilities extended by OpenHarmony.
+ * This module provides extended APIs for creating a Vulkan surface and obtaining OH_NativeBuffer and
+ * OH_NativeBuffer properties through OHNativeWindow.
+ *
+ * @syscap SystemCapability.Graphic.Vulkan
+ * @since 10
+ * @version 1.0
+ */
+
+/**
+ * @file vulkan_ohos.h
+ *
+ * @brief Declares the Vulkan APIs extended by OpenHarmony. File to include:
+ *
+ * @library libvulkan.so
+ * @since 10
+ * @version 1.0
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * @brief Defines the surface extension of OpenHarmony.
+ * @since 10
+ * @version 1.0
+ */
+#define VK_OHOS_surface 1
+
+/**
+ * @brief Defines the OHNativeWindow struct.
+ * @since 10
+ * @version 1.0
+ */
+typedef struct NativeWindow OHNativeWindow;
+
+/**
+ * @brief Defines the surface extension version of OpenHarmony.
+ * @since 10
+ * @version 1.0
+ */
+#define VK_OHOS_SURFACE_SPEC_VERSION 1
+
+/**
+ * @brief Defines the surface extension name of OpenHarmony.
+ * @since 10
+ * @version 1.0
+ */
+#define VK_OHOS_SURFACE_EXTENSION_NAME "VK_OHOS_surface"
+
+/**
+ * @brief Defines the bit mask of the VkFlags type used for the creation of a Vulkan surface.
+ * It is a reserved flag type.
+ * @since 10
+ * @version 1.0
+ */
+typedef VkFlags VkSurfaceCreateFlagsOHOS;
+
+/**
+ * @brief Defines the parameters required for creating a Vulkan surface.
+ * @since 10
+ * @version 1.0
+ */
+typedef struct VkSurfaceCreateInfoOHOS {
+ /**
+ * Struct type.
+ */
+ VkStructureType sType;
+ /**
+ * Pointer to the next-level struct.
+ */
+ const void* pNext;
+ /**
+ * Reserved flag type.
+ */
+ VkSurfaceCreateFlagsOHOS flags;
+ /**
+ * Pointer to an OHNativeWindow instance.
+ */
+ OHNativeWindow* window;
+} VkSurfaceCreateInfoOHOS;
+
+/**
+ * @brief Defines the function pointer for creating a Vulkan surface.
+ *
+ * @syscap SystemCapability.Graphic.Vulkan
+ * @param instance Vulkan instance.
+ * @param pCreateInfo Pointer to the VkSurfaceCreateInfoOHOS struct,
+ * including the parameters required for creating a Vulkan surface.
+ * @param pAllocator Pointer to a callback function for custom memory allocation.
+ * If custom memory allocation is not required, pass in NULL, and the default memory allocation function is used.
+ * @param pSurface Pointer to the Vulkan surface created. The type is VkSurfaceKHR.
+ * @return Returns VK_SUCCESS if the execution is successful;
+ * returns an error code of the VkResult type otherwise.
+ * @since 10
+ * @version 1.0
+ */
+typedef VkResult (VKAPI_PTR *PFN_vkCreateSurfaceOHOS)(
+ VkInstance instance,
+ const VkSurfaceCreateInfoOHOS* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkSurfaceKHR* pSurface
+);
+
+#ifndef VK_NO_PROTOTYPES
+
+/**
+ * @brief Creates a Vulkan surface.
+ *
+ * @syscap SystemCapability.Graphic.Vulkan
+ * @param instance Vulkan instance.
+ * @param pCreateInfo Pointer to the VkSurfaceCreateInfoOHOS struct,
+ * including the parameters required for creating a Vulkan surface.
+ * @param pAllocator Pointer to a callback function for custom memory allocation.
+ * If custom memory allocation is not required, pass in NULL, and the default memory allocation function is used.
+ * @param pSurface Pointer to the Vulkan surface created. The type is VkSurfaceKHR.
+ * @return Returns VK_SUCCESS if the execution is successful;
+ * returns an error code of the VkResult type otherwise.
+ * @since 10
+ * @version 1.0
+ */
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateSurfaceOHOS(
+ VkInstance instance,
+ const VkSurfaceCreateInfoOHOS* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkSurfaceKHR* pSurface);
+#endif
+
+
+/**
+ * @brief Defines the external memory extension of OpenHarmony.
+ * @since 10
+ * @version 1.0
+ */
+#define VK_OHOS_external_memory 1
+
+/**
+ * @brief Defines the OH_NativeBuffer struct.
+ * @since 10
+ * @version 1.0
+ */
+struct OH_NativeBuffer;
+
+/**
+ * @brief Defines the external memory extension version of OpenHarmony.
+ * @since 10
+ * @version 1.0
+ */
+#define VK_OHOS_EXTERNAL_MEMORY_SPEC_VERSION 1
+
+/**
+ * @brief Defines the external memory extension name of OpenHarmony.
+ * @since 10
+ * @version 1.0
+ */
+#define VK_OHOS_EXTERNAL_MEMORY_EXTENSION_NAME "VK_OHOS_external_memory"
+
+/**
+ * @brief Defines the usage of a NativeBuffer.
+ * @since 10
+ * @version 1.0
+ */
+typedef struct VkNativeBufferUsageOHOS {
+ /**
+ * Struct type.
+ */
+ VkStructureType sType;
+ /**
+ * Pointer to the next-level struct.
+ */
+ void* pNext;
+ /**
+ * @brief Defines the usage of a NativeBuffer.
+ */
+ uint64_t OHOSNativeBufferUsage;
+} VkNativeBufferUsageOHOS;
+
+/**
+ * @brief Defines the properties of a NativeBuffer.
+ * @since 10
+ * @version 1.0
+ */
+typedef struct VkNativeBufferPropertiesOHOS {
+ /**
+ * Struct type.
+ */
+ VkStructureType sType;
+ /**
+ * Pointer to the next-level struct.
+ */
+ void* pNext;
+ /**
+ * @brief Defines the size of the occupied memory.
+ */
+ VkDeviceSize allocationSize;
+ /**
+ * @brief Defines the memory type.
+ */
+ uint32_t memoryTypeBits;
+} VkNativeBufferPropertiesOHOS;
+
+/**
+ * @brief Defines the format properties of a NativeBuffer.
+ * @since 10
+ * @version 1.0
+ */
+typedef struct VkNativeBufferFormatPropertiesOHOS {
+ /**
+ * Struct type.
+ */
+ VkStructureType sType;
+ /**
+ * Pointer to the next-level struct.
+ */
+ void* pNext;
+ /**
+ * Format properties.
+ */
+ VkFormat format;
+ /**
+ * Externally defined format.
+ */
+ uint64_t externalFormat;
+ /**
+ * Features of the externally defined format.
+ */
+ VkFormatFeatureFlags formatFeatures;
+ /**
+ * A group of VkComponentSwizzles.
+ */
+ VkComponentMapping samplerYcbcrConversionComponents;
+ /**
+ * Color model.
+ */
+ VkSamplerYcbcrModelConversion suggestedYcbcrModel;
+ /**
+ * Color value range.
+ */
+ VkSamplerYcbcrRange suggestedYcbcrRange;
+ /**
+ * X chrominance offset.
+ */
+ VkChromaLocation suggestedXChromaOffset;
+ /**
+ * Y chrominance offset.
+ */
+ VkChromaLocation suggestedYChromaOffset;
+} VkNativeBufferFormatPropertiesOHOS;
+
+/**
+ * @brief Defines the pointer to an OH_NativeBuffer struct.
+ * @since 10
+ * @version 1.0
+ */
+typedef struct VkImportNativeBufferInfoOHOS {
+ /**
+ * Struct type.
+ */
+ VkStructureType sType;
+ /**
+ * Pointer to the next-level struct.
+ */
+ const void* pNext;
+ /**
+ * Pointer to an OH_NativeBuffer struct.
+ */
+ struct OH_NativeBuffer* buffer;
+} VkImportNativeBufferInfoOHOS;
+
+/**
+ * @brief Defines a struct used to obtain an OH_NativeBuffer from the Vulkan memory.
+ * @since 10
+ * @version 1.0
+ */
+typedef struct VkMemoryGetNativeBufferInfoOHOS {
+ /**
+ * Struct type.
+ */
+ VkStructureType sType;
+ /**
+ * Pointer to the next-level struct.
+ */
+ const void* pNext;
+ /**
+ * VkDeviceMemory instance.
+ */
+ VkDeviceMemory memory;
+} VkMemoryGetNativeBufferInfoOHOS;
+
+/**
+ * @brief Defines an externally defined format.
+ * @since 10
+ * @version 1.0
+ */
+typedef struct VkExternalFormatOHOS {
+ /**
+ * Struct type.
+ */
+ VkStructureType sType;
+ /**
+ * Pointer to the next-level struct.
+ */
+ void* pNext;
+ /**
+ * Externally defined format.
+ */
+ uint64_t externalFormat;
+} VkExternalFormatOHOS;
+
+/**
+ * @brief Defines a function pointer used to obtain OH_NativeBuffer properties.
+ *
+ * @syscap SystemCapability.Graphic.Vulkan
+ * @param device VkDevice instance.
+ * @param buffer Pointer to the OH_NativeBuffer struct.
+ * @param pProperties Pointer to the struct holding the properties of OH_NativeBuffer.
+ * @return Returns VK_SUCCESS if the execution is successful;
+ * returns an error code of the VkResult type otherwise.
+ * @since 10
+ * @version 1.0
+ */
+typedef VkResult (VKAPI_PTR *PFN_vkGetNativeBufferPropertiesOHOS)(
+ VkDevice device,
+ const struct OH_NativeBuffer* buffer,
+ VkNativeBufferPropertiesOHOS* pProperties
+);
+
+/**
+ * @brief Defines a function pointer used to obtain an OH_NativeBuffer instance.
+ *
+ * @syscap SystemCapability.Graphic.Vulkan
+ * @param device VkDevice instance.
+ * @param pInfo Pointer to the VkMemoryGetNativeBufferInfoOHOS struct.
+ * @param pBuffer Double pointer to the OH_NativeBuffer obtained.
+ * @return Returns VK_SUCCESS if the execution is successful;
+ * returns an error code of the VkResult type otherwise.
+ * @since 10
+ * @version 1.0
+ */
+typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryNativeBufferOHOS)(
+ VkDevice device,
+ const VkMemoryGetNativeBufferInfoOHOS* pInfo,
+ struct OH_NativeBuffer** pBuffer
+);
+
+#ifndef VK_NO_PROTOTYPES
+
+/**
+ * @brief Obtains the properties of an OH_NativeBuffer instance.
+ *
+ * @syscap SystemCapability.Graphic.Vulkan
+ * @param device VkDevice instance.
+ * @param buffer Pointer to the OH_NativeBuffer struct.
+ * @param pProperties Pointer to the struct holding the properties of OH_NativeBuffer.
+ * @return Returns VK_SUCCESS if the execution is successful;
+ * returns an error code of the VkResult type otherwise.
+ * @since 10
+ * @version 1.0
+ */
+VKAPI_ATTR VkResult VKAPI_CALL vkGetNativeBufferPropertiesOHOS(
+ VkDevice device,
+ const struct OH_NativeBuffer* buffer,
+ VkNativeBufferPropertiesOHOS* pProperties);
+
+/**
+ * @brief Obtains an OH_NativeBuffer instance.
+ *
+ * @syscap SystemCapability.Graphic.Vulkan
+ * @param device VkDevice instance.
+ * @param pInfo Pointer to the VkMemoryGetNativeBufferInfoOHOS struct.
+ * @param pBuffer Double pointer to the OH_NativeBuffer obtained.
+ * @return Returns VK_SUCCESS if the execution is successful;
+ * returns an error code of the VkResult type otherwise.
+ * @since 10
+ * @version 1.0
+ */
+VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryNativeBufferOHOS(
+ VkDevice device,
+ const VkMemoryGetNativeBufferInfoOHOS* pInfo,
+ struct OH_NativeBuffer** pBuffer);
+
+/**
+ * @brief Returns the appropriate gralloc usage flag based on
+ * the given Vulkan device, image format, and image usage flag.
+ *
+ * @syscap SystemCapability.Graphic.Vulkan
+ * @param device VkDevice instance.
+ * @param format Image format.
+ * @param imageUsage Image usage flag.
+ * @param grallocUsage Pointer to the gralloc usage flag.
+ * @return Returns VK_SUCCESS if the execution is successful;
+ * returns an error code of the VkResult type otherwise.
+ * @since 10
+ * @version 1.0
+ */
+VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsageOHOS (
+ VkDevice device,
+ VkFormat format,
+ VkImageUsageFlags imageUsage,
+ uint64_t* grallocUsage);
+
+/**
+ * @brief Obtains the ownership of the swap chain image and imports the fence of the external signal
+ * to the VkSemaphore and VkFence objects.
+ *
+ * @syscap SystemCapability.Graphic.Vulkan
+ * @param device VkDevice instance.
+ * @param image Vulkan image to obtain.
+ * @param nativeFenceFd File descriptor of the native fence.
+ * @param semaphore Vulkan semaphore indicating that the image is available.
+ * @param fence Vulkan fence used for synchronization when the image acquisition is complete.
+ * @return Returns VK_SUCCESS if the execution is successful;
+ * returns an error code of the VkResult type otherwise.
+ * @since 10
+ * @version 1.0
+ */
+VKAPI_ATTR VkResult VKAPI_CALL vkAcquireImageOHOS (
+ VkDevice device,
+ VkImage image,
+ int32_t nativeFenceFd,
+ VkSemaphore semaphore,
+ VkFence fence);
+
+/**
+ * @brief Sends a signal to the system hardware buffer to release an image once it is no longer needed
+ * so that other components can access it.
+ *
+ * @syscap SystemCapability.Graphic.Vulkan
+ * @param queue Handle to the Vulkan queue.
+ * @param waitSemaphoreCount Number of semaphores to wait on.
+ * @param pWaitSemaphores Pointer to the array of semaphores to wait on.
+ * @param images Handle to the Vulkan image to be released.
+ * @param pNativeFenceFd Pointer to the file descriptor of the fence.
+ * @return Returns VK_SUCCESS if the execution is successful;
+ * returns an error code of the VkResult type otherwise.
+ * @since 10
+ * @version 1.0
+ */
+VKAPI_ATTR VkResult VKAPI_CALL vkQueueSignalReleaseImageOHOS (
+ VkQueue queue,
+ uint32_t waitSemaphoreCount,
+ const VkSemaphore* pWaitSemaphores,
+ VkImage image,
+ int32_t* pNativeFenceFd);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/en/native_sdk/hid/hid_ddk_api.h b/en/native_sdk/hid/hid_ddk_api.h
new file mode 100644
index 0000000000000000000000000000000000000000..83e830b56ca4085b40325660f00d077dc49fbb4a
--- /dev/null
+++ b/en/native_sdk/hid/hid_ddk_api.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef HID_DDK_API_H
+#define HID_DDK_API_H
+
+/**
+ * @addtogroup HidDdk
+ * @{
+ *
+ * @brief Provides HID DDK interfaces, including creating a device, sending an event, and destroying a device.
+ *
+ * @syscap SystemCapability.Driver.HID.Extension
+ * @since 11
+ * @version 1.0
+ */
+
+/**
+ * @file hid_ddk_api.h
+ *
+ * @brief Declares the HID DDK interfaces for the host to access an input device.
+ *
+ * File to include:
+ * @since 11
+ * @version 1.0
+ */
+
+#include
+#include "hid_ddk_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @brief Creates a device.
+ *
+ * @permission ohos.permission.ACCESS_DDK_HID
+ * @param hidDevice Pointer to the basic information required for creating a device, including the device name,
+ * vendor ID, and product ID.
+ * @param hidEventProperties Pointer to the events of the device to be observed, including the event type and
+ * properties of the key event, absolute coordinate event, and relative coordinate event.
+ * @return Returns the device ID (a non-negative number) if the operation is successful;
+ * returns a negative number otherwise.
+ * @since 11
+ * @version 1.0
+ */
+int32_t OH_Hid_CreateDevice(HidDevice *hidDevice, HidEventProperties *hidEventProperties);
+
+/**
+ * @brief Sends an event list to a device.
+ *
+ * @permission ohos.permission.ACCESS_DDK_HID
+ * @param deviceId ID of the device, to which the event list is sent.
+ * @param items List of events to sent. The event information includes the event type (HidEventType),
+ * event code (HidSynEvent for a synchronization event code, HidKeyCode for a key code, HidBtnCode
+ * for a button code, HidAbsAxes for an absolute coordinate code, HidRelAxes
+ * for a relative coordinate event, and HidMscEvent for other input event code), and value input by the device.
+ * @param length Length of the event list (number of events sent at a time).
+ * @return Returns 0 if the operation is successful; returns a negative number otherwise.
+ * @since 11
+ * @version 1.0
+ */
+int32_t OH_Hid_EmitEvent(int32_t deviceId, const EmitItem items[], uint16_t length);
+
+/**
+ * @brief Destroys a device.
+ *
+ * @permission ohos.permission.ACCESS_DDK_HID
+ * @param deviceId ID of the device to destroy.
+ * @return Returns 0 if the operation is successful; returns a negative number otherwise.
+ * @since 11
+ * @version 1.0
+ */
+int32_t OH_Hid_DestroyDevice(int32_t deviceId);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // HID_DDK_API_H
diff --git a/en/native_sdk/hid/hid_ddk_types.h b/en/native_sdk/hid/hid_ddk_types.h
new file mode 100644
index 0000000000000000000000000000000000000000..766b3721f7c8da39cc847072a0d71f4533193868
--- /dev/null
+++ b/en/native_sdk/hid/hid_ddk_types.h
@@ -0,0 +1,590 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HID_DDK_TYPES_H
+#define HID_DDK_TYPES_H
+/**
+ * @addtogroup HidDdk
+ * @{
+ *
+ * @brief Provides HID DDK interfaces, including creating a device, sending an event, and destroying a device.
+ *
+ * @syscap SystemCapability.Driver.HID.Extension
+ * @since 11
+ * @version 1.0
+ */
+
+/**
+ * @file hid_ddk_types.h
+ *
+ * @brief Provides definitions of enum variables and structs in the HID DDK.
+ *
+ * File to include:
+ * @since 11
+ * @version 1.0
+ */
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @brief Defines event information.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct EmitItem {
+ /** Event type */
+ uint16_t type;
+ /** Event code */
+ uint16_t code;
+ /** Event value */
+ uint32_t value;
+} EmitItem;
+
+/**
+ * @brief Enumerates the input devices.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef enum {
+ /** Pointer device */
+ HID_PROP_POINTER = 0x00,
+ /** Direct input device */
+ HID_PROP_DIRECT = 0x01,
+ /** Touch device with bottom keys */
+ HID_PROP_BUTTONPAD = 0x02,
+ /** Full multi-touch device */
+ HID_PROP_SEMI_MT = 0x03,
+ /** Touch device with top soft keys */
+ HID_PROP_TOPBUTTONPAD = 0x04,
+ /** Pointing stick */
+ HID_PROP_POINTING_STICK = 0x05,
+ /** Accelerometer */
+ HID_PROP_ACCELEROMETER = 0x06
+} HidDeviceProp;
+
+/**
+ * @brief Defines the basic device information.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct HidDevice {
+ /** Device name */
+ const char *deviceName;
+ /** Vendor ID */
+ uint16_t vendorId;
+ /** Product ID */
+ uint16_t productId;
+ /** Version */
+ uint16_t version;
+ /** Bus type */
+ uint16_t bustype;
+ /** Device properties */
+ HidDeviceProp *properties;
+ /** Number of device properties */
+ uint16_t propLength;
+} HidDevice;
+
+/**
+ * @brief Enumerates the event types.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef enum {
+ /** Synchronization event */
+ HID_EV_SYN = 0x00,
+ /** Key event */
+ HID_EV_KEY = 0x01,
+ /** Relative coordinate event */
+ HID_EV_REL = 0x02,
+ /** Absolute coordinate event */
+ HID_EV_ABS = 0x03,
+ /** Other special event */
+ HID_EV_MSC = 0x04
+} HidEventType;
+
+/**
+ * @brief Enumerates the synchronization event codes.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef enum {
+ /** Indicates the end of an event. */
+ HID_SYN_REPORT = 0,
+ /** Indicates configuration synchronization. */
+ HID_SYN_CONFIG = 1,
+ /** Indicates the end of a multi-touch ABS data packet. */
+ HID_SYN_MT_REPORT = 2,
+ /** Indicates that the event is discarded. */
+ HID_SYN_DROPPED = 3
+} HidSynEvent;
+
+/**
+ * @brief Enumerates the key value codes.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef enum {
+ /** Key A */
+ HID_KEY_A = 30,
+ /** Key B */
+ HID_KEY_B = 48,
+ /** Key C */
+ HID_KEY_C = 46,
+ /** Key D */
+ HID_KEY_D = 32,
+ /** Key E */
+ HID_KEY_E = 18,
+ /** Key F */
+ HID_KEY_F = 33,
+ /** Key G */
+ HID_KEY_G = 34,
+ /** Key H */
+ HID_KEY_H = 35,
+ /** Key I */
+ HID_KEY_I = 23,
+ /** Key J */
+ HID_KEY_J = 36,
+ /** Key K */
+ HID_KEY_K = 37,
+ /** Key L */
+ HID_KEY_L = 38,
+ /** Key M */
+ HID_KEY_M = 50,
+ /** Key N */
+ HID_KEY_N = 49,
+ /** Key O */
+ HID_KEY_O = 24,
+ /** Key P */
+ HID_KEY_P = 25,
+ /** Key Q */
+ HID_KEY_Q = 16,
+ /** Key R */
+ HID_KEY_R = 19,
+ /** Key S */
+ HID_KEY_S = 31,
+ /** Key T */
+ HID_KEY_T = 20,
+ /** Key U */
+ HID_KEY_U = 22,
+ /** Key V */
+ HID_KEY_V = 47,
+ /** Key W */
+ HID_KEY_W = 17,
+ /** Key X */
+ HID_KEY_X = 45,
+ /** Key Y */
+ HID_KEY_Y = 21,
+ /** Key Z */
+ HID_KEY_Z = 44,
+ /** Key 0 */
+ HID_KEY_0 = 11,
+ /** Key 1 */
+ HID_KEY_1 = 2,
+ /** Key 2 */
+ HID_KEY_2 = 3,
+ /** Key 3 */
+ HID_KEY_3 = 4,
+ /** Key 4 */
+ HID_KEY_4 = 5,
+ /** Key 5 */
+ HID_KEY_5 = 6,
+ /** Key 6 */
+ HID_KEY_6 = 7,
+ /** Key 7 */
+ HID_KEY_7 = 8,
+ /** Key 8 */
+ HID_KEY_8 = 9,
+ /** Key 9 */
+ HID_KEY_9 = 10,
+ /** Key grave (`) */
+ HID_KEY_GRAVE = 41,
+ /** Key minum (-) */
+ HID_KEY_MINUS = 12,
+ /** Key equals (=) */
+ HID_KEY_EQUALS = 13,
+ /** Key left bracket ([) */
+ HID_KEY_LEFT_BRACKET = 26,
+ /** Key right bracket (]) */
+ HID_KEY_RIGHT_BRACKET = 27,
+ /** Key backslash (\) */
+ HID_KEY_BACKSLASH = 43,
+ /** Key semicolon (;) */
+ HID_KEY_SEMICOLON = 39,
+ /** Key apostrophe (') */
+ HID_KEY_APOSTROPHE = 40,
+ /** Key slash (/) */
+ HID_KEY_SLASH = 53,
+ /** Key comma (,) */
+ HID_KEY_COMMA = 51,
+ /** Key period (.) */
+ HID_KEY_PERIOD = 52,
+ /** Numeral 0 on the numeric keypad */
+ HID_KEY_NUMPAD_0 = 82,
+ /** Numeral 1 on the numeric keypad */
+ HID_KEY_NUMPAD_1 = 79,
+ /** Numeral 2 on the numeric keypad */
+ HID_KEY_NUMPAD_2 = 80,
+ /** Numeral 3 on the numeric keypad */
+ HID_KEY_NUMPAD_3 = 81,
+ /** Numeral 4 on the numeric keypad */
+ HID_KEY_NUMPAD_4 = 75,
+ /** Numeral 5 on the numeric keypad */
+ HID_KEY_NUMPAD_5 = 76,
+ /** Numeral 6 on the numeric keypad*/
+ HID_KEY_NUMPAD_6 = 77,
+ /** Numeral 7 on the numeric keypad */
+ HID_KEY_NUMPAD_7 = 71,
+ /** Numeral 8 on the numeric keypad */
+ HID_KEY_NUMPAD_8 = 72,
+ /** Numeral 9 on the numeric keypad */
+ HID_KEY_NUMPAD_9 = 73,
+ /** Arithmetic operator / (division) on the numeric keypad */
+ HID_KEY_NUMPAD_DIVIDE = 70,
+ /** Arithmetic operator * (multiplication) on the numeric keypad */
+ HID_KEY_NUMPAD_MULTIPLY = 55,
+ /** Arithmetic operator - (subtraction) on the numeric keypad */
+ HID_KEY_NUMPAD_SUBTRACT = 74,
+ /** Arithmetic operator + (addition) on the numeric keypad */
+ HID_KEY_NUMPAD_ADD = 78,
+ /** Decimal point (.) on the numeric keypad */
+ HID_KEY_NUMPAD_DOT = 83
+} HidKeyCode;
+
+/**
+ * @brief Enumerates the button codes.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef enum {
+ /** Button 0 */
+ HID_BTN_0 = 0x100,
+ /** Button 1 */
+ HID_BTN_1 = 0x101,
+ /** Button 2 */
+ HID_BTN_2 = 0x102,
+ /** Button 3 */
+ HID_BTN_3 = 0x103,
+ /** Button 4 */
+ HID_BTN_4 = 0x104,
+ /** Button 5 */
+ HID_BTN_5 = 0x105,
+ /** Button 6 */
+ HID_BTN_6 = 0x106,
+ /** Button 7 */
+ HID_BTN_7 = 0x107,
+ /** Button 8 */
+ HID_BTN_8 = 0x108,
+ /** Button 9 */
+ HID_BTN_9 = 0x109,
+ /** Left mouse button */
+ HID_BTN_LEFT = 0x110,
+ /** Right mouse button */
+ HID_BTN_RIGHT = 0x111,
+ /** Middle mouse button */
+ HID_BTN_MIDDLE = 0x112,
+ /** Side mouse button */
+ HID_BTN_SIDE = 0x113,
+ /** Extra mouse button */
+ HID_BTN_EXTRA = 0x114,
+ /** Mouse forward button */
+ HID_BTN_FORWARD = 0x115,
+ /** Mouse backward button */
+ HID_BTN_BACK = 0x116,
+ /** Mouse task button */
+ HID_BTN_TASK = 0x117,
+ /** Pen */
+ HID_BTN_TOOL_PEN = 0x140
+ /** Rubber */
+ HID_BTN_TOOL_RUBBER = 0x141
+ /** Brush */
+ HID_BTN_TOOL_BRUSH = 0x142
+ /** Pencil */
+ HID_BTN_TOOL_PENCIL = 0x143
+ /** Air brush */
+ HID_BTN_TOOL_AIRBRUSH = 0x144
+ /** Finger */
+ HID_BTN_TOOL_FINGER = 0x145
+ /** Mouse */
+ HID_BTN_TOOL_MOUSE = 0x146
+ /** Lens */
+ HID_BTN_TOOL_LENS = 0x147
+ /** Five-finger touch */
+ HID_BTN_TOOL_QUINTTAP = 0x148
+ /** Stylus 3 */
+ HID_BTN_STYLUS3 = 0x149
+ /** Touch */
+ HID_BTN_TOUCH = 0x14a
+ /** Stylus */
+ HID_BTN_STYLUS = 0x14b
+ /** Stylus 2 */
+ HID_BTN_STYLUS2 = 0x14c
+ /** Two-finger touch */
+ HID_BTN_TOOL_DOUBLETAP = 0x14d
+ /** Three-finger touch */
+ HID_BTN_TOOL_TRIPLETAP = 0x14e
+ /** Four-finger touch */
+ HID_BTN_TOOL_QUADTAP = 0x14f
+ /** Scroll wheel */
+ HID_BTN_WHEEL = 0x150
+} HidBtnCode;
+
+/**
+ * @brief Enumerates the absolute coordinate codes.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef enum {
+ /** X axis */
+ HID_ABS_X = 0x00,
+ /** Y axis */
+ HID_ABS_Y = 0x01,
+ /** Z axis */
+ HID_ABS_Z = 0x02,
+ /** X axis of the right analog stick */
+ HID_ABS_RX = 0x03,
+ /** Y axis of the right analog stick */
+ HID_ABS_RY = 0x04,
+ /** Z axis of the right analog stick */
+ HID_ABS_RZ = 0x05,
+ /** Throttle */
+ HID_ABS_THROTTLE = 0x06,
+ /** Rudder */
+ HID_ABS_RUDDER = 0x07,
+ /** Scroll wheel */
+ HID_ABS_WHEEL = 0x08,
+ /** Gas */
+ HID_ABS_GAS = 0x09,
+ /** Brake */
+ HID_ABS_BRAKE = 0x0a,
+ /** HAT0X */
+ HID_ABS_HAT0X = 0x10,
+ /** HAT0Y */
+ HID_ABS_HAT0Y = 0x11,
+ /** HAT1X */
+ HID_ABS_HAT1X = 0x12,
+ /** HAT1Y */
+ HID_ABS_HAT1Y = 0x13,
+ /** HAT2X */
+ HID_ABS_HAT2X = 0x14,
+ /** HAT2Y */
+ HID_ABS_HAT2Y = 0x15,
+ /** HAT3X */
+ HID_ABS_HAT3X = 0x16,
+ /** HAT3Y */
+ HID_ABS_HAT3Y = 0x17,
+ /** Pressure */
+ HID_ABS_PRESSURE = 0x18,
+ /** Distance */
+ HID_ABS_DISTANCE = 0x19,
+ /** Inclination of X axis */
+ HID_ABS_TILT_X = 0x1a,
+ /** Inclination of Y axis */
+ HID_ABS_TILT_Y = 0x1b,
+ /** Width of the touch tool */
+ HID_ABS_TOOL_WIDTH = 0x1c,
+ /** Volume */
+ HID_ABS_VOLUME = 0x20,
+ /** Others */
+ HID_ABS_MISC = 0x28
+} HidAbsAxes;
+
+/**
+ * @brief Enumerates the relative coordinate codes.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef enum {
+ /** X axis */
+ HID_REL_X = 0x00,
+ /** Y axis */
+ HID_REL_Y = 0x01,
+ /** Z axis */
+ HID_REL_Z = 0x02,
+ /** X axis of the right analog stick */
+ HID_REL_RX = 0x03,
+ /** Y axis of the right analog stick */
+ HID_REL_RY = 0x04,
+ /** Z axis of the right analog stick */
+ HID_REL_RZ = 0x05,
+ /** Horizontal scroll wheel */
+ HID_REL_HWHEEL = 0x06,
+ /** Scale */
+ HID_REL_DIAL = 0x07,
+ /** Scroll wheel */
+ HID_REL_WHEEL = 0x08,
+ /** Others */
+ HID_REL_MISC = 0x09,
+ /* Reserved */
+ HID_REL_RESERVED = 0x0a,
+ /** High-resolution scroll wheel */
+ HID_REL_WHEEL_HI_RES = 0x0b,
+ /** High-resolution horizontal scroll wheel */
+ HID_REL_HWHEEL_HI_RES = 0x0c
+} HidRelAxes;
+
+/**
+ * @brief Enumerates the codes of other input events.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef enum {
+ /** Serial number */
+ HID_MSC_SERIAL = 0x00,
+ /** Pulse */
+ HID_MSC_PULSELED = 0x01,
+ /** Gesture */
+ HID_MSC_GESTURE = 0x02,
+ /** Start event */
+ HID_MSC_RAW = 0x03,
+ /** Scan */
+ HID_MSC_SCAN = 0x04,
+ /** Timestamp */
+ HID_MSC_TIMESTAMP = 0x05
+} HidMscEvent;
+
+/**
+ * @brief Defines an array of the event type codes.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct HidEventTypeArray {
+ /** Event type code */
+ HidEventType *hidEventType;
+ /** Length of the array */
+ uint16_t length;
+} HidEventTypeArray;
+
+/**
+ * @brief Defines an array of key value properties.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct HidKeyCodeArray {
+ /** Key value code */
+ HidKeyCode *hidKeyCode;
+ /** Length of the array */
+ uint16_t length;
+} HidKeyCodeArray;
+
+/**
+ * @brief Defines an array of absolute coordinate properties.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct HidAbsAxesArray {
+ /** Absolute coordinate property code */
+ HidAbsAxes *hidAbsAxes;
+ /** Length of the array */
+ uint16_t length;
+} HidAbsAxesArray;
+
+/**
+ * @brief Defines an array of relative coordinate properties.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct HidRelAxesArray {
+ /** Relative coordinate property code */
+ HidRelAxes *hidRelAxes;
+ /** Length of the array */
+ uint16_t length;
+} HidRelAxesArray;
+
+/**
+ * @brief Defines an array of other special event properties.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct HidMscEventArray {
+ /** Code of the event property */
+ HidMscEvent *hidMscEvent;
+ /** Length of the array */
+ uint16_t length;
+} HidMscEventArray;
+
+/**
+ * @brief Defines the event properties of a device to be observed.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef struct HidEventProperties {
+ /** Array of event type codes */
+ struct HidEventTypeArray hidEventTypes;
+ /** Array of key value codes */
+ struct HidKeyCodeArray hidKeys;
+ /** Array of absolute coordinate property codes */
+ struct HidAbsAxesArray hidAbs;
+ /** Array of relative coordinate property codes */
+ struct HidRelAxesArray hidRelBits;
+ /** Array of other event property codes */
+ struct HidMscEventArray hidMiscellaneous;
+
+ /** Maximum values of the absolute coordinates */
+ int32_t hidAbsMax[64];
+ /** Minimum values of the absolute coordinates */
+ int32_t hidAbsMin[64];
+ /** Fuzzy values of the absolute coordinates */
+ int32_t hidAbsFuzz[64];
+ /** Fixed values of the absolute coordinates */
+ int32_t hidAbsFlat[64];
+} HidEventProperties;
+
+/**
+ * @brief Defines the error codes used in the HID DDK.
+ *
+ * @since 11
+ * @version 1.0
+ */
+typedef enum {
+ /** Operation successful */
+ HID_DDK_SUCCESS = 0,
+ /** Operation failed */
+ HID_DDK_FAILED = -1,
+ /** Invalid parameter */
+ HID_DDK_INVALID_PARAMETER = -2,
+ /** Invalid operation */
+ HID_DDK_INVALID_OPERATION = -3,
+ /** Null pointer exception */
+ HID_DDK_NULL_PTR = -4,
+ /** Timeout */
+ HID_DDK_TIMEOUT = -5,
+ /** Permission denied */
+ HID_DDK_NO_PERM = -6
+} HidDdkErrCode;
+#ifdef __cplusplus
+}
+/** @} */
+#endif /* __cplusplus */
+#endif // HID_DDK_TYPES_H
diff --git a/en/native_sdk/input/oh_input_manager.h b/en/native_sdk/input/oh_input_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..e49b4ab2838b043a18b4e41f16ef7efb1efece32
--- /dev/null
+++ b/en/native_sdk/input/oh_input_manager.h
@@ -0,0 +1,885 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OH_INPUT_MANAGER_H
+#define OH_INPUT_MANAGER_H
+
+/**
+ * @addtogroup input
+ * @{
+ *
+ * @brief Provides C APIs for the multimodal input module.
+ *
+ * @since 12
+ */
+
+/**
+ * @file oh_input_manager.h
+ *
+ * @brief Provides functions such as event injection and status query.
+ *
+ * @syscap SystemCapability.MultimodalInput.Input.Core
+ * @library libohinput.so
+ * @since 12
+ */
+
+#include