Interaction method and apparatus, and electronic device and storage medium

By detecting the hover state and gesture operation of the stylus in electronic devices, and generating ink paintings, the problem of single writing style of the stylus is solved and the user experience is improved.

WO2025039787A1PCT designated stage expired Publication Date: 2025-02-27HUAWEI TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/104689
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-08-21
Filing Date
2024-07-10
Publication Date
2025-02-27

AI Technical Summary

Technical Problem

When existing electronic devices use stylus to input, their writing style is single, which cannot meet the needs of users in different scenarios, resulting in poor user experience.

Method used

The writing style diversity of the stylus is expanded by detecting that the stylus is in hovering and implementing specific gesture operations, generating and displaying ink paintings.

Benefits of technology

The function of drawing ink paintings in electronic devices is realized, which improves the user's user experience and meets the needs of users in different scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024104689_27022025_PF_FP_ABST
    Figure CN2024104689_27022025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present application are an interaction method and apparatus, and an electronic device and a storage medium, whereby a specific gesture operation can be implemented on a stylus pen in a hovering state, so as to draw an ink wash painting in a matching electronic device, such that the diversity of styles of writing that the stylus pen can input is extended, thereby meeting the requirements of a user in different scenarios, and improving the usage experience of the user. The interaction method comprises: detecting that a stylus pen is in a hovering state, and detecting a preset gesture operation for the stylus pen; and in response to the preset gesture operation, generating and displaying an ink wash painting.
Need to check novelty before this filing date? Find Prior Art

Description

Interaction method, device, electronic device and storage medium

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on August 21, 2023, with application number 202311054670.7 and application name “An interactive method, device, electronic device and storage medium”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The embodiments of the present application relate to the field of terminal technology, and in particular to an interaction method, device, electronic device, and storage medium. Background Art

[0003] Currently, for electronic devices equipped with a stylus, the stylus can be used to realize a variety of functions, for example, using the stylus to record text, or using the stylus to draw a flowchart or a mind map. However, in the above scenarios, the stylus simulates the writing experience of a hard pen style when inputting information, that is, the writing style that the stylus can input is relatively single, which cannot meet the user's usage needs in different scenarios, resulting in a poor user experience.

[0004] Summary of the Invention

[0005] The embodiments of the present application provide an interactive method, device, electronic device, and storage medium, which can draw ink paintings on a matching electronic device by performing specific gesture operations on a stylus in a hovering state, thereby expanding the diversity of writing styles that can be input by the stylus, thereby meeting the needs of users in different scenarios and improving the user experience.

[0006] In a first aspect, an embodiment of the present application provides an interaction method, applied to an electronic device, wherein the electronic device supports a stylus as a corresponding input device, the method comprising:

[0007] detecting that the stylus is in a hovering state and detecting a preset gesture operation for the stylus;

[0008] In response to the preset gesture operation, an ink painting is generated and displayed.

[0009] In an embodiment of the present application, by placing the stylus in a hovering state and then performing simple gesture operations on the stylus in the hovering state, an ink painting can be generated and displayed in an electronic device that matches the stylus, thereby expanding the interaction function between the stylus and the electronic device, meeting the user's needs for drawing ink paintings in the electronic device, and improving the user experience.

[0010] Optionally, the preset gesture operation is a squeezing operation on the stylus pen body, and generating and displaying an ink painting in response to the preset gesture operation includes:

[0011] In response to the squeezing operation, adjusting a reference ink output of the stylus;

[0012] Determining a reference opacity and a reference width corresponding to the reference ink output amount based on a correspondence between the ink output amount and the opacity of the line, and based on a correspondence between the ink output amount and the width of the line;

[0013] A preview ink painting is generated and displayed, wherein the opacity of the lines of the preview ink painting is the reference opacity, and the width of the lines of the preview ink painting is the reference width.

[0014] In an embodiment of the present application, a squeezing operation can be performed on the stylus in a hovering state to adjust the baseline ink output of the stylus, thereby preparing for the subsequent drawing of an ink painting; at the same time, a preview ink painting can be generated based on the line opacity and line width corresponding to the above-mentioned baseline ink output, so that the user can adjust the baseline ink output more intuitively.

[0015] Optionally, the method further includes:

[0016] In response to a drawing operation of the stylus, obtaining an actual pressure value at a point where the stylus is placed;

[0017] determining an actual ink output amount based on the actual pressure value and the reference ink output amount;

[0018] A line combination corresponding to opacity and width is generated and displayed according to the actual ink output amount.

[0019] In the embodiment of the present application, since the degree of force applied by the user when writing during the drawing process will also affect the amount of ink output, after adjusting the baseline ink output of the stylus and using the stylus to draw, the electronic device can further obtain the pressure value at the point where the stylus is put down, and then adjust the baseline ink output according to the pressure value. In other words, the user can control the opacity and thickness of the final line by adjusting the pressure value applied to the electronic device according to his or her own needs, thereby improving the user experience.

[0020] Optionally, the preset gesture operation is a tapping operation on the stylus body, and generating and displaying an ink painting in response to the preset gesture operation includes:

[0021] In response to the tapping operation, determining a scattered point generation area corresponding to the stylus on a display screen of the electronic device;

[0022] Randomly generating scattered points based on a first preset number within the scattered point generation area;

[0023] The ink painting including at least the scattered points is displayed.

[0024] In an embodiment of the present application, a tapping operation can be performed on the stylus in a hovering state, and a preset number of scatter points will be randomly generated in the corresponding scatter point generation area in the electronic device, thereby achieving the goal of using the stylus to generate an ink painting with a scatter point effect.

[0025] Optionally, establishing a spatial coordinate system based on a preset reference point on the display screen of the electronic device, and determining a scattered point generation area corresponding to the stylus on the display screen of the electronic device includes:

[0026] Determining a first pen tip spatial coordinate of the pen tip of the stylus, and determining a tilt angle between the stylus and the preset reference point;

[0027] Projecting the first pen tip spatial coordinates onto the display screen to obtain a first projection point, and using the first projection point as the center point of the scattered point generation area;

[0028] determining a radius value of the scattered point generation area based on a vertical component of the first pen tip spatial coordinate relative to the display screen and the tilt angle;

[0029] The scattered point generation area is determined based on the center point and the radius value.

[0030] In the embodiment of the present application, the scatter point generation area is determined based on the spatial coordinates of the stylus tip when in a hovering state and the tilt angle of the stylus. That is, the user can adjust the spatial coordinates of the stylus tip and the tilt of the stylus according to their actual needs to change the scatter point generation area, so that the user can generate scatter points in any area, thereby improving the user experience.

[0031] Optionally, randomly generating scattered points based on a first preset number within the scattered point generation area includes:

[0032] Dividing the scattered point generation area into a second preset number of scattered point generation sub-areas;

[0033] Based on the distance between each of the scatter point generating subregions and the center point, a plurality of scatter points are randomly generated in each of the scatter point generating subregions, wherein the sum of the number of scatter points in all the scatter point generating subregions is equal to the first preset number, the size of the scatter points in the same scatter point generating subregion is positively correlated with the distance from the center point, and the density and opacity of the scatter points in the same scatter point generating subregion are negatively correlated with the distance from the center point.

[0034] In an embodiment of the present application, the scatter point generation area can be divided into multiple scatter point generation sub-areas, and then the size of the scatter points, the density of the scatter points and the opacity of the scatter points in each scatter point generation sub-area are determined according to the distance between each scatter point generation sub-area and the center point. For example, the farther away from the center point, the larger the scatter points, the smaller the scatter point density (that is, the sparser the scatter points), and the smaller the opacity of the scatter points (that is, the lighter the color of the scatter points), so that the final scatter point state can be more consistent with the scatter point state generated based on the brush, thereby presenting a better visual effect.

[0035] Optionally, the preset gesture operation is a waving operation, and in response to the preset gesture operation, generating and displaying an ink drawing includes:

[0036] In response to the waving operation, controlling the pre-drawn lines to diffuse by a preset diffusion distance in a direction corresponding to the waving operation to generate a diffusion area, wherein the opacity of the pre-drawn lines during the diffusion process is negatively correlated with the preset diffusion distance, and the opacity in the diffusion area is negatively correlated with the distance between the pre-drawn lines;

[0037] The ink painting including at least the pre-drawn lines and the diffusion area is displayed.

[0038] In an embodiment of the present application, a waving operation can be performed on the stylus in a hovering state, and the pre-drawn lines on the display screen of the electronic device will diffuse a set distance along the waving direction to form a diffusion area. In the diffusion process, as the diffusion distance increases, the opacity of the pre-drawn lines gradually decreases, that is, a diffusion area is formed in which the color between the pre-drawn lines and the diffusion area gradually becomes lighter, thereby achieving the purpose of using the stylus to generate an ink painting with a diffusion effect.

[0039] Optionally, in response to the waving operation, controlling the pre-drawn line to diffuse by a preset diffusion distance along a direction corresponding to the waving operation to generate a diffusion area includes:

[0040] In response to the swiping operation, determining an actual separation distance between a tip of the stylus pen and the pre-drawn line at the start of the swiping operation;

[0041] According to the correspondence between the separation distance and the preset diffusion distance, the preset diffusion distance is determined to correspond to the actual separation distance, wherein the separation distance is positively correlated with the preset diffusion distance;

[0042] The pre-drawn line is controlled to diffuse by the preset diffusion distance along a direction corresponding to the swiping operation to generate the diffusion area.

[0043] In the embodiment of the present application, the spacing distance between the tip of the stylus pen and the pre-drawn line is positively correlated with the diffusion distance of the pre-drawn line, that is, the larger the spacing distance, the larger the corresponding diffusion distance; the smaller the spacing distance, the smaller the corresponding diffusion distance. The user can then adjust the spacing distance between the tip of the stylus pen and the pre-drawn line according to their actual needs, thereby generating a diffusion area with a specific diffusion distance to achieve a better visual effect.

[0044] Optionally, the preset gesture operation is a waving operation, and in response to the preset gesture operation, generating and displaying an ink painting includes:

[0045] In response to the swiping operation, determining an actual swiping speed;

[0046] determining an actual diffusion speed corresponding to the actual waving speed based on a corresponding relationship between the waving speed and the diffusion speed, wherein the waving speed and the diffusion speed are positively correlated;

[0047] Controlling the pre-drawn lines to diffuse along the direction corresponding to the swiping operation based on the actual diffusion speed to generate a diffusion area; wherein the opacity of the pre-drawn lines during the diffusion process is negatively correlated with the preset diffusion distance, and the opacity in the diffusion area is negatively correlated with the distance between the pre-drawn lines;

[0048] In response to reaching a preset diffusion time, the diffusion of the pre-drawn line is stopped, and the ink painting including at least the pre-drawn line and the diffusion area is generated and displayed.

[0049] In the embodiment of the present application, the speed of the stylus pen swing can be considered to be positively correlated with the diffusion speed of the pre-drawn line. That is, the faster the swing speed, the faster the diffusion speed; the slower the swing speed, the slower the diffusion speed. Therefore, given a certain diffusion time, the faster the diffusion speed, the greater the diffusion distance in a single swing operation. Users can then adjust the swing speed of the stylus pen according to their actual needs to generate a diffusion area with a specific diffusion distance, achieving a better visual effect.

[0050] Optionally, before determining the actual diffusion speed corresponding to the actual waving speed based on the correspondence between the waving speed and the diffusion speed, the method further includes:

[0051] determining an actual separation distance between the tip of the stylus and the pre-drawn line at the beginning of the swiping operation;

[0052] Determining an actual diffusion speed corresponding to the actual waving speed based on a correspondence between the waving speed and the diffusion speed includes:

[0053] Based on the corresponding relationship between the waving speed / the interval distance and the diffusion speed, the actual diffusion speed corresponding to the actual waving speed / the actual interval distance is determined, and the interval distance is positively correlated with the diffusion speed.

[0054] In the embodiment of the present application, the diffusion distance of the pre-drawn line is related not only to the waving speed, but also to the spacing distance between the tip of the stylus pen and the pre-drawn line. That is, the larger the spacing distance, the larger the corresponding diffusion distance; the smaller the spacing distance, the smaller the corresponding diffusion distance. The user can then adjust the spacing distance between the tip of the stylus pen and the pre-drawn line and the waving speed according to their actual needs, thereby generating a diffusion area with a specific diffusion distance to achieve a better visual effect.

[0055] Optionally, a spatial coordinate system is established based on a preset reference point on the display screen of the electronic device, the tip of the stylus pen at the start of the waving operation is a second tip spatial coordinate, and in response to the waving operation, determining an actual spacing distance between the tip of the stylus pen and the pre-drawn line at the start of the waving operation includes:

[0056] Projecting the second pen tip spatial coordinates onto the display screen to obtain a second projection point;

[0057] Determining a point-line distance between the second projection point and the pre-drawn line;

[0058] The point-to-line distance is taken as the actual spacing distance.

