User interface drawing method and device and medium
By determining the configuration information of the application to determine the target drawing method of user interface drawing, the problem of large-scale workload of modifying the UI drawing method of view control one by one in the prior art is solved, and global modification adaptation of the user interface and performance optimization of Android Framework are realized.
Patent Information
- Application Number
- CN202311398373.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-25
- Publication Date
- 2025-04-25
AI Technical Summary
In the prior art, developers need to modify the UI drawing method of each view control in the APP one by one, resulting in huge workload and introduce problems to the implementation of the system framework.
Determine the target drawing method used to implement user interface drawing by determining the configuration information of the application, including the configuration and drawing status of the target drawing attributes of the global attributes and the view control.
There is no need to modify the UI drawing method of each view control one by one, and the global modification and adaptation of the user interface is realized through the configuration of the target drawing attributes, which reduces the application's adaptation workload and optimizes the functional implementation and performance of the target drawing attributes of the Android Framework.
Smart Images

Figure CN119887995A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a user interface drawing method, device and medium. Background Art
[0002] The client's user interface (UI) is the object that users operate when they interact with the client. Due to the need for business flexibility, target drawing properties (such as the rounded corners of a rounded rectangle) are effective for a single view control. Currently, developers are required to modify the UI drawing method of each view control in the APP (Application) one by one, which is not only a huge workload for the implementation of the APP, but also introduces many problems to the implementation of the system framework. Summary of the invention
[0003] In order to overcome the problems existing in the related art, the present disclosure provides a user interface drawing method, device and medium.
[0004] According to a first aspect of an embodiment of the present disclosure, a user interface drawing method is provided, including:
[0005] Determining first configuration information of an application, wherein the first configuration information is used to indicate a configuration state of a target drawing attribute in a global attribute of the application;
[0006] Determine second configuration information and third configuration information of a view control in the application, wherein the second configuration information is used to indicate a configuration state of a target drawing attribute of the view control, and the third configuration information is used to indicate a drawing state of the target drawing attribute of the view control;
[0007] A target drawing method for implementing user interface drawing of the application is determined according to the first configuration information, the second configuration information, and the third configuration information.
[0008] Optionally, determining a target drawing method for implementing user interface drawing of the application program according to the first configuration information, the second configuration information, and the third configuration information includes:
[0009] Determine a target state value according to the first configuration information, the second configuration information and the third configuration information;
[0010] According to the corresponding relationship between the preset state value and the drawing method, a target drawing method corresponding to the target state value is determined.
[0011] Optionally, determining a target state value according to the first configuration information, the second configuration information, and the third configuration information includes:
[0012] If the third configuration information indicates that the drawing state of the target drawing attribute of the view control is a drawing-allowed state, the target state value is determined according to the first configuration information and the second configuration information.
[0013] Optionally, the method further comprises:
[0014] If the third configuration information indicates that the drawing state of the target drawing attribute of the view control is a drawing-not-allowed state, the first value is determined as the target state value.
[0015] Optionally, determining the target state value according to the first configuration information and the second configuration information includes:
[0016] If the first configuration information indicates that the configuration state of the target drawing attribute in the application global attribute is not configured, the target state value is determined according to the second configuration information.
[0017] Optionally, determining the target state value according to the second configuration information includes:
[0018] If the second configuration information indicates that the configuration state of the target drawing attribute of the view control is not configured, determining the first value as the target state value;
[0019] If the second configuration information indicates that the configuration state of the target drawing attribute of the view control is configured, the second numerical value is determined as the target state value.
[0020] Optionally, the method further comprises:
[0021] If the third configuration information indicates that the drawing state of the target drawing attribute of the view control is the drawing allowed state, and the first configuration information indicates that the configuration state of the target drawing attribute in the application global properties is configured, then the second value is determined as the target state value, and the second value is different from the first value.
[0022] Optionally, determining a target drawing method corresponding to the target state value according to a correspondence between a preset state value and a drawing method includes:
[0023] If the target state value is a first value, determining a first drawing method corresponding to the target drawing attribute as the target drawing method;
[0024] If the target state value is a second value, a second drawing method corresponding to the target drawing attribute is determined as the target drawing method, and the second drawing method is different from the first drawing method.
[0025] Optionally, the target drawing object of the target drawing attribute is a rounded corner; and the second drawing method corresponding to the target drawing attribute includes:
[0026] Determine target fillet information of the fillet to be drawn of the image to be processed;
[0027] According to the target rounded corner information, determine a target mask image and a target area image in the image to be processed, wherein the target mask image includes pixel change information of the rounded corner to be drawn, and the target area image is an area image in the image to be processed that needs to be rounded;
[0028] A rounded corner image of the image to be processed is determined according to the target area image and the target mask image.
[0029] According to a second aspect of an embodiment of the present disclosure, there is provided a user interface drawing device, including:
[0030] A first determining module, used to determine first configuration information of an application, wherein the first configuration information is used to indicate a configuration state of a target drawing attribute in a global attribute of the application;
[0031] A second determining module is used to determine second configuration information and third configuration information of a view control in the application, wherein the second configuration information is used to indicate a configuration state of a target drawing attribute of the view control, and the third configuration information is used to indicate a drawing state of the target drawing attribute of the view control;
[0032] The third determining module is used to determine a target drawing method for implementing user interface drawing of the application program according to the first configuration information, the second configuration information and the third configuration information.
[0033] Optionally, the third determining module includes:
[0034] A first determination submodule, configured to determine a target state value according to the first configuration information, the second configuration information, and the third configuration information;
[0035] The second determining submodule is used to determine a target drawing method corresponding to the target state value according to a preset correspondence relationship between the state value and the drawing method.
[0036] Optionally, the first determining submodule includes:
[0037] The third determination submodule is used to determine the target state value according to the first configuration information and the second configuration information if the third configuration information indicates that the drawing state of the target drawing attribute of the view control is a drawing-allowed state.
[0038] Optionally, the device further comprises:
[0039] The fourth determination module is used to determine the first value as the target state value if the third configuration information indicates that the drawing state of the target drawing attribute of the view control is a drawing-not-allowed state.
[0040] Optionally, the third determining submodule includes:
[0041] The fourth determining submodule is configured to determine the target state value according to the second configuration information if the first configuration information indicates that the configuration state of the target drawing attribute in the application global attribute is not configured.
[0042] Optionally, the fourth determining submodule includes:
[0043] a fifth determining submodule, configured to determine the first value as the target state value if the second configuration information indicates that the configuration state of the target drawing attribute of the view control is not configured;
[0044] The sixth determination submodule is used to determine the second numerical value as the target state value if the second configuration information indicates that the configuration state of the target drawing attribute of the view control is configured.
[0045] Optionally, the device further comprises:
[0046] A fifth determination module is used to determine a second numerical value as the target state value if the third configuration information indicates that the drawing state of the target drawing attribute of the view control is a drawing-allowed state, and the first configuration information indicates that the configuration state of the target drawing attribute in the application global properties is configured, and the second numerical value is different from the first numerical value.
[0047] Optionally, the second determining submodule is used to determine the target drawing method corresponding to the target state value in the following manner:
[0048] If the target state value is a first value, determining a first drawing method corresponding to the target drawing attribute as the target drawing method;
[0049] If the target state value is a second value, a second drawing method corresponding to the target drawing attribute is determined as the target drawing method, and the second drawing method is different from the first drawing method.
[0050] Optionally, the target drawing object of the target drawing attribute is a rounded corner; and the second drawing method corresponding to the target drawing attribute includes:
[0051] Determine target fillet information of the fillet to be drawn of the image to be processed;
[0052] According to the target rounded corner information, determine a target mask image and a target area image in the image to be processed, wherein the target mask image includes pixel change information of the rounded corner to be drawn, and the target area image is an area image in the image to be processed that needs to be rounded;
[0053] A rounded corner image of the image to be processed is determined according to the target area image and the target mask image.
[0054] According to a third aspect of an embodiment of the present disclosure, there is provided a user interface drawing device, including:
[0055] processor;
[0056] a memory for storing processor-executable instructions;
[0057] The processor is configured to execute the steps of the user interface drawing method provided in the first aspect of the present disclosure.
[0058] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the program instructions are executed by a processor, the steps of the user interface drawing method provided in the first aspect of the present disclosure are implemented.
[0059] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0060] Determine the first configuration information of the application, the first configuration information is used to indicate the configuration state of the target drawing attribute in the global attributes of the application; determine the second configuration information and the third configuration information of the view control in the application, the second configuration information is used to indicate the configuration state of the target drawing attribute of the view control, and the third configuration information is used to indicate the drawing state of the new interface style of the view control; according to the first configuration information, the second configuration information and the third configuration information, determine the target drawing method for implementing the user interface drawing of the application. In this way, there is no need to modify the UI drawing method of each view control one by one. Through the configuration of the target drawing attribute, the global modification adaptation of the user interface can be achieved, which can reduce the adaptation workload of the application on the one hand, and on the other hand, it also reduces the workload of the function implementation and performance optimization of the target drawing attribute of the Android Framework.
[0061] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0063] Figure 1 The figure is a flowchart of a method for drawing a user interface according to an exemplary embodiment.
[0064] Figure 2 is a flowchart of a second drawing method according to an exemplary embodiment.
[0065] Figure 3 The diagram is an interaction diagram among ViewRootImpl, view control, RecordingCanvas and HWUI according to an exemplary embodiment.
[0066] Figure 4 The figure is a block diagram of a user interface drawing device according to an exemplary embodiment.
[0067] Figure 5 The figure is a block diagram of a user interface drawing device according to an exemplary embodiment. DETAILED DESCRIPTION
[0068] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0069] It should be noted that all actions to determine signals, information or data in the present disclosure are performed in compliance with the relevant data protection laws and policies of the country where they are located and with the authorization given by the owner of the corresponding device.
[0070] Figure 1 FIG. 1 is a flowchart of a method for drawing a user interface according to an exemplary embodiment. The method can be applied to terminal devices such as mobile phones, tablet computers, vehicles, and televisions. Figure 1 As shown, the method may include S101 to S103.
[0071] S101, determining first configuration information of an application program, where the first configuration information is used to indicate a configuration state of a target drawing attribute in a global attribute of the application program.
[0072] For example, the target drawing attribute can be a new attribute of the target drawing object, which can be used to indicate that the drawing method corresponding to the target drawing object is newly added. The target drawing object can include the rounded corners of a rounded rectangle, or can include the edges of a rectangle, which is not limited here. The configuration state of the first configuration information can indicate whether the target drawing attribute is globally configured for the application. For example, the global configuration file (such as AndroidManifest.xml) of the application of the terminal device can be obtained. If the global configuration file includes the target drawing attribute, it can be determined that the first configuration information indicates that the target drawing attribute is configured in the global attribute of the application. At this time, the value of the first configuration information flag1 can be determined to be true; if the global configuration file does not include the target drawing attribute, it can be determined that the first configuration information indicates that the target drawing attribute is not configured in the global attribute of the application. At this time, the value of the first configuration information flag1 can be determined to be false. Specifically, ViewRootImpl in WMS (Window MangerServices) can read the AndroidManifest.xml of the APP when the APP is initialized, and determine whether the target drawing attribute is included in the AndroidManifest.xml to determine the value of the first configuration information flag1. Whenever the view component refreshes the view, the value of the first configuration information flag1 may be re-determined. The WMS may send the determined first configuration information to each view control under the APP.
[0073] S102, determining second configuration information and third configuration information of a view control in the application, the second configuration information is used to indicate a configuration state of a target drawing attribute of the view control, and the third configuration information is used to indicate a drawing state of a target drawing attribute of the view control.
[0074] For example, the configuration status in the second configuration information may indicate whether the target drawing attribute is configured for the view control, and the drawing status of the third configuration information may indicate whether the drawing style corresponding to the target drawing attribute is allowed for the view control. For each view control in the APP, the enable information can be obtained by calling the enable interface corresponding to the target drawing attribute, and the second configuration information and the third configuration information of the view control can be determined according to the enable information. For example, the enable interface corresponding to the target drawing attribute in the view or Drawable can be called so that the view control can obtain the enable information through the enable interface, and then determine its second configuration information and the third configuration information. Before the enable information is received, the default value of the third configuration information flag3 can be false. Before the enable information is received, the default value of the second configuration information flag2 can be true or false.
[0075] If the value of flag2 is true, it can be determined that the second configuration information indicates that the configuration status of the target drawing attribute of the view control is configured, that is, the target drawing attribute is configured for the view control; if the value of flag2 is false, it can be determined that the second configuration information indicates that the configuration status of the target drawing attribute of the view control is not configured, that is, the target drawing attribute is not configured for the view control.
[0076] If the value of flag3 is true, it can be determined that the third configuration information indicates that the drawing state of the target drawing attribute of the view control is a drawing-not-allowed state, that is, the drawing style corresponding to the target drawing attribute is not allowed for the view control; if the value of flag3 is false, it can be determined that the third configuration information indicates that the drawing state of the target drawing attribute of the view control is a drawing-allowed state, that is, the drawing style corresponding to the target drawing attribute is allowed for the view control.
[0077] The enable information can be true or false. In an optional embodiment, for each view control in the APP, the enable information can be obtained through an interface, and the second configuration information and the third configuration information can be determined at the same time. For example, if the enable information is true, it can be determined that the value of the second configuration information flag2 is true, and the value of the third configuration information flag3 is still the default value false; if the enable information is false, it can be determined that the value of the second configuration information flag2 is still the default value, such as false, and the value of the third configuration information flag3 is true. In another optional embodiment, for each view control in the APP, the second configuration information and the third configuration information can also be obtained through two different interfaces respectively, such as directly inputting the value of flag2 through the first interface and inputting the value of flag3 through the second interface. Compared with the first configuration information and the second configuration information, the third configuration information has a higher priority.
[0078] APP can choose to configure global properties in AndroidManifest.xml; or choose not to enable global properties but enable the function of applying new UI drawing methods for individual view controls, that is, allow individual view controls to implement the drawing style corresponding to the target drawing properties; or, enable global properties but disable the function of applying new UI drawing methods for individual view controls, that is, allow other view controls except individual view controls to implement the drawing style corresponding to the target drawing properties. The third configuration information can be used to forcibly disable the function of applying new UI drawing methods for individual view controls when the target drawing properties are globally configured, so as to achieve adaptive modification of the UI. The second configuration information can be used to configure the target drawing properties for individual view controls when the target drawing properties are not globally configured.
[0079] S103: Determine a target drawing method for implementing user interface drawing of the application program according to the first configuration information, the second configuration information, and the third configuration information.
[0080] The target drawing method can be determined by the HWUI (Hardware UI, an Android UI rendering component) of the terminal device from a variety of drawing methods. The target drawing method is a UI drawing method corresponding to the target drawing object. For example, the target drawing method may include a first drawing method and a second drawing method, wherein the first drawing method may be a UI drawing method for the target drawing object previously used by the HWUI; the second drawing method may be a new UI drawing method for the target drawing object that has not been used by the HWUI before. According to the first configuration information, the second configuration information, and the third configuration information, the view control in the APP that applies the new UI drawing method to the target drawing object and the view control that applies the previous UI drawing method to the target drawing object can be determined, and the results are transmitted to the HWUI so that the HWUI can determine the UI drawing method to be adopted by each view component for the target drawing object to achieve the overall drawing of the user interface. In this way, the path from APP to WMS and then to HWUI can be opened. When APP calls the UI drawing method corresponding to the target drawing attribute in HWUI to implement user interface drawing, HWUI can quickly determine the target drawing method to be executed by each view component. There is no need to modify the UI drawing method of each view control one by one. The user interface can be globally modified and adapted by configuring the target drawing attribute. On the one hand, it reduces the adaptation workload of APP, and on the other hand, it also reduces the workload of function implementation and performance optimization of the target drawing attribute of Android Framework.
[0081] In the above technical solution, the first configuration information of the application is determined, and the first configuration information is used to indicate the configuration state of the target drawing attribute in the global attributes of the application; the second configuration information and the third configuration information of the view control in the application are determined, and the second configuration information is used to indicate the configuration state of the target drawing attribute of the view control, and the third configuration information is used to indicate the drawing state of the new interface style of the view control; according to the first configuration information, the second configuration information and the third configuration information, the target drawing method for implementing the user interface drawing of the application is determined. In this way, there is no need to modify the UI drawing method of each view control one by one. Through the configuration of the target drawing attribute, the global modification adaptation of the user interface can be achieved, which can reduce the adaptation workload of the application on the one hand, and on the other hand, it also reduces the workload of the function implementation and performance optimization of the target drawing attribute of the Android Framework.
[0082] In an optional embodiment, in S103, determining a target drawing method for implementing user interface drawing of an application program according to the first configuration information, the second configuration information, and the third configuration information may include:
[0083] Determine a target state value according to the first configuration information, the second configuration information, and the third configuration information;
[0084] According to the correspondence between the preset state value and the drawing method, a target drawing method corresponding to the target state value is determined.
[0085] For example, the view control can determine the target state value state based on the first configuration information flag1, the second configuration information flag2 and the third configuration information flag3, and send the target state value state to the corresponding RecordingCanvas, and then the RecordingCanvas can send the target state value state to the drawing op of the HWUI for recording, so that the HWUI can determine the target drawing method corresponding to the target state value state during the actual drawing process. Among them, each view control can construct two RecordingCanvas, one RecordingCanvas is used for the view control itself, and the other RecordingCanvas is used for the background of the view control. The correspondence between the state value and the drawing method can be preset according to actual needs. In this way, when the target state value is determined, the corresponding target drawing method can be determined.
[0086] In an optional embodiment, determining a target drawing method corresponding to a target state value according to a correspondence between a preset state value and a drawing method may include:
[0087] If the target state value is a first value, a first drawing method corresponding to the target drawing attribute is determined as the target drawing method;
[0088] If the target state value is the second value, the second drawing method corresponding to the target drawing attribute is determined as the target drawing method.
[0089] The second drawing method is different from the first drawing method. The target state value state can be true or false. For example, if the target state value state is true, it can be determined that when the drawing of the target drawing attribute is realized, the target drawing method is the first drawing method; if the target state value state is false, it can be determined that when the drawing of the target drawing attribute is realized, the target drawing method is the second drawing method. That is, the first value is false and the second value is true.
[0090] The first drawing method may be a UI drawing method for the target drawing object previously used by the HWUI. For example, it may be a basic drawing method stored in the HWUI when the terminal device leaves the factory. Taking the rounded corners of a rounded rectangle as an example of a target drawing object, the first drawing method may be to make the radius of the circle tangent to the right angle to achieve rounded corner drawing, or may be to use a path fitted with a Bezier curve to achieve rounded corner drawing.
[0091] The second drawing method may be a new UI drawing method for the target drawing object that has not been used by HWUI before. The target drawing object is still taken as an example of a rounded rectangle with rounded corners, such as Figure 2 As shown, the second drawing method may include:
[0092] S201, determining target fillet information of a fillet to be drawn in an image to be processed;
[0093] S202, determining a target mask image and a target area image in the image to be processed according to the target rounded corner information, wherein the target mask image includes pixel change information of the rounded corner to be drawn, and the target area image is an area image in the image to be processed that needs to be rounded;
[0094] S203: Determine a rounded corner image of the image to be processed according to the target area image and the target mask image.
[0095] For example, the image to be processed may be a rectangular image, which may be a square image or a rectangular image. The fillet to be drawn may be an arc segment of a circle or an arc segment of an ellipse, and the embodiments of the present disclosure do not specifically limit this. The target fillet information may be used to characterize the size of the target texture mapping. When the fillet to be drawn is an arc segment of a circle, the target fillet information is used to characterize the size of the circular radius of the target texture mapping, and when the fillet to be drawn is an arc segment of an ellipse, the target fillet information may be used to characterize the size of the major axis and the minor axis of the target texture mapping.
[0096] When it is necessary to perform rounded corner processing on an image to be processed, one image to be processed may correspond to one rounded corner to be drawn, or may correspond to multiple rounded corners to be drawn. When one image to be processed corresponds to one rounded corner to be drawn, the rounded corner to be drawn may correspond to a target rounded corner information. When one image to be processed corresponds to multiple rounded corners to be drawn, one rounded corner to be drawn may correspond to one target rounded corner information, and multiple rounded corners to be drawn may correspond to multiple target rounded corner information, and the multiple target rounded corner information may be the same or different.
[0097] Then, the target mask image and the target area image can be determined according to the target rounded corner information. Then, the rounded corner image of the image to be processed can be determined according to the target mask image and the target area image. The target mask image can include pixel change information of the rounded corners to be drawn, and the target area image can be the area image that needs to be rounded in the image to be processed.
[0098] The pixel change information may be the specific pixel value corresponding to each pixel point of the fillet to be drawn in the target mask image. In the target mask image, each pixel point corresponds to a specific pixel value, and the pixel values corresponding to different pixels may be partially the same or may be different.
[0099] The target area image may be an area image in the image to be processed where the corners of the image need to be processed into rounded corners. For example, when the image to be processed is a rectangular image, the area image where the corners of the image to be processed are rounded may be an area image where the four right angles of the rectangular image are located.
[0100] By determining the rounded corner image in the image to be processed based on the target mask image with pixel change information and the target area image, the smoothness and anti-aliasing property of the connection between the curve and the straight line in the image to be processed can be improved, and the time for rounding the corners of the image to be processed can be reduced, thereby improving the efficiency of rounding the corners of the image to be processed and improving the user experience at the same time. In addition, the application scenarios for rounding the corners of the image to be processed are increased, such as user interface design scenarios, web page design scenarios, graphic design scenarios, and other application scenarios.
[0101] In the above image processing method, according to the target rounded corner information of the image to be processed, the target area image of the image to be processed and the target mask image with the pixel change information of the rounded corner to be drawn are determined, and according to the target mask image and the target area image, the rounded corner image of the image to be processed is determined. The rounded corner smoothness and anti-aliasing property of the rounded corner image can be improved, and the time for processing the image to be processed can be reduced, thereby improving the efficiency of processing the image to be processed.
[0102] In an optional embodiment, the user interface drawing method provided by the present disclosure may further include:
[0103] If the third configuration information indicates that the drawing state of the target drawing attribute of the view control is a drawing-not-allowed state, the first value is determined as the target state value.
[0104] For example, if the third configuration information indicates that the drawing state of the target drawing attribute of the view control is a drawing-disallowed state, it can be determined that the function of the view control to apply a new UI drawing method to the target drawing object is forcibly turned off, and its target state value state can be determined to be a first value. In the actual UI drawing process, HWUI can determine that the target drawing method corresponding to the view control is the first drawing method, so that the previous UI drawing method can be applied (i.e., the first drawing method is applied).
[0105] In an optional embodiment, determining the target state value according to the first configuration information, the second configuration information, and the third configuration information may include:
[0106] If the third configuration information indicates that the drawing state of the target drawing attribute of the view control is the drawing-allowed state, the target state value is determined according to the first configuration information and the second configuration information.
[0107] For example, if the third configuration information indicates that the drawing state of the target drawing attribute of the view control is the drawing allowed state, it can be determined that the function of the view control to apply the new UI drawing method for the target drawing object is not forcibly closed, and the target state value can be determined based on the first configuration information and the second configuration information, that is, based on whether the target drawing attribute is globally configured and whether the target drawing attribute of the view control is configured (that is, whether the target drawing attribute is locally configured).
[0108] In an optional embodiment, the user interface drawing method provided by the present disclosure may further include:
[0109] If the third configuration information indicates that the drawing state of the target drawing attribute of the view control is the drawing allowed state, and the first configuration information indicates that the configuration state of the target drawing attribute in the application global properties is configured, then the second value is determined as the target state value, and the second value is different from the first value.
[0110] For example, if the third configuration information indicates that the drawing state of the target drawing attribute of the view control is the drawing-allowed state, it can be determined that for the target drawing object, the view control allows the application of a new UI drawing method; if the first configuration information indicates that the configuration state of the target drawing attribute in the application global properties is configured, it can be determined that the target drawing attribute is globally configured, and at this time its target state value state can be determined as the second value true. In this way, HWUI can determine that the target drawing method corresponding to the view control is the second drawing method, so as to apply the new UI drawing method.
[0111] In an optional embodiment, determining the target state value according to the first configuration information and the second configuration information may include:
[0112] If the first configuration information indicates that the configuration state of the target drawing attribute in the application global attribute is not configured, the target state value is determined according to the second configuration information.
[0113] For example, if the third configuration information indicates that the drawing state of the target drawing attribute of the view control is the drawing-allowed state, it can be determined that for the target drawing object, the view control allows the application of a new UI drawing method; if the first configuration information indicates that the configuration state of the target drawing attribute in the application's global properties is not configured, it can be determined that the target drawing attribute is not globally configured. At this time, the target state value can be determined based on the second configuration information, that is, based on whether the target drawing attribute of the view control is configured.
[0114] In an optional embodiment, the target state value is determined according to the second configuration information:
[0115] If the second configuration information indicates that the configuration state of the target drawing attribute of the view control is not configured, determining the first value as the target state value;
[0116] If the second configuration information indicates that the configuration state of the target drawing attribute of the view control is configured, the second value is determined as the target state value.
[0117] For example, if the third configuration information indicates that the drawing state of the target drawing attribute of the view control is the drawing-allowed state, it can be determined that the view control allows the application of a new UI drawing method for the target drawing object; if the first configuration information indicates that the configuration state of the target drawing attribute in the global properties of the application is not configured, it can be determined that the target drawing attribute is not globally configured. In this state, if the second configuration information indicates that the configuration state of the target drawing attribute of the view control is configured, the new UI drawing method of the view control can be used normally for the target drawing object, and the second value true can be determined as the target state value; if the second configuration information indicates that the configuration state of the target drawing attribute of the view control is not configured, it can be determined that during the drawing process, content related to the target drawing attribute is missing, and the new UI drawing method for the target drawing object cannot be used normally, and the first value false can be determined as the target state value.
[0118] Figure 3 is an interaction diagram among ViewRootImpl, view control, RecordingCanvas and HWUI according to an exemplary embodiment. Figure 3 , the implementation process of the user interface drawing method provided by the present disclosure can be more clearly understood. Figure 3 As shown, the method may include S301 to S310.
[0119] S301, ViewRootImpl sends the determined first configuration information to the view control.
[0120] S302, the view control determines the second configuration information and the third configuration information.
[0121] S303, the view control determines whether the third configuration information is true, and if so, executes S307, and if not, executes S304.
[0122] S304, the view control determines whether the first configuration information is true, and if so, executes S306, and if not, executes S305.
[0123] S305, the view control determines whether the second configuration information is true, and if so, executes S306, and if not, executes S307.
[0124] S306, the view control determines that the target state value state is true.
[0125] S307, the view control determines that the target state value state is false.
[0126] S308, the view control sends the determined target state value state to the RecordingCanvas.
[0127] S309, RecordingCanvas sends the received target state value state to HWUI.
[0128] S310, if the target state value state is true, the HWUI determines the target drawing method for implementing the user interface drawing of the application as the first drawing method; if the target state value state is false, the HWUI determines the target drawing method for implementing the user interface drawing of the application as the second drawing method.
[0129] The first configuration information is true, indicating that the configuration state of the target drawing attribute in the application global properties is configured; the second configuration information is true, indicating that the configuration state of the target drawing attribute of the view control is configured; the third configuration information is true, and the drawing state of the target drawing attribute of the view control is not allowed to draw. The first drawing method is the UI drawing method for the target drawing object used by HWUI before, and the second drawing method is the UI drawing method for the target drawing object that was not used by HWUI before.
[0130] In this way, based on the third configuration information, it can be determined whether the view control is forced to close the function of applying the new UI drawing method for the target drawing object. If it is not forced to close, it can be determined that the view control has the possibility of normally applying the new UI drawing method. Afterwards, it can be determined whether the new UI drawing method of the view control can be used normally by first globally and then locally. In this way, HWUI can simply and quickly determine the target drawing method that needs to be called for each view control, and developers do not need to make independent adjustments to the target drawing method of each view control one by one. When implementing user interface drawing, the global modification and adaptation of the user interface can be performed through the configuration of the target drawing attributes. On the one hand, it reduces the adaptation workload of the APP, and on the other hand, it also reduces the workload of the function implementation and performance optimization of the target drawing attributes of the Android Framework.
[0131] Based on the same inventive concept, the present disclosure also provides a user interface drawing device. Figure 4 4 is a block diagram of a user interface drawing device 400 according to an exemplary embodiment. Figure 4 , the user interface drawing device 400 may include:
[0132] A first determining module 401 is used to determine first configuration information of an application program, where the first configuration information is used to indicate a configuration state of a target drawing attribute in a global attribute of the application program;
[0133] A second determining module 402 is used to determine second configuration information and third configuration information of a view control in the application, wherein the second configuration information is used to indicate a configuration state of a target drawing attribute of the view control, and the third configuration information is used to indicate a drawing state of a target drawing attribute of the view control;
[0134] The third determination module 403 is used to determine a target drawing method for implementing user interface drawing of the application program according to the first configuration information, the second configuration information and the third configuration information.
[0135] In the above technical solution, the first configuration information of the application is determined, and the first configuration information is used to indicate the configuration state of the target drawing attribute in the global attributes of the application; the second configuration information and the third configuration information of the view control in the application are determined, and the second configuration information is used to indicate the configuration state of the target drawing attribute of the view control, and the third configuration information is used to indicate the drawing state of the new interface style of the view control; according to the first configuration information, the second configuration information and the third configuration information, the target drawing method for implementing the user interface drawing of the application is determined. In this way, there is no need to modify the UI drawing method of each view control one by one. Through the configuration of the target drawing attribute, the global modification adaptation of the user interface can be achieved, which can reduce the adaptation workload of the application on the one hand, and on the other hand, it also reduces the workload of the function implementation and performance optimization of the target drawing attribute of the Android Framework.
[0136] Optionally, the third determining module 403 includes:
[0137] A first determination submodule, configured to determine a target state value according to the first configuration information, the second configuration information, and the third configuration information;
[0138] The second determining submodule is used to determine a target drawing method corresponding to the target state value according to a preset correspondence relationship between the state value and the drawing method.
[0139] Optionally, the first determining submodule includes:
[0140] The third determination submodule is used to determine the target state value according to the first configuration information and the second configuration information if the third configuration information indicates that the drawing state of the target drawing attribute of the view control is a drawing-allowed state.
[0141] Optionally, the device 400 further includes:
[0142] The fourth determination module is used to determine the first value as the target state value if the third configuration information indicates that the drawing state of the target drawing attribute of the view control is a drawing-not-allowed state.
[0143] Optionally, the third determining submodule includes:
[0144] The fourth determining submodule is configured to determine the target state value according to the second configuration information if the first configuration information indicates that the configuration state of the target drawing attribute in the application global attribute is not configured.
[0145] Optionally, the fourth determining submodule includes:
[0146] a fifth determining submodule, configured to determine the first value as the target state value if the second configuration information indicates that the configuration state of the target drawing attribute of the view control is not configured;
[0147] The sixth determination submodule is used to determine the second numerical value as the target state value if the second configuration information indicates that the configuration state of the target drawing attribute of the view control is configured.
[0148] Optionally, the device 400 further includes:
[0149] A fifth determination module is used to determine a second numerical value as the target state value if the third configuration information indicates that the drawing state of the target drawing attribute of the view control is a drawing-allowed state, and the first configuration information indicates that the configuration state of the target drawing attribute in the application global properties is configured, and the second numerical value is different from the first numerical value.
[0150] Optionally, the second determining submodule is used to determine the target drawing method corresponding to the target state value in the following manner:
[0151] If the target state value is a first value, determining a first drawing method corresponding to the target drawing attribute as the target drawing method;
[0152] If the target state value is a second value, a second drawing method corresponding to the target drawing attribute is determined as the target drawing method, and the second drawing method is different from the first drawing method.
[0153] Optionally, the target drawing object of the target drawing attribute is a rounded corner; and the second drawing method corresponding to the target drawing attribute includes:
[0154] Determine target fillet information of the fillet to be drawn of the image to be processed;
[0155] According to the target rounded corner information, determine a target mask image and a target area image in the image to be processed, wherein the target mask image includes pixel change information of the rounded corner to be drawn, and the target area image is an area image in the image to be processed that needs to be rounded;
[0156] A rounded corner image of the image to be processed is determined according to the target area image and the target mask image.
[0157] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0158] The present disclosure also provides a computer-readable storage medium on which computer program instructions are stored. When the program instructions are executed by a processor, the steps of the user interface drawing method provided by the present disclosure are implemented.
[0159] Figure 5 8 is a block diagram of a user interface drawing device 800 according to an exemplary embodiment. For example, the device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0160] Reference Figure 5 , the device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output interface 812 , a sensor component 814 , and a communication component 816 .
[0161] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0162] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0163] The power supply component 806 provides power to the various components of the device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 800.
[0164] The multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0165] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the device 800 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
[0166] The input / output interface 812 provides an interface between the processing component 802 and the peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0167] The sensor assembly 814 includes one or more sensors for providing various aspects of the status assessment of the device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the device 800, and the sensor assembly 814 can also detect the position change of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration / deceleration of the device 800, and the temperature change of the device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0168] The communication component 816 is configured to facilitate wired or wireless communication between the device 800 and other devices. The device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0169] In an exemplary embodiment, the apparatus 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.
[0170] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by the processor 820 of the device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0171] In another exemplary embodiment, a computer program product is further provided. The computer program product includes a computer program that can be executed by a programmable device. The computer program has a code portion for executing the above-mentioned user interface drawing method when executed by the programmable device.
[0172] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the present disclosure. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0173] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A user interface drawing method, characterized in that: include: Determining first configuration information of an application, wherein the first configuration information is used to indicate a configuration state of a target drawing attribute in a global attribute of the application; Determine second configuration information and third configuration information of a view control in the application, wherein the second configuration information is used to indicate a configuration state of a target drawing attribute of the view control, and the third configuration information is used to indicate a drawing state of the target drawing attribute of the view control; A target drawing method for implementing user interface drawing of the application is determined according to the first configuration information, the second configuration information, and the third configuration information.
2. The user interface drawing method according to claim 1, characterized in that: The determining, according to the first configuration information, the second configuration information and the third configuration information, a target drawing method for implementing user interface drawing of the application program includes: Determine a target state value according to the first configuration information, the second configuration information and the third configuration information; According to the corresponding relationship between the preset state value and the drawing method, a target drawing method corresponding to the target state value is determined.
3. The user interface drawing method according to claim 2, characterized in that: The determining a target state value according to the first configuration information, the second configuration information, and the third configuration information includes: If the third configuration information indicates that the drawing state of the target drawing attribute of the view control is a drawing-allowed state, the target state value is determined according to the first configuration information and the second configuration information.
4. The user interface drawing method according to claim 2, characterized in that: The method further comprises: If the third configuration information indicates that the drawing state of the target drawing attribute of the view control is a drawing-not-allowed state, the first value is determined as the target state value.
5. The user interface drawing method according to claim 3, characterized in that: The determining the target state value according to the first configuration information and the second configuration information includes: If the first configuration information indicates that the configuration state of the target drawing attribute in the application global attribute is not configured, the target state value is determined according to the second configuration information.
6. The user interface drawing method according to claim 5, characterized in that: The determining the target state value according to the second configuration information includes: If the second configuration information indicates that the configuration state of the target drawing attribute of the view control is not configured, determining the first value as the target state value; If the second configuration information indicates that the configuration state of the target drawing attribute of the view control is configured, the second numerical value is determined as the target state value.
7. The user interface drawing method according to claim 2, characterized in that: The method further comprises: If the third configuration information indicates that the drawing state of the target drawing attribute of the view control is the drawing allowed state, and the first configuration information indicates that the configuration state of the target drawing attribute in the application global properties is configured, then the second numerical value is determined as the target state value, and the second numerical value is different from the first numerical value.
8. The user interface drawing method according to claim 2, characterized in that: The determining, according to the correspondence between the preset state value and the drawing method, a target drawing method corresponding to the target state value comprises: If the target state value is a first value, determining a first drawing method corresponding to the target drawing attribute as the target drawing method; If the target state value is a second value, a second drawing method corresponding to the target drawing attribute is determined as the target drawing method, and the second drawing method is different from the first drawing method.
9. A user interface drawing device, characterized in that: include: A first determining module, used to determine first configuration information of an application, wherein the first configuration information is used to indicate a configuration state of a target drawing attribute in a global attribute of the application; A second determining module is used to determine second configuration information and third configuration information of a view control in the application, wherein the second configuration information is used to indicate a configuration state of a target drawing attribute of the view control, and the third configuration information is used to indicate a drawing state of the target drawing attribute of the view control; The third determining module is used to determine a target drawing method for implementing user interface drawing of the application program according to the first configuration information, the second configuration information and the third configuration information.
10. A user interface drawing device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to execute the steps of the user interface drawing method according to any one of claims 1 to 8.
11. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the steps of the user interface drawing method described in any one of claims 1 to 8 are implemented.