Interaction method and device, electronic equipment and storage medium

By implementing specific gesture operations on the hovered stylus and generating and displaying ink paintings, the problem of single writing style of the stylus is solved and the user experience is improved.

CN119493479APending Publication Date: 2025-02-21HUAWEI TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202311054670.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-21
Publication Date
2025-02-21

AI Technical Summary

Technical Problem

In existing electronic devices, the writing style of the stylus when inputting information is relatively 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 performing specific gesture operations such as squeezing, tapping or swinging on the stylus in a hover state.

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 CN119493479A_ABST
    Figure CN119493479A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an interaction method and device, electronic equipment and a storage medium, which can draw an ink and wash painting in the matched electronic equipment by implementing specific gesture operation on a handwriting pen in a hovering state, so that the diversity of writing styles capable of being input by the handwriting pen is expanded, the requirements of a user in different scenes are met, and the user experience is improved. And the user experience is improved. The interaction method comprises the steps that it is detected that a handwriting pen is in a hovering state, and preset gesture operation for the handwriting pen is detected; 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

[Technical field]

[0001] 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 technology]

[0002] At present, 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 can be input by the stylus is relatively single, which cannot meet the user's usage needs in different scenarios, resulting in a poor user experience. [Summary of the invention]

[0003] The embodiments of the present application provide an interactive method, device, electronic device and storage medium, which can draw ink paintings in 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.

[0004] In a first aspect, an embodiment of the present application provides an interaction method, which is applied to an electronic device, wherein the electronic device supports a stylus as a corresponding input device, and a spatial coordinate system is established based on a preset reference point in a display screen of the electronic device, and the method includes:

[0005] Detecting in the spatial coordinate system that the stylus pen is in a hovering state and detecting a preset gesture operation for the stylus pen;

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

[0007] 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 interactive 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 experience.

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

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

[0010] Based on the corresponding relationship between the ink output amount and the opacity of the line, and based on the corresponding relationship between the ink output amount and the width of the line, determine the reference opacity and reference width corresponding to the reference ink output amount;

[0011] 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.

[0012] 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.

[0013] Optionally, the method further includes:

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

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

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

[0017] In the embodiment of the present application, since the 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 their own needs, thereby improving the user experience.

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

[0019] In response to the tapping operation, determining a scattered point generation area corresponding to the stylus;

[0020] Randomly generate scattered points based on a first preset number in the scattered point generation area;

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

[0022] In the 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.

[0023] Optionally, determining a scattered point generation area corresponding to the handwriting pen includes:

[0024] 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;

[0025] 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;

[0026] Determine 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;

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

[0028] In the embodiment of the present application, the scatter point generation area is determined based on the spatial coordinates of the tip of the stylus pen when in a hovering state and the inclination angle of the stylus pen. That is to say, the user can adjust the spatial coordinates of the tip of the stylus pen and the inclination of the stylus pen 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.

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

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

[0031] 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 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.

[0032] 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.

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

[0034] 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;

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

[0036] 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 in the display screen of the electronic device will diffuse a set distance along the waving direction to form a diffusion area, and during 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.

[0037] 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:

[0038] 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;

[0039] 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;

[0040] 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.

[0041] 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. Then, the user can 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.

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

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

[0044] 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;

[0045] Controlling the pre-drawn lines to diffuse along the direction corresponding to the waving 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;

[0046] 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.

[0047] In the embodiment of the present application, the swing speed of the stylus 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. In the case of a certain diffusion time, the faster the diffusion speed, the greater the diffusion distance in one swing operation process. Then the user can adjust the swing speed of the stylus according to their actual needs, thereby generating a diffusion area with a specific diffusion distance to achieve a better visual effect.

[0048] Optionally, 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:

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

[0050] 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:

[0051] 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.

[0052] In the embodiment of the present application, the diffusion distance of the pre-drawn line is related to the waving speed as well as 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.

[0053] Optionally, when the waving operation starts, the tip of the stylus pen is a second tip space 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 when the waving operation starts includes:

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

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

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

[0057] In an embodiment of the present application, the projection point of the spatial coordinates of the stylus pen tip on the electronic device display screen can be first determined, and then the point-line distance from the projection point to the pre-drawn line can be calculated, and then the point-line distance can be used as the interval distance between the stylus pen tip and the pre-drawn line, thereby being able to accurately and conveniently calculate the interval distance between the stylus pen tip and the pre-drawn line.

[0058] Optionally, 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:

[0059] 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;

[0060] The preset gesture operation is a waving operation, and in response to the preset gesture operation, an ink painting is generated and displayed, including:

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

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

[0063] In the embodiment of the present application, the pre-drawn line itself has the ability to diffuse, and during the diffusion process, as the diffusion distance increases, the opacity of the pre-drawn line gradually decreases, that is, a diffusion area is formed in which the color of the pre-drawn line to the diffusion area gradually becomes lighter. When the diffusion area formed by the automatic diffusion of the pre-diffusion area meets the needs of the user, the handwriting pen in the hovering state can be waved, and the pre-drawn line will stop diffusing, thereby achieving the purpose of using the handwriting pen to generate an ink painting with a diffusion effect.

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

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

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

[0067] 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;

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

[0069] 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 according to 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, original ink points of a specific size can be generated at the above-mentioned ink point generation center, and the original ink points can be controlled to diffuse radially to form radial ink points, thereby achieving the purpose of using the stylus to generate an ink painting with an ink dripping effect.

[0070] Optionally, in response to the shaking operation, determining the center point of ink dot generation includes:

[0071] 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;

[0072] 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;

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

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

[0075] 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 when the shaking operation starts and ends, and the midpoint of the line connecting the two projection points is 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 their actual needs, and thus conveniently change the center point of ink dot generation.

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

[0077] 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;

[0078] 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;

[0079] 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;

[0080] Based on the corresponding relationship among 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.

[0081] In an embodiment of the present application, the vertical height when the shaking operation stops is used as the dripping height of the ink dots, 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 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 closely aligned with the ink dot state generated based on the brush, so as to present a better visual effect.