[0059] In an embodiment of the present application, the projection point of the spatial coordinates of the stylus tip on the electronic device display screen can be first determined, and then the point-line distance between the projection point and the pre-drawn line can be calculated, and then the point-line distance can be used as the interval distance between the stylus tip and the pre-drawn line, so that the interval distance between the stylus tip and the pre-drawn line can be calculated accurately and conveniently.

[0060] Optionally, before detecting that the stylus is in a hovering state and detecting a preset gesture operation for the stylus, the method further includes:

[0061] Controlling the pre-drawn lines to diffuse along a preset diffusion direction based on a preset diffusion speed to generate a diffusion area, wherein the opacity of the pre-drawn lines during the diffusion process is negatively correlated with the diffusion distance, and the opacity in the diffusion area is negatively correlated with the distance between the pre-drawn lines;

[0062] The preset gesture operation is a waving operation, and in response to the preset gesture operation, generating and displaying an ink painting includes:

[0063] In response to the swiping operation, stopping the diffusion of the pre-drawn line;

[0064] The ink painting including at least the pre-drawn lines and the diffusion area is displayed.

[0065] In this embodiment of the present application, the pre-drawn lines themselves have the ability to diffuse. During the diffusion process, the opacity of the pre-drawn lines gradually decreases as the diffusion distance increases, forming a diffusion area with a gradually lighter color between the pre-drawn lines and the diffusion area. When the diffusion area formed by the automatic diffusion of the pre-diffusion area meets the user's needs, the hovering stylus can be waved to stop the pre-drawn lines from diffusing, thereby achieving the purpose of using the stylus to create an ink painting with a diffusion effect.

[0066] Optionally, the preset gesture operation is a shaking operation, and in response to the preset gesture operation, generating and displaying an ink painting includes:

[0067] In response to the shaking operation, determining a center point of ink dot generation and a diffusion distance of the ink dot;

[0068] Determine ink dot size based on current ink output;

[0069] generating original ink dots based on the ink dot size at the ink dot generation center point, and controlling the original ink dots to radially diffuse the ink dot diffusion distance to generate radial ink dots;

[0070] The ink painting including at least the radial ink dots is displayed.

[0071] In an embodiment of the present application, a shaking operation can be performed on the stylus in a hovering state, and then the ink point generation center and the ink point diffusion distance can be determined based on the relevant characteristics of the shaking operation. At the same time, the size of the ink point to be generated can be considered to be related to the current ink output of the stylus. Then, an original ink point of a specific size can be generated at the above-mentioned ink point generation center, and the original ink point can be controlled to diffuse radially, thereby forming radial ink points, thereby achieving the purpose of using the stylus to generate an ink painting with an ink dripping effect.

[0072] Optionally, establishing a spatial coordinate system based on a preset reference point on the display screen of the electronic device, and determining the center point of ink dot generation in response to the shaking operation includes:

[0073] In response to the shaking operation, determining a third pen tip space coordinate of the pen tip of the stylus at the beginning of the shaking operation, and determining a fourth pen tip space coordinate of the pen tip of the stylus at the end of the shaking operation;

[0074] Projecting the third pen tip spatial coordinate onto the display screen to obtain a third projection point; and projecting the fourth pen tip spatial coordinate onto the display screen to obtain a fourth projection point;

[0075] Determine a midpoint of the projection points between the third projection point and the fourth projection point;

[0076] The midpoint of the projection points is used as the center point for generating the ink dots.

[0077] In an embodiment of the present application, the spatial coordinates of the stylus pen can be projected onto the display screen of the electronic device at the start and end of the shaking operation, and the midpoint of the line connecting the two projection points can be used as the center point of ink dot generation. In other words, the center point of ink dot generation is associated with the start and end of the shaking operation, so that the user can adjust the shaking operation according to his or her actual needs, and thus conveniently change the center point of ink dot generation.

[0078] Optionally, in response to the shaking operation, determining the ink dot diffusion distance includes:

[0079] In response to the shaking operation, calculating a spatial distance between the third pen tip spatial coordinate and the fourth pen tip spatial coordinate, and using the spatial distance as an actual shaking amplitude corresponding to the shaking operation;

[0080] Taking the vertical component of the fourth pen tip spatial coordinate relative to the display screen as the actual drop height of the ink dot when it drops;

[0081] Based on the corresponding relationship among the drop height, the shaking amplitude and the ink dot spreading distance, the ink dot spreading distance corresponding to the actual drop height and the actual shaking amplitude is determined.

[0082] In an embodiment of the present application, the vertical height when the shaking operation stops is used as the dripping height of the ink dot, and the spatial distance between the start and end of the shaking operation is used as the shaking amplitude. The ink dot diffusion distance is adjusted together according to the shaking height and the shaking amplitude. In other words, the user can control the shaking height and the shaking amplitude according to their actual needs, so that the final ink dot diffusion state can be more consistent with the ink dot state generated based on the brush, so as to present a better visual effect.

[0083] Optionally, the stylus is in an eyedropper function, the preset gesture operation is a squeeze operation, and in response to the preset gesture operation, generating and displaying an ink painting includes:

[0084] In response to the squeezing operation, determining a closed area based on attribute information of pre-collected pixel points;

[0085] The closed area is filled with color to generate and display the filled ink painting.

[0086] In an embodiment of the present application, when the stylus is in the eyedropper function, a squeeze operation can be performed with the stylus in a hovering state to trigger analysis of the pre-collected pixels of the stylus, thereby determining multiple pixels with the same attributes as the pre-collected pixels, that is, determining a specific closed area. The determined closed area is then filled with a specific color, thereby achieving the purpose of using the stylus to generate an ink painting with a filled effect.

[0087] In a second aspect, an embodiment of the present application provides an interactive device, which is provided in an electronic device that supports a stylus as a corresponding input device, and includes:

[0088] a detection unit, configured to detect that the stylus pen is in a hovering state and detect a preset gesture operation for the stylus pen;

[0089] The processing unit is configured to generate and display an ink painting in response to the preset gesture operation.

[0090] Optionally, the preset gesture operation is a squeezing operation on the stylus pen body, and the processing unit is specifically configured to:

[0091] In response to the squeezing operation, adjusting a reference ink output of the stylus;

[0092] Determining a reference opacity and a reference width corresponding to the reference ink output amount based on a correspondence between the ink output amount and the opacity of the line, and based on a correspondence between the ink output amount and the width of the line;

[0093] A preview ink painting is generated and displayed, wherein the opacity of the lines of the preview ink painting is the reference opacity, and the width of the lines of the preview ink painting is the reference width.

[0094] Optionally, the interaction device further includes:

[0095] an acquiring unit, configured to acquire an actual pressure value at a point where the stylus is placed in response to a drawing operation of the stylus;

[0096] a determining unit, configured to determine an actual ink output amount based on the actual pressure value and the reference ink output amount;

[0097] The processing unit is further configured to determine, generate, and display a line combination corresponding to opacity and width according to the actual ink output.

[0098] Optionally, the preset gesture operation is a tapping operation on the stylus body, and the processing unit includes:

[0099] a scatter point generation area determination unit, configured to determine, in response to the tapping operation, a scatter point generation area corresponding to the stylus on the display screen of the electronic device;

[0100] A scatter point generating unit, configured to randomly generate scatter points based on a first preset number within the scatter point generating area;

[0101] A display unit is configured to display the ink painting at least including the scattered points.

[0102] Optionally, a spatial coordinate system is established based on a preset reference point on the display screen of the electronic device, and the scattered point generation area determination unit is specifically configured to:

[0103] Determining a first pen tip spatial coordinate of the pen tip of the stylus, and determining a tilt angle between the stylus and the preset reference point;

[0104] Projecting the first pen tip spatial coordinates onto the display screen to obtain a first projection point, and using the first projection point as the center point of the scattered point generation area;

[0105] determining a radius value of the scattered point generation area based on a vertical component of the first pen tip spatial coordinate relative to the display screen and the tilt angle;

[0106] The scattered point generation area is determined based on the center point and the radius value.

[0107] Optionally, the scattered point generating unit is specifically configured to:

[0108] Dividing the scattered point generation area into a second preset number of scattered point generation sub-areas;

[0109] Based on the distance between each scatter point generating subregion and the center point, a plurality of scatter points are randomly generated and displayed in each scatter point generating subregion, wherein the sum of the number of scatter points in all scatter point generating subregions is equal to the first preset number, the size of the scatter points in the same scatter point generating subregion is positively correlated with the distance from the center point, and the density and opacity of the scatter points in the same scatter point generating subregion are negatively correlated with the distance from the center point.

[0110] Optionally, the preset gesture operation is a waving operation, and the processing unit includes:

[0111] a diffusion unit, configured to, in response to the waving operation, control the pre-drawn line to diffuse by a preset diffusion distance in a direction corresponding to the waving operation to generate a diffusion area, wherein the opacity of the pre-drawn line during the diffusion process is negatively correlated with the preset diffusion distance, and the opacity in the diffusion area is negatively correlated with the distance between the pre-drawn lines;

[0112] A display unit is configured to display the ink painting including at least the pre-drawn lines and the diffusion area.

[0113] Optionally, the diffusion unit includes:

[0114] a spacing distance determining unit, configured to determine, in response to the waving operation, an actual spacing distance between the tip of the stylus pen and the pre-drawn line at the start of the waving operation;

[0115] a diffusion distance determining unit, configured to determine whether the actual separation distance corresponds to the preset diffusion distance according to a correspondence between the separation distance and the preset diffusion distance, wherein the separation distance is positively correlated with the preset diffusion distance;

[0116] The line diffusion unit is used to control the pre-drawn line to diffuse by the preset diffusion distance along the direction corresponding to the swiping operation to generate the diffusion area.

[0117] Optionally, the preset gesture operation is a waving operation, and the processing unit includes:

[0118] a waving speed determining unit, configured to determine an actual waving speed in response to the waving operation;

[0119] a diffusion speed determining unit, configured to determine an actual diffusion speed corresponding to the actual waving speed based on a correspondence between the waving speed and the diffusion speed, wherein the waving speed and the diffusion speed are positively correlated;

[0120] a diffusion unit, configured to control the diffusion of the pre-drawn lines along the direction corresponding to the swiping operation based on the actual diffusion speed to generate a diffusion area; wherein the opacity of the pre-drawn lines during the diffusion process is negatively correlated with the preset diffusion distance, and the opacity in the diffusion area is negatively correlated with the distance between the pre-drawn lines;

[0121] The display unit is configured to stop diffusing the pre-drawn line in response to reaching a preset diffusion time, and generate and display the ink painting including at least the pre-drawn line and the diffusion area.

[0122] Optionally, the interaction device further includes:

[0123] a spacing distance determining unit, configured to determine an actual spacing distance between the tip of the stylus pen and the pre-drawn line at the beginning of the waving operation;

[0124] The diffusion speed determination unit is specifically configured to:

[0125] Based on the corresponding relationship between the waving speed / the interval distance and the diffusion speed, the actual diffusion speed corresponding to the actual waving speed / the actual interval distance is determined, and the interval distance is positively correlated with the diffusion speed.

[0126] Optionally, a spatial coordinate system is established based on a preset reference point on the display screen of the electronic device, and the interval distance determination unit is specifically configured to:

[0127] Projecting the second pen tip spatial coordinates onto the display screen to obtain a second projection point;

[0128] Determining a point-line distance between the second projection point and the pre-drawn line;

[0129] The point-to-line distance is taken as the actual spacing distance.

[0130] Optionally, the interaction device further includes:

[0131] an automatic diffusion unit, configured to control the diffusion of the pre-drawn lines along a preset diffusion direction based on a preset diffusion speed to generate a diffusion area, wherein the opacity of the pre-drawn lines during the diffusion process is negatively correlated with the diffusion distance, and the opacity in the diffusion area is negatively correlated with the distance between the pre-drawn lines;

[0132] The preset gesture operation is a waving operation, and the processing unit is specifically configured to:

[0133] In response to the swiping operation, stopping the diffusion of the pre-drawn line;

[0134] The ink painting including at least the pre-drawn lines and the diffusion area is displayed.

[0135] Optionally, the preset gesture operation is a shaking operation, and the processing unit includes:

[0136] an ink dot generation center determination unit, configured to determine an ink dot generation center point in response to the shaking operation;

[0137] an ink dot spreading distance determining unit, configured to determine an ink dot spreading distance in response to the shaking operation;

[0138] An ink dot size determination unit, configured to determine an ink dot size based on a current ink output amount;

[0139] an ink dot generation and diffusion unit, configured to generate an original ink dot based on the ink dot size at the ink dot generation center point, and control the original ink dot to radially diffuse the ink dot diffusion distance to generate radial ink dots;

[0140] The display unit is used to display the ink painting including at least the radial ink dots.

[0141] Optionally, a spatial coordinate system is established based on a preset reference point on the display screen of the electronic device, and the ink dot generation center determination unit is specifically configured to:

[0142] In response to the shaking operation, determining a third pen tip space coordinate of the pen tip of the stylus at the beginning of the shaking operation, and determining a fourth pen tip space coordinate of the pen tip of the stylus at the end of the shaking operation;

