A display method and related device
By dividing the terminal device into regions and using the reaction-diffusion equation for iterative rendering, an animated display of fluid diffusion effects is achieved, solving the problem of monotonous animation effects and improving user experience and device efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2024-11-30
- Publication Date
- 2026-05-08
AI Technical Summary
In existing technologies, the display methods of animation effects on terminal devices lack diversity, resulting in an inadequate user experience.
By dividing the terminal device into target and non-target areas and using reaction-diffusion equations with different parameters to iteratively render pixels, an animated display of fluid diffusion effects is achieved, including smoothing of boundary areas and iterative control of segmented areas.
It enriches the styles of animation display, reduces power consumption, avoids overheating, and improves visual experience and interactivity.
Smart Images

Figure CN120429049B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminal technology, and in particular to a display method and related equipment. Background Technology
[0002] When users use mobile phones, tablets, and other terminal devices (also known as electronic devices), these devices can display a variety of animation effects. Users can interact with these electronic devices, causing the displayed animation effects to change. Summary of the Invention
[0003] This application provides a display method and related equipment. According to the display method, an electronic device can divide different display areas for target content, and iterate using reaction-diffusion equations with different parameters for different display areas. Based on the iteration results, rendering and display are performed, thereby achieving the display of target content in a specific display area with a fluid diffusion effect. This enriches the style of displaying target content on the display screen.
[0004] In a first aspect, this application provides a display method. This method can be applied to an electronic device. According to this method, in response to a first operation, the electronic device can display a first animation in a first display area. The first display area includes a target area and a non-target area. The first animation is an animation that displays target content in the target area using a fluid diffusion effect. The first animation may include multiple frames of images, and at least one of the multiple frames includes the target content. Specifically, for any frame of the first animation, the color of each pixel in the target area is determined based on a first reaction-diffusion equation, and the color of each pixel in the non-target area is determined based on a second reaction-diffusion equation. The first reaction-diffusion equation may include a first generation rate and a first vanishing rate, and the second reaction-diffusion equation may include a second generation rate and a second vanishing rate. The first generation rate is the generation rate of a first type of pixel in the target area, and the second generation rate is the generation rate of a first type of pixel in the non-target area; the first vanishing rate is the vanishing rate of a second type of pixel in the target area, and the second vanishing rate is the vanishing rate of a second type of pixel in the non-target area. The first generation rate is different from the second generation rate, and the first vanishing rate is different from the second vanishing rate. The color of the first type of pixel is different from the color of the second type of pixel.
[0005] In the solution provided in this application, in response to the first operation, the electronic device can use reaction diffusion equations with different parameters to iterate for pixels in different regions, thereby achieving continuous color change of the pixel and displaying the target content with a fluid diffusion effect. This can enrich the display form of the target content on the display screen and bring users a more interesting visual experience.
[0006] It is understood that the reaction-diffusion equation involved in this application can be a reaction-diffusion equation in which two components diffuse into each other in the system. In this application, the two components can be understood as two types of pixels of different colors, namely, a first type of pixel and a second type of pixel. They are iterated based on reaction-diffusion equations with different parameters, just like liquids of different concentrations diffuse into each other. When the iteration reaches a stable state (the result of the iteration based on the reaction-diffusion equation does not change much), the electronic device can display the target content on the display screen.
[0007] In conjunction with the first aspect, in one possible implementation, the method may further include: prior to displaying the first animation, in response to the first operation, the electronic device may determine a target area and a non-target area based on the target content.
[0008] The electronic device can display a first animation in a first display area, specifically including: when displaying the (N-1)th frame of the first animation, for each pixel in the first display area, if the pixel is in the target area, the electronic device can update the first concentration and second concentration corresponding to the pixel based on a first reaction-diffusion equation; if the pixel is in a non-target area, the electronic device can update the first concentration and second concentration corresponding to the pixel based on a second reaction-diffusion equation; the electronic device can determine the target color of the pixel based on the first concentration and second concentration; if the target color of each pixel in the first display area has been determined, the electronic device can render the Nth frame of the first animation based on the target color of each pixel in the first display area, and display the Nth frame of the first animation in the first display area. Here, N is a positive integer. The first concentration is the concentration of a first type of pixel, and the second concentration is the concentration of a second type of pixel.
[0009] In the solution provided in this application, in response to the first operation, the electronic device can divide the target area and non-target area based on the target content. Before displaying each frame of the first animation, the electronic device can use the corresponding reaction diffusion equation to determine the target color of the pixel in different areas, thereby rendering the frame to be displayed. Because the target color of the pixel changes based on the law of fluid diffusion, the electronic device can display the target content with a fluid diffusion effect when continuously displaying frame after frame of the first animation.
[0010] It is understandable that when displaying the N-1th frame of the first animation, the electronic device only needs to iterate using the corresponding reaction-diffusion equation for the pixels in the two regions, and can determine the target color of each pixel in the first display area without iterating multiple times based on the corresponding reaction-diffusion equation, thereby quickly rendering the Nth frame of the first animation. This can reduce power consumption to a certain extent and avoid overheating when the user is not using the electronic device.
[0011] In conjunction with the first aspect, in one possible implementation, the method may further include: before displaying the first animation, in response to the first operation, the electronic device may determine a target area and a non-target area based on the target content, and determine the boundary area between the target area and the non-target area in the first display area based on the SDF corresponding to the target content.
[0012] The electronic device can display a first animation in a first display area, specifically including: when displaying the (N-1)th frame of the first animation, for each pixel in the first display area, if the pixel is in the display area of the target area excluding the boundary area, the electronic device can update the first concentration and second concentration corresponding to the pixel based on the first reaction-diffusion equation; if the pixel is in the display area of the non-target area excluding the boundary area, the electronic device can update the first concentration and second concentration corresponding to the pixel based on the second reaction-diffusion equation; if the pixel is in the boundary area, the electronic device can process the parameters in the first reaction-diffusion equation and the parameters in the second reaction-diffusion equation based on the SDF corresponding to the pixel to obtain a third reaction-diffusion equation, and update the first concentration and second concentration corresponding to the pixel based on the third reaction-diffusion equation; the electronic device can determine the target color of the pixel based on the first concentration and second concentration corresponding to the pixel; if the target color of each pixel in the first display area has been determined, the electronic device can render the Nth frame of the first animation based on the target color of each pixel in the first display area, and display the Nth frame of the first animation in the first display area.
[0013] In the solution provided in this application, in response to the first operation, the electronic device can divide the target area and non-target area based on the target content, and can also determine the boundary area between the target area and the non-target area. Before displaying each frame of the first animation, for pixels in different areas, the electronic device can use the corresponding reaction diffusion equation to determine the target color of the pixel, thereby rendering the frame to be displayed. Furthermore, for each pixel in the boundary area, the electronic device can process the parameters in the two sets of reaction diffusion equations corresponding to the target area and the non-target area based on the SDF corresponding to the pixel, to obtain a processed reaction diffusion equation (which includes the processed parameters), and determine the target color of the pixel based on the processed reaction diffusion equation, thereby achieving smoothing of the boundary area. In this way, the outline of the target content displayed by the electronic device with a fluid diffusion effect (e.g., the outline of the characters mentioned below) is smoother, which can bring a better visual experience to the user.
[0014] It should be noted that the electronic device processes the parameters in the first and second reaction-diffusion equations based on the SDF corresponding to each pixel. This can also be understood as the electronic device mixing the parameters in these different reaction-diffusion equations based on the SDF corresponding to that pixel. The resulting processed parameters are the mixed parameters, and the resulting processed reaction-diffusion equation (i.e., the third reaction-diffusion equation) is the mixed reaction-diffusion equation.
[0015] In conjunction with the first aspect, in one possible implementation, the method may further include: before displaying the first animation, in response to the first operation, the electronic device may determine a target area and a non-target area based on the target content, and divide the first display area to obtain multiple block areas.
[0016] The electronic device can display a first animation in a first display area, specifically including: when displaying the (N-1)th frame of the first animation, for each pixel in the first display area, if the pixel is in a target area, the electronic device can update the first concentration and the second concentration corresponding to the pixel based on a first reaction-diffusion equation until the number of iterations based on the first reaction-diffusion equation reaches the target number of iterations corresponding to the block area to which the pixel belongs; if the pixel is in a non-target area, the electronic device can update the first concentration and the second concentration corresponding to the pixel based on a second reaction-diffusion equation until the number of iterations based on the second reaction-diffusion equation reaches the target number of iterations corresponding to the block area to which the pixel belongs; the electronic device can determine the target color of the pixel based on the first concentration and the second concentration corresponding to the pixel; when the target color of each pixel in the first display area has been determined, the electronic device can render the Nth frame of the first animation based on the target color of each pixel in the first display area and display the Nth frame of the first animation in the first display area.
[0017] In the solution provided in this application, in response to the first operation, the electronic device can divide the first display area in two different ways: first, it divides the first display area into a target area and a non-target area based on the target content; second, it divides the first display area into multiple block areas. Furthermore, the electronic device can set corresponding target iteration counts for these multiple block areas. Before displaying each frame of the first animation, for each pixel in the first display area, the electronic device needs to iterate based on the corresponding reaction-diffusion equation until the iteration count corresponding to its partition is reached. Only then can the electronic device determine its corresponding target color and render the frame to be displayed. On the one hand, the electronic device does not need to set the target iteration count per pixel, but rather per block area. That is, the electronic device does not need to set the target iteration count for each pixel separately, but rather for the entire pixel set. This simplifies the process and facilitates control of the target iteration count by the electronic device. On the other hand, before determining the target color of a pixel, the electronic device needs to iterate the reaction-diffusion equation a certain number of times. This allows for timely updates to the target color of the pixel, preventing a significant difference between the final determined target color and the actual color that should be displayed due to a small number of iterations. This avoids affecting the fluid diffusion effect when displaying the target content.
[0018] In conjunction with the first aspect, in one possible implementation, the method may further include: before displaying the first animation, in response to the first operation, the electronic device may determine a target region and a non-target region based on the target content, determine the boundary region of the target region and the non-target region in the first display region based on the SDF corresponding to the target content, and divide the first display region to obtain multiple block regions.
[0019] The electronic device can display a first animation in a first display area. Specifically, when displaying the (N-1)th frame of the first animation, for each pixel in the first display area, if the pixel is located in the display area of the target region excluding the boundary region, the electronic device can update the first concentration and second concentration corresponding to the pixel based on a first reaction-diffusion equation until the number of iterations based on the first reaction-diffusion equation reaches the target number of iterations corresponding to the block region to which the pixel belongs. If the pixel is located in the display area of a non-target region excluding the boundary region, the electronic device can update the first concentration and second concentration corresponding to the pixel based on a second reaction-diffusion equation until the number of iterations based on the second reaction-diffusion equation reaches the target number of iterations corresponding to the block region to which the pixel belongs. If a pixel is located in a boundary region, the electronic device can process the parameters in the first and second reaction-diffusion equations based on the SDF corresponding to that pixel to obtain a third reaction-diffusion equation. It can then update the first and second concentrations corresponding to that pixel based on the third reaction-diffusion equation until the number of iterations based on the third reaction-diffusion equation reaches the target iteration number corresponding to the block region to which the pixel belongs. The electronic device can determine the target color of that pixel based on the first and second concentrations. Given that the target colors of each pixel in the first display area have been determined, the electronic device can render the Nth frame image of the first animation based on the target colors of each pixel in the first display area and display the Nth frame image in the first display area.
[0020] In the solution provided in this application, in response to the first operation, the electronic device can divide the first display area in two different ways: first, it divides the first display area into a target area and a non-target area, as well as the boundary area between the target area and the non-target area, based on the target content; second, it divides the first display area into multiple block areas. Furthermore, the electronic device can set corresponding target iteration numbers for these multiple block areas. Before displaying each frame of the first animation, for each pixel in the first display area, the electronic device needs to iterate based on the corresponding reaction-diffusion equation until the iteration number corresponding to its partition is reached. Only then can the electronic device determine its corresponding target color, thereby rendering the frame to be displayed. This allows for timely updates to the target color of pixels while balancing the complexity of the process. Based on this, for each pixel in the boundary area, the electronic device can process the parameters in the two sets of reaction-diffusion equations corresponding to the target area and the non-target area based on the SDF corresponding to the pixel, and then determine the target color of the pixel based on the reaction-diffusion equation obtained after the processing, thereby achieving smoothing of the boundary area. In this way, the outline of the target content displayed by the electronic device with a fluid diffusion effect is smoother, providing a better visual experience for the user.
[0021] In conjunction with the first aspect, in one possible implementation, the electronic device processes the parameters in the first and second reaction-diffusion equations based on the SDF corresponding to the pixel to obtain a third reaction-diffusion equation. Specifically, this may include: the electronic device determining a first interpolation factor based on the mapping relationship between the SDF corresponding to the pixel in the boundary region and a first interval; interpolating between the first and second generation rates based on the first interpolation factor to obtain a third generation rate; and interpolating between the first and second vanishing rates based on the first interpolation factor to obtain a third vanishing rate; and determining the third reaction-diffusion equation based on the third generation rate and the third vanishing rate. The first interpolation factor can be the difference between 1 and the first mapping value. The first mapping value is the mapping value of the SDF corresponding to the pixel in the first interval.
[0022] In the solution provided in this application, the electronic device can use a linear interpolation method to achieve smooth processing of the boundary area between the target area and the non-target area, so that when the target content is displayed in the target area, the outline (or boundary) of the target content transitions more smoothly and naturally.
[0023] It is understood that electronic devices may also use other methods (e.g., polynomial interpolation, spline interpolation, Bessel interpolation, smoothing filters, SG filters, etc.) to perform the above-mentioned smoothing of the boundary region, and this application does not limit this.
[0024] In some embodiments of this application, the first interpolation factor may be the interpolation factor mentioned below, the first mapping value may be the smoothstep (minimum value in the first distance range, maximum value in the first distance range, SDF distance of the pixel) mentioned below, and the first interval may be the first distance range mentioned below.
[0025] In conjunction with the first aspect, in one possible implementation, the method may further include: when displaying the (N-1)th frame of the first animation, the electronic device may determine the Laplacian operator currently corresponding to multiple block regions, and the Laplacian operator corresponding to multiple block regions in the latest h-frame image displayed in the first animation; and may also adjust the target iteration number corresponding to the multiple block regions based on the Laplacian operator currently corresponding to the multiple block regions, and the Laplacian operator corresponding to the multiple block regions in the latest h-frame image displayed in the first animation.
[0026] In the solution provided in this application, the electronic device can determine the diffusion status (whether it is in a rapid diffusion state or a stable state) of each block region by combining the color gradient changes of one or more frames of the displayed first animation, and adjust the target iteration number corresponding to the block region based on the diffusion status. Specifically, on the one hand, for block regions in a rapid diffusion state, the electronic device can increase its corresponding target iteration number, thereby updating the target color of each pixel in the block region in a timely manner and avoiding affecting the fluid diffusion effect when displaying the target content. On the other hand, for block regions in a stable state, the electronic device can reduce or maintain its corresponding target iteration number, thereby reducing power consumption to a certain extent. The electronic device can achieve a balance between the above two aspects by adjusting the target iteration number on a block region basis.
[0027] In some embodiments of this application, the h-frame image may be an h-frame image in the sliding window mentioned below.
[0028] In conjunction with the first aspect, in one possible implementation, the electronic device adjusts the target iteration number corresponding to the plurality of block regions based on the Laplacian operator currently corresponding to the plurality of block regions and the Laplacian operator corresponding to the plurality of block regions in the latest displayed h-frame image in the first animation. Specifically, this may include: for each of the plurality of block regions, the electronic device can determine a first value and a second value corresponding to the block region; if the first value is less than the second value, the electronic device can reduce the target iteration number corresponding to the block region; if the first value is equal to the second value, the electronic device can keep the target iteration number corresponding to the block region unchanged; if the first value is greater than the second value, the electronic device can increase the target iteration number corresponding to the block region. Here, the first value is the number of pixels within the color gradient range of the corresponding Laplacian operator included in the block region, and the second value is the average number of pixels within the color gradient range of the corresponding Laplacian operator included in the block region in the h-frame image.
[0029] In the solution provided in this application, the electronic device can determine the color gradient change of a block region based on the average value of the Laplacian operator of the block region included in the multi-frame images of the first animation that has been displayed, rather than simply based on the color gradient change of the previous frame image that has been displayed. The color gradient change determined in this way is the color gradient change of the block region over a period of time, rather than the color gradient change in real time, thereby controlling the number of adjustments to the target iteration number and preventing the adjustments from being too frequent, which can reduce power consumption to a certain extent.
[0030] It is understood that the specific meaning of the color gradient range can be found in the relevant description below, and will not be elaborated here.
[0031] In conjunction with the first aspect, in one possible implementation, the electronic device determines the target color of a pixel based on a first concentration and a second concentration corresponding to the pixel. Specifically, this may include: if the first concentration corresponding to the pixel is greater than its corresponding second concentration, the electronic device may determine that its target color is the color of a first type of pixel; and if the first concentration corresponding to the pixel is less than or equal to its corresponding second concentration, the electronic device may determine that its target color is the color of a second type of pixel.
[0032] In the solution provided in this application, for each pixel in the first display area, the electronic device can determine the target color of the pixel based on the relationship between the first concentration and the second concentration corresponding to the pixel, thereby realizing the display of the fluid diffusion effect on the display screen.
[0033] In conjunction with the first aspect, in one possible implementation, the electronic device updates the first and second concentrations corresponding to the pixel based on the first reaction-diffusion equation. Specifically, this may include: the electronic device can update the first and second concentrations respectively using the formula... and The electronic device updates the first and second concentrations corresponding to each pixel based on the second reaction-diffusion equation. Specifically, the electronic device can update the first and second concentrations corresponding to each pixel using the formula... and Update the first and second concentrations corresponding to each pixel. Where A is the first concentration of the pixel before the update, B is the second concentration of the pixel before the update, A' is the first concentration of the pixel after the update, B' is the second concentration of the pixel after the update, and D... A1 and D A2 D is the diffusion coefficient of the first type of pixel. B1 and D B2 denoted as the diffusion coefficient of the second type of pixel, f1 as the first generation rate, f2 as the second generation rate, k1 as the first disappearance rate, k2 as the second disappearance rate, and Δt as the time of change.
[0034] In the solution provided in this application, the electronic device can adopt and This set of reaction diffusion equations, and for different areas in the first display area (e.g., target area and non-target area), the electronic device can adopt different generation and disappearance rates to simulate the diffusion effect of fluids with different concentrations, and convert the fluid concentration into pixel color, thereby realizing the display of the fluid diffusion effect for the target content.
[0035] It should be noted that the reaction terms (including source terms and disappearance terms) in the above reaction-diffusion equation are only an example provided by this application. Electronic devices may also use other reaction terms (e.g., monostable reaction terms, bistable reaction terms, ignition reaction terms, etc.), and this application does not impose any restrictions on them.
[0036] In conjunction with the first aspect, in one possible implementation, the first concentration corresponding to a pixel can be the R channel value of that pixel, and the second concentration corresponding to a pixel can be the G channel value of that pixel.
[0037] In the solution provided in this application, for scenarios based on RGB color space, electronic devices can use any two of the R channel value, G channel value, B channel value and transparency corresponding to a pixel to represent the first concentration and the second concentration, thereby realizing the display of the animation of the target content on the display screen with a fluid diffusion effect.
[0038] It should be noted that for other types of color spaces (e.g., HSV / HSB color space, YCbCr color space, YPbPr color space, XYZ color space, etc.), electronic devices can represent the first and second concentrations corresponding to a pixel in other ways, and this application does not impose any limitations on this. For example, in a scenario where the display is based on the YCbCr color space, the electronic device can represent the first and second concentrations corresponding to the pixel using any two of the Y channel value, Cb channel value, and Cr channel value corresponding to the pixel.
[0039] In conjunction with the first aspect, in one possible implementation, the method may further include: before displaying the first animation, in response to the first operation, the electronic device may set initial values for a first concentration and a second concentration corresponding to each pixel in the first display area. For each pixel in the first display area, the initial value of its corresponding first concentration is less than the initial value of its corresponding second concentration.
[0040] In the solution provided in this application, before displaying the first animation, in response to the first operation, the electronic device can uniformly set the initial values of the first concentration and the second concentration for each pixel in the first display area, so that the initial color of each pixel in the first display area is the same (e.g., all are the colors of the second type of pixels). For example, the electronic device can set the initial value of the first concentration corresponding to each pixel in the first display area to be less than its corresponding initial value of the second concentration. This can more completely simulate the fluid diffusion effect to display the target content.
[0041] In conjunction with the first aspect, in one possible implementation, after the electronic device sets the initial values of the first concentration and the second concentration corresponding to each pixel in the first display area, the method may further include: in response to a second operation on a first position in the first display area, for one or more pixels corresponding to the first position, the electronic device may reset the corresponding first concentration and the second concentration, and the reset first concentration is greater than the reset second concentration.
[0042] In the solution provided in this application, after the electronic device uniformly sets the initial values of the first concentration and the second concentration for each pixel in the first display area, the user can trigger the electronic device to start simulating the fluid diffusion effect to display the target content. That is, for one or more pixels in the first display area affected by the user's operation, the electronic device can reset their corresponding first concentration and second concentration. In this way, during the subsequent iteration based on the corresponding reaction diffusion equation, the target color of the pixels in the first display area can change, and the electronic device will not be unable to simulate the fluid diffusion effect to display the target content because its target color is always the color of the second type of pixel.
[0043] In conjunction with the first aspect, in one possible implementation, after the electronic device sets the initial values of the first concentration and the second concentration corresponding to each pixel in the first display area, the method may further include: after an interval of a first time period, for any one or more pixels in the first display area, the electronic device may reset their corresponding first concentration and second concentration, and the reset first concentration is greater than the reset second concentration.
[0044] In the solution provided in this application, after the electronic device uniformly sets the initial values of the first concentration and the second concentration for each pixel in the first display area, the electronic device can automatically start simulating the fluid diffusion effect to display the target content. That is, after a first time interval, for any one or more pixels in the first display area, the electronic device can reset their corresponding first concentration and second concentration. In this way, during the subsequent iteration based on the corresponding reaction diffusion equation, the target color of the pixels in the first display area can change, and the electronic device will not be unable to simulate the fluid diffusion effect to display the target content because its target color is always the color of the second type of pixel.
[0045] In some embodiments of this application, if the electronic device receives an operation on the first display area when the interval is less than a first duration, then in response to the operation, the electronic device can reset the corresponding first concentration and second concentration for one or more pixels corresponding to the operation. If the electronic device still does not receive an operation on the first display area when the interval reaches the first duration, then the electronic device can randomly select one or more pixels in the first display area to reset the corresponding first concentration and second concentration.
[0046] In conjunction with the first aspect, in one possible implementation, the method may further include: during the display of the first animation by the electronic device, in response to a third operation on a second position in the first display area, the electronic device may set the first concentration and the second concentration corresponding to one or more pixels at the second position to the initial values of the first concentration and the second concentration, respectively.
[0047] In the solution provided in this application, during the display of the first animation on the electronic device, the electronic device can respond to the user's sliding operation on the first display area and set the color of one or more pixels corresponding to the sliding operation to the color of the second type of pixels, thereby achieving the effect of erasing the first type of pixels and providing the user with more interactive experience.
[0048] In conjunction with the first aspect, in one possible implementation, the method may further include: during the display of the first animation by the electronic device, in response to a fourth operation targeting a third position in the first display area, the electronic device may increase the target iteration number corresponding to one or more pixels at the third position.
[0049] In the solution provided in this application, the electronic device can divide the first display area. For areas where user interaction occurs (e.g., the high-diffusion area mentioned below), the electronic device can increase its corresponding target iteration count. For areas where there is no user interaction (e.g., the low-diffusion area mentioned below), the electronic device can maintain or decrease its corresponding target iteration count. In this way, the electronic device can update the target color of each pixel in the area where user interaction occurs in a timely manner.
[0050] In some embodiments of this application, the third position may correspond to one or more pixels in the high diffusion region mentioned below.
[0051] In conjunction with the first aspect, in one possible implementation, the target content may include target text.
[0052] It is understood that the target content can be set according to actual needs, and this application does not impose any restrictions on this. Electronic devices can display not only patterns with a fluid diffusion effect, but also text with a fluid diffusion effect, which greatly enriches the display effect of the content.
[0053] In a second aspect, this application provides an electronic device including one or more memories and one or more processors; the one or more memories may be coupled to the one or more processors, the memories being used to store computer program code including computer instructions, the one or more processors calling the computer instructions to cause the electronic device to perform the method as described in the first aspect or any implementation thereof.
[0054] Thirdly, this application provides a computer storage medium. The computer storage medium includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the method described in the first aspect or any implementation thereof.
[0055] Fourthly, embodiments of this application provide a chip. This chip can be applied to an electronic device, and the chip includes one or more processors. The processors are used to invoke computer instructions to cause the electronic device to perform the methods described in the first aspect or any implementation thereof.
[0056] Fifthly, embodiments of this application provide a chip system. This chip system can be applied to an electronic device. The chip system includes at least one processor and an interface for receiving instructions and transmitting them to the at least one processor; the at least one processor executes the received instructions, causing the electronic device to perform the method described in the first aspect or any implementation thereof.
[0057] In some embodiments of this application, the chip system may be an application processor (AP) or a system on chip (SoC) including an AP, and the method described in the first aspect or any implementation thereof may be implemented by an AP.
[0058] In some other embodiments of this application, the chip system may include an access point (AP) and other modules. These other modules may be a modem (also known as a baseband processor).
[0059] Sixthly, embodiments of this application provide a computer program product including instructions. When the computer program product is run on an electronic device, it causes the electronic device to perform the method described in the first aspect or any implementation thereof.
[0060] It is understood that the electronic device provided in the second aspect, the computer storage medium provided in the third aspect, the chip provided in the fourth aspect, the chip system provided in the fifth aspect, and the computer program product provided in the sixth aspect are all used to execute the method described in the first aspect or any implementation thereof. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects of any possible implementation of the first aspect, which will not be repeated here. Attached Figure Description
[0061] Figure 1 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application;
[0062] Figure 2 A schematic diagram of the software structure of an electronic device provided in an embodiment of this application;
[0063] Figure 3 A schematic diagram of a reaction-diffusion algorithm provided for an embodiment of this application;
[0064] Figure 4A A flowchart illustrating a display method provided in an embodiment of this application;
[0065] Figure 4B A flowchart illustrating yet another display method provided in an embodiment of this application;
[0066] Figure 4C A flowchart illustrating yet another display method provided in an embodiment of this application;
[0067] Figure 5A A schematic diagram of a text area and a non-text area provided in an embodiment of this application;
[0068] Figure 5B A schematic diagram of a boundary region provided in an embodiment of this application;
[0069] Figures 6A-6D A set of schematic diagrams showing text with a fluid diffusion effect provided for embodiments of this application;
[0070] Figure 7A and Figure 7B A set of schematic diagrams illustrating the effects of triggering fluid diffusion provided in the embodiments of this application;
[0071] Figure 8A and Figure 8B An SDF diagram of a set of target text provided for embodiments of this application;
[0072] Figure 9 This application provides a schematic diagram of the division of a first display area according to an embodiment of the present application;
[0073] Figure 10 A schematic diagram of a sliding window provided in an embodiment of this application;
[0074] Figure 11 A schematic diagram illustrating a change in target text provided in an embodiment of this application;
[0075] Figure 12 A schematic diagram illustrating another instance of target text changing, provided for an embodiment of this application;
[0076] Figure 13 This application provides a user interaction diagram in an embodiment;
[0077] Figures 14A-14C This application provides another set of user interaction diagrams for embodiments of the present application;
[0078] Figure 15 A schematic diagram illustrating the division of a high-diffusion region and a low-diffusion region provided in an embodiment of this application;
[0079] Figure 16 This is a schematic diagram illustrating another division of high-diffusion and low-diffusion regions provided in an embodiment of this application. Detailed Implementation
[0080] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B; "and / or" in the text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more than two.
[0081] It should be understood that the terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0082] It should be understood that the term "user interface" in the specification, claims, and drawings of this application refers to the medium interface through which an application or operating system interacts and exchanges information with the user. A common form of user interface is the graphical user interface (GUI), which refers to a user interface related to computer operation displayed graphically. It can be an icon, window, control, or other interface element displayed on the screen of an electronic device. Controls can include visual interface elements such as icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, and widgets.
[0083] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described in this application can be combined with other embodiments.
[0084] This application provides a display method and related device. According to the display method, an electronic device can achieve a fluid diffusion effect on target content. That is, the electronic device can display target content on a display screen with a fluid diffusion effect. Furthermore, while the electronic device is displaying the target content with a fluid diffusion effect, in response to user operation, the electronic device can reset the color of the pixels in the touch area and continue to display the target content with the fluid diffusion effect. This enriches the text display style and provides users with a better interactive experience.
[0085] It is understood that the fluid diffusion effect involved in this application refers to the display effect of simulating the mutual diffusion of fluids (such as the mutual diffusion of two fluids).
[0086] The apparatus involved in the embodiments of this application will be introduced first below.
[0087] The electronic devices involved in this application can be terminal devices, specifically mobile phones, tablets, wearable devices, in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), or dedicated cameras (e.g., SLR cameras, point-and-shoot cameras), etc. The embodiments of this application do not impose any restrictions on the specific type of electronic devices.
[0088] The hardware structure of the electronic device involved in the embodiments of this application is described below.
[0089] Please see Figure 1 , Figure 1 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application.
[0090] like Figure 1As shown, the electronic device may include: a processor, an external memory interface, internal memory, a Universal Serial Bus (USB) interface, a charging management module, a power management module, a battery, antenna 1, antenna 2, a mobile communication module, a wireless communication module, a sensor module, buttons, a motor, an indicator, a camera, a display screen, an audio module, and a Subscriber Identity Module (SIM) card slot, etc. The audio module may include a speaker, receiver, microphone, headphone jack, etc., and the sensor module may include pressure sensors, gyroscope sensors, barometric pressure sensors, magnetic sensors, accelerometers, proximity sensors, proximity sensors, fingerprint sensors, temperature sensors, touch sensors, ambient light sensors, bone conduction sensors, etc.
[0091] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device. It is understood that the illustrated components can be implemented in hardware, software, or a combination of both. In some embodiments of this application, the electronic device may include more components than illustrated. For example, the electronic device may include other types of sensors. In still other embodiments of this application, the electronic device may include fewer components than illustrated, or combine some components, or split some components, or arrange different components. The interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a structural limitation on the electronic device.
[0092] A processor may include one or more processing units, such as an application processor (AP), a modem (also known as a baseband processor), a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), and / or a neural network processing unit (NPU). The AP is responsible for running the operating system and applications. The modem is responsible for handling various communication protocols.
[0093] The wireless communication function of an electronic device can be implemented through antenna 1, antenna 2, a mobile communication module, a wireless communication module, and a modem. The modem can interact with the base station through antennas (e.g., antenna 1, antenna 2, etc.). In some embodiments, antenna 1 of the electronic device is coupled to the mobile communication module, and antenna 2 is coupled to the wireless communication module, enabling the electronic device to communicate with networks and other devices through wireless communication technology.
[0094] Electronic devices can achieve display functions through GPUs, displays, and application processors.
[0095] A GPU is a microprocessor for image processing, connected to a display screen and an application processor. A GPU performs mathematical and geometric calculations for graphics rendering. A processor may include one or more GPUs, which execute program instructions to generate or modify display information. A display screen is used to display images, videos, etc. In some embodiments, an electronic device may include one or more displays screens.
[0096] A camera is used to capture still images or videos. An ISP (Image Signal Processor) processes the data fed back from the camera. Light is transmitted through the lens to the camera's photosensitive element, where the light signal is converted into an electrical signal. The camera's photosensitive element then transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. Electronic devices may include one or more cameras.
[0097] Internal memory may include one or more RAMs and one or more non-volatile memory (NVMs). RAMs can be directly read and written by the processor and can be used to store executable programs (e.g., machine instructions) of the operating system or other running programs, as well as user and application data. NVMs can also store executable programs and user and application data, and can be pre-loaded into RAMs for direct processor access.
[0098] In this embodiment of the application, the code implementing the method described in this embodiment can be stored in non-volatile memory. When the electronic device is running, the electronic device can load the executable code stored in the non-volatile memory into random access memory.
[0099] External memory interfaces can be used to connect to external non-volatile memory, thereby expanding the storage capacity of electronic devices.
[0100] Electronic devices can implement audio functions through audio modules, speakers, receivers, microphones, headphone jacks, and application processors.
[0101] The software structure of the electronic device involved in the embodiments of this application is described below.
[0102] The operating system of an electronic device can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application uses the layered architecture of the Android operating system as an example to exemplify the software structure of an electronic device. It should be noted that although this application uses the Android operating system (which can be simply referred to as the Android system) as an example, its basic principles are equally applicable to electronic devices based on operating systems such as iOS or Windows.
[0103] Please see Figure 2 , Figure 2 This is a schematic diagram of the software structure of an electronic device provided in an embodiment of this application.
[0104] The software architecture of electronic devices adopts a layered architecture, dividing the software into several layers, each with a clear role and division of labor. Layers communicate with each other through software interfaces. Taking the Android system running on an application platform as an example, in some embodiments of this application, the Android system's software architecture is divided into five layers, from top to bottom: the application layer, the framework layer, the Android runtime and system libraries, the hardware abstraction layer (HAL), and the kernel layer.
[0105] The application layer can include a series of application packages. These application packages can include applications such as camera, gallery, calendar, SMS, call, map, navigation, video, WLAN, Bluetooth, music, and settings.
[0106] like Figure 2 As shown, the settings may include lock screen related options, such as setting the lock screen style, setting the lock screen time, and setting the lock screen wallpaper. In some embodiments of this application, the user can select a fluid diffusion effect as the lock screen style in the settings. In this case, the lock screen wallpaper displayed by the electronic device has a fluid diffusion effect, and the displayed clock text also has a fluid diffusion effect.
[0107] In some embodiments of this application, the third-party application may also include lock screen related settings options. In this case, the user can also select a lock screen style with a fluid diffusion effect in the third-party application, so that the lock screen wallpaper and text displayed on the electronic device have a fluid diffusion effect.
[0108] The framework layer provides application programming interfaces (APIs) and programming frameworks for applications in the application layer.
[0109] like Figure 2As shown, the framework layer can include a text rendering module. The text rendering module can be used to implement fluid diffusion effects for text in multiple scenarios (such as lock screen scenarios).
[0110] In some embodiments of this application, the framework layer may include predefined functions. For example, the framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, etc. The phone manager is used to provide call functionality for electronic devices, such as call status management (including call connection, call termination, etc.).
[0111] The runtime is responsible for system scheduling and management. The runtime includes the core libraries and the virtual machine. The core libraries consist of two parts: one part contains the functionalities that the programming language (e.g., Java) needs to call, and the other part is the system's core libraries. The application layer and framework layer run in the virtual machine. The virtual machine executes the programming files (e.g., Java files) of the application layer and framework layer into binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0112] System libraries can include multiple functional modules. Examples include a Surface Manager, Media Libraries, 3D graphics processing libraries (e.g., OpenGL ES), and 2D graphics engines (e.g., SGL). The specific meanings and functions of these modules can be found in relevant technical documentation and will not be elaborated upon here.
[0113] The Hardware Abstraction Layer (HAL) is an interface layer located between the operating system kernel and upper-level software, its purpose being to abstract away hardware. The HAL is an abstract interface for device kernel drivers, providing application programming interfaces (APIs) that allow access to the underlying device to higher-level Java API frameworks. The HAL can provide a standard interface to expose device hardware functionality to higher-level Java API frameworks. The HAL contains multiple library modules (e.g., camera HAL, audio HAL, etc.). When the system framework layer API requests access to the portable device's hardware, the operating system loads the library module for that hardware component.
[0114] The kernel layer is the foundation of the Android system. It is responsible for hardware drivers, networking, power, system security, and memory management. The kernel layer acts as an intermediary between hardware and software, relaying application requests to the hardware. It can include audio drivers, display drivers, camera drivers, and sensor drivers.
[0115] It should be noted that the application provides Figure 2The illustrated software architecture diagram of the electronic device is merely an example and does not limit the specific module divisions within different layers of the Android system. For details, please refer to the descriptions of the Android system software architecture in conventional technologies. Furthermore, the method provided in this application can also be implemented on other operating systems, which will not be listed here.
[0116] The following explanations of some of the terms and related technologies used in this application are provided to facilitate understanding by those skilled in the art.
[0117] 1. Reaction-Diffuse Algorithm
[0118] The reaction-diffuse algorithm is a computational method used to simulate chemical reactions and molecular diffusion. It is typically used to simulate the dynamic changes in the concentration of chemical substances in space and time, i.e., substances interconvert through local chemical reactions and spread across spatial surfaces through diffusion.
[0119] The following explanation uses a reaction-diffusion algorithm based on two substances, X and Y, as an example.
[0120] In reaction-diffusion algorithms based on X and Y, such as Figure 3 As shown in (a), X is added at a certain generation rate, such as Figure 3 As shown in (b), two Ys can transform an X into a Y, as... Figure 3 As shown in (c), Y is removed at a certain decay rate.
[0121] In fluid diffusion algorithms, the kill rate and feed rate are two important parameters. They are typically used to describe the changes in certain physical quantities within a fluid and together influence the distribution and changes of substances within the fluid. By adjusting the kill rate and feed rate, different physical processes and chemical reactions can be simulated. The meanings of these two parameters are as follows:
[0122] Kill rate generally refers to the rate at which a substance in a fluid is consumed. In chemical reactions, it represents the rate at which reactants are consumed. For example, in combustion models, kill rate can represent the rate of fuel consumption, which is usually related to the concentration of reactants and the reaction rate constant. In fluid dynamics simulations, kill rate can be used to control the decay or consumption process of substances in the simulation to ensure the accuracy and realism of the simulation results.
[0123] Feed rate refers to the rate at which a substance is supplied to a fluid. In chemical reactions, it represents the rate at which reactants or products are formed. In fluid dynamics simulations, feed rate can be used to control the formation or supply of substances in the simulation, which is crucial for simulating the dynamic changes of substances in a fluid. For example, in combustion, feed rate can control the supply rate of oxygen or fuel, thereby affecting the progress and efficiency of combustion.
[0124] 2. Laplacian Operator
[0125] The Laplacian operator is a commonly used operator in image processing and computer vision for edge detection and feature extraction. Based on the second derivative of an image, the Laplacian operator provides second-order information about brightness variations, thus aiding in the identification of edges and textures within the image.
[0126] This application relates to the Laplace operator in two-dimensional space. It can be understood that, in two-dimensional space, the Laplace operator is represented as: here, Let e denote the Laplace operator, where e is a function in two-dimensional space.
[0127] 3. Directed Distance Field (SDF)
[0128] SDF (Search Engine Definition) is a technique used in image processing and computer graphics that records the distance from each point in space to the nearest object surface, using positive and negative values to distinguish whether a point is inside or outside an object. Specifically, SDF maps each point in space to the distance from that point to the nearest object surface. If the point is inside an object, the distance is negative; if the point is outside an object, the distance is positive; and if the point is exactly on the object surface, the distance is 0.
[0129] 4. RGB color model (or RGB color space)
[0130] The RGB color model is a widely used method of color representation. RGB stands for Red, Green, and Blue, and these three color channels together define almost all colors in the color space. The value of the red channel represents the intensity of red in an image. The range of red channel values is typically 0 to 255, where 0 represents no red and 255 represents the brightest red. Similarly, the value of the green channel represents the intensity of green in an image. The range of green channel values is also 0 to 255, where 0 represents no green and 255 represents the brightest green. Likewise, the value of the blue channel represents the intensity of blue in an image. The range of blue channel values is also 0 to 255, where 0 represents no blue and 255 represents the brightest blue.
[0131] The following describes a display method provided by an embodiment of this application.
[0132] The display method provided in this application can be applied to electronic devices, and the display method may include, but is not limited to, the following:
[0133] In response to a first operation, a first animation is displayed in a first display area. The first display area includes a target area and a non-target area. The first animation is an animation that displays target content in the target area using a fluid diffusion effect. The first animation may include multiple frames, and at least one of the multiple frames includes the target content.
[0134] In this process, for any frame of the first animation, the color of each pixel in the target region is determined based on a first reaction-diffusion equation, while the color of each pixel in the non-target region is determined based on a second reaction-diffusion equation. The first reaction-diffusion equation may include a first generation rate and a first vanishing rate, and the second reaction-diffusion equation may include a second generation rate and a second vanishing rate. The first generation rate is the generation rate of first-type pixels (e.g., white pixels) in the target region, and the second generation rate is the generation rate of first-type pixels in the non-target region. The first vanishing rate is the vanishing rate of second-type pixels (e.g., black pixels) in the target region, and the second vanishing rate is the vanishing rate of second-type pixels in the non-target region. The first generation rate is different from the second generation rate, and the first vanishing rate is different from the second vanishing rate. The color of the first-type pixels is different from the color of the second-type pixels. This means that the first-type pixels and the second-type pixels are two different colored pixels that diffuse into each other.
[0135] Understandably, the first operation is used to trigger the electronic device to display target content. The first operation can specifically be a touch, sound, or gesture operation, etc., and this application does not limit this. For example, the first operation can be as follows: Figure 6A The operation of pressing the power button is shown.
[0136] It is understood that the target content can be a target pattern or target text, etc., and this application does not impose any restrictions on it.
[0137] In some embodiments of this application, prior to displaying the first animation, in response to a first operation, the electronic device can determine a target area and a non-target area based on the target content.
[0138] In some embodiments of this application, before displaying the first animation, in response to the first operation, the electronic device may also determine the boundary region between the target region and the non-target region in the first display area based on the SDF corresponding to the target content.
[0139] In some embodiments of this application, before displaying the first animation, in response to the first operation, the electronic device may further divide the first display area to obtain multiple block areas.
[0140] In some embodiments of this application, the initial color of each pixel in the first display area can be the color of a second type of pixel. In one possible implementation, before displaying the first animation, in response to the first operation, for each pixel in the first display area, the electronic device can set the initial density of its corresponding first type of pixel and the initial density of its corresponding second type of pixel, and the initial density of the corresponding first type of pixel is less than the initial density of its corresponding second type of pixel. This means that the initial color set by the electronic device for each pixel in the first display area is the color of the second type of pixel.
[0141] It is understood that the initial concentration of the first type of pixels is the initial value of the first concentration (or the first concentration in the initial state), and the initial concentration of the second type of pixels is the initial value of the second concentration (or the second concentration in the initial state). It is also understood that the initial concentrations of the first and second types of pixels can be set according to actual needs, and this application does not impose any restrictions on this. For example, the range of the first and second concentrations can be [0,1], the initial value of the first concentration can be 0, and the initial value of the second concentration can be 1.
[0142] In some embodiments of this application, after setting initial values for the first concentration and the second concentration corresponding to each pixel in the first display area, the electronic device can iterate based on its corresponding reaction-diffusion equation for each pixel in the first display area. During this process, the corresponding first and second concentrations remain unchanged, which means that the corresponding target color will not change (e.g., it will always be black), and the fluid diffusion effect cannot be achieved. In this case, the electronic device can reset the first and second concentrations corresponding to one or more pixels based on user operation, or reset the first and second concentrations corresponding to one or more pixels based on a certain interval, so that after each pixel in the first display area iterates based on the corresponding reaction-diffusion equation, its corresponding first and second concentrations change, thereby achieving the fluid diffusion effect.
[0143] In one possible implementation, after setting initial values for the first concentration and the second concentration corresponding to each pixel in the first display area, in response to a second operation for a first position in the first display area, the electronic device can reset the corresponding first concentration and the second concentration for one or more pixels corresponding to the first position, and the reset first concentration is greater than the reset second concentration, so that the target color of the one or more pixels corresponding to the first position is the color of the first type of pixels.
[0144] For example, a second operation targeting a first location within a first display area can be as follows: Figure 7A The touch operation shown applies to the first display area. In this case, one or more pixels corresponding to the first position can be... Figure 7A The pixels in the touch area shown.
[0145] It is understood that the one or more pixels corresponding to the first position may include: the one or more pixels included in the first position. In some embodiments of this application, the one or more pixels corresponding to the first position may further include: one or more pixels located in the area surrounding the first position.
[0146] It is understood that this application does not limit the shape of the region surrounding the first position. For example, the region surrounding the first position can be a circular region with a radius of a certain distance centered on the first position. In this case, one or more pixels corresponding to the first position can be pixels included in the circular region.
[0147] In some embodiments of this application, the area surrounding the first location is smaller than a first area threshold. It is understood that the first area threshold is smaller than the area of the first display area, and the first area threshold can be set according to actual needs; this application does not limit this. For example, the first area threshold can be the area of a segmented region mentioned below.
[0148] In another possible implementation, after setting the initial values of the first concentration and the second concentration for each pixel in the first display area and after a first time interval, the electronic device can reset the corresponding first concentration and the second concentration for any one or more pixels in the first display area. The reset first concentration is greater than the reset second concentration. In this way, the target color of any one or more pixels in the first display area is the color of the first type of pixels.
[0149] For example, any one or more pixels in the first display area can be Figure 7B The pixels in the randomly selected area shown.
[0150] It is understood that the electronic device may determine the specific duration of the aforementioned interval from the moment the first operation is received, and this application does not impose any restrictions on this.
[0151] In some embodiments of this application, during the display of the first animation, the electronic device may receive a third operation for a second position in the first display area. In response to the operation, for one or more pixels corresponding to the second position, the electronic device may set the corresponding first concentration and second concentration to their initial states, that is, reset the corresponding first concentration to the initial concentration of the first type of pixel and reset the corresponding second concentration to the initial concentration of the second type of pixel.
[0152] For example, a third operation targeting a second location within a first display area could be as follows: Figure 13 The sliding operation shown applies to the first display area. For example, a third operation targeting a second position within the first display area could also be as follows: Figures 14A-14C The sliding operation shown applies to the first display area.
[0153] It is understood that the specific details of the one or more pixels corresponding to the second position can be found in the description of the one or more pixels corresponding to the first position mentioned above, and will not be repeated here.
[0154] The following example uses rendering and displaying the Nth frame of the first animation, combined with... Figures 4A-4C This section will introduce the specific implementation method of displaying the first animation on electronic devices.
[0155] like Figure 4A As shown, when displaying the (N-1)th frame of the first animation, the electronic device can perform the following steps:
[0156] S1: When displaying the (N-1)th frame of the first animation, determine the target color of each pixel in the first display area based on the first reaction diffusion equation and the second reaction diffusion equation.
[0157] When displaying the (N-1)th frame of the first animation, the electronic device can determine the target color of each pixel in the first display area based on the first reaction-diffusion equation and the second reaction-diffusion equation. That is, the electronic device can traverse every pixel in the first display area and determine its target color based on the corresponding reaction-diffusion equation. It is understood that the specific implementation of this traversal can be found in the relevant description below, and will not be elaborated upon here.
[0158] As can be understood, the meanings of the first and second reaction diffusion equations can be specifically referred to in the relevant descriptions below, and will not be elaborated here.
[0159] It can be understood that the target color of a pixel (or simply the target color of the pixel) refers to the color of that pixel in the image to be displayed (or the next frame of the first animation). In other words, when displaying the (N-1)th frame of the first animation, the color of the pixel in the Nth frame of the first animation is the target color of that pixel. Similarly, when displaying the Nth frame of the first animation, the color of the pixel in the (N+1)th frame of the first animation is the target color of that pixel.
[0160] In some embodiments of this application, when the electronic device performs step S1, for each pixel in the first display area, it may perform the following: Figure 4B Steps S1011-S1013 are shown below:
[0161] S1011: When a pixel is located in the target area, update the first concentration and the second concentration corresponding to the pixel based on the first reaction-diffusion equation.
[0162] S1012: If the pixel is in a non-target area, update the first concentration and the second concentration corresponding to the pixel based on the second reaction-diffusion equation.
[0163] The electronic device can determine whether a pixel is in a target region or a non-target region. If the pixel is in the target region, the electronic device can update the concentration of the first type of pixel (i.e., the first concentration) and the concentration of the second type of pixel (i.e., the second concentration) based on the first reaction-diffusion equation. If the pixel is in a non-target region, the electronic device can update the first concentration and the second concentration based on the second reaction-diffusion equation.
[0164] In some embodiments of this application, the first concentration corresponding to a pixel can be the R channel value of that pixel, and the second concentration corresponding to a pixel can be the G channel value of that pixel.
[0165] In some other embodiments of this application, the first concentration and the second concentration corresponding to the pixel can be any two of the following: the R channel value of the pixel, the G channel value of the pixel, the B channel value of the pixel, and the transparency of the pixel.
[0166] In some embodiments of this application, the electronic device can set a target iteration number for each pixel in the first display area. In this case, the electronic device can update the first and second concentrations corresponding to the pixel based on the corresponding reaction-diffusion equation until the iteration number of the pixel reaches the target iteration number. That is, when the iteration number of the pixel reaches its corresponding target iteration number, the electronic device can stop updating the first and second concentrations corresponding to the pixel based on the corresponding reaction-diffusion equation. Here, the iteration number of the pixel refers to the number of times the electronic device iterates (or updates / calculates) based on the corresponding reaction-diffusion equation.
[0167] As you can understand, the target iteration count refers to the number of iterations (or calculations) required to render the image to be displayed based on the reaction-diffusion equation. In other words, when an electronic device displays the current image, each pixel on the screen needs to be iterated several times based on the corresponding reaction-diffusion equation before the color (i.e., the target color) of that pixel in the next frame can be determined based on the result of the last iteration. The number of iterations in this process is the target iteration count.
[0168] It is understood that the target iteration count for each pixel in the first display area can be the same or different, and this application does not impose any restrictions on this. For example, the electronic device can set the same target iteration count for each pixel in the first display area. As another example, the electronic device can set a larger target iteration count for some pixels in the first display area, while setting a smaller target iteration count for other pixels.
[0169] In some embodiments of this application, before the electronic device displays the first animation, the number of target iterations corresponding to each pixel in the first display area is the same. That is, the initial number of target iterations corresponding to each pixel in the first display area is the same.
[0170] In some embodiments of this application, during the display of the first animation on an electronic device, the number of target iterations corresponding to each pixel in the first display area may remain unchanged.
[0171] In some embodiments of this application, during the display of the first animation by the electronic device, the electronic device may adjust the target iteration number corresponding to the pixels in the first display area.
[0172] In one possible implementation, the electronic device can update the target content, and correspondingly, the target region and non-target regions can also be updated. In this case, for pixels in the changed parts of the target region (e.g., parts that were originally non-target regions but are now target regions, and parts that were originally target regions but are now non-target regions), the electronic device can increase its corresponding target iteration count. For pixels in the unchanged parts of the target region, the electronic device can either keep its corresponding target iteration count unchanged or decrease its corresponding target iteration count.
[0173] In another possible implementation, during the display of the first animation by the electronic device, the electronic device can receive an operation on the first display area, and for one or more pixels corresponding to the operation, the electronic device can increase its corresponding target iteration number, while for one or more pixels in the first display area other than those corresponding to the operation, the electronic device can keep its corresponding target iteration number unchanged or decrease its corresponding target iteration number.
[0174] It is understood that the one or more pixels corresponding to the operation may include one or more pixels within the location of the operation. In some embodiments of this application, the one or more pixels corresponding to the operation may further include one or more pixels located in the surrounding area of the location of the operation. It is understood that this application does not limit the surrounding area of the location of the operation. For example, the surrounding area of the location of the operation may be a circular area with a radius of a certain distance centered on the operation location. In this case, the one or more pixels corresponding to the operation may be pixels included in the circular area.
[0175] It is understood that the operation on the first display area can be a touch operation. In this case, the one or more pixels corresponding to the operation may include one or more pixels at the touch location, and may also include one or more pixels surrounding the touch location. Of course, the operation on the first display area can also be a sound operation, a gesture operation, etc., and this application does not limit it in this regard.
[0176] For example, the operation targeting the first display area can be the operation targeting the third position within the first display area mentioned above. In this case, the one or more pixels corresponding to the operation can be the one or more pixels corresponding to the third position. It is understood that the one or more pixels corresponding to the third position can be specifically referred to in the relevant description of the one or more pixels corresponding to the first position mentioned above, and will not be repeated here.
[0177] In some embodiments of this application, in response to the first operation, the electronic device can obtain multiple segmented regions. The electronic device can divide the first display area and set a target iteration number for each segmented region. That is, the electronic device sets a corresponding target iteration number for each segmented region. This means that the target iteration number corresponding to pixels in the same segmented region is the same.
[0178] It is understood that the target iteration counts corresponding to different segmented regions may be the same or different, and this application does not impose any restrictions on this. In some embodiments of this application, before the electronic device displays the first animation, the target iteration counts corresponding to each segmented region are the same. That is, the initial target iteration counts corresponding to each segmented region are the same. In other embodiments of this application, before the electronic device displays the first animation, the target iteration counts corresponding to each segmented region are not completely the same. That is, the initial target iteration counts corresponding to each segmented region are not completely the same, i.e., at least two segmented regions have different initial target iteration counts.
[0179] In the above scenario, for each pixel in the first display area, if the pixel is located in the target area, the electronic device can update the first concentration and second concentration corresponding to that pixel based on the first reaction-diffusion equation until the number of iterations based on the first reaction-diffusion equation reaches the target iteration number corresponding to the block area to which the pixel belongs. Furthermore, if the number of iterations based on the first reaction-diffusion equation reaches the target iteration number corresponding to the block area to which the pixel belongs, the electronic device can determine the target color of the pixel based on the first concentration and second concentration corresponding to that pixel (i.e., the first concentration and second concentration corresponding to the pixel after the update of the target iteration number). Similarly, if the pixel is located in a non-target area, the electronic device can update the first concentration and second concentration corresponding to that pixel based on the second reaction-diffusion equation until the number of iterations based on the second reaction-diffusion equation reaches the target iteration number corresponding to the block area to which the pixel belongs. Furthermore, if the number of iterations based on the second reaction-diffusion equation reaches the target iteration number corresponding to the block area to which the pixel belongs, the electronic device can determine the target color of the pixel based on the first concentration and second concentration corresponding to that pixel (i.e., the first concentration and second concentration corresponding to the pixel after the update of the target iteration number).
[0180] In some embodiments of this application, during the display of the first animation by the electronic device, the electronic device may adjust the target iteration number corresponding to one or more block areas in the first display area.
[0181] In one possible implementation, the electronic device can update the target content, and correspondingly, the target area and non-target areas can also be updated. In this case, for the block areas involved in the changed parts of the target area (e.g., parts that were originally non-target areas but are now target areas, and parts that were originally target areas but are now non-target areas), the electronic device can increase its corresponding target iteration count. For the block areas involved in the unchanged parts of the target area, the electronic device can either keep its corresponding target iteration count unchanged or decrease its corresponding target iteration count.
[0182] In another possible implementation, during the display of the first animation by the electronic device, the electronic device can receive an operation on the first display area, and for one or more block areas corresponding to the operation, the electronic device can increase its corresponding target iteration number, while for one or more block areas in the first display area other than those corresponding to the operation, the electronic device can keep its corresponding target iteration number unchanged or decrease its corresponding target iteration number.
[0183] In some embodiments of this application, the one or more block regions corresponding to the operation can be the same block region as the location of the operation.
[0184] It is understandable that the specific implementation method for adjusting the target iteration number corresponding to the block region of the electronic device can be found in the following text, and will not be elaborated here.
[0185] S1013: Determine the target color of the pixel based on the first and second concentrations corresponding to the pixel.
[0186] It is understandable that after an electronic device updates the first and second concentrations corresponding to a pixel, it can determine the target color of that pixel based on the first and second concentrations (i.e., the updated first and second concentrations). It is also understood that the first concentration involved in determining the target color of a pixel is the current first concentration corresponding to that pixel, that is, the first concentration most recently determined by the electronic device, or the updated first concentration corresponding to that pixel. Similarly, the second concentration involved in determining the target color of a pixel is the current second concentration corresponding to that pixel, that is, the second concentration most recently determined by the electronic device, or the updated second concentration corresponding to that pixel.
[0187] In some embodiments of this application, when the number of iterations of each pixel reaches its corresponding target number of iterations, the electronic device can determine its target color based on its corresponding first concentration and second concentration.
[0188] It is understood that the specific implementation of electronic devices determining their target color based on the first and second concentrations corresponding to pixels can be found in the following text, and will not be elaborated here.
[0189] In some embodiments of this application, when the electronic device performs step S1, for each pixel in the first display area, it may perform the following: Figure 4C Steps S1021-S1024 are shown below:
[0190] S1021: When a pixel is located in the display area of the target region excluding the boundary region, update the first concentration and the second concentration corresponding to the pixel based on the first reaction diffusion equation.
[0191] S1022: When the pixel is in the display area outside the boundary area of the non-target area, update the first concentration and the second concentration corresponding to the pixel based on the second reaction diffusion equation.
[0192] S1023: When the pixel is in the boundary region, the parameters in the first reaction-diffusion equation and the parameters in the second reaction-diffusion equation are processed based on the SDF corresponding to the pixel to obtain the third reaction-diffusion equation, and the first concentration and the second concentration corresponding to the pixel are updated based on the third reaction-diffusion equation.
[0193] The electronic device can determine whether a pixel is located within a display area of the target region excluding the boundary region, a display area of the non-target region excluding the boundary region, or a boundary region. If the pixel is within a display area of the target region excluding the boundary region, the electronic device can update the first and second concentrations corresponding to that pixel based on a first reaction-diffusion equation. If the pixel is within a display area of the non-target region excluding the boundary region, the electronic device can update the first and second concentrations corresponding to that pixel based on a second reaction-diffusion equation. If the pixel is within a boundary region, the electronic device can process the parameters in the first and second reaction-diffusion equations based on the SDF corresponding to that pixel to obtain a third reaction-diffusion equation, and update the first and second concentrations corresponding to the pixel based on the third reaction-diffusion equation.
[0194] It is understandable that the boundary region can include multiple pixels at the boundary between the target region and the non-target region. In other words, the boundary region can include a part of the target region and a part of the non-target region.
[0195] As is understood, the descriptions of the first and second concentrations can be found above, and will not be repeated here. The specific implementation of the electronic device in determining the third reaction diffusion equation can be found below, and will not be elaborated upon here.
[0196] Similar to the above, in some embodiments of this application, the electronic device can set a target number of iterations for each pixel in the first display area. The specific implementation method can be referred to the above, and will not be repeated here.
[0197] Similar to the above, in some embodiments of this application, in response to the first operation, the electronic device can obtain multiple block regions, the electronic device can divide the first display area, and set a target iteration number for each block region, that is, the electronic device sets a corresponding target iteration number for each block region.
[0198] In the above scenario, for each pixel in the first display area, if the pixel is located in the display area of the target area excluding the boundary area, the electronic device can update the first concentration and second concentration corresponding to that pixel based on the first reaction-diffusion equation until the number of iterations based on the first reaction-diffusion equation reaches the target iteration number corresponding to the block area to which the pixel belongs. Furthermore, if the number of iterations based on the first reaction-diffusion equation reaches the target iteration number corresponding to the block area to which the pixel belongs, the electronic device can determine the target color of the pixel based on the first concentration and second concentration corresponding to that pixel (i.e., the first concentration and second concentration corresponding to the pixel after the update following the target iteration number). Similarly, if the pixel is located in the display area of a non-target area excluding the boundary area, the electronic device can update the first concentration and second concentration corresponding to that pixel based on the second reaction-diffusion equation until the number of iterations based on the second reaction-diffusion equation reaches the target iteration number corresponding to the block area to which the pixel belongs. Furthermore, when the number of iterations based on the second reaction-diffusion equation reaches the target iteration number corresponding to the block to which the pixel belongs, the electronic device can determine the target color of the pixel based on the first and second concentrations corresponding to the pixel (i.e., the first and second concentrations corresponding to the pixel after the update of the target iteration number). Similarly, when the pixel is in a boundary region, the electronic device can process the parameters in the first and second reaction-diffusion equations based on the SDF corresponding to the pixel to obtain the third reaction-diffusion equation, and update the first and second concentrations corresponding to the pixel based on the third reaction-diffusion equation until the number of iterations based on the third reaction-diffusion equation reaches the target iteration number corresponding to the block region to which the pixel belongs. Furthermore, when the number of iterations based on the third reaction-diffusion equation reaches the target iteration number corresponding to the block to which the pixel belongs, the electronic device can determine the target color of the pixel based on the first and second concentrations corresponding to the pixel (i.e., the first and second concentrations corresponding to the pixel after the update of the target iteration number).
[0199] It is understood that the relevant descriptions of the segmented regions can be found in the context, and will not be elaborated upon here.
[0200] S1024: Determine the target color of the pixel based on the first and second concentrations corresponding to the pixel.
[0201] It is understood that the specific implementation of step S1024 can be referred to the relevant description of step S1013, and this application will not repeat it here.
[0202] S2: Render the Nth frame of the first animation based on the target color of each pixel in the first display area.
[0203] Given the target color of each pixel in the first display area, the electronic device can render the Nth frame of the first animation based on the target color of each pixel in the first display area.
[0204] S3: Display the Nth frame of the first animation in the first display area.
[0205] After the electronic device renders the Nth frame of the first animation, it can display the Nth frame in the first display area.
[0206] The following section uses the target text as an example to illustrate the specific implementation of the above embodiments.
[0207] For ease of understanding and description, when the target content is target text, this application refers to the target area as the text area and the non-target area as the non-text area.
[0208] First, for pixels in text areas and non-text areas, electronic devices use reaction-diffusion equations with different parameters to determine their target colors, and then render and display based on the target colors of these pixels.
[0209] In some embodiments of this application, in response to the first operation, before displaying the first animation, the electronic device can determine the text region and non-text region in the first display area based on the target text. Furthermore, before displaying any frame of the first animation, the electronic device can determine the color of the pixels in the text region and the target color of the pixels in the non-text region based on the corresponding reaction-diffusion equation, and then render the image to be displayed based on the target colors of the pixels in the text region and the non-text region. It is understood that the electronic device can repeatedly perform the above operations to display the first animation on the display screen.
[0210] The first animation may be an animation in which target text is displayed in a text area of a first display area with a fluid diffusion effect. The first animation includes multiple frames of images, and the electronic device displays the target text in the text area of the display screen when at least one of the multiple frames of images is displayed.
[0211] It is understood that the first operation is used to trigger the electronic device to display target text. In some embodiments of this application, the first operation can be a screen lock operation. In this case, the target text can be the current system time. That is, in response to the screen lock operation, the electronic device can lock the screen and display the system time. In still other embodiments of this application, the first operation can be an operation to trigger the launch of a weather application (e.g., clicking the weather application icon). In this case, the target text can be the current temperature. That is, after the electronic device launches the weather application, it can display the current temperature. In still other embodiments of this application, the first operation can be an operation to trigger a countdown. In this case, the target text can be the remaining countdown time.
[0212] In some embodiments of this application, the first display area may be the entire display area of the screen. In this case, the electronic device can display the first animation in the entire display area, that is, display the target text with a fluid diffusion effect in the entire display area. In still other embodiments of this application, the first display area may be a partial display area of the screen. In this case, the electronic device can display the first animation in a partial display area, that is, display the target text with a fluid diffusion effect in a partial display area, while displaying other content (e.g., controls, patterns, text, etc. that the foreground application needs to display) in other display areas.
[0213] Taking the first display area as the entire display area of the screen as an example, such as Figure 5A As shown, the target text can be 1, the non-text area can be the area outside the glyph outline of 1, and the text area can be the area inside the glyph outline of 1.
[0214] For example, the first display area can be the entire display area of the screen, and the electronic device can display such as Figure 6A The desktop interface shown can be used as follows: Figure 6A The first animation shown may include, for example, the operation of pressing the power button. Figures 6B-6D The image displayed on the screen is shown. In response to pressing the power button, the electronic device can display, as shown... Figures 6B-6D The interface shown, i.e., the electronic device can display the current system time on the screen using a fluid diffusion effect (e.g.) Figures 6A-6D The animation shown is at 15:27.
[0215] In some embodiments of this application, before displaying any frame of the first animation, the electronic device can traverse every pixel in the first display area and determine its target color based on the reaction diffusion equation. After the target color of every pixel in the first display area is determined, the image to be displayed is rendered based on the target colors of these pixels.
[0216] It is understood that this application does not restrict the way the electronic device traverses pixels. For example, the electronic device may traverse the pixels in the first display area in a top-to-bottom, left-to-right order (pixels with smaller row numbers are listed first, and for each row of pixels, pixels with smaller column numbers are listed first). As another example, the electronic device may first traverse the pixels in the text area and then traverse the pixels in the non-text area. Similarly, the electronic device may first traverse the pixels in the non-text area and then traverse the pixels in the text area.
[0217] The reaction-diffusion equations involved in the embodiments of this application will be described in detail below.
[0218] In some embodiments of this application, the reaction-diffusion equation can be:
[0219] Where A' represents the current concentration of the first type of pixel. B' represents the current concentration of the first type of pixel. A represents the original concentration of the first type of pixel. B represents the original concentration of the second type of pixel.
[0220] In some embodiments of this application, the concentration of the first type of pixels and the concentration of the second type of pixels can be represented by any two of the R channel, G channel, and B channel representing pixel color. For example, the concentration of the first type of pixels can be represented by the R channel representing pixel color, and the concentration of the second type of pixels can be represented by the G channel representing pixel color.
[0221] In some embodiments of this application, the density of the first type of pixels and the density of the second type of pixels can be represented by any two of the R channel, G channel, B channel representing pixel color, and transparency. For example, the density of the first type of pixels can be the B channel representing pixel color, and the density of the second type of pixels can be transparency.
[0222] D A It is the diffusion coefficient of the first type of pixel, used to quantify the rate at which the first type of pixel diffuses into the second type of pixel. D B This is the diffusion coefficient of the second type of pixel, used to quantify the rate at which the second type of pixel diffuses into the first type of pixel. The diffusion coefficient describes the propagation rate of a substance in a medium due to a concentration gradient.
[0223] It is the Laplacian operator for the first type of pixel, representing the color gradient. This is the Laplacian operator for the second type of pixel, representing the color gradient. During diffusion, matter flows from high-concentration areas to low-concentration areas, and this flow can be described by the Laplacian operator.
[0224] AB 2 This indicates the rate at which pixels of type 1 are converted into pixels of type 2.
[0225] f represents the generation rate of the first type of pixels (i.e., the generation rate mentioned above). f(1-A) is a source term representing the generation of the first type of pixels in the system (referring to the display screen in this application). This means that the generation rate of the first type of pixels is affected by its current concentration. When its concentration is close to 1, the source term is close to 0, indicating that the system is close to saturation.
[0226] k represents the rate at which the second type of pixels naturally disappears (i.e., the disappearance rate mentioned above). -(k+f)B is a disappearance rate term representing the disappearance of the second type of pixels in the system. This means that the disappearance rate of the second type of pixels is affected by their current concentration and by the generation rate of the first type of pixels, and there is an additional constant k representing the natural mortality rate of the second type of pixels.
[0227] Δt represents the time change in each iteration.
[0228] It should be noted that the source term and disappearance rate term in the reaction-diffusion equation involved in the embodiments of this application can be set according to actual needs, and this application does not impose any restrictions on them. The above f(1-A) and -(k+f)B are merely examples provided by the embodiments of this application and should not be regarded as limitations on this application.
[0229] For ease of understanding and description, this application denotes the number of image frames included in the first animation as M, and any frame in the first animation as the Nth frame. It is understood that N is less than or equal to M, and both N and M are positive integers.
[0230] The following describes the specific implementation method of rendering and displaying the Nth frame image in the first animation using an electronic device.
[0231] In some embodiments of this application, when displaying the (N-1)th frame of the first animation, for each pixel in the first display area, if the pixel is in a text area, the electronic device can determine the target color of the pixel based on a first reaction-diffusion equation; if the pixel is in a non-text area, the electronic device can determine the target color of the pixel based on a second reaction-diffusion equation. It can be understood that after determining the target color of each pixel in the first display area, the electronic device can render the Nth frame image based on the target colors of these pixels and display the Nth frame image.
[0232] For ease of understanding and description, this application denotes the first generation rate and the first disappearance rate as f1 and k1, respectively, and the second generation rate and the second disappearance rate as f2 and k2, respectively.
[0233] In some embodiments of this application, the first reaction-diffusion equation may be: Similarly, the diffusion equation for the second reaction can be:
[0234] It is understood that the meanings of the parameters in the first and second reaction-diffusion equations can be found above, and will not be repeated here. It should be noted that A can be different for different pixels, and similarly, B can also be different for different pixels. It should also be noted that A' and B' obtained in the previous iteration based on the reaction-diffusion equation are respectively A and B for the next iteration based on the reaction-diffusion equation.
[0235] In some embodiments of this application, the diffusion coefficient (i.e., D) of the first type of pixel in the first reaction diffusion equation A1 ) and the diffusion coefficient of the first type of pixel in the second reaction diffusion equation (i.e., D) A2 The same can be used. Similarly, the diffusion coefficient (i.e., D) of the second type of pixel in the first reaction diffusion equation can also be used. B1 ) and the diffusion coefficient of the second type of pixel in the second reaction diffusion equation (i.e., D) B2 () can be the same.
[0236] In some embodiments of this application, the diffusion coefficient (i.e., D) of the first type of pixel in the first reaction diffusion equation A1 ) and the diffusion coefficient of the first type of pixel in the second reaction diffusion equation (i.e., D) A2 The diffusion coefficients (D) of the second type of pixel in the first reaction diffusion equation can be different. B1 ) and the diffusion coefficient of the second type of pixel in the second reaction diffusion equation (i.e., D) B2 (They can be different.)
[0237] In some embodiments of this application, after receiving a first operation, the electronic device responds to a second operation on a first display area. For one or more pixels in the first display area corresponding to the second operation, the electronic device can set its target color to the color of a first type of pixel. Specifically, the electronic device can set its corresponding A and B accordingly, so that the target color determined based on the set A and B is the color of the first type of pixel (for example, setting its corresponding A and B to 1 and 0 respectively).
[0238] It is understood that the second operation can be a touch, gesture, voice, or other operation, and this application does not limit its specific type.
[0239] For example, the first display area can be the entire display area of the screen, the first type of pixels can be white pixels, and the second type of pixels can be black pixels. Figure 7A As shown, after receiving the first operation, the electronic device can set the entire first display area to black. After receiving a touch operation on the first display area, the electronic device can set the color of the pixels in the touch area corresponding to the touch operation to white. In subsequent processes, the electronic device can display white target text in the first display area with a fluid diffusion effect.
[0240] In some embodiments of this application, when the time interval between the electronic device receiving the first operation is not less than a first duration, the electronic device may randomly select one or more pixels in the first display area and set their target color as the color of the first type of pixel. Specifically, the electronic device may set its corresponding A and B so that the target color determined based on the set A and B is the color of the first type of pixel (for example, setting its corresponding A and B to 1 and 0 respectively).
[0241] For example, the first display area can be the entire display area of the screen, the first type of pixels can be white pixels, and the second type of pixels can be black pixels. Figure 7B As shown, when the duration of the first operation received by the electronic device (starting from the time the first operation is received) is less than a first duration, the color of the pixels in the first display area is not set separately. However, when the duration of the first operation received by the electronic device is equal to or greater than the first duration, the electronic device can randomly select an area in the first display area and set the color of the pixels in that area to white. In subsequent processes, the electronic device can display white target text in the first display area with a fluid diffusion effect.
[0242] In some embodiments of this application, the ranges of A and B involved in this application can be [0,1].
[0243] In some embodiments of this application, the initial value of A for each pixel in the first display area is 0, and the initial value of B for each pixel is 1. In this case, the color of each pixel in the first display area is the color of the second type of pixel. In one possible implementation, after receiving the first operation, in response to the second operation on the first display area, for one or more pixels in the first display area corresponding to the second operation, the electronic device can set the corresponding A to 1 and the corresponding B to 0. In another possible implementation, when the time interval between the electronic device receiving the first operation and the first time interval is a first time period, the electronic device can randomly select one or more pixels in the first display area and set the corresponding A to 1 and the corresponding B to 0.
[0244] It is understood that the initial duration can be set according to actual needs, and this application does not impose any restrictions on it. For example, the initial duration can be 5 milliseconds (ms).
[0245] In some embodiments of this application, for a pixel in the first display area, after the electronic device determines A' and B' based on the reaction-diffusion equation (i.e., the first reaction-diffusion equation / the second reaction-diffusion equation) corresponding to the pixel, the target color of the pixel can be determined based on the magnitude of A' and B'.
[0246] In one possible implementation, if A'>B', the electronic device can determine that the target color of the pixel is the color of a first type of pixel. For example, if the first type of pixel is a white pixel, the electronic device can determine that the target color of the pixel is white. However, if A'≤B', the electronic device can determine that the target color of the pixel is the color of a second type of pixel. For example, if the second type of pixel is a black pixel, the electronic device can determine that the target color of the pixel is black.
[0247] In another possible implementation, if the value of A'-B' is greater than the first difference, the electronic device can determine that the target color of the pixel is the color of a first type of pixel; however, if the value of A'-B' is less than or equal to the first difference, the electronic device can determine that the target color of the pixel is the color of a second type of pixel.
[0248] It is understood that the first difference can be set according to actual needs, and this application does not impose any restrictions on it. For example, the first difference can be 0.2. As another example, the first difference can be 0.3.
[0249] In another possible implementation, if A' is within a first concentration range and B' is within a second concentration range, the electronic device can determine that the target color of the pixel is the color of a first type of pixel. However, if A' is not within the first concentration range or B' is not within the second concentration range, the electronic device can determine that the target color of the pixel is the color of a second type of pixel.
[0250] It is understood that the first concentration range and the second concentration range can be set according to actual needs, and this application does not impose any restrictions on them. For example, the first concentration range can be [0.5, 1], and the second concentration range can be [0, 0.5].
[0251] Second, on the one hand, for pixels in text areas and non-text areas excluding the boundary areas, the electronic device uses reaction diffusion equations with different parameters to determine their target colors. On the other hand, for pixels in the boundary areas of text areas and non-text areas, the electronic device mixes the parameters in the reaction diffusion equations corresponding to the text areas and non-text areas based on their SDF distance to obtain a mixed reaction diffusion equation, and determines their target colors based on the mixed reaction diffusion equation. Then, it performs rendering and display based on the target colors of each pixel in the first display area.
[0252] In some embodiments of this application, in response to the first operation, before displaying the first animation, the electronic device can determine the text region and non-text region in the first display area based on the target text, and determine the boundary region based on the SDF of the target text. Furthermore, before displaying any frame of the first animation, for pixels in the text region (excluding the boundary region) and pixels in the non-text region (excluding the boundary region), the electronic device can determine the target color of each pixel based on the corresponding reaction-diffusion equation. For pixels in the boundary region, the electronic device can mix the parameters in the reaction-diffusion equations corresponding to the text region and non-text region based on the SDF distance of the pixel to obtain a mixed reaction-diffusion equation, and determine the target color of the pixel based on this mixed reaction-diffusion equation. Thus, the electronic device can render the image to be displayed based on the target colors of each pixel in the first display area (including pixels in the text region (excluding the boundary region), the non-text region (excluding the boundary region), and the boundary region). It is understood that the electronic device can repeatedly execute the above operations to display the first animation on the display screen.
[0253] Understandably, the boundary region can be the area surrounding the dividing line between text and non-text areas (such as the outline of the target text). The boundary region may include part of the text area and part of the non-text area. Taking the first display area as the entire display area of the screen as an example, such as... Figure 5B As shown, the text area can be the area within the outline of the character "1", and the non-text area can be the area outside the outline of the character "1". The boundary area can include part of the text area and part of the non-text area. The boundary area can be a white-filled area, and the black lines in this white-filled area represent the outline of the character "1". Figure 5B The two black-filled areas are the non-text area excluding the boundary area and the text area excluding the boundary area, respectively.
[0254] It is understandable that the SDF of the target text refers to the minimum distance from a pixel to the outline of the target text. If the pixel is inside the target text, its SDF distance is negative; if the pixel is on the outline of the target text, its SDF distance is 0; and if the pixel is outside the target text, its SDF distance is positive.
[0255] In some embodiments of this application, the electronic device can obtain the SDF corresponding to each pixel in the first display area through the SDF image corresponding to the target text. For example, of the three channels (such as the R, G, and B channels in the RGB color space) corresponding to a pixel in the SDF image, one channel can be used to store the SDF corresponding to that pixel, and the other two channels can be used to store the coordinates of that pixel on the display screen. In this case, the electronic device can determine the SDF corresponding to the pixel and the coordinates of that pixel on the display screen through the channel values of the pixel in the SDF image.
[0256] For example, Figure 8A and Figure 8B The image shows the SDF values for target text 1 and 6. For example... Figure 8A As shown, the SDF distance of pixels located inside the "1" shape is negative, the SDF distance of pixels located on the outline of the "1" shape is 0, and the SDF distance of pixels located outside the "1" shape is positive. Figure 8B As shown, the SDF distance of pixels inside the 6 is negative, the SDF distance of pixels on the outline of the 6 is 0, and the SDF distance of pixels outside the 6 is positive.
[0257] As is understandable, the relevant description of traversing the pixels in the first display area can be found above, and will not be repeated here.
[0258] The following describes the specific implementation method of rendering and displaying the Nth frame image in the first animation using an electronic device.
[0259] It is understandable that when displaying the (N-1)th frame of the first animation, for each pixel in the first display area, if the pixel is located in a text area (excluding boundary areas), the electronic device can determine the target color of the pixel based on the first reaction diffusion equation. If the pixel is located in a non-text area (excluding boundary areas), the electronic device can determine the target color of the pixel based on the second reaction diffusion equation. If the pixel is located in a boundary area, the electronic device can mix the parameters in the first and second reaction diffusion equations based on the pixel's SDF distance to obtain mixed parameters and a mixed reaction diffusion equation. The electronic device can then determine the target color of the pixel based on this mixed reaction diffusion equation. It is also understandable that after determining the target color of each pixel in the first display area, the electronic device can render the Nth frame image based on these target colors and display the Nth frame image.
[0260] The following section details how to mix the parameters in the first and second reaction diffusion equations.
[0261] Understandably, for pixels in the boundary region, the electronic device can perform smoothing, determine the corresponding interpolation factor based on the SDF distance of the pixel, and then mix the parameters in the first reaction-diffusion equation and the second reaction-diffusion equation based on the corresponding interpolation factor to obtain the mixed reaction-diffusion equation, and determine the color of the pixel based on the reaction-diffusion equation.
[0262] In some embodiments of this application, the SDF distance of pixels in the boundary region is within a first distance range. It is understood that the first distance range can be set according to actual needs, and this application does not limit it. For example, the first distance range can be [-0.01, 0.01]. For instance, in the case where the first animation consists of multiple frames of 1024 pixel * 1024 pixel images, the length of a pixel is denoted as 1 / 1024, approximately 0.001. In this case, the first distance range of [-0.01, 0.01] represents a range within which the glyph outline of the target text is no more than 10 pixels away (including the range within the text region and non-text region within which the glyph outline of the target text is no more than 10 pixels away).
[0263] In some embodiments of this application, the electronic device may smooth boundary regions based on the smoothstep function. It is understood that the smoothstep function can provide a smooth transition between two values, which is very useful in computer graphics, especially in scenarios where a smooth transition between two colors, textures, or numerical values is required.
[0264] In some embodiments of this application, the interpolation factor can be: dText = 1 - smoothstep(minimum value in the first distance range, maximum value in the first distance range, SDF distance of the pixel). For example, dText = 1 - smoothstep(-0.01, 0.01, sdfFont). Wherein, sdfFont refers to the SDF distance of the pixel.
[0265] In some embodiments of this application, the electronic device can perform linear interpolation on the first generation rate and the second generation rate based on the interpolation factor corresponding to the pixel to obtain the mixed generation rate. Similarly, the electronic device can perform linear interpolation on the first disappearance rate and the second disappearance rate based on the interpolation factor corresponding to the pixel to obtain the mixed disappearance rate.
[0266] For ease of understanding and description, this application denotes the generation rate after mixing as f3 and the disappearance rate after mixing as k3.
[0267] In some embodiments of this application, the electronic device can mix the first generation rate and the second generation rate based on the `mix` function. That is, `f3 = mix(f2, f1, dText)`. Similarly, the electronic device can also mix the first vanishing rate and the second vanishing rate based on the `mix` function. That is, `k3 = mix(k2, k1, dText)`. It is understood that the `mix` function is primarily used for linear interpolation between two values.
[0268] In some embodiments of this application, the first type of diffusion coefficients in the first reaction-diffusion equation and the second reaction-diffusion equation are the same, and the second type of diffusion coefficients in the first reaction-diffusion equation and the second reaction-diffusion equation are also the same. In this case, the electronic device can directly replace the generation rate and the disappearance rate in the first reaction-diffusion equation or the second reaction-diffusion equation with the above-mentioned generation rate and the above-mentioned disappearance rate after mixing, respectively, to obtain the above-mentioned mixed reaction-diffusion equation.
[0269] In some embodiments of this application, the first type of diffusion coefficients in the first reaction-diffusion equation and the second reaction-diffusion equation are different, and the second type of diffusion coefficients in the first reaction-diffusion equation and the second reaction-diffusion equation are also different. In this case, the electronic device not only needs to mix the generation rate and the disappearance rate in the first reaction-diffusion equation and the second reaction-diffusion equation, but also needs to mix the diffusion coefficients in the first reaction-diffusion equation and the second reaction-diffusion equation.
[0270] For ease of understanding and description, this application denotes the diffusion coefficient of the first type of pixels after mixing as D. A3 The diffusion coefficient of the second type of pixels after mixing is denoted as D. B3 .
[0271] In some embodiments of this application, the electronic device can mix the diffusion coefficients of first-type pixels in the first reaction-diffusion equation and the second reaction-diffusion equation based on the mix function, and mix the diffusion coefficients of second-type pixels in the first reaction-diffusion equation and the second reaction-diffusion equation. That is, D A3 =mix(D A2 D A1 ,dText), D B3 =mix(D B2 D B1 ,dText).
[0272] It should be noted that for different pixels in the boundary region, the corresponding interpolation factors can be the same or different, which means that the corresponding reaction-diffusion equations after mixing can be the same or different.
[0273] Understandably, similar to the above, for a pixel in the first display area, after the electronic device determines A' and B' based on the reaction-diffusion equation (i.e., the first reaction-diffusion equation / the second reaction-diffusion equation / the mixed reaction-diffusion equation) corresponding to the pixel, it can determine the target color of the pixel based on the size of A' and B'. For the specific implementation method, please refer to the above, and this application will not repeat it here.
[0274] Third, on the one hand, the electronic device divides the first display area and adjusts the target iteration number of each block area in the image to be displayed based on the color gradient changes of the already displayed image. On the other hand, for pixels in the text area and non-text area, the electronic device uses reaction diffusion equations with different parameters to determine the target color of the pixel until the iteration number of each pixel in the text area and non-text area reaches the target iteration number corresponding to its block area. Then, the electronic device renders based on the target color of each pixel in the first display area.
[0275] In some embodiments of this application, in response to the first operation, before displaying the first animation, the electronic device can determine the text area and non-text area in the first display area based on the target text, and can also divide the first display area. Furthermore, before displaying any frame of the first animation, the electronic device can adjust the target iteration number of each segmented area and use a corresponding reaction-diffusion equation to determine the target color of each pixel in the first display area until the iteration number of each pixel in the first display area is its corresponding target iteration number (i.e., the target iteration number corresponding to its segmented area). At this point, the electronic device can render the image to be displayed based on the target color of each pixel. It is understood that the electronic device can repeatedly execute the above operations to achieve the display of the first animation on the screen.
[0276] As can be understood, the target iteration count refers to the number of calculations (iterations) performed based on the reaction-diffusion equation to determine the target color of a pixel. In other words, the target iteration count refers to the number of times A' and B' need to be determined based on the reaction-diffusion equation before the electronic device renders the Nth frame of the image after the (N-1)th frame has been displayed; that is, the number of calculations required based on the reaction-diffusion equation before determining the target color of a pixel.
[0277] In some embodiments of this application, the target color of each pixel in the first display area used by the electronic device to render the image to be displayed is the most recently determined target color.
[0278] In some embodiments of this application, before displaying any frame of the first animation, and before the number of iterations of a pixel (the number of iterations in the case of the previous frame of the arbitrary frame that has been displayed) is the target number of iterations, the electronic device may determine A' and B' based solely on the reaction-diffusion equation corresponding to the pixel, and no longer determine the target pixel of the pixel based on A' and B'. Instead, the electronic device determines A' and B' based on the reaction-diffusion equation corresponding to the pixel and determines the target pixel of the pixel based on A' and B' only when the number of iterations of the pixel is the target number of iterations.
[0279] For example, if the target iteration number of a certain pixel in the first display area is 3, then after the electronic device determines A' and B' based on the reaction-diffusion equation corresponding to the pixel for the first time, it does not need to determine the target color of the pixel based on A' and B'. Similarly, after the electronic device redetermines A' and B' based on the reaction-diffusion equation corresponding to the pixel for the second time, it also does not need to determine the target color of the pixel based on the redetermined A' and B'. However, after the electronic device redetermines A' and B' based on the reaction-diffusion equation corresponding to the pixel for the third time, it can determine the target color of the pixel based on the redetermined A' and B'.
[0280] In some embodiments of this application, before displaying any frame of the first animation, regardless of whether the number of iterations for a pixel is less than or equal to the target number of iterations, the electronic device can determine A' and B' based on the reaction-diffusion equation corresponding to the pixel, and determine the target pixel for that pixel based on A' and B'. If the number of iterations for a pixel is less than the target number of iterations, the electronic device can update the target pixel for that pixel based on the next determined A' and B' after the next determination of A' and B'.
[0281] For example, if the target iteration count for a certain pixel in the first display area is 3, then after the electronic device determines A' and B' based on the reaction-diffusion equation corresponding to that pixel for the first time, it can determine the target color of that pixel based on A' and B'. Similarly, after the electronic device redetermines A' and B' based on the reaction-diffusion equation corresponding to that pixel for the second time, it can also redetermine the target color of that pixel based on the redetermined A' and B' and update the target color of that pixel to the redetermined target color. Similarly, after the electronic device redetermines A' and B' based on the reaction-diffusion equation corresponding to that pixel for the third time, it can redetermine the target color of that pixel based on the redetermined A' and B' and update the target color of that pixel to the redetermined target color.
[0282] In some embodiments of this application, in response to a first operation, after the electronic device sets the target color of one or more pixels in a first display area to the color of a first type of pixel, the electronic device may begin to adjust the target iteration number of each block area.
[0283] In some embodiments of this application, in response to the first operation, when the electronic device sets the target color of one or more pixels in the first display area to the color of a first type of pixel for a second duration, the electronic device may begin to adjust the target iteration number of each block area.
[0284] It is understood that the second duration can be set according to actual needs, and this application does not impose any restrictions on it. For example, the second duration can be 10ms.
[0285] The following explains the specific implementation method of dividing the first display area of an electronic device into multiple block areas.
[0286] It is understood that this application does not limit the method of dividing the first display area. In some embodiments of this application, the electronic device may divide the first display area based on one or more of the following factors: preset block area, preset block shape, preset block number, and division interval.
[0287] In one possible implementation, the electronic device can divide the first display area using a preset block area. For example, the preset block area can be a fixed value, allowing the electronic device to divide the first display area into 'a' blocks of equal size. Alternatively, the preset block area can include multiple block areas, allowing the electronic device to divide the first display area into multiple blocks of partially identical or completely different sizes.
[0288] In one possible implementation, the electronic device can divide the first display area using preset block areas and preset block shapes. For example, the electronic device can divide the first display area into multiple rectangular areas of equal size.
[0289] In one possible implementation, the electronic device can divide the first display area with a preset number of blocks and a preset shape.
[0290] In one possible implementation, the electronic device can divide the first display area by a preset interval.
[0291] It is understood that the preset block area, preset block shape, preset block number, and division interval can be set according to actual needs, and this application does not impose any restrictions on this.
[0292] For example, the preset number of blocks can be 9, and the preset shape can be a rectangle. Figure 9 As shown, the electronic device can divide the first display area into 9 rectangular areas. It is understood that these 9 rectangular areas can be identical, or they can be rectangular areas with different areas or side lengths; this application does not impose any restrictions on this.
[0293] Of course, electronic devices may use other methods to divide the first display area, and this application does not limit this.
[0294] As is understandable, the relevant description of traversing the pixels in the first display area can be found above, and will not be repeated here.
[0295] The following explains the specific implementation method for adjusting the target iteration number of pixels in each block region of the electronic device.
[0296] It is understandable that the number of target iterations can be the same for each pixel in the same block region.
[0297] In some embodiments of this application, the initial target iteration number is the same for each segmented region. That is, before the electronic device displays the first animation, the target iteration number is the same for each pixel in each segmented region of the first display area.
[0298] In some embodiments of this application, the electronic device can create a Laplacian operator sliding window, which may include the latest displayed frame h of the first animation. Before displaying the next frame of the first animation, the electronic device can adjust the target iteration number for each block region based on the color gradient changes of each block region in the h-frame image. It is understood that h is a positive integer.
[0299] It is understood that the specific value of h can be set according to actual needs, and this application does not impose any restrictions on it. For example, h can be 4. That is to say, the sliding window can include the 4 frames of images that have been displayed on the screen in the first animation and are displayed latest. For example, as shown below. Figure 10 As shown, when the electronic device displays the (N-1)th frame of the first animation, the sliding window may include the (N-4)th frame, the (N-3)th frame, the (N-2)th frame, and the (N-1)th frame of the first animation.
[0300] For ease of understanding and description, this application denotes the number of pixels in each block of the first display area corresponding to the Laplacian operator within the color gradient range as the Laplacian operator corresponding to that block.
[0301] In some embodiments of this application, when determining the Laplacian operator for the i-th block region, for each pixel in the i-th block region, the electronic device can combine the R-channel and G-channel values of the four surrounding pixels (the four pixels above, below, left, and right) to determine the Laplacian operator for that pixel. After determining the Laplacian operator for each pixel in the i-th block region, the electronic device can determine the number of pixels with the corresponding Laplacian operator within the color gradient range.
[0302] The Laplacian operator for a pixel can be represented as:
[0303]
[0304] Here, e(x,y) represents the R-channel and G-channel values of the pixel (or a two-dimensional array composed of the R-channel and G-channel values of the pixel), and e(x+1,y), e(x-1,y), e(x,y+1), and e(x,y-1) represent the R-channel and G-channel values of the four pixels surrounding the pixel.
[0305] The above-described method for determining the Laplacian operator of a pixel based on R-channel and G-channel values is merely an example provided in this application and should not be considered a limitation thereof. In some embodiments of this application, when an electronic device determines the Laplacian operator of a pixel, it may calculate it based on any two of the R-channel, G-channel, and B-channel values.
[0306] It is understood that pixels whose corresponding Laplacian operator falls within the color gradient range are considered edge pixels. The color gradient range can be set according to actual needs, and this application does not impose any restrictions on it. For example, the color gradient range can be non-zero. That is to say, the Laplacian operator corresponding to a pixel must fall within the color gradient range, which specifically includes: the Laplacian operator corresponding to the pixel being non-zero.
[0307] In some embodiments of this application, when displaying the (N-1)th frame of the first animation, for the i-th block region in the first display area, on the one hand, the electronic device can determine the Laplacian operator of the i-th block region in the h frames of images already displayed in the sliding window, and determine the average value of the h Laplacian operators of the i-th block region; on the other hand, the electronic device can determine the current Laplacian operator of the i-th block region. It is understood that i is a positive integer, and i is less than or equal to h.
[0308] In one possible implementation, if the current Laplacian operator of the i-th block is greater than the average value, the electronic device can increase the target iteration number corresponding to the i-th block; if the current Laplacian operator of the i-th block is equal to the average value, the electronic device can maintain the target iteration number corresponding to the i-th block; and if the current Laplacian operator of the i-th block is less than the average value, the electronic device can decrease the target iteration number corresponding to the i-th block. In another possible implementation, if the current Laplacian operator of the i-th block is greater than the average value, the electronic device can either increase or maintain the target iteration number corresponding to the i-th block; and if the current Laplacian operator of the i-th block is less than or equal to the average value, the electronic device can decrease the target iteration number corresponding to the i-th block.
[0309] In some embodiments of this application, the electronic device increases the target iteration number corresponding to the i-th block region, specifically including: the electronic device increases the target iteration number corresponding to the i-th block region by c1 times.
[0310] In some embodiments of this application, the electronic device reduces the target iteration number corresponding to the i-th block region, specifically including: the electronic device reduces the target iteration number corresponding to the i-th block region by c2 times.
[0311] It is understood that c1 and c2 are positive integers, and their specific values can be set according to actual needs; this application does not impose any restrictions on this. It is also understood that c1 and c2 can be the same or different. For example, c1 and c2 can both be 1. Another example is that c1 can be 2, while c2 can be 1.
[0312] In some embodiments of this application, the target iteration number corresponding to the i-th block region is less than or equal to the preset maximum iteration number.
[0313] It is understood that the preset maximum number of iterations can be set according to actual needs, and this application does not impose any restrictions on this. In some embodiments of this application, the preset maximum number of iterations can be set according to the performance of the electronic device (such as the GPU processing power of the electronic device). The performance of the electronic device can be determined by factors such as its hardware specifications and software configuration. For example, for a high-performance electronic device, the preset maximum number of iterations can be 10, while for a low-performance electronic device, the preset maximum number of iterations can be 3. In some embodiments of this application, the preset maximum number of iterations can be within a preset iteration range. For example, the preset iteration range can be 5-8 (inclusive). In this case, the preset maximum number of iterations can be set to any integer between 5 and 8.
[0314] The following describes the specific implementation method of rendering and displaying the Nth frame image in the first animation using an electronic device.
[0315] Understandably, when displaying the (N-1)th frame of the first animation, the electronic device can repeatedly traverse the pixels in the first display area until the iteration count of each pixel in the first display area reaches its target iteration count. At this point, the electronic device can stop traversing the pixels in the first display area and render the Nth frame based on the target color of each pixel in the first display area.
[0316] During the process of traversing the pixels in the first display area, for any pixel in the first display area, the electronic device can perform the following steps:
[0317] The electronic device can determine the target iteration number of the block region to which a pixel belongs, and whether the pixel's iteration number (i.e., the number of times the pixel has already been iterated) has reached the target iteration number of its block region. If the pixel's iteration number has not reached the target iteration number of its block region, that is, the pixel's iteration number is less than the target iteration number of its block region, the electronic device can continue to iterate on the pixel. In other words, if the pixel is in a text region, the electronic device can update the pixel's target color based on the first reaction-diffusion equation; if the pixel is in a non-text region, the electronic device can update the pixel's target color based on the second reaction-diffusion equation. If the pixel's iteration number has reached the target iteration number of its block region, that is, the pixel's iteration number is the target iteration number of its block region, then the electronic device will no longer iterate on the pixel before rendering the image to be displayed. In other words, the electronic device will no longer update the pixel's target color based on the reaction-diffusion equation; the pixel's target color is the target color determined in the last iteration.
[0318] As is understood, the descriptions of the reaction diffusion equation and the target color of the updated pixel can be found above, and will not be repeated here.
[0319] Fourthly, the electronic device divides the first display area and adjusts the target iteration number of each block in the image to be displayed based on the color gradient changes of the already displayed image. Secondly, for pixels in text and non-text areas (excluding boundary areas), the electronic device uses reaction-diffusion equations with different parameters to determine their target colors. Thirdly, for pixels in the boundary areas between text and non-text areas, the electronic device mixes the parameters in the reaction-diffusion equations corresponding to the text and non-text areas based on their SDF distance, obtaining a mixed reaction-diffusion equation, and determines its target color based on this mixed reaction-diffusion equation. This process continues until the iteration number of each pixel in the first display area reaches the target iteration number corresponding to its block area, at which point the electronic device performs rendering based on the target color of each pixel.
[0320] In some embodiments of this application, in response to the first operation, before displaying the first animation, the electronic device can determine the text region and non-text region in the first display area based on the target text, and can also determine the boundary region based on the SDF of the target text, and can also divide the first display area. Furthermore, before displaying any frame of the first animation, the electronic device can adjust the target iteration number of each block region. For pixels in the text region (excluding the boundary region) and pixels in the non-text region (excluding the boundary region), the electronic device can determine the target color of the pixel based on the corresponding reaction-diffusion equation. For pixels in the boundary region, the electronic device can mix the parameters in the reaction-diffusion equations corresponding to the text region and non-text region based on the SDF distance of the pixel to obtain a mixed reaction-diffusion equation, and determine the target color of the pixel based on the mixed reaction-diffusion equation. This process continues until the iteration number of each pixel in the first display area is its corresponding target iteration number (i.e., the target iteration number corresponding to its block region). At this point, the electronic device can render the image to be displayed based on the target color of each pixel in the first display area. It is understood that the electronic device can repeatedly execute the above operations to display the first animation on the screen.
[0321] The following describes the specific implementation method of rendering and displaying the Nth frame image in the first animation using an electronic device.
[0322] Understandably, when displaying the (N-1)th frame of the first animation, the electronic device can repeatedly traverse the pixels in the first display area until the iteration count of each pixel in the first display area reaches its target iteration count. At this point, the electronic device can stop traversing the pixels in the first display area and render the Nth frame based on the target color of each pixel in the first display area.
[0323] During the process of traversing the pixels in the first display area, for any pixel in the first display area, the electronic device can perform the following steps:
[0324] The electronic device can determine the target iteration number of the block region to which a pixel belongs, and determine whether the iteration number of the pixel (i.e., the number of times the pixel has been iterated) has reached the target iteration number of its block region. If the iteration number of the pixel has not reached the target iteration number of its block region, that is, the iteration number of the pixel is less than the target iteration number of its block region, the electronic device can continue to iterate on the pixel. In other words, when the pixel is in a text region excluding the boundary region, the electronic device can update the target color of the pixel based on the first reaction diffusion equation; when the pixel is in a non-text region excluding the boundary region, the electronic device can update the target color of the pixel based on the second reaction diffusion equation; and when the pixel is in a boundary region, the electronic device can mix the parameters in the first and second reaction diffusion equations based on the SDF distance of the pixel to obtain the mixed parameters and the mixed reaction diffusion equation, and update the target color of the pixel based on the mixed reaction diffusion equation. If the number of iterations for a pixel reaches the target number of iterations for its block region, that is, the number of iterations for a pixel is the target number of iterations for its block region, then the electronic device will no longer iterate over the pixel before rendering the image to be displayed. In other words, the electronic device will no longer update the target color of the pixel based on the reaction-diffusion equation, that is, the target color of the pixel is the target color determined in the last iteration.
[0325] As is understood, the descriptions of the reaction diffusion equation and the target color of the updated pixel can be found above, and will not be repeated here.
[0326] It should be noted that, based on any of the above display methods, if the target text changes, the electronic device can redetermine the text and non-text areas based on the changed target text. Furthermore, based on the second display method described above, the electronic device can also determine the SDF of the changed target text and redetermine the boundary area based on that SDF.
[0327] For example, such as Figure 11As shown in (a), (b) and (c), when the target text changes from 16 to 17, the electronic device can determine that the target text has changed and display the text as 16 to 17 with a fluid diffusion effect.
[0328] For example, such as Figure 12 As shown, when the current system time changes from 15:27 to 15:28 in the locked state, the electronic device can determine that the target text has changed. In this case, the electronic device can redetermine the text area and non-text area based on the changed system time, and use the corresponding reaction diffusion equation to determine the target color of each pixel on the display screen, thereby achieving the effect of fluid diffusion to change the displayed text from 15 and 27 to 15 and 28.
[0329] It should also be noted that, based on any of the above display methods, during the process of the electronic device displaying target text in the text area of the first display area with a fluid diffusion effect (e.g., the electronic device displaying the first animation), if the electronic device receives an operation targeting the first display area, the electronic device can set the pixel in the area corresponding to the operation to the color of the second type of pixel (e.g., black).
[0330] In other words, upon receiving an operation targeting the first display area, for any pixel within the first display area, the electronic device can determine whether the pixel is located within the area corresponding to the operation before executing any of the aforementioned display methods. If the pixel is located within the area corresponding to the operation, the electronic device can determine the target color of the pixel as the color of the second type of pixel and does not iterate over it. If the pixel is not located within the area corresponding to the operation, the electronic device can execute any of the aforementioned display methods to determine the target color of the pixel. That is, when the user's sliding position on the display changes, on the one hand, the electronic device does not need to maintain the color of the pixel at the original sliding position as the color of the second type of pixel, but instead determines the target color of the pixel at the original sliding position based on the aforementioned display methods. On the other hand, the electronic device can set the target color of the pixel at the current sliding position to the color of the second type of pixel without needing to determine the target color of the current sliding position based on the aforementioned display methods.
[0331] In one possible implementation, the operation on the first display area can be a touch operation. In this case, the area corresponding to the touch operation is the area corresponding to the touch point, i.e., the touch area. It is understood that the touch area can be smaller or larger than the actual touch area, or the same as the actual touch area; this application does not impose any limitations on this.
[0332] For example, such as Figure 13As shown in (a), (b), and (c), when the electronic device displays the number 16 on the screen with a fluid diffusion effect, the user can slide on the screen, and in response to this slide, the corresponding sliding area on the screen is uniformly displayed in black. Figure 13 (a) and Figure 13 As shown in (c), when the user's swipe position on the display changes from the area containing the number 1 to the area containing the number 6, the electronic device does not need to maintain the color of the pixel at the original swipe position in the area containing the number 1 as black. Instead, it determines the target color of the pixel at the original swipe position based on the display method described above, such as... Figure 13 As shown in (c), the black pixels displayed in the area where the number 1 is located due to the sliding change back to white pixels. On the other hand, the electronic device can set the target color of the pixel currently located in the area where the number 6 is located to black without having to determine the target color of the current sliding position based on the above display method.
[0333] For example, such as Figures 14A-14C As shown, when an electronic device displays the current system time on a screen using a fluid diffusion effect, the user can swipe on the screen, and in response to this swipe, the corresponding swipe area on the screen is uniformly displayed in black. For example... Figure 14B and Figure 14C As shown, when the user's swipe position on the display changes from near the number 2 to near the number 7, on the one hand, the electronic device does not need to keep the color of the pixels near the number 2 black, but determines the target color of the pixels at the original swipe position based on the above display method. On the other hand, the electronic device can set the target color of the pixels at the swipe position near the number 7 to black, without needing to determine the target color of the current swipe position based on the above display method.
[0334] Furthermore, based on any of the above display methods, during the process of the electronic device displaying target text in the text area of the first display area with a fluid diffusion effect (e.g., the electronic device displaying a first animation), if the electronic device receives an operation targeting the first display area, the electronic device can divide the first display area into a high-diffusion area and a low-diffusion area based on the operation. In some embodiments of this application, the operation can be a touch operation, and the segmented area involved in the operation can include the segmented area touched by the user.
[0335] In some embodiments of this application, in response to the first operation, the electronic device does not divide the first display area into multiple blocks. In this case, if the electronic device subsequently receives an operation on the first display area, the electronic device can divide the high diffusion area and the low diffusion area based solely on the display area involved in the operation.
[0336] Understandably, the specific implementation method for dividing the region involved here can refer to the specific implementation method for dividing the region into blocks described above. For example, as Figure 15 As shown, the electronic device can divide one rectangular area in the first display area involved in the operation into a high diffusion area and another rectangular area in the first display area into a low diffusion area.
[0337] In some other embodiments of this application, in response to a first operation, the electronic device divides the first display area into multiple blocks. In this case, if the electronic device subsequently receives an operation on the first display area, the electronic device can determine that the high diffusion area includes the block area involved in the operation, and the low diffusion area includes the block area not involved in the operation.
[0338] For example, such as Figure 16 As shown, the electronic device divides the first display area into nine sub-areas: A1, A2, A3, A4, A5, A6, A7, A8, and A9. Furthermore, the first display area is further divided into high-diffusion and low-diffusion areas. The high-diffusion area includes all areas of A1, A2, and A3, and parts of A4, A5, and A6. The low-diffusion area includes parts of A4, A5, and A6, and all areas of A7, A8, and A9. In this configuration, the electronic device can set the target iteration count for A1, A2, A3, A4, A5, and A6 to the iteration count corresponding to the high-diffusion area, and set the target iteration count for A7, A8, and A9 to the iteration count corresponding to the low-diffusion area.
[0339] It is understood that the display method involved in the embodiments of this application can be comprised of a lock screen application, a text rendering module, and a display screen (such as...) in an electronic device. Figure 1 and Figure 2 This is achieved as shown. The lock screen application can detect the first operation and trigger the display of target text with a fluid diffusion effect. The text rendering module is used to determine the target color of each pixel in the first display area. The display screen is used to display the image to be displayed (such as multiple frames of images included in the first animation).
[0340] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A display method, characterized in that, The method is applied to an electronic device, and the method includes: In response to a first operation, a first animation is displayed in a first display area; the first display area includes a target area and a non-target area; the first animation is an animation that displays target content in the target area with a fluid diffusion effect; the first animation includes multiple frames of images, at least one of which includes the target content; Specifically, for any frame of the first animation, the color of each pixel in the target region is determined based on a first concentration and a second concentration corresponding to each pixel in the target region. The first and second concentrations of each pixel in the target region are determined based on a first reaction-diffusion equation. The color of each pixel in the non-target region is determined based on a first concentration and a second concentration corresponding to each pixel in the non-target region. The first and second concentrations of each pixel in the non-target region are determined based on a second reaction-diffusion equation. The first reaction-diffusion equation includes a first generation rate and a first vanishing rate. The second reaction-diffusion equation includes a second generation rate and a second vanishing rate. The first generation rate is the generation rate of a first type of pixel in the target region, and the second generation rate is the generation rate of a first type of pixel in the non-target region. The first vanishing rate is the vanishing rate of a second type of pixel in the target region, and the second vanishing rate is the vanishing rate of a second type of pixel in the non-target region. The color of the first type of pixel is different from the color of the second type of pixel, the first generation rate is different from the second generation rate, and the first vanishing rate is different from the second vanishing rate. The first concentration is the concentration of the first type of pixel, and the second concentration is the concentration of the second type of pixel.
2. The method as described in claim 1, characterized in that, The method further includes: Before displaying the first animation, in response to the first operation, the target region and the non-target region are determined based on the target content; The display of the first animation in the first display area includes: When displaying the (N-1)th frame of the first animation, for each pixel in the first display area, if the pixel is in the target area, the first concentration and the second concentration corresponding to the pixel are updated based on the first reaction-diffusion equation; if the pixel is in the non-target area, the first concentration and the second concentration corresponding to the pixel are updated based on the second reaction-diffusion equation; where N is a positive integer. The target color of the pixel is determined based on the first and second concentrations corresponding to the pixel. The Nth frame of the first animation is obtained by rendering the target color of each pixel in the first display area. The Nth frame image is displayed in the first display area.
3. The method as described in claim 1, characterized in that, The method further includes: Before displaying the first animation, in response to the first operation, the target region and the non-target region are determined based on the target content, and the boundary region of the target region and the non-target region in the first display area is determined based on the directed distance field SDF corresponding to the target content; The display of the first animation in the first display area includes: When displaying the (N-1)th frame of the first animation, for each pixel in the first display area, if the pixel is located in the display area of the target region excluding the boundary region, the first and second concentrations corresponding to the pixel are updated based on the first reaction-diffusion equation; if the pixel is located in the display area of the non-target region excluding the boundary region, the first and second concentrations corresponding to the pixel are updated based on the second reaction-diffusion equation; if the pixel is located in the boundary region, the parameters in the first and second reaction-diffusion equations are processed based on the SDF corresponding to the pixel to obtain a third reaction-diffusion equation, and the first and second concentrations corresponding to the pixel are updated based on the third reaction-diffusion equation; where N is a positive integer. The target color of the pixel is determined based on the first and second concentrations corresponding to the pixel. The Nth frame of the first animation is obtained by rendering the target color of each pixel in the first display area. The Nth frame image is displayed in the first display area.
4. The method as described in claim 1, characterized in that, The method further includes: Before displaying the first animation, in response to the first operation, the target area and the non-target area are determined based on the target content, and the first display area is divided to obtain multiple block areas; The display of the first animation in the first display area includes: When displaying the (N-1)th frame of the first animation, for each pixel in the first display area, if the pixel is in the target area, the first concentration and second concentration corresponding to the pixel are updated based on the first reaction-diffusion equation until the number of iterations based on the first reaction-diffusion equation reaches the target number of iterations corresponding to the block area to which the pixel belongs; if the pixel is in the non-target area, the first concentration and second concentration corresponding to the pixel are updated based on the second reaction-diffusion equation until the number of iterations based on the second reaction-diffusion equation reaches the target number of iterations corresponding to the block area to which the pixel belongs; where N is a positive integer. The target color of the pixel is determined based on the first and second concentrations corresponding to the pixel. The Nth frame of the first animation is obtained by rendering the target color of each pixel in the first display area. The Nth frame image is displayed in the first display area.
5. The method as described in claim 1, characterized in that, The method further includes: Before displaying the first animation, in response to the first operation, the target region and the non-target region are determined based on the target content, the boundary region of the target region and the non-target region in the first display region is determined based on the directed distance field SDF corresponding to the target content, and the first display region is divided to obtain multiple block regions; The display of the first animation in the first display area includes: When displaying the (N-1)th frame of the first animation, for each pixel in the first display area, if the pixel is located in the display area of the target region excluding the boundary region, the first concentration and second concentration corresponding to the pixel are updated based on the first reaction-diffusion equation until the number of iterations based on the first reaction-diffusion equation reaches the target number of iterations corresponding to the block region to which the pixel belongs. If the pixel is located in the display area of the non-target region excluding the boundary region, the first concentration and second concentration corresponding to the pixel are updated based on the second reaction-diffusion equation until the number of iterations based on the second reaction-diffusion equation reaches the target number of iterations corresponding to the block region to which the pixel belongs. If the pixel is located in the boundary region, the parameters in the first reaction-diffusion equation and the parameters in the second reaction-diffusion equation are processed based on the SDF corresponding to the pixel to obtain a third reaction-diffusion equation, and the first concentration and second concentration corresponding to the pixel are updated based on the third reaction-diffusion equation until the number of iterations based on the third reaction-diffusion equation reaches the target number of iterations corresponding to the block region to which the pixel belongs. N is a positive integer. The target color of the pixel is determined based on the first and second concentrations corresponding to the pixel. The Nth frame of the first animation is obtained by rendering the target color of each pixel in the first display area. The Nth frame image is displayed in the first display area.
6. The method as described in claim 3 or 5, characterized in that, The process of processing the parameters in the first reaction-diffusion equation and the parameters in the second reaction-diffusion equation based on the SDF corresponding to the pixel to obtain the third reaction-diffusion equation includes: Based on the mapping relationship between the SDF corresponding to the pixel in the boundary region and the first interval, a first interpolation factor is determined; the first interpolation factor is the difference between 1 and the first mapping value; the first mapping value is the mapping value of the SDF corresponding to the pixel in the first interval; A third generation rate is obtained by interpolating between the first generation rate and the second generation rate based on the first interpolation factor, and a third disappearance rate is obtained by interpolating between the first disappearance rate and the second disappearance rate based on the first interpolation factor. The third reaction diffusion equation is determined based on the third generation rate and the third disappearance rate.
7. The method as described in claim 4 or 5, characterized in that, The method further includes: When displaying the (N-1)th frame of the first animation, determine the Laplacian operator currently corresponding to the plurality of block regions, and the Laplacian operator corresponding to the plurality of block regions in the hth frame of the first animation that has been displayed the latest; where h is a positive integer. Based on the Laplacian operator currently corresponding to the multiple block regions, and the Laplacian operator corresponding to the multiple block regions in the h-frame image that has been displayed in the first animation and is the latest to be displayed, the target iteration number corresponding to the multiple block regions is adjusted.
8. The method as described in claim 7, characterized in that, The step of adjusting the target iteration number corresponding to the multiple block regions based on the Laplacian operator currently corresponding to the multiple block regions and the Laplacian operator corresponding to the multiple block regions in the latest displayed h-frame image in the first animation includes: For each of the plurality of segmented regions, a first value and a second value corresponding to the segmented region are determined; the first value is the number of pixels in the segmented region whose corresponding Laplacian operator is included within the color gradient range; the second value is the average number of pixels in the h-frame image whose corresponding Laplacian operator is included within the color gradient range. If the first value is less than the second value, reduce the target iteration number corresponding to the segmented region; When the first value is equal to the second value, the target iteration number corresponding to the segmented region remains unchanged; If the first value is greater than the second value, the target iteration number corresponding to the segmented region is increased.
9. The method according to any one of claims 2-5 and 8, characterized in that, Determining the target color of the pixel based on the first and second concentrations corresponding to the pixel includes: If the first concentration corresponding to the pixel is greater than the second concentration corresponding to the pixel, the target color of the pixel is determined to be the color of the first type of pixel. If the first concentration corresponding to the pixel is less than or equal to the second concentration corresponding to the pixel, the target color of the pixel is determined to be the color of the second type of pixel.
10. The method according to any one of claims 2-5 and 8, characterized in that, The step of updating the first concentration and second concentration corresponding to the pixel based on the first reaction-diffusion equation includes: Through formula and Update the first and second concentrations corresponding to the pixels respectively; The step of updating the first and second concentrations corresponding to the pixel based on the second reaction-diffusion equation includes: Through formula and Update the first and second concentrations corresponding to the pixels respectively; Where A represents the first concentration of the pixel before the update, and B represents the second concentration of the pixel before the update. The first concentration corresponding to the updated pixel. The updated second concentration corresponds to the pixel. and The diffusion coefficient of the first type of pixel is . and The diffusion coefficient of the second type of pixel is . The first generation rate, The second generation rate, This is the first disappearance rate. This is the second disappearance rate. It indicates the time of change.
11. The method according to any one of claims 2-5 and 8, characterized in that, The first concentration corresponding to the pixel is the R channel value of the pixel, and the second concentration corresponding to the pixel is the G channel value of the pixel.
12. The method according to any one of claims 1-5 and 8, characterized in that, The method further includes: Before displaying the first animation, in response to the first operation, initial values of the first concentration and the second concentration corresponding to each pixel in the first display area are set; for each pixel in the first display area, the initial value of the first concentration corresponding to the pixel is less than the initial value of the second concentration corresponding to the pixel.
13. The method as described in claim 12, characterized in that, After setting the initial values of the first concentration and the second concentration corresponding to each pixel in the first display area, the method further includes: In response to a second operation targeting a first position in the first display area, for one or more pixels corresponding to the first position, a corresponding first concentration and a corresponding second concentration are reset, and the reset first concentration is greater than the reset second concentration.
14. The method as described in claim 12, characterized in that, After setting the initial values of the first concentration and the second concentration corresponding to each pixel in the first display area, the method further includes: After a first time interval, for any one or more pixels in the first display area, the corresponding first concentration and second concentration are reset, and the reset first concentration is greater than the reset second concentration.
15. The method as described in claim 12, characterized in that, The method further includes: During the display of the first animation, in response to a third operation targeting a second position in the first display area, the first concentration and the second concentration corresponding to one or more pixels at the second position are respectively set to the initial value of the first concentration and the initial value of the second concentration.
16. The method according to any one of claims 1-5, 8, and 13-15, characterized in that, The method further includes: During the display of the first animation, in response to the fourth operation targeting the third position in the first display area, the target iteration number corresponding to one or more pixels at the third position is increased.
17. The method according to any one of claims 1-5, 8, and 13-15, characterized in that, The target content includes the target text.
18. An electronic device, characterized in that, The electronic device includes one or more memories and one or more processors; the one or more memories are coupled to the one or more processors, the memories are used to store computer program code, the computer program code including computer instructions, and the processor invokes the computer instructions to perform the method of any one of claims 1-17.
19. A computer-readable storage medium, characterized in that, Used to store computer instructions that, when executed on an electronic device, cause the electronic device to perform the method described in any one of claims 1-17.
Citation Information
Patent Citations
Color image edge detection method
CN114022505A
Rendering method and device
CN117292033A