[0082] Optionally, the stylus pen is in an 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:

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

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

[0085] In the embodiment of the present application, when the stylus is in the pipette function, the stylus in the hovering state can be squeezed to trigger the analysis of the pre-collected pixel points of the stylus, thereby determining a plurality of pixel points having the same attributes as the pre-collected pixel points, that is, determining a specific closed area. Then, the determined closed area is filled with a specific color, thereby achieving the purpose of using the stylus to generate an ink painting with a filling effect.

[0086] In a second aspect, an embodiment of the present application provides an interactive device, wherein the interactive device is arranged in an electronic device, wherein the electronic device supports a stylus as a corresponding input device, and wherein the interactive device comprises:

[0087] 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;

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

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

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

[0091] Based on the corresponding relationship between the ink output amount and the opacity of the line, and based on the corresponding relationship between the ink output amount and the width of the line, determine the reference opacity and reference width corresponding to the reference ink output amount;

[0092] 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.

[0093] Optionally, the interaction device further includes:

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

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

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

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

[0098] a scattered point generation area determination unit, configured to determine a scattered point generation area corresponding to the stylus in response to the tapping operation;

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

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

[0101] Optionally, the scattered point generation area determination unit is specifically used to:

[0102] 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;

[0103] 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;

[0104] 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;

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

[0106] Optionally, the scattered point generating unit is specifically used for:

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

[0108] 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.

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

[0110] a diffusion unit, configured to control the pre-drawn line to diffuse by a preset diffusion distance in a direction corresponding to the waving operation in response to the waving operation, and 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;

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

[0112] Optionally, the diffusion unit includes:

[0113] 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 beginning of the waving operation;

[0114] a diffusion distance determination unit, configured to determine the preset diffusion distance corresponding to the actual spacing distance according to a correspondence between the spacing distance and the preset diffusion distance, wherein the spacing distance is positively correlated with the preset diffusion distance;

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

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

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

[0118] a diffusion speed determining unit, configured to determine 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 is positively correlated with the diffusion speed;

[0119] a diffusion unit, used to control the pre-drawn line to diffuse along the direction corresponding to the waving operation based on the actual diffusion speed 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;

[0120] The display unit is used for stopping diffusing the pre-drawn line in response to reaching a preset diffusion time, and generating and displaying the ink painting including at least the pre-drawn line and the diffusion area.

[0121] Optionally, the interaction device further includes:

[0122] 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;

[0123] The diffusion speed determination unit is specifically used for:

[0124] 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.

[0125] Optionally, the interval distance determining unit is specifically used to:

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

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

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

[0129] Optionally, the interaction device further includes:

[0130] An automatic diffusion unit, used for 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;

[0131] The preset gesture operation is a waving operation, and the processing unit is specifically used for:

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

[0133] Optionally, the processing unit includes:

[0134] An ink dot generation center determination unit, used to determine the ink dot generation center point in response to the shaking operation;

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

[0136] An ink dot size determination unit, used to determine the ink dot size based on the current ink output amount;

[0137] An ink dot generation and diffusion unit, used 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;

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

[0139] Optionally, the ink dot generation center determination unit is specifically used for:

[0140] 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;

[0141] 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;

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

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

[0144] Optionally, the ink dot diffusion distance determination unit is specifically used for:

[0145] 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;

[0146] 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;

[0147] 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;

[0148] Based on the corresponding relationship among 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.

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

[0150] Optionally, the stylus pen is in the pipette 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 the attribute information of the 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, the electronic device comprising:

[0154] at least one processor;

[0155] a memory coupled to the processor;

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

[0157] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method as 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 invention are consistent with the technical solutions of the first aspect of the embodiments of the present invention, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be described in detail.

Brief Description of the Drawings

[0159] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. 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 paying creative work.

[0160] Figure 1 A flowchart of an interactive method provided in an embodiment of the present application;

[0161] Figure 2 A flowchart of a method for generating a preview ink painting provided in an embodiment of the present application;

[0162] Figure 3 A schematic diagram of a squeezing operation performed on a stylus pen provided in an embodiment of the present application;

[0163] Figure 4 A schematic diagram of a preview of an ink painting corresponding to different reference ink output amounts provided in an embodiment of the present application;

[0164] Figure 5 A flowchart of a method for drawing lines using a stylus provided in an embodiment of the present application;

[0165] Figure 6 A schematic diagram of a method for generating a scatter effect provided in an embodiment of the present application;

[0166] Figure 7 A schematic diagram of a tapping operation performed by a stylus pen provided in an embodiment of the present application;

[0167] Figure 8 A schematic diagram of a flow chart of a method for determining a scattered point generation area provided in an embodiment of the present application;

[0168] Fig. 9 A schematic diagram of a scattered point generation area provided in an embodiment of the present application;

[0169] Fig.10 A schematic diagram of generating a scatter effect provided in an embodiment of the present application;

[0170] Fig.11 A schematic diagram of a process for generating scattered points provided in an embodiment of the present application;

[0171] Fig.12 A schematic diagram of a scattered point attribute changing with distance provided in this embodiment;

[0172] Fig.13 A schematic diagram of a flow chart of a method for generating a diffusion effect ink painting provided in an embodiment of the present application;

[0173] Fig.14 A schematic diagram of a waving operation of a stylus provided in an embodiment of the present application;

[0174] Fig.15 A schematic diagram of a diffusion area formed by diffusion of a pre-drawn line provided in an embodiment of the present application;

[0175] Fig.16 A schematic flow chart of a method for controlling diffusion of a pre-drawn line based on the distance between a stylus pen and the pre-drawn line provided in an embodiment of the present application;

[0176] Fig.17 A schematic flow chart of a method for calculating the distance between a stylus pen tip and a pre-drawn line provided in an embodiment of the present application;

[0177] Fig.18 A schematic diagram of a diffusion effect under multiple pre-drawn lines provided in an embodiment of the present application;