[0143] Projecting the third pen tip spatial coordinate onto the display screen to obtain a third projection point; and projecting the fourth pen tip spatial coordinate onto the display screen to obtain a fourth projection point;

[0144] Determine a midpoint of the projection points between the third projection point and the fourth projection point;

[0145] The midpoint of the projection points is used as the center point for generating the ink dots.

[0146] Optionally, the ink dot diffusion distance determining unit is specifically configured to:

[0147] In response to the shaking operation, calculating a spatial distance between the third pen tip spatial coordinate and the fourth pen tip spatial coordinate, and using the spatial distance as an actual shaking amplitude corresponding to the shaking operation;

[0148] Taking the vertical component of the fourth pen tip spatial coordinate relative to the display screen as the actual drop height of the ink dot when it drops;

[0149] Based on the corresponding relationship among the drop height, the shaking amplitude and the ink dot spreading distance, the ink dot spreading distance corresponding to the actual drop height and the actual shaking amplitude is determined.

[0150] Optionally, the stylus is in the eyedropper function, the preset gesture operation is a squeeze operation, and the processing unit is specifically configured to:

[0151] In response to the squeezing operation, determining a closed area based on attribute information of pre-collected pixel points;

[0152] The closed area is filled with color to generate and display the filled ink painting.

[0153] In a third aspect, an embodiment of the present application provides an electronic device, comprising:

[0154] at least one processor;

[0155] a memory coupled to the processor;

[0156] The at least one processor is configured to implement the steps of the method described in any embodiment of the first aspect when executing the computer program stored in the memory.

[0157] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in any embodiment of the first aspect.

[0158] It should be understood that the second to fourth aspects of the embodiments of the present application are consistent with the technical solutions of the first aspect of the embodiments of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated. BRIEF DESCRIPTION OF THE DRAWINGS

[0159] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0160] FIG1 is a flow chart of an interaction method provided in an embodiment of the present application;

[0161] FIG2 is a flow chart of a method for generating a preview ink painting according to an embodiment of the present application;

[0162] FIG3 is a schematic diagram of a squeezing operation performed on a stylus pen according to an embodiment of the present application;

[0163] FIG4 is a schematic diagram of previewing an ink painting corresponding to different reference ink output amounts provided by an embodiment of the present application;

[0164] FIG5 is a flow chart of a method for drawing lines using a stylus provided in an embodiment of the present application;

[0165] FIG6 is a schematic flow chart of a method for generating a scatter effect provided in an embodiment of the present application;

[0166] FIG7 is a schematic diagram of a tapping operation performed on a stylus pen according to an embodiment of the present application;

[0167] FIG8 is a flow chart of a method for determining a scattered point generation area provided in an embodiment of the present application;

[0168] FIG9 is a schematic diagram of a scattered point generation area provided in an embodiment of the present application;

[0169] FIG10 is a schematic diagram of generating a scatter effect provided by an embodiment of the present application;

[0170] FIG11 is a schematic diagram of a process of generating scattered points according to an embodiment of the present application;

[0171] FIG12 is a schematic diagram of a scattered point attribute changing with distance provided by this embodiment;

[0172] FIG13 is a flow chart of a method for generating a diffusion effect ink painting according to an embodiment of the present application;

[0173] FIG14 is a schematic diagram of a waving operation performed on a stylus pen according to an embodiment of the present application;

[0174] FIG15 is a schematic diagram of a diffusion area formed by diffusion of a pre-drawn line provided in an embodiment of the present application;

[0175] FIG16 is a flowchart of a method for controlling the diffusion of a pre-drawn line based on the distance between a stylus and the pre-drawn line, provided by an embodiment of the present application;

[0176] FIG17 is a flow chart of a method for calculating the distance between a stylus tip and a pre-drawn line provided in an embodiment of the present application;

[0177] FIG18 is a schematic diagram of a diffusion effect under multiple pre-drawn lines provided in an embodiment of the present application;

[0178] FIG19 is a flow chart of another method for generating a diffusion effect ink painting according to an embodiment of the present application;

[0179] FIG20 is a schematic flow chart of a method for controlling diffusion rate according to an embodiment of the present application;

[0180] FIG21 is a flow chart of another method for generating a diffusion effect ink painting according to an embodiment of the present application;

[0181] FIG22 is a flow chart of a method for generating an ink painting with an ink drop effect provided by an embodiment of the present application;

[0182] FIG23 is a schematic diagram of a shaking operation performed on a stylus pen according to an embodiment of the present application;

[0183] FIG24 is a flow chart of a method for determining an ink dot generation center according to an embodiment of the present application;

[0184] FIG25 is a flow chart of a method for determining ink dot diffusion distance according to an embodiment of the present application;

[0185] FIG26 is a schematic diagram of a radial ink dot provided in an embodiment of the present application;

[0186] FIG27 is a flow chart of a method for generating an ink painting with a filled effect provided by an embodiment of the present application;

[0187] FIG28 is a schematic diagram of color filling provided by an embodiment of the present application;

[0188] FIG29 is a schematic structural diagram of an interactive device provided in an embodiment of the present application;

[0189] FIG30 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0190] In order to better understand the technical solutions of this specification, the embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0191] It should be clear that the embodiments described are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this specification.

[0192] The terms used in the examples of this application are for the purpose of describing specific embodiments only and are not intended to limit this specification. The singular forms "a," "an," "the," and "the" used in the examples of this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.

[0193] The following is an introduction to the brush painting techniques involved in the embodiments of this application.

[0194] Ink diffusion techniques mainly include blowing ink and waving ink. Blowing ink involves spreading ink by blowing air, thereby creating a blurred and gradient effect. Blowing ink is mainly suitable for large-scale, wide-area ink diffusion, and is often used to depict vast landscapes, clouds, and other effects. Waving ink involves waving tools (such as brushes and fans) to splash and diffuse ink, thereby creating a blurred and gradient effect. Waving ink is suitable for depicting local details over a smaller area, and is often used to depict delicate textures such as leaves and petals.

[0195] The dotting technique involves applying a moderate amount of ink to a brush, brush, or bamboo stick. Then, gently tapping, dotting, or twisting the brush onto the paper, creating a dotted pattern. This technique can create a variety of textures in ink paintings, such as stone, bark, and fabric. It can also be used to depict natural scenes, such as the starry sky, flowers, and raindrops.

[0196] Ink dripping technique: This technique uses ink dripping or spilling onto paper to create artwork. By controlling the speed, angle, and position of the ink dripping, it produces a rich variety of forms and textures. The principle of the ink dripping technique is based on the fluidity and wettability of ink. At the moment of dripping or spilling, due to gravity and the friction of the droplets, the ink will freely diffuse and penetrate the paper, creating a transparent, rich texture. The forms and textures formed by the diffusion of ink are difficult to predict and control, so the ink dripping technique has a certain degree of randomness and surprise. The ink dripping technique has a wide range of applications. In ink painting, it can be used to express natural scenery, such as the flowing and graceful appearance of water droplets, raindrops, and flower petals.

[0197] At present, for electronic devices equipped with display screens, in addition to supporting the user's touch commands or voice commands as input, they can also support stylus as an input device for input. However, when using a stylus for input, it can usually be used for text recording and marking, drawing flowcharts, drawing mind maps, etc. In the above scenarios, when information is input based on a stylus, the writing experience is simulated in the style of a hard pen. However, users are usually not limited to using a stylus for office work. For example, users also want to use a stylus to draw ink paintings, but hard pen style cannot draw ink paintings. In other words, when using a stylus as an input device, the writing style that can be input by the stylus is relatively single, which cannot meet the needs of users in different scenarios, resulting in a poor user experience.

[0198] In view of this, an embodiment of the present application provides an interaction method, in which, by placing the stylus in a hovering state and then performing simple gesture operations on the stylus in the hovering state, an ink painting can be generated and displayed in an electronic device that matches the stylus, thereby expanding the writing style of the stylus, which is equivalent to expanding the interaction function between the stylus and the electronic device, meeting the user's needs for drawing ink paintings in the electronic device, and improving the user's usage experience.

[0199] The technical solution provided by the embodiment of the present application is introduced below with reference to the accompanying drawings. Referring to Figure 1, the embodiment of the present application provides an interactive method, which is applied to an electronic device having a display screen and supporting a stylus as an input device. For example, the electronic device can be a smart phone, a tablet computer, an e-reader, etc., and there is no special restriction here. The electronic device and the stylus can be connected based on Bluetooth or based on Wireless Fidelity (WiFi). There is no special restriction on the connection method here. The process of the method is described as follows:

[0200] Step 101: Detecting that the stylus is in a hovering state and detecting a preset gesture operation for the stylus.

[0201] In the embodiment of the present application, the hovering state can be considered as a state in which the distance between the stylus pen and the electronic device is greater than 0 and less than a set threshold, that is, it can be considered as a state in which the stylus pen is relatively close and there is no contact. For example, when the distance between the stylus pen and the electronic device is (0, 14 mm), the following describes in detail how the electronic device detects that the stylus pen is in the hovering state.

[0202] Method 1: Determine whether the stylus is in a hovering state based on electromagnetic induction.

[0203] For example, the tip of a stylus pen is equipped with an electromagnetic transmitter that emits electromagnetic signals. The electronic device is equipped with an electromagnetic sensor that receives the electromagnetic signal from the stylus tip and then determines whether the stylus is in a hovering state based on the strength of the received electromagnetic signal. For example, if the electromagnetic sensor in the electronic device detects that the electromagnetic signal is below a set strength, it determines that the stylus is in a hovering state.

[0204] Method 2: Determine whether the stylus is in a hovering state based on distance.

[0205] For example, an infrared sensor installed in an electronic device emits an infrared beam and measures the time it takes for the infrared beam to reflect back to the sensor. When a stylus hovers above the screen, the infrared beam is blocked by the pen tip, causing the measured reflection time to change. If the reflection time exceeds a set time, the stylus is considered to be in a hovering state. Alternatively, the reflection time can be used to further determine the distance between the stylus and the electronic device. If this distance is greater than a set distance, the stylus is considered to be in a hovering state.

[0206] For example, an electronic device equipped with an ultrasonic pen sensor emits ultrasonic waves and measures the time it takes for them to reflect back to the sensor. When a stylus hovers above the screen, the ultrasonic wave is blocked by the pen tip, causing the measured reflection time to change. If the reflection time exceeds a set time, the stylus is considered to be in a hovering state. Alternatively, the reflection time can be used to further determine the distance between the stylus and the electronic device. If this distance is greater than the set distance, the stylus is considered to be in a hovering state.

[0207] Method 3: Determine whether the stylus is in a hovering state based on acceleration.

[0208] For example, an acceleration sensor is installed in the electronic device, and the acceleration sensor can be used to detect the acceleration of the stylus when it slides on the electronic device. When the acceleration detected by the acceleration sensor is 0, it is determined that the stylus is in a hovering state.

[0209] It should be understood that in addition to the three detection mechanisms described above, other mechanisms may be used to determine whether the stylus is in a hovering state, such as utilizing capacitance changes or analyzing images captured by a camera, without particular limitation. Furthermore, determining whether the stylus is in a hovering state may be performed using any one of the aforementioned mechanisms, or a combination of multiple mechanisms, without particular limitation.

[0210] After determining that the stylus is in a hovering state, it can further detect whether a preset gesture operation is applied to the stylus. The preset gesture operation here can be considered to be similar to the operation when actually using a brush to draw ink painting, so that users who are accustomed to using a brush can also adapt to using a stylus to paint in a relatively short time. When the user applies a preset gesture operation to the stylus, the touch signal generated by the internal touch sensor of the stylus is sent to the electronic device via Bluetooth or Wi-Fi direct connection.

[0211] Step 102: Generate and display an ink painting in response to a preset gesture operation.

[0212] In an embodiment of the present application, after the electronic device detects that the stylus is in a hovering state and determines through the above-mentioned touch signal that the user has performed a preset gesture operation on the stylus, it can generate and display on the display screen an ink painting corresponding to the preset gesture operation and having a specific visual effect.

[0213] In some embodiments, there are multiple visual effects that need to be presented when drawing ink paintings, so accordingly, it is necessary to design multiple preset gesture operations to correspond to them. The following describes in detail how different visual effects are presented under different preset gesture operations.

[0214] Visual effect 1: Preview the opacity and width of the line.

[0215] Please refer to Figure 2, which is a flowchart of a method for generating a preview ink painting provided in an embodiment of the present application. Step 102 can be implemented by executing sub-steps 201 to 203:

[0216] Step 201: In response to a squeeze operation, adjust a baseline ink output of the stylus.

[0217] When using a brush to draw an ink painting, the user needs to dip the brush in ink for painting. The amount of ink used determines the opacity (i.e., the color depth of the line) and the thickness of the line displayed on the drawing paper during the subsequent painting process. It should be understood that the larger the amount of ink, the greater the opacity, and the darker the line color; the smaller the amount of ink, the lower the opacity, and the lighter the line color. Similarly, the more ink used, the easier it is for the ink to spread on the drawing paper, and the thicker the drawn line; conversely, the less ink used, the less likely the ink is to spread on the drawing paper, and the thinner the drawn line.

[0218] In an embodiment of the present application, when a stylus cannot directly dip into ink, the stylus's baseline ink output can be adjusted by simulating the process of drawing liquid through a "straw." When the squeeze ball in the "straw" is squeezed and then released, the external liquid enters the squeeze ball and the body of the "straw" due to the pressure difference. This squeezing operation adjusts the amount of liquid in the "straw." Similarly, a touch sensor can be positioned at a preset location on the stylus body. For example, the preset location can be the middle of the stylus body, or any other location that suits user preferences. This is not particularly limited here. See Figure 3 for a schematic diagram of a squeeze operation performed on a stylus according to an embodiment of the present application. As shown in Figure 3, when a single click from each of two fingers is detected, it can be considered a two-finger squeeze operation. Then, in response to the squeeze operation, the baseline ink output can be increased by a first set value. For example, the first set value can be 5% of the maximum baseline ink output. Each time a squeeze operation is detected, the baseline ink output increases by the first set value until it reaches the maximum baseline ink output. It should be understood that the user's squeeze operation described above can be considered to be completed in a short period of time, for example, 0.5 seconds or 1 second. When a prolonged squeeze operation is detected, for example, a squeeze operation of more than 3 seconds or 5 seconds, the baseline ink output is reduced by a second set value. For example, the second set value may be 5% of the maximum baseline ink output. Each time a prolonged squeeze operation is detected, the baseline ink output is reduced by the second set value until the baseline ink output reaches 0. It should be understood that the first and second set values ​​can be different and are not particularly limited herein.

[0219] Step 202: Based on the correspondence between the ink output and the opacity of the line, and based on the correspondence between the ink output and the width of the line, determine the reference opacity and reference width corresponding to the reference ink output.

[0220] In an embodiment of the present application, the electronic device pre-stores a correspondence between a reference ink output and the opacity and width of a line. The correspondence here can be stored in a table, that is, the table stores the correspondence between different reference ink outputs and opacities and widths in an exhaustive manner; or, the correspondence here can also be a mathematical expression, for example, the reference ink output is a, the opacity is ka (for example, the value range of ka is [0,1]), and the line width is ja (for example, the value range of ja is (0,40]). There is no special restriction on the values ​​of a, k, and j. After determining the adjusted reference ink output, the electronic device can determine the reference opacity and reference width of the drawn line based on the above-mentioned correspondence and the current reference ink output.

[0221] Step 203: Generate and display a preview of the ink painting.

[0222] Since the object adjusted by the user is the ink output of the stylus, but in the actual process of drawing an ink painting, the ink output directly affects the opacity and width of the drawn lines. Therefore, in an embodiment of the present application, in order to enable the user to more intuitively judge whether the adjusted baseline ink output is appropriate, that is, whether the opacity and line width used in the subsequent drawing process are appropriate, a preview ink painting can be generated and displayed on the display screen of the electronic device. The preview ink painting displayed here is not the actual drawing of the user, but the opacity in a pre-stored ink painting template is replaced with the baseline opacity determined in step 1022, and the line width in the ink painting template is replaced with the baseline width determined in step 1022, so as to serve as a basis for the user to judge whether the adjusted baseline ink output is appropriate.

[0223] Please refer to Figure 4, which shows a schematic diagram of a preview of an ink painting corresponding to different baseline ink output levels provided in an embodiment of the present application. As shown in Figure 4(a), when the baseline ink output level is 30%, the line opacity is 0.3 and the line width is 10px; as shown in Figure 4(b), when the baseline ink output level is 50%, the line opacity is 0.5 and the line width is 20px; as shown in Figure 4(c), when the baseline ink output level is 70%, the line opacity is 0.7 and the line width is 30px.

[0224] In some embodiments, after the user determines that the adjusted baseline ink output is appropriate, the user can use the stylus to contact the display screen of the electronic device to draw the relevant lines in the ink painting. In the process of drawing with a brush, the degree of force applied by the user when writing will also affect the ink output of the brush, and thus indirectly affect the opacity and line width of the drawn lines. Therefore, in the process of drawing with a stylus, the degree of force applied by the user when writing can also be associated with the ink output of the stylus, so that the user can control the opacity and thickness of the final rendered lines according to their own needs, thereby improving the user experience.

[0225] Please refer to FIG5, which is a flowchart of a method for drawing lines using a stylus provided in an embodiment of the present application. After executing step 203, you can continue to execute steps 204 to 206:

[0226] Step 204: In response to the drawing operation of the stylus, obtain the actual pressure value at the point where the stylus is placed.

[0227] In an embodiment of the present application, during the actual drawing process using a stylus, the tip of the stylus is in contact with the display screen of the electronic device. In one possible implementation, a pressure sensor can be installed at the tip of the stylus, and the pressure value at the point where the stylus is placed can be detected by the pressure sensor. The pressure value can be used to characterize the degree of force applied by the user. When the pressure value is greater, the greater the degree of force applied by the user; when the pressure value is smaller, the smaller the degree of force applied by the user. The stylus can then send the actual pressure value detected by the internal pressure sensor to the electronic device, so that the electronic device can know the degree of force applied by the user when writing. Of course, the pressure sensor can also be directly installed in the display screen of the electronic device, so that the electronic device can directly obtain the above-mentioned actual pressure value. There is no special restriction on how to obtain the actual pressure value.

[0228] Step 205: Determine the actual ink output volume based on the actual pressure value and the reference ink output volume.

[0229] In the embodiment of the present application, the reference ink output can be considered as the ink output under the standard pressure value. When the actual pressure value is less than the standard pressure value, the actual ink output is less than the reference ink output; when the actual pressure value is greater than the standard pressure value, the actual ink output is greater than the reference ink output. Therefore, the user can use the reference ink output as a reference and change the actual ink output by changing the pressure value applied to the display screen of the electronic device, thereby better meeting the requirements for the opacity and width of the lines in actual painting.

[0230] For example, the standard pressure value of 0.5Pa corresponds to a reference ink output of 50%. If the actual pressure value is 0.7Pa, the actual ink output is 70%; if the actual pressure value is 0.3Pa, the actual ink output is 30%.

[0231] Step 206: Generate and display a line combination corresponding to opacity and width according to the actual ink output.

[0232] In the embodiment of the present application, since there is a corresponding relationship between the reference ink output and the opacity and width of the line, after determining the actual ink output, the above corresponding relationship can still be used to determine the actual opacity and actual width of the line corresponding to the actual ink output, and display the relevant drawn lines on the display screen of the electronic device.

[0233] Visual effect two: Generate scatter effect.

[0234] Please refer to Figure 6, which is a flow chart of a method for generating a scatter effect provided in an embodiment of the present application. Step 102 can be implemented by executing sub-steps 301 to 303:

[0235] Step 301: In response to a tapping operation, a scattered point generation area corresponding to the stylus is determined on a display screen of an electronic device.

[0236] When using a brush to draw an ink painting, the user can dip the brush into a certain amount of ink and then knock the brush against another object, such as another brush that is not dipped in ink. The brush will then be vibrated, and the ink will be dispersed into small droplets that splash onto the drawing paper, thus forming a scatter effect on the drawing paper.

[0237] In an embodiment of the present application, when a stylus is used to draw, a tapping operation on the stylus can also be simulated. For example, a touch sensor is installed at a preset position in the stylus body. The preset position can be the middle position of the stylus body, or the front 1 / 4 position based on the pen tip. There is no special limitation on the preset position here. Please refer to Figure 7, which is a schematic diagram of a tapping operation on a stylus provided in an embodiment of the present application. As shown in Figure 7, when the touch sensor provided on the stylus body detects a single-click operation of a user's finger, it can be judged as a tapping operation. The stylus can then send a touch signal representing the tapping operation to the electronic device via Bluetooth or WIFI direct connection. After receiving the touch signal, the electronic device can know that the user is currently performing a tapping operation on the stylus.

[0238] After the electronic device determines that the user performs a tapping operation on the stylus in the hovering state, it further determines a scatter point generation area corresponding to the stylus on the display screen.

[0239] In some embodiments, when using a writing brush to generate scatter points, the scatter point generation location is typically related to the hovering position of the brush tip dipped in ink. The user can adjust the hovering position of the writing brush tip to adjust the scatter point generation area. Therefore, in embodiments of the present application, the scatter point generation area can also be determined based on the hovering position of the stylus pen tip.

[0240] Please refer to Figure 8, which is a flowchart of a method for determining a scattered point generation area provided in an embodiment of the present application. Step 301 can be specifically implemented by executing sub-steps 3011 to 3014:

[0241] Step 3011: Determine a first pen tip space coordinate of the pen tip of the stylus, and determine a tilt angle between the stylus and a preset reference point.

[0242] In the embodiments of the present application, a spatial coordinate system is established with a preset reference point on the display screen of the electronic device as a reference. For example, the preset reference point can be the upper left corner, lower left corner, upper right corner, lower right corner, or the center point of the display screen, without particular limitation. Furthermore, the width direction of the display screen can be the X-axis, the height direction can be the Y-axis, and the vertical direction can be the Z-axis. Alternatively, the height direction of the display screen can be the X-axis, the width direction can be the Y-axis, and the vertical direction can be the Z-axis, without particular limitation.

[0243] Taking the example of a stylus pen tip equipped with an electromagnetic transmitter and an electronic device equipped with an electromagnetic sensor, the electromagnetic transmitter in the stylus pen tip can emit electromagnetic signals, and the electromagnetic sensor in the electronic device can receive the above electromagnetic signals and detect the intensity and time delay of the electromagnetic signals. The electronic device can then analyze and process the intensity and time delay of the electromagnetic signals, and then use relevant algorithms to determine the first spatial coordinates of the stylus pen tip.

[0244] For example, a time-domain inversion algorithm uses the time delay of electromagnetic signal propagation to calculate position, determining the first spatial coordinate of the stylus tip by measuring the signal propagation time difference. A multi-point positioning algorithm uses multiple sensors to measure electromagnetic wave signals and determines the spatial coordinate of the stylus tip through triangulation or other geometric calculation methods. A model matching algorithm matches received electromagnetic signals with pre-stored models. By comparing the matching degree between the received electromagnetic signals and different position models, the first spatial coordinate of the stylus tip can be determined. Of course, other algorithms can also be used to determine the first spatial coordinate of the stylus tip, and this is not specifically limited here.

[0245] At the same time, both the stylus and the electronic device are equipped with a gyroscope. The stylus can send information such as the angular velocity detected by its own gyroscope to the electronic device. After receiving the angular velocity information of the stylus, the electronic device can combine the angular velocity information detected by its own gyroscope and the data of other sensors (accelerometer and electromagnetic sensor) to obtain fused data. Then, based on the attitude solution algorithm and the above-mentioned fused data, the tilt angle of the stylus is calculated. For example, the attitude solution algorithm can be an extended Kalman filter algorithm, a Mahony filter algorithm, a complementary filter, etc., which are not particularly limited here.

[0246] Step 3012: Project the first pen tip spatial coordinates onto the display screen to obtain a first projection point, and use the first projection point as the center point of the scatter point generation area.

[0247] Step 3013: Determine the radius value of the scatter point generation area based on the vertical component of the first pen tip space coordinate relative to the display screen and the tilt angle.

[0248] When using a writing brush to generate scattered points, the corresponding scattered point generation area can be approximately regarded as a circular area radiated by the writing brush tip. Therefore, in the embodiment of the present application, when using a stylus to generate scattered points, the corresponding scattered point generation area can also be a circular area.

[0249] Specifically, after determining the first pen tip spatial coordinate of the stylus tip and the stylus's tilt angle, the first pen tip spatial coordinate can be projected onto the plane of the electronic device's display screen to determine the first projection point. This first projection point is then used as the center point of the scatter point generation area, simulating the association of the scatter point generation area with the stylus tip position when painting with a brush. Based on this, the radius of the scatter point generation area is determined based on the stylus's tilt angle and the vertical component of the first pen tip spatial coordinate relative to the display screen, that is, the vertical height of the stylus tip relative to the display screen.

[0250] Please refer to Figure 9, which is a schematic diagram of a scatter point generation area provided in an embodiment of the present application. As shown in Figure 9, the first spatial coordinate of the stylus tip is (x, y, z), then the coordinates of the first projection point of the first spatial coordinate on the display screen are (x, y), that is, the center point of the scatter point generation area is (x, y); if the inclination angle of the stylus is q, then the radius value is k*z*log(q), where k is the proportional coefficient, the base of the log function is between (0, 1), and the radius value is positively correlated with z, that is, the larger z is, the larger the radius value is; the smaller z is, the smaller the radius value is. The radius value is negatively correlated with q, and the closer the inclination angle is to 0 degrees, the larger the radius value is; and the closer the inclination angle is to 90 degrees, the smaller the radius value is.

[0251] Step 3014: Determine a scatter point generation area based on the center point and the radius value.