[0178] Fig.19 A schematic diagram of a flow chart of another method for generating a diffusion effect ink painting provided in an embodiment of the present application;

[0179] Fig. 20 A schematic diagram of a method for controlling diffusion rate provided in an embodiment of the present application;

[0180] Fig.21 A schematic diagram of a flow chart of another method for generating a diffusion effect ink painting provided in an embodiment of the present application;

[0181] Fig. 22 A schematic diagram of a flow chart of a method for generating an ink painting with an ink drop effect provided in an embodiment of the present application;

[0182] Fig.23 A schematic diagram of a shaking operation of a stylus provided in an embodiment of the present application;

[0183] Fig.24 A schematic diagram of a flow chart of a method for determining an ink dot generation center provided in an embodiment of the present application;

[0184] Fig.25A schematic diagram of a flow chart of a method for determining ink dot diffusion distance provided in an embodiment of the present application;

[0185] Fig.26 A schematic diagram of a radial ink dot provided in an embodiment of the present application;

[0186] Fig. 27 A schematic diagram of a flow chart of a method for generating a filled ink painting provided in an embodiment of the present application;

[0187] Fig.28 A schematic diagram of color filling provided in an embodiment of the present application;

[0188] Fig.29 A schematic diagram of the structure of an interactive device provided in an embodiment of the present application;

[0189] Fig.30 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. [Specific implementation method]

[0190] In order to better understand the technical solution 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 described embodiments 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 creative work are within the scope of protection of this specification.

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

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

[0194] Ink diffusion technique: mainly includes blowing ink technique and waving ink technique. Blowing ink technique refers to spreading ink by blowing air, so as to achieve the blurring and gradient effect of texture. Blowing ink technique is mainly suitable for large-area and wide ink diffusion, and is often used to express broad landscapes, clouds and other effects; waving ink technique is to splash and diffuse ink by waving tools (such as brushes, fans, etc.), so as to achieve the blurring and gradient effect of texture. The waving ink technique is suitable for the expression of local details in a smaller area, and is often used to depict delicate textures such as leaves and petals.

[0195] Point-and-dye technique: Dip a proper amount of ink on a brush, brush or bamboo stick. Then, gently tap, smear or twist the brush on the paper to form a dot pattern on the paper. Point-and-dye technique can create various textures in ink painting, such as stone texture, bark texture, fabric texture, etc. It can also be used to depict natural scenes, such as the starry sky, flowers, raindrops, etc.

[0196] Ink dripping technique: Use ink dripping or spilling on paper to create. It produces rich and diverse forms and texture effects by controlling the speed, angle and position of ink dripping. The principle of ink dripping technique is based on the fluidity and wettability of ink. At the moment of ink dripping or spilling, due to gravity and friction of droplets, the ink will freely diffuse and penetrate on the paper, forming a transparent and rich texture effect. The form and texture 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 application scenarios of ink dripping technique are wide. In ink painting, the ink dripping technique can be used to express natural scenery, such as the elegance and flow of water droplets, raindrops, petals, etc.

[0197] At present, for electronic devices equipped with display screens, in addition to supporting the user's touch commands or voice commands as input, a stylus can also be supported 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 of the hard pen style is simulated. 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 the 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 a 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 experience.

[0199] The following is an introduction to the technical solution provided by the embodiment of the present application in conjunction with the accompanying drawings. Figure 1, an embodiment of the present application provides an interaction method, which is applied to an electronic device, the electronic device has a display screen and supports 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), and there is no special restriction on the connection method here. The process of the method is described as follows:

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