[0252] In the embodiment of the present application, after respectively determining the center point and the radius value of the scatter point generation area, the scatter point generation area can be determined.

[0253] Step 302: Randomly generate scatter points within a scatter point generation area based on a first preset number.

[0254] Please refer to Figure 10, which is a schematic diagram of generating a scatter point effect according to an embodiment of the present application. Each tap of the stylus by the user can be considered to generate a first predetermined number of scatter points. The color of the scatter points can be any pre-selected color, without particular limitation. To generate a large number of scatter points, the stylus can be tapped multiple times.

[0255] The first preset number of scattered points will be distributed in the entire scattered point generation area according to the set rules.

[0256] Please refer to Figure 11, which is a flowchart of a scattered point generation method provided in an embodiment of the present application. Step 302 can be implemented by executing sub-steps 3021 to 3022:

[0257] Step 3021: Divide the scatter point generation area into a second preset number of scatter point generation sub-areas.

[0258] Step 3022: Based on the distance between each scatter point generation sub-region and the center point, randomly generate and display multiple scatter points in each scatter point generation sub-region.

[0259] In the embodiment of the present application, for the second preset number of scatter point generation sub-regions, the scatter points in the same scatter point generation sub-region can be considered to be relatively close to the center point, so the attributes of the scatter points in the same scatter point generation sub-region are set to be the same, while the distances from the center between different scatter point generation sub-regions can be considered to be significantly different, so the attributes of the scatter points in different scatter point generation sub-regions are set to be different, so that the final scatter point state can be more closely aligned with the scatter point state generated based on the brush, thereby presenting a better visual effect. It should be understood that the sum of the number of scatter points in the second preset number of scatter point generation sub-regions is equal to the first preset number.

[0260] For example, the attributes of scatter points can be considered as the size, density, and opacity of the scatter points. The size of the scatter points in the same scatter point generating sub-region is positively correlated with the distance from the center point. That is, for a certain scatter point generating sub-region, the closer it is to the center point, the smaller the scatter points in the scatter point generating sub-region are, and the farther it is from the center point, the larger the scatter points in the scatter point generating sub-region are. The density and opacity of the scatter points in the same scatter point generating sub-region are negatively correlated with the distance from the center point. That is, for a certain scatter point generating sub-region, the closer it is to the center point, the greater the density of the scatter points in the scatter point generating sub-region (i.e., the denser the scatter points), and the greater the opacity of the scatter points (i.e., the darker the color); the farther it is from the center point, the smaller the density of the scatter points in the scatter point generating sub-region (i.e., the sparser the scatter points), and the smaller the opacity of the scatter points (i.e., the lighter the color).

[0261] Please refer to Figure 12, which is a schematic diagram of how scatter point attributes vary with distance, provided in this embodiment. As shown in Figure 12, the scatter point generation area is divided into three subareas: scatter point generation subarea 1, scatter point generation subarea 2, and scatter point generation subarea 3. Scatter point generation subarea 1 is closest to the center point, while scatter point generation subarea 3 is farthest from the center point. Scatter point generation subarea 1 has the smallest number of scattered points, the highest density, and the highest opacity; scatter point generation subarea 3 has the largest number of scattered points, the lowest density, and the lowest opacity; and scatter point generation subarea 2 has a scatter point size, density, and opacity that are between those of scatter point generation subarea 1 and scatter point generation subarea 3.

[0262] Step 303: Displaying the ink painting at least including scattered points.

[0263] In an embodiment of the present application, the display screen of an electronic device may contain a pre-drawn, unfinished ink painting. By superimposing a scatter effect on this unfinished ink painting, a complete ink painting is formed. Alternatively, the scatter points can serve as the basis for subsequently drawing other elements, and the user can further process the scatter points to form a complete ink painting.

[0264] For example, an unfinished ink painting only includes the branches of wintersweet, while the superimposed scattered dots are equivalent to the flowers of wintersweet, thus forming a complete wintersweet ink painting.

[0265] Visual effect three: Generate diffusion effect.

[0266] Please refer to Figure 13, which is a flowchart of a method for generating a diffusion effect ink painting provided by an embodiment of the present application. Step 102 can be specifically implemented by executing sub-steps 401 and 402:

[0267] Step 401: In response to a swiping operation, control the pre-drawn line to diffuse by a preset diffusion distance along a direction corresponding to the swiping operation to generate a diffusion area.

[0268] In an embodiment of the present application, a spatial coordinate system is established based on a preset reference point on the display screen of the electronic device, and the spatial coordinates of the stylus tip are determined within this spatial coordinate system. The specific methods for establishing the spatial coordinate system and determining the stylus tip spatial coordinates can be found in the scheme described in step 3011 and will not be further described here. Please refer to FIG14 , which is a schematic diagram of a waving operation performed with a stylus according to an embodiment of the present application. As shown in FIG14 , if the electronic device detects that the stylus tip spatial coordinates continuously change in a certain direction within a set time period, and the motion trajectories formed between two stylus tip spatial coordinates are nearly parallel or completely parallel, it can be determined that the preset gesture performed by the user with the stylus is a waving operation. Based on this, the electronic device can control the pre-drawn line to spread by a preset diffusion distance in the direction corresponding to the waving operation (i.e., it spreads at a preset diffusion speed until the diffusion stops after the preset diffusion time), thereby forming a diffusion area. In other words, each time the electronic device detects a waving operation by the user, it controls the pre-drawn line to spread by a preset diffusion distance in the waving direction until the diffusion reaches a level that satisfies the user's visual effect. There is no special restriction on the size of the preset diffusion distance.

[0269] It should be understood that in the process of diffusion of the lines drawn by the brush, since the amount of ink of the drawn lines is fixed, during the diffusion process, as the diffusion distance increases, the opacity of the lines at the beginning of the diffusion will decrease due to the decrease in the amount of ink. Then, when using the waving operation of the stylus to form a diffusion effect, in the process of diffusion of the pre-drawn lines, the electronic device can also simulate the negative correlation between the opacity of the pre-drawn lines and the preset diffusion distance, and simulate the negative correlation between the opacity in the diffusion area and the distance between the pre-drawn lines, that is, the color of the pre-drawn lines is the darkest, the color in the diffusion area gradually becomes lighter, and the color at the edge of the diffusion area away from the pre-drawn lines is the lightest, so that from the beginning of the pre-drawn line to the edge side of the diffusion area away from the pre-drawn line, a visual effect of gradually lighter color as the distance increases is presented.

[0270] Please refer to Figure 15, which is a schematic diagram of a diffusion region formed by the diffusion of a pre-drawn line provided in an embodiment of the present application. As shown in Figure 15(a), before the diffusion process begins, the opacity of the pre-drawn line is 0.9; as shown in Figure 15(b), when the diffusion process ends, the opacity of the pre-drawn line is 0.6, the opacity of the edge of the diffusion region away from the pre-drawn line is 0.2, and the opacity of the area between the pre-drawn line and the edge is between (0.2, 0.6), thus presenting a visual effect of gradually transitioning from an opacity of 0.6 to an opacity of 0.2.

[0271] In some embodiments, the preset diffusion distance corresponding to the pre-drawn line can be adjusted according to the actual needs of the user, thereby generating a diffusion area with a specific diffusion distance to achieve a better visual effect.

[0272] Please refer to Figure 16, which is a flowchart of a method for controlling the diffusion of pre-drawn lines based on the distance between the stylus and the pre-drawn lines provided in an embodiment of the present application. Step 401 can be implemented by executing sub-steps 4011 to 4013:

[0273] Step 4011: In response to a swipe operation, determine the actual separation distance between the tip of the stylus pen and the pre-drawn line at the beginning of the swipe operation.

[0274] In an embodiment of the present application, based on the recognition of the waving operation, the start time of the waving operation can be determined, and then the spatial position of the stylus pen tip corresponding to the above start time can be determined. The pre-drawn line also has its own spatial position in the spatial coordinate system. Therefore, based on the spatial position of the stylus pen tip and the spatial position of the pre-drawn line, the actual spacing distance between the stylus pen tip and the pre-drawn line can be determined.

[0275] In some embodiments, since the stylus tip and the pre-drawn line are not located in the same plane, in order to more conveniently calculate the actual distance between the stylus tip and the pre-drawn line, they can be converted to the same plane for calculation.

[0276] Please refer to Figure 17, which is a flowchart of a method for calculating the distance between the stylus tip and the pre-drawn line provided in an embodiment of the present application. Step 4011 can be implemented by executing sub-steps 40111 to 40113:

[0277] Step 40111: Project the second pen tip space coordinates onto the display screen to obtain a second projection point.

[0278] In the embodiment of the present application, the second pen tip space coordinates of the stylus pen tip can be projected onto the plane where the display screen is located, that is, the plane where the pre-drawn line is located, so as to obtain the second projection point corresponding to the stylus pen tip.

[0279] Step 40112: Determine the point-line distance between the second projection point and the pre-drawn line.

[0280] In an embodiment of the present application, the midpoint of the pre-drawn line can be taken as a reference to calculate the point-line distance between the second projection point and the pre-drawn line. Of course, other points in the pre-drawn line can also be taken as a reference for calculating the above-mentioned point-line distance. There is no special restriction here.

[0281] Step 40113: Use the point-line distance as the actual interval distance.

[0282] In an embodiment of the present application, the point-to-line distance between the second projection point of the stylus tip and the pre-drawn line calculated in the plane where the display screen is located is used as the actual spacing distance between the stylus tip and the pre-drawn line, thereby simplifying the complex calculation process of directly calculating the actual spacing distance in space.

[0283] Step 4012: Determine the preset diffusion distance corresponding to the actual spacing distance according to the corresponding relationship between the spacing distance and the preset diffusion distance.

[0284] Step 4013: Control the pre-drawn line to diffuse by a preset diffusion distance along the direction corresponding to the swiping operation to generate a diffusion area.

[0285] In this embodiment of the present application, the distance between the tip of the stylus pen and the pre-drawn line at the start of a swipe operation is correlated with the preset diffusion distance of the pre-drawn line, with the swipe operation starting time as the reference. The distance is positively correlated with the preset diffusion distance, i.e., the smaller the distance, the smaller the preset diffusion distance; the larger the distance, the larger the preset diffusion distance. During the actual diffusion process, the user can adjust the actual distance between the tip of the stylus pen and the pre-drawn line by adjusting the starting position of the swipe operation. The preset diffusion distance is then determined based on the actual distance, thereby controlling the pre-drawn line to diffuse according to the preset diffusion distance corresponding to the actual distance, thereby achieving a satisfactory diffusion effect for the user.

[0286] It should be understood that when there are multiple pre-drawn lines, the diffusion scheme in the above embodiment is also applicable, that is, only one waving operation needs to be applied, and the object of the waving operation can be considered to be all pre-drawn lines. Since the actual spacing distances between different pre-drawn lines and the tip of the stylus are different, different pre-drawn lines in the same ink painting diffuse different preset diffusion distances, thereby achieving a specific visual effect.

[0287] Please refer to Figure 18, which is a schematic diagram of a diffusion effect for multiple pre-drawn lines provided in an embodiment of the present application. As shown in Figure 18, there are two pre-drawn lines, namely, pre-drawn line 1 and pre-drawn line 2. When the user swings the stylus, the tip of the stylus is relatively close to pre-drawn line 1 and relatively far away from pre-drawn line 2. Therefore, the preset diffusion distance 1 corresponding to pre-drawn line 1 is smaller than the preset diffusion distance 2 corresponding to pre-drawn line 2.

[0288] Step 402: Displaying an ink painting including at least pre-drawn lines and a diffusion area.

[0289] In the embodiment of the present application, after the diffusion process is completed, the display screen of the electronic device can display an ink painting that at least includes pre-drawn lines and a diffusion area.

[0290] Please refer to Figure 19, which is a flowchart of another method for generating a diffusion effect ink painting provided by an embodiment of the present application. Step 102 can be specifically implemented by executing sub-steps 501 and 504:

[0291] Step 501: In response to a swiping operation, determine an actual swiping speed.

[0292] In this embodiment of the present application, a spatial coordinate system is established using a preset reference point on the display screen of the electronic device as a reference, and the spatial coordinates of the stylus tip are determined within this spatial coordinate system. The specific methods for establishing the spatial coordinate system and determining the stylus tip spatial coordinates can be found in step 3011 and will not be further described here. The method for determining whether a swipe operation has been performed with the stylus, based on the known stylus tip spatial coordinates, can be found in step 401 and will not be further described here.

[0293] After identifying a swipe operation, the electronic device can naturally determine when the swipe operation begins and ends. Therefore, the electronic device can determine the length of the stylus tip's motion trajectory corresponding to a single swipe operation based on the stylus tip's spatial coordinates at the start and end of the swipe operation. Furthermore, the electronic device can determine the duration of the single swipe operation based on the start and end times of the swipe operation. By calculating the ratio of the stylus tip's motion trajectory length to the duration of the single swipe operation, the electronic device can determine the actual swipe speed corresponding to the single swipe operation.