[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 relatively close state without contact. For example, when the distance between the stylus pen and the electronic device is (0, 14mm), the following describes in detail how the electronic device detects that the stylus pen is in a hovering state.

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

[0203] For example, an electromagnetic transmitter is installed in the tip of the stylus pen, which can emit electromagnetic signals. An electromagnetic sensor is installed in the electronic device, which can receive the electromagnetic signal from the tip of the stylus pen, and then determine whether the stylus pen is in a hovering state based on the strength of the received electromagnetic signal. For example, when the electromagnetic sensor in the electronic device detects that the electromagnetic signal is lower than the set strength, it is determined that the stylus pen is in a hovering state.

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

[0205] For example, an infrared sensor is installed in an electronic device, which emits an infrared beam and measures the time it takes for the infrared beam to be reflected back to the sensor. When the stylus is hovering above the screen, the infrared beam will be blocked by the pen tip, causing the measured reflection time to change. If the reflection time exceeds the set time, it is determined that the stylus is in a hovering state. Alternatively, the distance between the stylus and the electronic device is further determined based on the reflection time. When the distance is greater than the set distance, it is determined that the stylus is in a hovering state.

[0206] For another example, an ultrasonic pen sensor is installed in an electronic device, which emits ultrasonic waves and measures the time from the emission to the reflection back to the sensor. When the stylus is hovering above the screen, the ultrasonic wave will be blocked by the pen tip, causing the measured reflection time to change. If the reflection time exceeds the set time, it is determined that the stylus is in a hovering state. Alternatively, the distance between the stylus and the electronic device is further determined based on the reflection time. When the distance is greater than the set distance, it is determined that the stylus is in a hovering state.

[0207] Method 3: Determine whether the stylus pen 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 above three detection mechanisms, other mechanisms can also be used to determine whether the stylus is in a hovering state, for example, by using capacitance changes or analyzing images collected by a camera, and no particular restrictions are made here. At the same time, when determining whether the stylus is in a hovering state, any one of the above mechanisms can be used to determine, or a combination of multiple mechanisms can be used to determine, and no particular restrictions are made here.

[0210] After determining that the stylus is in a hovering state, it is possible to 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 of actually using a brush to draw ink paintings, so that users who are accustomed to using a brush to paint can also adapt to using a stylus to paint in a relatively short period of time. When the user applies a preset gesture operation to the stylus, the stylus will generate a touch signal from the internal touch sensor and send it to the electronic device via Bluetooth or WIFI 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 correspondingly, multiple preset gesture operations need to be designed to correspond to them. The following describes in detail the different visual effects presented under different preset gesture operations.

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

[0215] See also Figure 2 , 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 squeezing operation, adjusting a reference ink output amount of the stylus pen.

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

[0218] In the embodiment of the present application, when the stylus cannot directly dip into ink, the baseline ink output of the stylus can be adjusted by simulating the process of a "straw" sucking up liquid. When the squeezing ball in the "straw" is squeezed and then released, the external liquid will enter the squeezing ball and the tube body of the "straw" due to the pressure difference, that is, the amount of liquid in the "straw" is adjusted through the squeezing operation. Similarly, a touch sensor can be set at a preset position on the body of the stylus. For example, the preset position can be the middle position of the stylus body, and of course it can also be other positions that meet the user's operating habits. There is no special limitation here. Please refer to Figure 3 , is a schematic diagram of a squeeze operation performed on a stylus provided in an embodiment of the present application. Figure 3As shown, when a single click operation from each of the two fingers is detected, it can be considered as a two-finger squeeze operation. Then, in response to the squeeze operation, the reference ink output can be increased according to the first set value. For example, the first set value is 5% of the maximum reference ink output. Each time a user's squeeze operation is detected, the reference ink output increases by the first set value until it increases to the maximum reference ink output. It should be understood that the user's squeeze operation can be considered to be completed in a short time, for example, 0.5S, or 1S. When it is detected that the user performs a squeeze operation on the stylus for a long time, for example, it is detected that the user performs a squeeze operation on the body of the stylus for more than 3S or more than 5S, the reference ink output is reduced according to the second set value. For example, the second set value is 5% of the maximum reference ink output. Each time a user's long-term squeeze operation is detected, the reference ink output will be reduced by the second set value until the reference ink output is 0. It should be understood that the above-mentioned first set value and the second set value may also be different, and there is no special restriction here.

[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, a correspondence between a reference ink output and the opacity and width of a line is pre-stored in the electronic device. 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]), and 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 ink painting, the ink output directly affects the opacity and width of the drawn lines. Therefore, in the embodiment of the present application, in order to enable the user to more intuitively judge whether the adjusted reference 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 actually drawn by the user, but the opacity in a pre-stored ink painting template is replaced with the reference opacity determined in step 1022, and the line width in the ink painting template is replaced with the reference width determined in step 1022, so as to serve as a basis for the user to judge whether the adjusted reference ink output is appropriate.

[0223] See also Figure 4 , is a schematic diagram of a preview of an ink painting corresponding to different reference ink output amounts provided in an embodiment of the present application. Figure 4 As shown in (a), when the base ink output is 30%, the opacity of the line is 0.3 and the line width is 10px; Figure 4 As shown in (b), when the base ink output is 50%, the opacity of the line is 0.5 and the line width is 20px; Figure 4 As shown in (c), when the reference ink output is 70%, the opacity of the line is 0.7 and the line width is 30px.

[0224] In some embodiments, after the user determines that the adjusted reference ink output is appropriate, the stylus can be brought into contact with 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 force applied by the user when writing will also affect the ink output of the brush, and thus indirectly affect the opacity and width of the drawn lines. Therefore, in the process of drawing with a stylus, the 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 presented lines according to their own needs, thereby improving the user experience.

[0225] See also Figure 5 , which is a flow chart of a method for drawing lines using a stylus provided in an embodiment of the present application. After executing step 203, steps 204 to 206 may be continued:

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

[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. The greater the pressure value, the greater the degree of force applied by the user; the smaller the pressure value, 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 amount based on the actual pressure value and the reference ink output amount.

[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 opacity and width of lines in actual painting.

[0230] For example, the reference ink output corresponding to the standard pressure value of 0.5Pa is 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] See also 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 ink paintings, the user can dip the brush into a certain amount of ink and then knock the brush with the ink against another object, such as another brush that is not dipped in ink. The brush with the ink will then be vibrated, and the ink will be dispersed into small ink drops and splash onto the drawing paper, thus forming a scattered effect on the drawing paper.

[0237] In the embodiment of the present application, when drawing with a stylus pen, a tapping operation on the stylus pen can also be simulated. For example, a touch sensor is installed at a preset position in the stylus pen body, and the preset position can be the middle position of the stylus pen body, or the front 1 / 4 position based on the pen tip. There is no special restriction on the preset position. Figure 7 , is a schematic diagram of a tapping operation performed by a stylus provided in an embodiment of the present application. Figure 7 As shown, when the touch sensor set on the stylus body detects a single click operation of a user's finger, it can be judged as a tapping operation. Then the stylus can 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 currently performs 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 the scattered point generation area corresponding to the stylus on the display screen.

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

[0240] See also Figure 8 , is a flow chart of a method for determining a scattered point generation area provided in an embodiment of the present application. Step 301 can be 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 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. 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, and there is no special limitation here. At the same time, 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. Of course, the height direction of the display screen can also be the X-axis, the width direction can be the Y-axis, and the vertical direction can be the Z-axis, and there is no special limitation here.

[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 electromagnetic signals and detect the strength and time delay of the electromagnetic signals. The electronic device can then analyze and process the strength 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, the time domain inversion algorithm uses the time delay of electromagnetic signal propagation to calculate the position, and determines the first spatial coordinate of the stylus tip by measuring the signal propagation time difference; the 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; the model matching algorithm is a method of matching the received electromagnetic signal with a pre-stored model. By comparing the matching degree of the received electromagnetic signal with the models of different positions, 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, and there is no special restriction 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 (acceleration sensor and electromagnetic sensor) to obtain fused data. Then, based on the attitude solution algorithm and the above fused data, the inclination angle of the stylus is solved. 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 scattered 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 a writing brush is used 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 a writing brush is used to generate scattered points, the corresponding scattered point generation area can also be a circular area.

[0249] Specifically, after determining the first pen tip space coordinate of the stylus pen tip and the inclination angle of the stylus pen, the first pen tip space coordinate can be projected onto the plane where the display screen of the electronic device is located, so that the first projection point can be determined, and then the first projection point can be used as the center point of the scatter point generation area, so as to simulate the association of the scatter point generation area with the position of the stylus pen tip when painting with a brush. On this basis, based on the inclination angle of the stylus pen and the vertical component of the first pen tip space coordinate compared to the display screen, that is, the vertical height of the stylus pen tip compared to the display screen, the radius value of the scatter point generation area is jointly determined.

[0250] See also Fig. 9 , is a schematic diagram of a scattered point generation area provided in an embodiment of the present application. Fig. 9 As shown, the first spatial coordinate of the stylus tip is (x, y, z), then the first projection point coordinate of the first spatial coordinate on the display screen is (x, y), that is, the center point of the scattered 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 the z, the larger the radius value; the smaller the z, the smaller the radius value. The radius value is negatively correlated with q, and the closer the inclination angle is to 0 degrees, the larger the radius value; and the closer the inclination angle is to 90 degrees, the smaller the radius value.

[0251] Step 3014: Determine the 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 generating scatter points in a scatter point generation area based on a first preset number.

[0254] See also Fig.10 , is a schematic diagram of generating a scatter point effect provided in an embodiment of the present application. Each time the user taps the stylus, it can be considered that a first preset number of scatter points will be generated, where the color of the scatter points can be any pre-selected color, and there is no special restriction here. If a large number of scatter points need to be generated, 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] See also Fig.11 , which is a flow chart 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, a plurality of scatter points are randomly generated and displayed 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-areas, the scatter points in the same scatter point generation sub-area 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-area are set to be the same, while the distances from the center between different scatter point generation sub-areas can be considered to be quite different, so the attributes of the scatter points between different scatter point generation sub-areas are set to be different, 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. It should be understood that the sum of the number of scatter points in the second preset number of scatter point generation sub-areas is equal to the first preset number.

[0260] For example, the attributes of scattered points can be considered as the size, density and opacity of scattered points. The size of scattered points in the same scattered point generating sub-region is positively correlated with the distance from the center point, that is, for a certain scattered point generating sub-region, the closer it is to the center point, the smaller the scattered points in the scatter point generating sub-region, and the farther it is from the center point, the larger the scattered points in the scatter point generating sub-region. The density and opacity of scattered 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 scattered points in the scatter point generating sub-region (that is, the denser the scattered points), and the greater the opacity of scattered points (that is, the darker the color); the farther it is from the center point, the smaller the density of scattered points in the scatter point generating sub-region (that is, the sparser the scattered points), and the smaller the opacity of scattered points (that is, the lighter the color).

[0261] See also Fig.12 , which is a schematic diagram of a scattered point attribute changing with distance provided in this embodiment. Fig.12As shown, the scatter point generation area is divided into three sub-areas, namely, scatter point generation sub-area 1, scatter point generation sub-area 2 and scatter point generation sub-area 3. Scatter point generation sub-area 1 is closest to the center point, and scatter point generation sub-area 3 is farthest from the center point. The scatter points in scatter point generation sub-area 1 are the smallest, the density is the largest, and the opacity is the largest; the scatter points in scatter point generation sub-area 3 are the largest, the density is the smallest, and the opacity is the smallest; the scatter point size, scatter point density and opacity of scatter point generation sub-area 2 are between scatter point generation sub-area 1 and scatter point generation sub-area 3.

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

[0263] In the embodiment of the present application, the display screen of the electronic device may contain an unfinished ink painting drawn in advance, and a complete ink painting is formed by superimposing a scatter point effect on the unfinished ink painting. Alternatively, the scatter points here can be the basis for drawing other elements later, 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] See also Fig.13 , is a flow chart of a method for generating a diffusion effect ink painting provided in an embodiment of the present application. Step 102 can be implemented by executing sub-steps 401 and 402:

[0267] Step 401: In response to a 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.

[0268] In the embodiment of the present application, a spatial coordinate system is established based on the 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 solution recorded in step 3011, which will not be repeated here. Fig.14 , is a schematic diagram of a waving operation of a stylus provided in an embodiment of the present application. Fig.14As shown, if the electronic device detects that the spatial coordinates of the pen tip of the stylus pen change continuously in a certain direction within a set time length, and the motion trajectories formed between the spatial coordinates of the two pen tips are close to parallel or completely parallel, then it can be determined that the preset gesture operation performed by the user on the stylus pen is a waving operation. On this basis, the electronic device can control the pre-drawn line to diffuse a preset diffusion distance along the direction corresponding to the waving operation (that is, diffuse at a preset diffusion speed until the preset diffusion time is reached, and then the diffusion stops), 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 diffuse a preset diffusion distance along the waving direction until the diffusion degree that satisfies the user's visual effect is reached. There is no special restriction on the size of the preset diffusion distance here.