[0294] Step 502: Based on the corresponding relationship between the waving speed and the diffusion speed, determine the actual diffusion speed corresponding to the actual waving speed.

[0295] In an embodiment of the present application, the waving speed can be associated with the diffusion speed, and the waving speed and the diffusion speed are positively correlated, that is, the smaller the waving speed, the smaller the diffusion speed; conversely, the greater the waving speed, the greater the diffusion speed, so the actual diffusion speed can be determined based on the actual waving speed.

[0296] In some embodiments, in addition to controlling the diffusion speed based on the swiping speed, the diffusion speed may also be controlled in conjunction with the distance between the stylus tip and the pre-drawn line.

[0297] Please refer to Figure 20, which is a flow chart of a method for controlling diffusion rate provided in an embodiment of the present application. Before executing step 502, step 505 may also be executed:

[0298] Step 505: Determine the actual distance between the tip of the stylus and the pre-drawn line at the beginning of the swipe operation.

[0299] Step 502 can be specifically implemented by executing sub-step 5021:

[0300] Step 5021: Based on the corresponding relationship between the waving speed / interval distance and the diffusion speed, determine the actual diffusion speed corresponding to the actual waving speed / actual interval distance.

[0301] In the embodiment of the present application, the diffusion speed of the pre-drawn line is not only positively correlated with the swiping speed, but also positively correlated with the spacing distance between the tip of the stylus and the pre-drawn line. That is, the greater the spacing distance and the swiping speed, the greater the corresponding diffusion speed; the smaller the spacing distance and the swiping speed, the smaller the corresponding diffusion speed.

[0302] It should be understood that how to determine the actual spacing distance in step 505 can be referred to above steps 40111 to 40113, and will not be repeated here.

[0303] Step 503: Control the pre-drawn line to diffuse along the direction corresponding to the swiping operation based on the actual diffusion speed to generate a diffusion area.

[0304] In this embodiment of the present application, the electronic device can control the pre-drawn line to spread along the swipe direction according to the determined actual spreading speed, thereby generating a diffusion area. In other words, the user can adjust the distance between the stylus tip and the pre-drawn line and the swipe speed according to their actual needs to generate a diffusion area with a specific spreading distance to achieve a better visual effect.

[0305] It should be understood that in the process of diffusion of the lines drawn by the brush, since the amount of ink of the drawn lines is fixed, during the diffusion process, as the diffusion distance increases, the opacity of the lines at the beginning of the diffusion will decrease due to the decrease in the amount of ink. Then, when using the waving operation of the stylus to form a diffusion effect, in the process of diffusion of the pre-drawn lines based on the preset diffusion speed, the electronic device can also simulate the negative correlation between the opacity of the pre-drawn lines and the diffusion distance, and simulate the negative correlation between the opacity in the diffusion area and the distance between the pre-drawn lines, that is, the color of the pre-drawn lines is the darkest, the color in the diffusion area gradually becomes lighter, and the color at the edge of the diffusion area away from the pre-drawn lines is the lightest, so that from the beginning of the pre-drawn line to the edge side of the diffusion area away from the pre-drawn line, a visual effect of gradually lighter color as the distance increases is presented.

[0306] Step 504: In response to reaching a preset diffusion time, stop diffusing the pre-drawn line and display the ink painting including at least the pre-drawn line and the diffusion area.

[0307] In the embodiment of the present application, when a single swipe of the stylus is performed, the diffusion time of the pre-drawn line is fixed, i.e., the preset diffusion time. When the preset diffusion time is reached, the diffusion of the pre-drawn line ends. The smaller the actual diffusion speed, the smaller the final actual diffusion distance; conversely, the faster the actual diffusion speed, the larger the final actual diffusion distance. The electronic device can then display an ink painting containing at least the pre-drawn line and the resulting diffusion area.

[0308] In the above embodiment, adjusting the swipe speed of a single swipe directly affects the diffusion speed, and thus indirectly affects the size of the diffusion area formed by a single swipe. Users can adjust the swipe speed of the stylus according to their actual needs, thereby generating a diffusion area with a specific diffusion distance while ensuring a minimum number of swipes, thereby achieving a better visual effect.

[0309] In the above embodiment, the waving operation serves to trigger the pre-drawn line to spread, while in other embodiments, the waving operation can also serve to trigger the pre-drawn line to stop spreading.

[0310] Please refer to Figure 21, which is a flowchart of another method for generating a diffusion effect ink painting provided by an embodiment of the present application. Before step 101, step 103 may also be performed:

[0311] Step 103: Control the pre-drawn line to diffuse along a preset diffusion direction based on a preset diffusion speed to generate a diffusion area.

[0312] In this embodiment of the present application, before drawing a line, the user can select the ink type, which includes automatic diffusion ink and passive diffusion ink. When the user selects automatic diffusion ink to draw a line, the generated pre-drawn line has the ability to automatically diffuse. Once the pre-drawn line is drawn, it will diffuse along a preset diffusion direction based on a preset diffusion speed, thereby generating a diffusion area. It should be understood that the preset diffusion direction can be a specific direction or can diffuse in all directions simultaneously, and this is not particularly limited here.

[0313] It should be understood that in the process of diffusion of the lines drawn by the brush, since the amount of ink of the drawn lines is fixed, during the diffusion process, as the diffusion distance increases, the opacity of the lines at the beginning of the diffusion will decrease due to the decrease in the amount of ink. Then, when using the waving operation of the stylus to form a diffusion effect, in the process of the pre-drawn lines diffusing along the preset diffusion direction, the electronic device can also simulate the negative correlation between the opacity of the pre-drawn lines and the diffusion distance, and simulate the negative correlation between the opacity in the diffusion area and the distance between the pre-drawn lines, that is, the color of the pre-drawn lines is the darkest, the color in the diffusion area gradually becomes lighter, and the color at the edge of the diffusion area away from the pre-drawn lines is the lightest, so that from the beginning of the pre-drawn line to the edge side of the diffusion area away from the pre-drawn line, a visual effect of gradually lighter color as the distance increases is presented.

[0314] Step 102 can be specifically implemented by executing sub-steps 601 to 602:

[0315] Step 601: In response to the preset gesture operation being a waving operation, stop diffusing the pre-drawn line.

[0316] Step 602: Displaying an ink painting including at least pre-drawn lines and a diffusion area.

[0317] In the embodiment of the present application, when the diffusion area formed by the diffusion of the pre-drawn line achieves the desired visual effect, the user can wave the stylus. Upon detecting the wave operation of the stylus, the electronic device stops spreading the pre-drawn line and displays an ink painting that includes at least the original drawn line and the subsequent diffusion area. It should be understood that how the electronic device recognizes the wave operation of the stylus can be referred to the content described in step 401 above and will not be repeated here.

[0318] It should be understood that the diffusion area here can be an embellishment of a pre-drawn ink painting, and after superimposing this diffusion area, a complete ink painting is formed. Alternatively, the diffusion area here can be the basis for subsequent drawing of other elements. The user can further process the diffusion area to form a complete ink painting.

[0319] Visual effect four: Generates an ink painting with an ink dripping effect.

[0320] Please refer to Figure 22, which is a flowchart of a method for generating an ink painting with an ink drop effect provided by an embodiment of the present application. Step 102 can be specifically implemented by executing sub-steps 701 to 705:

[0321] Step 701: In response to a shaking operation, determine a center point for generating an ink dot.

[0322] In an embodiment of the present application, a spatial coordinate system is established based on a preset reference point in the display screen of the electronic device, and the spatial coordinates of the pen tip of the stylus are determined in the spatial coordinate system. For details on how to establish the spatial coordinate system and how to determine the pen tip spatial coordinates, please refer to the scheme recorded in step 3011, which will not be repeated here. Please refer to Figure 23, which is a schematic diagram of a shaking operation for a stylus provided in an embodiment of the present application. As shown in Figure 23, a gyroscope is configured in the stylus. If the electronic device receives gyroscope data in the stylus indicating that the stylus is in a swinging state, and at the same time, the electronic device detects that the spatial coordinates of the pen tip of the stylus are continuously changing, and when the change is continuous, the spatial distance between the starting pen tip spatial coordinates and the ending pen tip spatial coordinates is within a set range, it can be determined that the user has performed a shaking operation on the stylus.

[0323] After determining that the user has performed a shaking operation on the stylus pen, the specific characteristics of the shaking operation can be associated with the ink dot generation center.

[0324] Please refer to Figure 24, which is a flowchart of a method for determining the center of ink dot generation provided by an embodiment of the present application. Step 701 can be implemented by executing sub-steps 7011 to 7014:

[0325] Step 7011: In response to a shaking operation, determine a third nib space coordinate of the stylus tip at the beginning of the shaking operation, and determine a fourth nib space coordinate of the stylus tip at the end of the shaking operation.

[0326] In an embodiment of the present application, based on the recognition of the shaking operation, the start time and end time of the shaking operation can be determined, and then the spatial position of the stylus tip corresponding to the above start time, that is, the third stylus tip spatial coordinate, and the spatial position of the stylus tip corresponding to the above end time, that is, the fourth stylus tip spatial coordinate, can be determined.

[0327] Step 7012: Project the third pen tip space coordinate onto the display screen to obtain a third projection point; and project the fourth pen tip space coordinate onto the display screen to obtain a fourth projection point.

[0328] In an embodiment of the present application, the third pen tip space coordinate and the fourth pen tip space coordinate are respectively projected onto the plane where the electronic device display screen is located, so as to determine the start time of the shaking operation, the initial position of the stylus pen tip on the plane where the display screen is located, that is, the third projection point, and the end time of the shaking operation, the end position of the stylus pen tip on the plane where the display screen is located, that is, the fourth projection point.

[0329] Step 7013: Determine the midpoint of the projection points between the third projection point and the fourth projection point.

[0330] In the embodiment of the present application, the third projection point and the fourth projection point are located in the same plane, and the midpoint of the line connecting the third projection point and the fourth projection point is the midpoint of the projection points.

[0331] For example, the coordinates of the third projection point are (x1, y1), and the coordinates of the fourth projection point are (x2, y2), then the coordinates of the midpoint of the projection points are ((x1+x2) / 2, (y1+y2) / 2).

[0332] Step 7014: Use the midpoint of the projection point as the center point for generating the ink dot.

[0333] In the embodiment of the present application, the midpoint of the projection point is used as the midpoint of ink dot generation, so that the user can more conveniently adjust the ink dot generation position by changing the start and end positions of the shaking operation.

[0334] Step 702: In response to the shaking operation, determine the ink dot diffusion distance.

[0335] In an embodiment of the present application, after determining that the user has performed a shaking operation on the stylus, the specific characteristics of the shaking operation can be associated with the ink dot diffusion distance, so that the user can adjust the ink dot diffusion distance by changing the characteristics of the shaking operation, thereby achieving the visual effect required by the user.

[0336] Please refer to Figure 25, which is a flowchart of a method for determining ink dot diffusion distance provided in an embodiment of the present application. Step 702 can be implemented by executing sub-steps 7021 to 7023:

[0337] Step 7021: In response to the shaking operation, calculate the spatial distance between the third pen tip spatial coordinate and the fourth pen tip spatial coordinate, and use the spatial distance as the actual shaking amplitude corresponding to the shaking operation.

[0338] In the embodiment of the present application, the third pen tip spatial coordinate is the spatial coordinate of the stylus tip when the shaking operation starts, and the fourth spatial coordinate is the spatial coordinate of the stylus tip when the shaking operation ends. Based on the known third pen tip spatial coordinate and the fourth spatial coordinate, the spatial distance corresponding to a single shaking operation from the start time to the end time can be determined, and this spatial distance can be considered as the actual shaking amplitude corresponding to the single shaking operation.

[0339] Step 7022: The vertical component of the fourth pen tip space coordinate relative to the display screen is used as the actual drop height when the ink drop is dropped.

[0340] When using a brush to generate an ink dripping effect, the ink dot can be considered to be thrown away from the brush tip at the moment the brush is stopped from shaking. Therefore, in the embodiment of the present application, when using a stylus to generate ink dots, the end time of the stylus shaking operation can also be used as the time when the ink dot is thrown out. At this time, the vertical component of the fourth pen tip space coordinate corresponding to the stylus tip relative to the display screen can be used as the actual dripping height of the ink dot when it drips.

[0341] Step 7023: Based on the correspondence between the drop height, the shaking amplitude and the ink dot spreading distance, the ink dot spreading distance is determined based on the actual drop height and the actual shaking amplitude.