[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. Therefore, 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 of the diffusion area away from the pre-drawn line, a visual effect of gradually lighter color as the distance increases is presented.

[0270] See also Fig.15 , which is a schematic diagram of a diffusion area formed by diffusion of a pre-drawn line provided in an embodiment of the present application. Fig.15 (a) shows that the opacity of the pre-drawn line is 0.9 before the diffusion process begins; Fig.15 As shown in (b), when the diffusion process is completed, the opacity of the pre-drawn line is 0.6, the opacity of the edge side of the diffusion area away from the pre-drawn line is 0.2, and the opacity of the area between the pre-drawn line and the above-mentioned edge side is between (0.2, 0.6), thus presenting a visual effect of gradually transitioning from opacity 0.6 to opacity 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, so as to generate a diffusion area with a specific diffusion distance to achieve a better visual effect.

[0272] See also Fig.16, a flowchart of a method for controlling the diffusion of pre-drawn lines based on the distance between a 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 an actual spacing distance between the tip of the stylus pen and the pre-drawn line at the beginning of the swipe operation.

[0274] In the 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 spacing distance between the stylus tip and the pre-drawn line, they can be converted to the same plane for calculation.

[0276] See also Fig.17 , is a flowchart of a method for calculating the spacing 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 lines are 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 pen 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 pen 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 a direction corresponding to the swiping operation to generate a diffusion area.

[0285] In the embodiment of the present application, the interval distance between the tip of the stylus pen and the pre-drawn line at the start of the waving operation is taken as a reference, and the interval distance is positively correlated with the preset diffusion distance of the pre-drawn line, that is, the smaller the interval distance, the smaller the preset diffusion distance; the larger the interval distance, the larger the preset diffusion distance. Then, in the actual diffusion process, the user can adjust the actual interval distance between the tip of the stylus pen and the pre-drawn line by adjusting the start position of the waving operation, and then determine the corresponding preset diffusion distance based on the actual interval distance, so as to control the pre-drawn line to diffuse according to the preset diffusion distance corresponding to the actual interval distance, thereby obtaining a diffusion effect satisfactory to 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 is required, and the object of the waving operation can be considered to be all the 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 are diffused by different preset diffusion distances, thereby achieving a specific visual effect.

[0287] See also Fig.18 , is a schematic diagram of a diffusion effect under multiple pre-drawn lines provided in an embodiment of the present application. Fig.18 As shown, there are two pre-drawn lines, namely, pre-drawn line 1 and pre-drawn line 2. When the user swings the stylus pen, the tip of the stylus pen is relatively close to pre-drawn line 1 and relatively far 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 diffused 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] See also Fig.19 , is a flow chart of another method for generating a diffusion effect ink painting provided by an embodiment of the present application. Step 102 can be implemented by executing sub-steps 501 and 504:

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

[0292] In the embodiment of the present application, a spatial coordinate system is established based on the preset reference point in the display screen of the electronic device, and the spatial coordinates of the pen tip of the stylus pen 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 solution recorded in step 3011, which will not be repeated here. Based on the known pen tip spatial coordinates, how to determine that the stylus pen has been swung, please refer to the solution recorded in step 401, which will not be repeated here.

[0293] On the basis of identifying the waving operation, the electronic device can naturally determine when the waving operation starts and ends. Therefore, the electronic device can determine the length of the pen tip motion track corresponding to a single waving operation based on the pen tip space coordinates of the stylus pen tip at the start of the waving operation and the space coordinates of the stylus pen tip at the end of the waving operation, and the electronic device can determine the duration of the single waving operation based on the start time of the waving operation and the end time of the waving operation, and then calculate the ratio of the pen tip motion track length to the duration of the single waving operation, so as to determine the actual waving speed corresponding to the single waving operation.

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

[0295] In the 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 interval distance between the stylus tip and the pre-drawn line.

[0297] See also Fig. 20 , 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 spacing distance between the tip of the stylus pen 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 swinging speed / interval distance and the diffusion speed, determine the actual diffusion speed corresponding to the actual swinging speed / actual interval distance.

[0301] In the embodiment of the present application, the diffusion speed of the pre-drawn line is positively correlated with the swing speed and the spacing distance between the tip of the stylus pen and the pre-drawn line, that is, the greater the spacing distance and the swing speed, the greater the corresponding diffusion speed; the smaller the spacing distance and the swing 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, which will not be repeated here.

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

[0304] In the embodiment of the present application, the electronic device can control the pre-drawn line to diffuse along the swing direction according to the determined actual diffusion speed, thereby generating a diffusion area. In other words, the user can adjust the distance between the tip of the stylus pen and the pre-drawn line and the swing speed according to their actual needs, thereby generating a diffusion area with a specific diffusion 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. Therefore, when the diffusion effect is formed by waving the stylus pen, in the process of diffusion of the pre-drawn lines based on a 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 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 the stylus is swung once, the diffusion time of the pre-drawn line is fixed, that is, the preset diffusion time. When the preset diffusion time is reached, the diffusion of the pre-drawn line ends, and when the actual diffusion speed is smaller, the final actual diffusion distance is also smaller; conversely, when the actual diffusion speed is larger, the final actual diffusion distance is also larger, and the electronic device can display an ink painting containing at least the pre-drawn line and the formed diffusion area.

[0308] In the above embodiment, by adjusting the waving speed of a single waving operation, the diffusion speed can be directly affected, and then the size of the diffusion area formed by the single waving operation can be indirectly affected. Then the user can adjust the waving speed of the stylus according to their actual needs, so as to generate a diffusion area with a specific diffusion distance while ensuring a small number of waving times, so as to achieve a better visual effect.

[0309] In the above embodiment, the waving operation plays a role in triggering the pre-drawn line to spread, while in other embodiments, the waving operation can also play a role in triggering the pre-drawn line to stop spreading.

[0310] See also Fig.21 , which is a flow chart 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 the embodiment of the present application, the user can select the type of ink before drawing a line, wherein the type of ink includes automatic diffusion type ink and passive diffusion type ink. When the user selects automatic diffusion type ink to draw a line, the generated pre-drawn line itself 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 here can be a specific direction, or it can diffuse in all directions at the same time, and there is no special limitation 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. Therefore, when using the waving operation of the stylus pen to form a diffusion effect, in the process of diffusion of the pre-drawn lines 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 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 lines.

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

[0317] In the embodiment of the present application, when the diffusion area formed by the diffusion of the pre-drawn line achieves the visual effect required by the user, the user can perform a waving operation on the stylus, and when the electronic device detects the waving operation on the stylus, it stops diffusing the pre-drawn line and displays an ink painting that at least includes the original drawn line and the subsequent diffusion area. It should be understood that how the electronic device recognizes the waving operation of the stylus can refer to the content recorded in the above step 401, which will not be repeated here.

[0318] It should be understood that the diffusion area here can be the embellishment of the pre-drawn ink painting, and after superimposing this diffusion area, a complete ink painting is formed, or 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: Ink painting that creates an ink dripping effect.

[0320] See also Fig. 22 , is a flow chart of a method for generating an ink painting with an ink drop effect provided in an embodiment of the present application. Step 102 can be implemented by executing sub-steps 701 to 705:

[0321] Step 701: In response to the shaking operation, determine the center point of ink dot generation.

[0322] In the embodiment of the present application, a spatial coordinate system is established based on the 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 solution recorded in step 3011, which will not be repeated here. Fig.23 , is a schematic diagram of a shaking operation of a stylus provided in an embodiment of the present application. Fig.23 As shown, the stylus is equipped with a gyroscope. If the electronic device receives gyroscope data from 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 spatial coordinates of the pen tip and the ending spatial coordinates of the pen tip is within a set range, then it can be determined that the user has performed a shaking operation on the stylus.

[0323] After it is determined 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] See also Fig.24 , is a flow chart of a method for determining the center of ink dot generation provided in 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, determining a third nib space coordinate of the stylus tip at the beginning of the shaking operation, and determining 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 pen tip corresponding to the above start time, that is, the third pen tip spatial coordinate, and the spatial position of the stylus pen tip corresponding to the above end time, that is, the fourth pen tip spatial coordinate, can be determined.

[0327] Step 7012: Project the third pen tip space coordinates onto the display screen to obtain a third projection point; and project the fourth pen tip space coordinates 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 in 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 in 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, then 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 point.

[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] See also Fig.25 , is a flow chart 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 pen tip when the shaking operation starts, and the fourth spatial coordinate is the spatial coordinate of the stylus pen 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 the spatial distance can be considered as the actual shaking amplitude corresponding to the single shaking operation.

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

[0340] When using a brush to generate an ink dripping effect, the ink dots 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 pen to generate ink dots, the end time of the stylus pen shaking operation can also be used as the time when the ink dots are thrown out. At this time, the vertical component of the fourth pen tip space coordinate corresponding to the stylus pen 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 diffusion distance, the ink dot diffusion 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 ink droplet's dripping height is, the faster its movement speed will be before it contacts the plane of the drawing paper. After contacting the plane of the drawing paper, the faster movement speed needs to be reduced to 0 in a very short time. Therefore, the ink droplet will be subjected to a larger force from the drawing paper, and will show a more significant diffusion, that is, a larger diffusion distance. Conversely, the lower the ink droplet's dripping height is, the slower its movement speed will be before it contacts the plane of the drawing paper. After contacting the plane of the drawing paper, the slower movement speed needs to be reduced to 0 in a very short time. Therefore, the ink droplet will be subjected to a smaller force from the drawing paper, and will show an insignificant diffusion, that is, a smaller diffusion distance. Similarly, the greater the shaking amplitude of the shaking operation, the faster the initial speed of the ink droplet will be. The larger the shaking amplitude is, the smaller the initial speed of the ink dots will be. Under the condition of a certain drop height, before it contacts the plane of the drawing paper, its speed can still be increased to a larger value. After it contacts the plane of the drawing paper, the smaller the speed needs to be reduced to 0 in a very short time. Then the ink dots will be subjected to a larger force from the drawing paper, and will show a more significant diffusion, that is, the diffusion distance is larger. Conversely, the smaller the shaking amplitude is, the smaller the initial speed of the ink dots will be. Under the condition of a certain drop height, before it contacts the plane of the drawing paper, its speed can still be increased to a limited value. After it contacts the plane of the drawing paper, the smaller the speed needs to be reduced to 0 in a very short time. Then the ink dots will only be subjected to a smaller force from the drawing paper, and will show insignificant diffusion, that is, the diffusion distance is smaller.

[0343] Therefore, in the embodiment of the present application, when using a stylus to generate an ink drop effect, the correspondence between the drop height of the ink dots, the shaking amplitude of the shaking operation and the ink dot diffusion distance can also be simulated, and they are all positively correlated. Therefore, based on the above correspondence, the actual shaking amplitude and the actual drop 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, and control the original ink dot to radially diffuse the ink dot diffusion distance to generate a radially distributed 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 diffuse according to the ink dot diffusion distance to obtain a radially distributed ink dot.

[0348] It should be understood that the radially distributed ink dot can include two parts. The first part is the irregular block area 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 including at least the radially distributed ink dot.

[0350] Please refer to Fig.26 , which is a schematic diagram of a radially distributed ink dot provided by the embodiments of the present application. As Fig.26 shown, after the diffusion process is completed, at least a radially distributed Chinese ink painting can be displayed on the display screen of the electronic device. It should be understood that the radially distributed ink dot here can be an ornament of a pre-drawn Chinese ink painting. After adding this radially distributed ink dot, a complete Chinese ink painting is formed. Or, the radially distributed ink dot here can be the basis for subsequently drawing other elements. Users can further process on the basis of the formed radially distributed 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 the embodiments of the present application. Step 102 can be specifically implemented by executing sub-steps 801 to 802:

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

[0354] When forming visual effects 1 to 4, it can be considered that the stylus is in the ink pen function. In the embodiment of the present application, when color filling is required, the stylus needs to be switched from the ink painting function to the straw function first, and then the stylus in the straw function is used to collect the attribute information of any pixel in the area where the user wants to fill the color in the display screen. When the stylus detects the squeeze operation, it sends the attribute information of the pre-collected pixel to the electronic device, where the attribute information includes the hue, saturation and brightness of the pixel. After the electronic device learns the attribute information of the pre-collected pixel, it can search for the adjacent pixels of the pre-collected pixel, which pixels have the attribute information difference with the pre-collected pixel within the set range, and jointly determine a closed area based on the pixels whose differences are within the set range and the pre-collected pixels. Here, when the stylus is in the straw function, how the electronic device identifies the squeeze operation on the stylus is the same as the judgment mechanism for judging the squeeze operation on the stylus when the stylus is in the ink painting brush function, and will not be repeated here.