[0342] When using a brush to create an ink dripping effect, the higher the drop height of the ink dot, the greater its movement speed will be before it contacts the plane of the drawing paper. After contacting the plane of the drawing paper, the greater movement speed needs to drop to 0 in a very short time, so the ink dot will show a more significant diffusion due to the greater force from the drawing paper, that is, the diffusion distance is larger. Conversely, the lower the drop height of the ink dot, the smaller its movement speed will be before it contacts the plane of the drawing paper. After contacting the plane of the drawing paper, the smaller movement speed needs to drop to 0 in a very short time, so the ink dot will show an insignificant diffusion due to the smaller force from the drawing paper, that is, the diffusion distance is smaller. Similarly, the greater the shaking amplitude of the shaking operation, the smaller the initial speed of the thrown ink dot. The larger the amplitude of the shaking operation, the smaller the initial velocity of the thrown ink dots. Under the condition of a certain drop height, before contacting the plane of the drawing paper, its movement speed can still be increased to a large extent. After contacting the plane of the drawing paper, since the large movement speed needs to drop to 0 in a very short time, the ink dots will only be affected by a small force from the drawing paper, and will show insignificant diffusion, that is, the diffusion distance is small. On the contrary, the smaller the shaking amplitude of the shaking operation, the smaller the initial velocity of the thrown ink dots. Under the condition of a certain drop height, before contacting the plane of the drawing paper, its movement speed still increases to a limited extent. After contacting the plane of the drawing paper, the small movement speed needs to drop to 0 in a very short time. Then the ink dots only need to be affected by a small force from the drawing paper, and will show insignificant diffusion, that is, the diffusion distance is small.

[0343] Therefore, in the embodiment of the present application, when using a stylus to generate an ink dripping effect, the correspondence between the dripping height of the ink dots, the shaking amplitude of the shaking operation and the ink dot diffusion distance can also be simulated and established, and they are all positively correlated. Based on the above correspondence, the actual shaking amplitude and the actual dripping height, and the corresponding actual diffusion distance can be determined.

[0344] Step 703: Determine the ink dot size based on the current ink output.

[0345] When using a writing brush to generate a dripping ink effect, the amount of ink蘸取的 by the writing brush determines the original size of the ink dots that can be formed after the ink drops. Therefore, in the embodiments of the present application, a corresponding relationship between the ink output and the ink dot size can also be established in advance, and then based on the current ink output of the stylus and the above corresponding relationship, the actual ink dot size can be determined.

[0346] Step 704: Generate an original ink dot based on the ink dot size at the ink dot generation center point, and control the original ink dot to radially spread the ink dot diffusion distance to generate a radially shaped ink dot.

[0347] In the embodiments of the present application, after determining the ink dot generation center and the ink dot size, an original ink dot, that is, an undiffused ink dot, can be generated at the ink dot generation center based on the ink dot size. On this basis, combined with the ink dot diffusion distance, control the original ink dot to radially spread according to the ink dot diffusion distance to obtain a radially shaped ink dot.

[0348] It should be understood that the radially shaped ink dot can include two parts. The first part is the irregular块状区域 in the middle, and the second part is the scattered dot area around. The radial diffusion radius of the irregular area in the first part is: k*w, where k is a random number, 0 < k < 1, and w represents the actual shaking amplitude; the radial diffusion radius of the scattered dot area in the second part is: j*h, where j is a random number, j > 1, and h represents the actual ink dripping height.

[0349] Step 705: Display a Chinese ink painting that at least includes a radially shaped ink dot.

[0350] Please refer to FIG. 26, which is a schematic diagram of a radially shaped ink dot provided by an embodiment of the present application. As shown in FIG. 26, after the diffusion process is completed, at least a radially shaped Chinese ink painting can be displayed on the display screen of the electronic device. It should be understood that the radially shaped ink dot here can be an embellishment of a pre-drawn Chinese ink painting. After superimposing this radially shaped ink dot, a complete Chinese ink painting is formed. Or, the radially shaped ink dot here can be the basis for subsequently drawing other elements. The user can further process on the basis of the formed radially shaped ink dot to form a complete Chinese ink painting.

[0351] Visual effect five: Generate a filling effect.

[0352] Please refer to FIG. 27, which is a schematic flowchart of a method for generating a Chinese ink painting with a filling effect provided by an embodiment of the present application. Step 102 can be specifically implemented by executing sub-steps 801 to sub-step 802:

[0353] Step 801: In response to a squeezing operation, determine a closed area based on the attribute information of pre-collected pixel points.

[0354] When creating visual effects 1 through 4, the stylus can be considered to be in the ink pen function. In this embodiment of the present application, when color filling is desired, the stylus first switches from the ink painting function to the eyedropper function. The stylus, while in the eyedropper function, is then used to collect attribute information for any pixel in the area of ​​the display screen that the user wishes to fill with color. When the stylus detects a squeeze operation, it transmits the pre-collected pixel attribute information to the electronic device. This attribute information includes the pixel's hue, saturation, and brightness. After obtaining the pre-collected pixel attribute information, the electronic device can search for adjacent pixels of the pre-collected pixel whose attribute information differs from the pre-collected pixel within a set range. A closed area is then defined based on the pixels within the set range and the pre-collected pixels. The electronic device's recognition of a squeeze operation on the stylus when in the eyedropper function is similar to the mechanism used to determine a squeeze operation when the stylus is in the ink painting function and will not be further elaborated here.

[0355] It should be understood that triggering color filling and triggering adjustment of the baseline ink output are both based on squeezing operations on the stylus. However, when adjusting the baseline ink volume, the stylus is in the brush function of ink painting, and when filling colors, the stylus is in the eyedropper function. Therefore, even if both are squeezing operations, it will not cause functional confusion.

[0356] Step 802: Fill the closed area with color, generate and display the filled ink painting.

[0357] In an embodiment of the present application, after a closed area is determined, the closed area can be filled with color. Please refer to Figure 28 for a schematic diagram of color filling provided in an embodiment of the present application. As shown in Figure 28, the color-filled ink painting is displayed on the display screen of an electronic device. The color filled here can be any color selected by the user and is not particularly limited here.

[0358] Referring to FIG. 29 , based on the same inventive concept, an embodiment of the present application provides an interactive device, which is provided in an electronic device that supports a stylus as a corresponding input device. The interactive device includes:

[0359] The detection unit 901 is configured to detect that the stylus pen is in a hovering state and detects a preset gesture operation for the stylus pen;

[0360] The processing unit 902 is configured to generate and display an ink painting in response to a preset gesture operation.

[0361] Optionally, the preset gesture operation is a squeezing operation on the stylus pen body, and the processing unit 902 is specifically configured to:

[0362] In response to the squeezing operation, adjusting a baseline ink output of the stylus;

[0363] Determining a reference opacity and a reference width corresponding to a reference ink output amount based on a correspondence between the ink output amount and the opacity of the line, and based on a correspondence between the ink output amount and the width of the line;

[0364] A preview ink painting is generated and displayed, wherein the opacity of the lines of the preview ink painting is the base opacity, and the width of the lines of the preview ink painting is the base width.

[0365] Optionally, the interactive device further includes:

[0366] an acquiring unit, configured to acquire an actual pressure value at a point where the stylus is placed in response to a drawing operation of the stylus;

[0367] a determining unit, configured to determine an actual ink output amount based on an actual pressure value and a reference ink output amount;

[0368] The processing unit 902 is further configured to determine, generate, and display a line combination corresponding to opacity and width according to the actual ink output.

[0369] Optionally, the preset gesture operation is a tapping operation on the stylus body, and the processing unit 902 includes:

[0370] a scatter point generation area determination unit, configured to determine, in response to a tapping operation, a scatter point generation area corresponding to the stylus on a display screen of the electronic device;

[0371] A scatter point generating unit, configured to randomly generate scatter points based on a first preset number within a scatter point generating area;

[0372] The display unit is configured to display the ink painting at least including scattered points.

[0373] Optionally, a spatial coordinate system is established based on a preset reference point on the display screen of the electronic device, and the scattered point generation area determination unit is specifically configured to:

[0374] Determining a first pen tip spatial coordinate of a pen tip of the stylus, and determining a tilt angle between the stylus and a preset reference point;

[0375] Projecting the first pen tip spatial coordinate onto the display screen to obtain a first projection point;

[0376] The first projection point is used as the center point of the scatter point generation area;

[0377] Determining a radius value of a scattered point generation area based on a vertical component of the first pen tip spatial coordinate relative to the display screen and an inclination angle;

[0378] Determines the scatter point generation area based on the center point and radius values.

[0379] Optionally, the scatter point generation unit is specifically used to:

[0380] dividing the scatter point generation area into a second preset number of scatter point generation sub-areas;

[0381] Based on the distance between each scatter point generating subregion and the center point, multiple scatter points are randomly generated and displayed in each scatter point generating subregion, wherein the sum of the number of scatter points in all scatter point generating subregions is equal to a first preset number, the size of the scatter points in the same scatter point generating subregion is positively correlated with the distance from the center point, and the density and opacity of the scatter points in the same scatter point generating subregion are negatively correlated with the distance from the center point.

[0382] Optionally, the preset gesture operation is a waving operation, and the processing unit 902 includes:

[0383] a diffusion unit, configured to control, in response to a waving operation, the diffusion of the pre-drawn lines by a preset diffusion distance in a direction corresponding to the waving operation to generate a diffusion area, wherein the opacity of the pre-drawn lines during the diffusion process is negatively correlated with the preset diffusion distance, and the opacity in the diffusion area is negatively correlated with the distance between the pre-drawn lines;

[0384] The display unit is used to display an ink painting including at least pre-drawn lines and a diffusion area.

[0385] Optionally, the diffusion unit includes:

[0386] a spacing distance determining unit, configured to determine, in response to a swipe operation, an actual spacing distance between a tip of the stylus pen and the pre-drawn line at the beginning of the swipe operation;

[0387] a diffusion distance determining unit, configured to determine the preset diffusion distance corresponding to the actual separation distance based on a correspondence between the separation distance and the preset diffusion distance, wherein the separation distance is positively correlated with the preset diffusion distance;

[0388] The line diffusion unit is used to control the pre-drawn line to diffuse a preset diffusion distance along the direction corresponding to the waving operation to generate a diffusion area.

[0389] Optionally, the preset gesture operation is a waving operation, and the processing unit 902 includes:

[0390] a waving speed determining unit, configured to determine an actual waving speed in response to the waving operation;

[0391] a diffusion speed determining unit, configured to determine an actual diffusion speed corresponding to the actual waving speed based on a correspondence between the waving speed and the diffusion speed, wherein the waving speed and the diffusion speed are positively correlated;

[0392] A diffusion unit is configured to control the diffusion of the pre-drawn lines along the direction corresponding to the swipe operation based on the actual diffusion speed, thereby generating a diffusion area. The opacity of the pre-drawn lines during the diffusion process is negatively correlated with the diffusion distance, and the opacity in the diffusion area is negatively correlated with the distance between the pre-drawn lines.

[0393] The display unit is configured to stop diffusing the pre-drawn lines in response to reaching a preset diffusion time, and generate and display an ink painting including at least the pre-drawn lines and the diffusion area.

[0394] Optionally, the interactive device further includes:

[0395] a spacing distance determining unit, configured to determine an actual spacing distance between the tip of the stylus pen and the pre-drawn line at the beginning of a waving operation;

[0396] The diffusion rate determination unit is specifically used for:

[0397] Based on the corresponding relationship between the swinging speed / interval distance and the diffusion speed, the actual diffusion speed corresponding to the actual swinging speed / actual interval distance is determined, and the interval distance is positively correlated with the diffusion speed.

[0398] Optionally, a spatial coordinate system is established based on a preset reference point on a display screen of the electronic device, and the interval distance determining unit is specifically configured to:

[0399] Projecting the second pen tip spatial coordinates onto the display screen to obtain a second projection point;

[0400] determining a point-to-line distance between the second projection point and the pre-drawn line;

[0401] The point-line distance is taken as the actual separation distance.

[0402] Optionally, the interactive device further includes:

[0403] an automatic diffusion unit, configured to control the diffusion of the pre-drawn lines along a preset diffusion direction based on a preset diffusion speed to generate a diffusion area, wherein the opacity of the pre-drawn lines during the diffusion process is negatively correlated with the diffusion distance, and the opacity in the diffusion area is negatively correlated with the distance between the pre-drawn lines;

[0404] The preset gesture operation is a waving operation, and the processing unit 902 is specifically configured to:

[0405] In response to the swiping operation, stopping the diffusion of the pre-drawn line;

[0406] An ink drawing including at least pre-drawn lines and a diffused area is displayed.

[0407] Optionally, the preset gesture operation is a shaking operation, and the processing unit 902 includes:

[0408] an ink dot generation center determination unit, configured to determine an ink dot generation center point in response to a shaking operation;

[0409] an ink dot spread distance determining unit, configured to determine an ink dot spread distance in response to a shaking operation;

[0410] An ink dot size determination unit, configured to determine an ink dot size based on a current ink output amount;

[0411] The ink dot generation and diffusion unit is used to generate original ink dots based on the ink dot size at the ink dot generation center point, and control the original ink dots to radially diffuse the ink dot diffusion distance to generate radial ink dots;

[0412] The display unit is used to display an ink painting containing at least radial ink dots.

[0413] Optionally, a spatial coordinate system is established based on a preset reference point on the display screen of the electronic device, and the ink dot generation center determination unit is specifically configured to:

[0414] In response to the shaking operation, determining a third pen tip space coordinate of the stylus pen tip at the beginning of the shaking operation, and determining a fourth pen tip space coordinate of the stylus pen tip at the end of the shaking operation;

[0415] Projecting the third pen tip spatial coordinate onto the display screen to obtain a third projection point; and projecting the fourth pen tip spatial coordinate onto the display screen to obtain a fourth projection point;

[0416] Determine a midpoint of the projection points between the third projection point and the fourth projection point;

[0417] The midpoint of the projected point is used as the center point for ink point generation.

[0418] Optionally, the ink dot diffusion distance determining unit is specifically configured to:

[0419] In response to the shaking operation, calculating a spatial distance between the third pen tip spatial coordinate and the fourth pen tip spatial coordinate, and using the spatial distance as an actual shaking amplitude corresponding to the shaking operation;

[0420] The vertical component of the fourth pen tip space coordinate relative to the display screen is used as the actual drop height when the ink drop falls;

[0421] Based on the corresponding relationship between the drop height, the shaking amplitude and the ink dot spreading distance, the ink dot spreading distance corresponding to the actual drop height and the actual shaking amplitude is determined.

[0422] Optionally, the stylus is in the eyedropper function, and the preset gesture operation is a squeeze operation. The processing unit 902 is specifically configured to:

[0423] In response to the squeeze operation, determining a closed area based on the attribute information of the pre-collected pixel points;

[0424] Fill the closed area with color to generate and display the filled ink painting.

[0425] Please refer to Figure 30. Based on the same inventive concept, an embodiment of the present application provides an electronic device, which includes at least one processor 1001, and the processor 1001 is used to execute a computer program stored in a memory to implement the steps of the interaction method shown in Figures 1-2, 5-6, 8, 11, 13, 16-17, 19-22, 24-25 and 27 provided in the embodiment of the present application.

[0426] Optionally, the processor 1001 may specifically be a central processing unit, a specific ASIC, or one or more integrated circuits for controlling program execution.

[0427] Optionally, the electronic device may further include a memory 1002 coupled to the at least one processor 1001. The memory 1002 may include ROM, RAM, and disk storage. The memory 1002 is used to store data required by the processor 1001 during operation, that is, it stores instructions executable by the at least one processor 1001. The at least one processor 1001 executes the methods shown in Figures 1-2, 5-6, 8, 11, 13, 16-17, 19-22, 24-25, and 27 by executing the instructions stored in the memory 1002. The number of memories 1002 may be one or more.

[0428] The physical devices corresponding to the detection unit 901 and the processing unit 902 can both be the aforementioned processor 1001. The electronic device can be used to execute the methods provided in the embodiments shown in Figures 1-2, 5-6, 8, 11, 13, 16-17, 19-22, 24-25, and 27. Therefore, regarding the functions that can be implemented by each functional module in the electronic device, reference can be made to the corresponding descriptions in the embodiments shown in Figures 1-2, 5-6, 8, 11, 13, 16-17, 19-22, 24-25, and 27, and no further details will be given.

[0429] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores computer instructions. When the computer instructions are executed on a computer, the computer executes the methods described in Figures 1-2, 5-6, 8, 11, 13, 16-17, 19-22, 24-25 and 27.

[0430] The above description is only a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of this specification should be included in the scope of protection of this specification.

Claims

1. An interactive method, characterized in that: Applied to an electronic device, the electronic device supports a stylus as a corresponding input device, the method comprising: Detecting that the stylus pen is in a hovering state and detecting a preset gesture operation for the stylus pen; In response to the preset gesture operation, an ink painting is generated and displayed.

2. The method according to claim 1, characterized in that The preset gesture operation is a squeezing operation on the stylus pen body, and in response to the preset gesture operation, an ink painting is generated and displayed, including: In response to the squeezing operation, adjusting a reference ink output amount of the stylus; Based on the corresponding relationship between the reference ink output and the opacity of the line, and based on the corresponding relationship between the ink output and the width of the line, determining the reference opacity and the reference width corresponding to the reference ink output; A preview ink painting is generated and displayed, wherein the opacity of the lines of the preview ink painting is the reference opacity, and the width of the lines of the preview ink painting is the reference width.

3. The method according to claim 2, characterized in that The method further comprises: In response to a drawing operation of the stylus, acquiring an actual pressure value at a point where the stylus is placed; determining an actual ink output amount based on the actual pressure value and the reference ink output amount; A line combination corresponding to the opacity and width is generated and displayed according to the actual ink output amount.

4. The method according to claim 1, characterized in that: The preset gesture operation is a tapping operation on the body of the stylus pen, and in response to the preset gesture operation, an ink painting is generated and displayed, including: In response to the tapping operation, determining a scattered point generation area corresponding to the stylus on a display screen of the electronic device; Randomly generate scattered points based on a first preset number in the scattered point generation area; The ink painting including at least the scattered points is displayed.

5. The method according to claim 4, characterized in that: A spatial coordinate system is established based on a preset reference point in the display screen of the electronic device, and a scattered point generation area corresponding to the stylus is determined in the display screen of the electronic device, including: Determining a first pen tip space coordinate of the pen tip of the stylus, and determining a tilt angle between the stylus and the preset reference point; Projecting the first pen tip spatial coordinates onto the display screen to obtain a first projection point, and using the first projection point as the center point of the scattered point generation area; Determining a radius value of the scattered point generation area based on a vertical component of the first pen tip space coordinate relative to the display screen and the tilt angle; The scattered point generation area is determined based on the center point and the radius value.

6. The method according to claim 5, characterized in that Randomly generating scattered points in the scattered point generation area based on a first preset number includes: Dividing the scattered point generation area into a second preset number of scattered point generation sub-areas; Based on the distance between each of the scatter point generating sub-regions and the center point, a plurality of scatter points are randomly generated and displayed in each of the scatter point generating sub-regions, wherein the sum of the numbers of scatter points in all the scatter point generating sub-regions is equal to the first preset number, the size of the scatter points in the same scatter point generating sub-region is positively correlated with the distance from the center point, and the density and opacity of the scatter points in the same scatter point generating sub-region are negatively correlated with the distance from the center point.

7. The method according to claim 1, characterized in that The preset gesture operation is a waving operation, and in response to the preset gesture operation, an ink drawing is generated and displayed, including: In response to the waving operation, controlling the pre-drawn line to diffuse by a preset diffusion distance along a direction corresponding to the waving operation to generate a diffusion area, wherein the opacity of the pre-drawn line during the diffusion process is negatively correlated with the preset diffusion distance, and the opacity in the diffusion area is negatively correlated with the distance between the pre-drawn lines; The ink painting including at least the pre-drawn lines and the diffusion area is displayed.

8. The method according to claim 7, characterized in that In response to the waving operation, controlling the pre-drawn line to diffuse by a preset diffusion distance along a direction corresponding to the waving operation to generate a diffusion area includes: In response to the swiping operation, determining an actual spacing distance between a tip of the stylus pen and the pre-drawn line at the beginning of the swiping operation; According to the correspondence between the spacing distance and the preset diffusion distance, the preset diffusion distance corresponding to the actual spacing distance is determined, wherein the spacing distance is positively correlated with the preset diffusion distance; The pre-drawn line is controlled to diffuse by the preset diffusion distance along a direction corresponding to the swiping operation to generate the diffusion area.

9. The method according to claim 1, characterized in that: The preset gesture operation is a waving operation, and in response to the preset gesture operation, an ink painting is generated and displayed, including: In response to the swiping operation, determining an actual swiping speed; Based on the corresponding relationship between the swinging speed and the diffusion speed, determining the actual diffusion speed corresponding to the actual swinging speed, wherein the swinging speed is positively correlated with the diffusion speed; Controlling the pre-drawn lines to diffuse along the direction corresponding to the swiping operation based on the actual diffusion speed to generate a diffusion area; wherein the opacity of the pre-drawn lines during the diffusion process is negatively correlated with the diffusion distance, and the opacity in the diffusion area is negatively correlated with the distance between the pre-drawn lines; In response to reaching a preset diffusion time, the diffusion of the pre-drawn line is stopped, and the ink painting including at least the pre-drawn line and the diffusion area is generated and displayed.

10. The method according to claim 9, characterized in that Before determining the actual diffusion speed corresponding to the actual waving speed based on the corresponding relationship between the waving speed and the diffusion speed, the method further includes: determining an actual spacing distance between the tip of the stylus pen and the pre-drawn line at the beginning of the swiping operation; Determining the actual diffusion speed corresponding to the actual waving speed based on the corresponding relationship between the waving speed and the diffusion speed includes: Based on the corresponding relationship between the swinging speed / interval distance and the diffusion speed, the actual diffusion speed corresponding to the actual swinging speed / the actual interval distance is determined, and the interval distance is positively correlated with the diffusion speed.

11. The method according to any one of claims 8 or 10, characterized in that: A spatial coordinate system is established based on a preset reference point in the display screen of the electronic device, the tip of the stylus pen at the start of the waving operation is a second tip spatial coordinate, and in response to the waving operation, an actual spacing distance between the tip of the stylus pen and the pre-drawn line at the start of the waving operation is determined, including: Projecting the second pen tip spatial coordinates onto the display screen to obtain a second projection point; Determining a point-to-line distance between the second projection point and the pre-drawn line; The point-to-line distance is taken as the actual spacing distance.

12. The method according to claim 1, characterized in that Before detecting that the stylus pen is in a hovering state and detecting a preset gesture operation for the stylus pen, the method further includes: Controlling the pre-drawn lines to diffuse along a preset diffusion direction based on a preset diffusion speed to generate a diffusion area, wherein the opacity of the pre-drawn lines during the diffusion process is negatively correlated with the diffusion distance, and the opacity in the diffusion area is negatively correlated with the distance between the pre-drawn lines; The preset gesture operation is a waving operation, and in response to the preset gesture operation, an ink painting is generated and displayed, including: In response to the swiping operation, stopping the diffusion of the pre-drawn line; The ink painting including at least the pre-drawn lines and the diffusion area is displayed.

13. The method according to claim 1, characterized in that The preset gesture operation is a shaking operation, and in response to the preset gesture operation, an ink painting is generated and displayed, including: In response to the shaking operation, determining a center point of ink dot generation and a diffusion distance of the ink dot; Determine ink dot size based on current ink output; Generating original ink dots based on the ink dot size at the ink dot generation center point, and controlling the original ink dots to diffuse radially by the ink dot diffusion distance to generate radial ink dots; The ink painting including at least the radial ink dots is displayed.

14. The method according to claim 13, characterized in that A spatial coordinate system is established based on a preset reference point in the display screen of the electronic device, and a center point of ink dot generation is determined in response to the shaking operation, including: In response to the shaking operation, determining a third pen tip space coordinate of the pen tip of the stylus when the shaking operation starts, and determining a fourth pen tip space coordinate of the pen tip of the stylus when the shaking operation ends; Projecting the third pen tip spatial coordinates onto the display screen to obtain a third projection point; and projecting the fourth pen tip spatial coordinates onto the display screen to obtain a fourth projection point; Determine a midpoint of the projection points between the third projection point and the fourth projection point; The midpoint of the projection points is used as the center point for generating the ink dots.

15. The method according to claim 14, characterized in that In response to the shaking operation, determining the ink dot diffusion distance includes: In response to the shaking operation, calculating a spatial distance between the third pen tip spatial coordinate and the fourth pen tip spatial coordinate, and using the spatial distance as an actual shaking amplitude corresponding to the shaking operation; Taking the vertical component of the fourth pen tip spatial coordinate relative to the display screen as the actual drop height of the ink dot when it drops; Based on the correspondence between the drop height, the shaking amplitude and the ink dot diffusion distance, the ink dot diffusion distance corresponding to the actual drop height and the actual shaking amplitude is determined.

16. The method according to claim 1, characterized in that The stylus is in the eyedropper function, the preset gesture operation is a squeeze operation, and in response to the preset gesture operation, an ink painting is generated and displayed, including: In response to the squeezing operation, determining a closed area based on the attribute information of the pre-collected pixel points; The closed area is filled with color to generate and display the filled ink painting.

17. An interactive device, characterized in that: The interactive device is arranged in an electronic device, the electronic device supports a stylus as a corresponding input device, and the interactive device comprises: A detection unit, configured to detect that the stylus pen is in a hovering state and detect a preset gesture operation for the stylus pen; The processing unit is used to generate and display an ink painting in response to the preset gesture operation.

18. An electronic device, characterized in that: The electronic device comprises: at least one processor; a memory coupled to the at least one processor; The at least one processor is configured to implement the steps of the method according to any one of claims 1 to 16 when executing the computer program stored in the memory.

19. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 16 are implemented.

Citation Information

Patent Citations

  • Interaction method and device, electronic equipment and storage medium

    CN119493479A

  • Portable device and guide information provision method thereof

    CN103631513A

  • Ink input for browser navigation

    CN108885615A

  • Live ink presence for real-time collaboration

    CN110506264A

  • Touch painting processing system and method

    CN111367433A