[0355] It should be understood that triggering color filling and triggering adjustment of the baseline ink output volume 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 the embodiment of the present application, after the closed area is determined, the closed area can be filled with color. Fig.28 , is a schematic diagram of a color filling provided in an embodiment of the present application. Fig.28 As shown, the ink painting after color filling is displayed on the electronic device display screen. The color filled here can be any color selected by the user, and there is no special restriction here.

[0358] See also Fig.29 Based on the same inventive concept, an embodiment of the present application provides an interactive device, which is arranged in an electronic device, and the electronic device supports a stylus as a corresponding input device, and the interactive device includes:

[0359] A detection unit 901 is used 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 used 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 reference ink output amount of the stylus;

[0363] Based on the corresponding relationship between the ink output amount and the opacity of the line, and based on the corresponding relationship between the ink output amount and the width of the line, determine the reference opacity and reference width corresponding to the reference ink output amount;

[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 acquisition 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 determination 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 used 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 scattered point generation area determination unit, used to determine a scattered point generation area corresponding to the stylus in response to a tapping operation;

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

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

[0373] Optionally, the scattered point generation area determination unit is specifically used for:

[0374] Determine the spatial coordinates of a first pen tip of the stylus and the tilt angle between the stylus and a preset reference point;

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

[0376] The first projection point is taken as the center point of the scattered point generation area;

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

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

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

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

[0381] Based on the distance between each scatter point generating sub-region and the center point, multiple scatter points are randomly generated and displayed in each scatter point generating sub-region, wherein the sum of the numbers of scatter points in all 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.

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

[0383] a diffusion unit, configured to control the pre-drawn line to diffuse by a preset diffusion distance in a direction corresponding to the waving operation in response to the waving operation, and 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;

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

[0385] Optionally, the diffusion unit includes:

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

[0387] a diffusion distance determination unit, configured to determine the preset diffusion distance corresponding to the actual spacing distance according to a correspondence between the spacing distance and the preset diffusion distance, wherein the spacing 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 swiping speed determining unit, for determining an actual swiping speed in response to a swiping operation;

[0391] a diffusion speed determining unit, configured to determine 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 is positively correlated with the diffusion speed;

[0392] A diffusion unit, used to control the pre-drawn lines to diffuse along the direction corresponding to the swiping operation based on the actual diffusion speed, and 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;

[0393] The display unit is used for stopping diffusing the pre-drawn lines in response to reaching a preset diffusion time, and generating and displaying an ink painting including at least the pre-drawn lines and the diffusion area.

[0394] Optionally, the interaction device further includes:

[0395] a spacing distance determining unit, used 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;

[0396] The diffusion speed 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, the interval distance determination unit is specifically used for:

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

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

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

[0402] Optionally, the interaction device further includes:

[0403] An automatic diffusion unit, used for 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;

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

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

[0406] Optionally, the processing unit 902 includes:

[0407] An ink dot generation center determination unit, used to determine the ink dot generation center point in response to the shaking operation;

[0408] an ink dot diffusion distance determination unit, for determining the ink dot diffusion distance in response to the shaking operation;

[0409] An ink dot size determination unit, used to determine the ink dot size based on the current ink output amount;

[0410] 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 diffuse radially by the ink dot diffusion distance to generate radial ink dots;

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

[0412] Optionally, the ink dot generation center determination unit is specifically used for:

[0413] 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;

[0414] 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;

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

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

[0417] Optionally, the ink dot diffusion distance determination unit is specifically used for:

[0418] 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;

[0419] Calculating the spatial distance between the third pen tip spatial coordinate and the fourth pen tip spatial coordinate, and using the spatial distance as the 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 among the drop height, the shaking amplitude and the ink dot diffusion distance, the ink dot diffusion distance is determined based on the actual drop height and the actual shaking amplitude.

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

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

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

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

[0426] See also Fig.30 Based on the same inventive concept, an embodiment of the present application provides an electronic device, the electronic device includes at least one processor 1001, the processor 1001 is used to execute a computer program stored in a memory, and implement the embodiment of the present application as provided in Figure 1-2 , Figure 5-6 , Figure 8 , Fig.11 , Fig.13 , Figure 16-17 , Figure 19-22 , Figure 24-25 as well as Fig. 27 The steps of the interactive method are shown.

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

[0428] Optionally, the electronic device may further include a memory 1002 coupled to the at least one processor 1001, and the memory 1002 may include a ROM, a RAM, and a disk memory. The memory 1002 is used to store data required by the processor 1001 when it is running, that is, it stores instructions that can be executed by the at least one processor 1001. The at least one processor 1001 executes the instructions stored in the memory 1002 to execute the following steps: Figure 1-2 , Figure 5-6 , Figure 8 , Fig.11 , Fig.13 , Figure 16-17 , Figure 19-22 , Figure 24-25 as well as Fig. 27 The method shown in the figure. The number of the memory 1002 is one or more.

[0429] 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 Figure 1-2 , Figure 5-6 , Figure 8 , Fig.11 , Fig.13 , Figure 16-17 , Figure 19-22 , Figure 24-25 as well as Fig. 27 Therefore, for the functions that can be realized by each functional module in the electronic device, please refer to Figure 1-2 , Figure 5-6 , Figure 8 , Fig.11 , Fig.13 , Figure 16-17 , Figure 19-22 , Figure 24-25 as well as Fig. 27 The corresponding description in the illustrated embodiment will not be repeated here.

[0430] The present application also provides a computer storage medium, wherein the computer storage medium stores computer instructions, and when the computer instructions are executed on a computer, the computer executes Figure 1-2 , Figure 5-6 , Figure 8 , Fig.11 , Fig.13 , Figure 16-17 , Figure 19-22 , Figure 24-25 as well as Fig. 27 The method described.

[0431] The above description is only a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, 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 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 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 spatial 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; Determine 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 based on a first preset number in the scattered point generation area 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 corresponding relationship among 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

Cited By

  • Interaction method and apparatus, and electronic device and storage medium

    EP4692998A1

  • Interaction method and apparatus, and electronic device and storage medium

    WO2025039787A1