A graffiti trajectory generation method and device, electronic equipment and storage medium
By generating smooth curves and combining them with preset brushstroke patterns, the problem of unevenness in graffiti trajectory drawing is solved, achieving a smooth and consistent graffiti trajectory effect.
Patent Information
- Application Number
- CN202211116649.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-14
- Publication Date
- 2026-11-03
- Estimated Expiration
- 2042-09-14
AI Technical Summary
The dynamic update method of the graffiti trajectory in the existing technology results in an uneven drawing effect with sharp corners, making it impossible to achieve a smooth curve.
A smooth curve is generated by collecting multiple sliding trajectory points, and a set of target trajectory points is determined from the smooth curve. These points are then superimposed with a preset brushstroke pattern to form a smooth graffiti trajectory.
It achieves smoothness in the graffiti trajectory and a high degree of consistency with the user's drawing trajectory, thus improving the drawing effect.
Smart Images

Figure CN115617247B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of Internet technology, and in particular to a method, apparatus, electronic device and storage medium for generating graffiti trails. Background Technology
[0002] In image editing software, you can use the drawing tool to draw on images to enhance their appearance. The drawing process with the drawing tool is dynamic, therefore the currently drawn drawing path needs to be updated dynamically.
[0003] In related technologies, the point-by-point drawing method is used to dynamically update the graffiti trajectory. Usually, when a trajectory point is detected, it is connected to the trajectory point detected in the previous step. The drawing effect is not smooth in this way, and corners are easy to appear when drawing curves. Summary of the Invention
[0004] This disclosure provides a method, apparatus, electronic device, and storage medium for generating graffiti trails. The technical solution of this disclosure is as follows:
[0005] According to a first aspect of the present disclosure, a graffiti trajectory generation method is provided, comprising:
[0006] In response to a trajectory drawing operation based on the target page, collect multiple sliding trajectory points generated by the trajectory drawing operation;
[0007] A first smooth curve is generated based on multiple sliding trajectory points;
[0008] Determine the set of first target trajectory points from the first smooth curve;
[0009] Each first target trajectory point in the first target trajectory point set is superimposed with the first preset brushstroke pattern to form the first graffiti trajectory.
[0010] In some possible embodiments, the trajectory drawing operation includes a series of consecutive trajectory drawing sub-operations;
[0011] In response to a trajectory drawing operation based on the target page, multiple sliding trajectory points generated by the trajectory drawing operation are collected, including:
[0012] In response to each of the multiple trajectory drawing sub-operations, at least one sliding trajectory point generated by each trajectory drawing sub-operation on the target page is collected;
[0013] Multiple sliding trajectory points are obtained based on at least one sliding trajectory point corresponding to each trajectory drawing sub-operation.
[0014] In some possible embodiments, a first smooth curve is generated based on a plurality of sliding trajectory points, including:
[0015] Count the collected sliding trajectory points;
[0016] When the number of collected sliding trajectory points reaches a preset number, a first smooth curve is generated based on the preset number of sliding trajectory points.
[0017] In some possible embodiments, the sliding trajectory points carry sequence identifiers;
[0018] A first smooth curve is generated based on a preset number of sliding trajectory points, including:
[0019] Based on the sequence identifier of each sliding trajectory point in a preset number of sliding trajectory points, the start point and end point are determined from the preset number of sliding trajectory points;
[0020] Using the Bézier curve generation method, the starting point is used as the starting point of the first smooth curve, the ending point is used as the ending point of the first smooth curve, and the sliding trajectory points other than the starting point and the ending point are used as the control points of the first smooth curve from a preset number of sliding trajectory points to generate the first smooth curve.
[0021] In some possible embodiments, the first preset brushstroke pattern includes the first brushstroke pattern currently selected on the target page;
[0022] The first target trajectory point set is determined from the first smooth curve, including:
[0023] Based on the size information of the first stroke pattern, determine the position information on the first smooth curve where the first stroke pattern can be arranged;
[0024] The location information is used as the location information of the first target trajectory point to obtain the first target trajectory point set.
[0025] In some possible embodiments, the location information includes lateral location information and longitudinal location information;
[0026] Based on the size information of the first stroke pattern, determine the position information on the first smooth curve where the first stroke pattern can be arranged, including:
[0027] Based on the position information of the starting point and the ending point of the first smooth curve, determine the horizontal distance and the vertical distance between the starting point and the ending point.
[0028] When the horizontal distance is greater than or equal to the vertical distance, the number of first stroke patterns that can be arranged in the horizontal distance and the horizontal position information of each first stroke pattern are determined based on the size information of the first stroke pattern.
[0029] The lateral position information of each arrangeable first stroke pattern is mapped onto the first smooth curve to obtain the longitudinal position information of each arrangeable first stroke pattern.
[0030] In some possible embodiments, determining the positional information on which the first stroke pattern can be arranged on the first smooth curve based on the size information of the first stroke pattern includes:
[0031] Based on the position information of the starting point and the ending point of the first smooth curve, determine the straight-line distance between the starting point and the ending point.
[0032] Based on the linear distance and the size information of the first stroke pattern, determine the number of first stroke patterns that can be arranged along the linear distance and the position information of each arrangeable first stroke pattern along the linear distance;
[0033] The position information of each arrangeable first stroke pattern in the straight line distance is mapped onto the first smooth curve to obtain the position information of each arrangeable first stroke pattern on the first smooth curve.
[0034] In some possible embodiments, the method further includes:
[0035] In response to an undo operation on the first graffiti track displayed on the target page, remove the first graffiti track from the target page;
[0036] In response to the cancellation operation of the undo operation, a redraw instruction for the first graffiti trajectory is generated;
[0037] Based on the redrawing instruction, read the first target trajectory point set of the first graffiti trajectory;
[0038] A second smooth curve is generated based on the first target trajectory point set;
[0039] Determine the set of second target trajectory points from the second smooth curve;
[0040] Each second target trajectory point in the second target trajectory point set is superimposed with a second preset brushstroke pattern to form a second graffiti trajectory.
[0041] According to a second aspect of the present disclosure, a graffiti trajectory generation apparatus is provided, comprising:
[0042] The acquisition module is configured to perform a trajectory drawing operation in response to the target page, and to acquire multiple sliding trajectory points generated by the trajectory drawing operation;
[0043] The first generation module is configured to generate a first smooth curve based on multiple sliding trajectory points;
[0044] The determination module is configured to determine a first set of target trajectory points from a first smooth curve;
[0045] The second generation module is configured to perform a process of superimposing each first target trajectory point in the first target trajectory point set with a first preset brushstroke pattern to form a first graffiti trajectory.
[0046] According to a third aspect of the present disclosure, an electronic device is provided, comprising:
[0047] processor;
[0048] Memory used to store processor-executable instructions;
[0049] The processor is configured to execute instructions to implement the graffiti trajectory generation method of the first aspect of the present disclosure.
[0050] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, which, when executed by a processor of an electronic device, enables the electronic device to perform the graffiti trajectory generation method of the first aspect of the present disclosure.
[0051] According to a fifth aspect of the present disclosure, a computer program product is provided, the computer program product including a computer program stored in a readable storage medium, and at least one processor of a computer device reading from the readable storage medium and executing the computer program, causing the computer device to perform the graffiti trajectory generation method of the first aspect of the present disclosure.
[0052] The technical solutions provided by the embodiments of this disclosure have at least the following beneficial effects:
[0053] By responding to a trajectory drawing operation based on a target page, multiple sliding trajectory points generated by the trajectory drawing operation are collected. A first smooth curve is generated based on these multiple sliding trajectory points, and a first target trajectory point set is determined from the first smooth curve. Finally, each first target trajectory point is superimposed with a first preset brushstroke pattern to form a first graffiti trajectory. Thus, the first target trajectory points that ultimately form the first graffiti trajectory in this disclosure are determined from the first smooth curve corresponding to multiple sliding trajectory points. The first target trajectory points not only have good smoothness but also ensure a high degree of consistency between the generated first graffiti trajectory and the actual trajectory drawn by the user.
[0054] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0055] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.
[0056] Figure 1 This is a schematic diagram illustrating an application environment according to an exemplary embodiment;
[0057] Figure 2 This is a schematic diagram illustrating a trajectory generation technique according to an exemplary embodiment;
[0058] Figure 3 This is a flowchart illustrating a graffiti trajectory generation method according to an exemplary embodiment;
[0059] Figure 4 This is a flowchart illustrating a trajectory drawing operation that generates multiple sliding trajectory points according to an exemplary embodiment;
[0060] Figure 5 This is a schematic diagram illustrating a first graffiti trajectory according to an exemplary embodiment;
[0061] Figure 6 This is a flowchart illustrating, according to an exemplary embodiment, a method for generating a first smooth curve based on multiple sliding trajectory points;
[0062] Figure 7 This is a flowchart illustrating, according to an exemplary embodiment, a method for generating a first smooth curve based on a preset number of sliding trajectory points;
[0063] Figure 8 This is a flowchart illustrating a method for determining a first set of target trajectory points from a first smooth curve, according to an exemplary embodiment.
[0064] Figure 9 This is a flowchart illustrating, according to an exemplary embodiment, a method for determining positional information of a first stroke pattern that can be arranged on a first smooth curve;
[0065] Figure 10 This is a schematic diagram of a page illustrating the determination of position information of a first stroke pattern that can be arranged on a first smooth curve, according to an exemplary embodiment.
[0066] Figure 11 This is a flowchart illustrating, according to an exemplary embodiment, a method for determining positional information of a first stroke pattern that can be arranged on a first smooth curve;
[0067] Figure 12 This is a schematic diagram of a page illustrating the determination of position information of a first stroke pattern that can be arranged on a first smooth curve, according to an exemplary embodiment.
[0068] Figure 13 This is a flowchart illustrating a graffiti trajectory generation method according to an exemplary embodiment;
[0069] Figure 14This is a block diagram illustrating a graffiti trajectory generation device according to an exemplary embodiment;
[0070] Figure 15 This is a block diagram illustrating an electronic device for generating graffiti tracks according to an exemplary embodiment. Detailed Implementation
[0071] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0072] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar first objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0073] It should be noted that the user information involved in this disclosure (including but not limited to user device information, user personal information, etc.) is all information authorized by the user or fully authorized by all parties.
[0074] Please see Figure 1 , Figure 1 This is a schematic diagram illustrating an application environment of a graffiti trajectory generation method according to an exemplary embodiment, such as... Figure 1 As shown, the application environment may include a server 01 and a client 02. The client 02 displays a target page, and the user can perform trajectory drawing operations on the target page using an external input device to form a doodle trajectory. When the target page is touchable, the user can directly slide their finger on the target page to perform trajectory drawing operations. In response to the trajectory drawing operation based on the target page, the server 01 collects multiple sliding trajectory points generated by the trajectory drawing operation, generates a first smooth curve based on these multiple sliding trajectory points, determines a first target trajectory point set from the first smooth curve, and superimposes each first target trajectory point in the first target trajectory point set with a first preset brushstroke pattern to form a first doodle trajectory.
[0075] like Figure 2As shown, in related technologies, when drawing the curve of a user's finger sliding on a target page, each detected trajectory point is connected to the previously detected trajectory point. For example, when trajectory point B is detected, trajectory point B is connected to the previously detected trajectory point A; when trajectory point C is detected, trajectory point C is connected to the previously detected trajectory point B, and so on. In this way of drawing the trajectory, when the user's finger slides too fast or the detection frequency is too slow, the distance between two successively detected trajectory points will be too large, so the final trajectory is prone to bends at the trajectory points. In particular, when drawing curves, the curves drawn in this way are not smooth.
[0076] To address the issue of poor trajectory rendering effects in related technologies, this embodiment of the present disclosure involves continuously or simultaneously acquiring multiple sliding trajectory points generated by the trajectory rendering operation. A first smooth curve is then generated based on these multiple sliding trajectory points. A first target trajectory point set is determined from the first smooth curve. Finally, each first target trajectory point in this set is superimposed with a first preset brushstroke pattern to form a first graffiti trajectory. Thus, since the first target trajectory points on the first graffiti trajectory are selected from the first smooth curve, the first graffiti trajectory can be guaranteed to have better smoothness. Compared to trajectory rendering methods in related technologies, the trajectory generation method of this disclosure significantly improves the rendering effect.
[0077] In some possible embodiments, server 01 may be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The operating system running on the server may include, but is not limited to, Android, iOS, Linux, Windows, Unix, etc.
[0078] In some possible embodiments, the client 02 described above may include, but is not limited to, smartphones, desktop computers, tablets, laptops, smart speakers, digital assistants, augmented reality (AR) / virtual reality (VR) devices, smart wearable devices, and other similar clients. It may also be software running on the aforementioned client, such as applications or mini-programs. Optionally, the operating system running on the client may include, but is not limited to, Android, iOS, Linux, Windows, Unix, and other similar systems.
[0079] In addition, it should be noted that, Figure 1 The example shown is only one application environment of the graffiti trajectory generation method provided in this disclosure. In practical applications, other application environments may also be included. For example, in other application environments, only client 01 is included, and the graffiti trajectory generation method can also be implemented on client 01.
[0080] Figure 3 This is a flowchart illustrating a graffiti trajectory generation method according to an exemplary embodiment, such as... Figure 3 As shown, the graffiti trajectory generation method can be applied to the server side, including the following steps:
[0081] In step S301, in response to the trajectory drawing operation based on the target page, multiple sliding trajectory points generated by the trajectory drawing operation are collected.
[0082] In this embodiment, the target page may refer to a client-side page, which may display a drawable area. Users can draw within this drawable area using their fingers or input devices. After calculation by the client and server, the user's drawing trajectory is displayed within the drawing area. The client-side page may be provided by a designated internet product, which may include professional drawing products, image editing products, office products, games, etc.
[0083] In some possible embodiments, when the client detects a trajectory drawing operation on the target page, it marks multiple sliding trajectory points generated by the trajectory drawing operation. For each marked sliding trajectory point, its information (which may include location information) is transmitted to the server in real time, so that the server can perform point-by-point drawing. That is, the server responds to the ongoing trajectory drawing operation on the target page by collecting multiple sliding trajectory points generated by the ongoing trajectory drawing operation in real time. Figure 2 As shown, the client can mark trajectory points on the trajectory drawn by the user's finger in real time when the user performs trajectory drawing operations. After marking trajectory point A, the information of trajectory point A is immediately transmitted to the server. In this way, the server can receive the information of each trajectory point A, B, C, D, and E in real time.
[0084] In other possible embodiments, the client can also transmit the information of all sliding trajectory points to the server in batches after the user completes a full trajectory drawing operation. That is, the server, in response to the trajectory drawing operation completed on the target page, collects multiple sliding trajectory points generated by the trajectory drawing operation. In this way, the server collects the information of trajectory points A, B, C, D, and E at once.
[0085] In the first possible embodiment mentioned above, the server can draw point by point based on the sliding trajectory points received in real time to generate graffiti trajectory. The response speed is fast, and the generated graffiti trajectory matches the actual trajectory of the user's finger, with high trajectory accuracy. Therefore, the former method can be the preferred implementation method.
[0086] In some possible embodiments, the trajectory drawing operation includes a series of consecutive trajectory drawing sub-operations; the above-described response to the trajectory drawing operation based on the target page, acquiring multiple sliding trajectory points generated by the trajectory drawing operation, may include, for example... Figure 4 The following steps are shown:
[0087] In step S401, in response to each of the multiple trajectory drawing sub-operations, at least one sliding trajectory point generated by each trajectory drawing sub-operation in the target page is collected.
[0088] In this step, a complete trajectory drawing operation is regarded as multiple consecutive trajectory drawing sub-operations. After the client marks at least one sliding trajectory point generated by each trajectory drawing sub-operation, it transmits at least one sliding trajectory point corresponding to each trajectory drawing sub-operation to the server.
[0089] In one specific embodiment, the client can pre-set the number of sliding trajectory points corresponding to each trajectory drawing sub-operation to a fixed number, which can be 3 or 4. When the client detects the fixed number of sliding trajectory points, it considers it as completing a trajectory drawing sub-operation and transmits the information of the fixed number of sliding trajectory points corresponding to the trajectory drawing sub-operation to the server. Thus, the server responds to each trajectory drawing sub-operation and collects the information of the fixed number of sliding trajectory points corresponding to each trajectory drawing sub-operation.
[0090] In another specific embodiment, the client can also pre-set the sliding length corresponding to each trajectory drawing sub-operation to a fixed length. The unit of this fixed length can be pixels, which can be determined based on the actual client hardware parameters. Whenever the client detects that the user's current drawn trajectory length has reached this fixed length, it considers it a completed trajectory drawing sub-operation and transmits the information of the sliding trajectory points corresponding to that sub-operation to the server. Here, the number of sliding trajectory points generated by each trajectory drawing sub-operation on the target page is not fixed. Since the client detects and marks trajectory points at a fixed frequency, if the user's finger swipe speed during the current trajectory drawing sub-operation is faster than during the previous trajectory drawing sub-operation, then the number of sliding trajectory points generated by the current trajectory drawing sub-operation on the target page will be less than the number generated by the previous trajectory drawing sub-operation. Therefore, the server responds to each trajectory drawing sub-operation by collecting information on a non-fixed number of sliding trajectory points corresponding to each sub-operation.
[0091] In step S403, multiple sliding trajectory points are obtained based on at least one sliding trajectory point corresponding to each trajectory drawing sub-operation.
[0092] In this step, after the server collects a fixed number or a non-fixed number of sliding trajectory points corresponding to each trajectory drawing sub-operation, it obtains all the sliding trajectory points generated by the trajectory drawing operation on the target page.
[0093] In the subsequent process of generating the graffiti trajectory, the server can generate a first smooth curve based on at least one sliding trajectory point corresponding to each trajectory drawing sub-operation; or, the server can generate a first smooth curve based on multiple sliding trajectory points corresponding to multiple consecutive trajectory drawing sub-operations.
[0094] In the above embodiments, since each trajectory drawing sub-operation after breaking down a complete trajectory drawing operation actually corresponds to a smaller number of sliding trajectory points, the amount of data transmitted from the client to the server each time is smaller, and the transmission speed is faster. This helps to improve the speed at which the server generates graffiti trajectories and achieves a fast response.
[0095] In step S303, a first smooth curve is generated based on multiple sliding trajectory points.
[0096] In step S305, a first target trajectory point set is determined from the first smooth curve.
[0097] In step S307, each first target trajectory point in the first target trajectory point set is superimposed with the first preset brushstroke pattern to form the first graffiti trajectory.
[0098] In this embodiment, the transmission method used by the client to transmit the sliding trajectory points generated by the trajectory drawing operation on the target page is not limited. For different client transmission methods, the server generates a first smooth curve based on multiple received sliding trajectory points, then determines a first target trajectory point set from the first smooth curve, and finally overlays each first target trajectory point in the first target trajectory point set with a first preset brushstroke pattern to form a first graffiti trajectory; Figure 5 As shown in the example, according to the user's trajectory direction, the server can receive multiple sliding trajectory points, including points P0, P1, and P2. The first smooth curve generated by the server based on the sliding trajectory points P0, P1, and P2 is shown as the gray dashed line (dashed lines P0P1 and P1P2 are auxiliary lines for generating the first smooth curve). The first target trajectory point set determined from the first smooth curve includes points A, B, and C. Subsequently, points A, B, and C are superimposed with a first preset brushstroke pattern (a five-pointed star pattern in the figure) to form a five-pointed star graffiti trajectory, i.e., the first graffiti trajectory. Since the first target trajectory points in the first target trajectory point set are the trajectory points after smoothing the received multiple sliding trajectory points, the final first graffiti trajectory has good smoothness.
[0099] As mentioned above, the server can respond to the sliding trajectory points generated by the trajectory drawing operation sent by the client in real time, and draw point by point based on the sliding trajectory points received in real time to generate the graffiti trajectory.
[0100] In some possible embodiments, the server can respond to each trajectory drawing sub-operation by generating a first smooth curve based on at least one sliding trajectory point corresponding to each trajectory drawing sub-operation; that is, the server can generate a current first smooth curve based on at least one sliding trajectory point corresponding to the current trajectory drawing sub-operation, then determine a current first target trajectory point set from the current first smooth curve, and form a current first graffiti trajectory based on each first target trajectory point in the current first target trajectory point set; after receiving at least one sliding trajectory point corresponding to the next trajectory drawing sub-operation, the above steps are repeated to form the next first graffiti trajectory; that is, the server draws point by point based on the sliding trajectory points received in real time, dynamically generating the first graffiti trajectory.
[0101] In the above embodiments, the number of sliding trajectory points used to generate the first smooth curve is determined by the trajectory drawing sub-operation. That is, the client can package the sliding trajectory points used to generate the first smooth curve and send them to the server in real time. After receiving the data, the server can directly generate the first smooth curve based on the information of the sliding trajectory points in the data packet.
[0102] In some possible embodiments, the above-described generation of a first smooth curve based on multiple sliding trajectory points may include, for example: Figure 6 The following steps are shown:
[0103] In step S601, the collected sliding trajectory points are counted.
[0104] In this embodiment, the server sets a counter to count the collected sliding trajectory points. Specifically, the server presets a threshold for the counter. When the counter reaches the threshold, it is reset to zero and the counting starts again.
[0105] In step S603, when the number of collected sliding trajectory points reaches a preset number, a first smooth curve is generated based on the preset number of sliding trajectory points; the preset number is a number greater than 1.
[0106] Specifically, the threshold of the counter is equal to the aforementioned preset number. When the server collects a preset number of sliding trajectory points, it generates a first smooth curve based on that preset number of sliding trajectory points; the generation of the curve requires at least 2 trajectory points, therefore, the preset number here is a number greater than 1, specifically, the preset number can be 3, 4 or other values.
[0107] In the above embodiments, the server does not need to rely on the client to transmit sliding trajectory points. It can freely set the number of sliding trajectory points required according to the first smooth curve to be generated in the actual application, which is highly flexible.
[0108] In some possible embodiments, the above-mentioned generation of a first smooth curve based on multiple sliding trajectory points may further include: timing the acquisition time; when the acquisition time reaches a preset duration, generating a first smooth curve based on the multiple sliding trajectory points acquired during the current acquisition time.
[0109] Specifically, the server sets a timer to track the data collection time. The server pre-sets a preset duration for the timer; when the timer reaches this preset duration, it is reset and restarted. The server generates a first smooth curve based on the multiple sliding trajectory points collected within each preset duration. The preset duration is set according to the frequency at which the client detects the user's sliding trajectory points.
[0110] In one specific embodiment, the sliding trajectory points carry sequence identifiers; the generation of the first smooth curve based on a preset number of sliding trajectory points may include, for example: Figure 7 The following steps are shown:
[0111] In step S701, the starting point and the ending point are determined from the preset number of sliding trajectory points based on the sequence identifier of each sliding trajectory point in the preset number of sliding trajectory points.
[0112] The sequence identifier indicates the order in which the server collects the sliding trajectory points, and also reflects the drawing order by the user. It can be represented by an incrementing number.
[0113] In this step, taking a preset quantity of 3 as an example, the server can determine the sliding trajectory point with the smallest sequence number among the 3 currently collected sliding trajectory points as the starting point, and the sliding trajectory point with the largest sequence number as the ending point.
[0114] In step S703, using the Bézier curve generation method, the starting point is used as the starting point of the first smooth curve, the ending point is used as the ending point of the first smooth curve, and the sliding trajectory points other than the starting point and the ending point are used as the control points of the first smooth curve from a preset number of sliding trajectory points to generate the first smooth curve.
[0115] In this step, the server can generate a first smooth curve using a Bézier curve generation method. Depending on the actual needs, it can generate second-order, third-order, or higher-order Bézier curves. The number of sliding trajectory points required varies depending on the order of the Bézier curve; the higher the order, the more sliding trajectory points are needed. Specifically, a second-order Bézier curve can be generated based on three sliding trajectory points.
[0116] like Figure 5 As shown, the server uses the Bézier curve generation method, taking P0 as the starting point of the first smooth curve to be generated, P2 as the ending point of the first smooth curve to be generated, and P1 as the control point of the first smooth curve to be generated, and finally generating the second-order Bézier curve as shown by the dashed line.
[0117] In the above embodiments, the server generates a corresponding first smooth curve for a preset number of sliding trajectory points using the Bézier curve generation method. As a result, the first smooth curve has a high degree of fit with the preset number of sliding trajectory points. This not only ensures that the smoothness of the first target trajectory point obtained based on the first smooth curve is good, but also that the final first graffiti trajectory is more consistent with the trajectory actually drawn by the user.
[0118] In this embodiment of the disclosure, the first graffiti trajectory is formed by superimposing each first target trajectory point with the first preset brushstroke pattern. Therefore, when the server determines the set of first target trajectory points from the first smooth curve, it needs to consider the size information of the first preset brushstroke pattern. If the size information of the first preset brushstroke pattern is small and the number of first target trajectory points determined from the first smooth curve is too large, the final first graffiti trajectory will have a sparse and discontinuous pattern, such as a broken line when drawing the curve.
[0119] Typically, next to the drawable area on the target page of the client, there is a doodle pen selection area or a brush selection area. The doodle pen selection area displays multiple different doodle pen stroke patterns for the user to choose from. Usually, the user needs to select the currently used stroke pattern before drawing a trajectory in the drawable area. Therefore, in some possible embodiments, the first preset stroke pattern includes the first stroke pattern currently selected on the target page.
[0120] Accordingly, the aforementioned determination of the first target trajectory point set from the first smooth curve may include, for example: Figure 8 The following steps are shown:
[0121] In step S801, based on the size information of the first stroke pattern, the position information of the first stroke pattern that can be arranged on the first smooth curve is determined.
[0122] In general, the client displays different pen stroke patterns in the pen selection area, as well as an area to adjust the size of the stroke pattern, allowing users to adjust the size of the stroke pattern.
[0123] Specifically, the server determines the number and position of the first stroke pattern that can be arranged on the first smooth curve based on the currently selected first stroke pattern and its size information. In practical applications, the number and position of the first stroke pattern can also be determined by combining the graffiti trajectory display effect. For example, when drawing a curve, if a continuous and uninterrupted display effect is desired, the number of arrangeable first stroke patterns on the first smooth curve is determined based on the size information of the first stroke pattern, while ensuring that there is some overlap between two adjacent arrangeable first stroke patterns on the first smooth curve; or, for cases where a certain type of first stroke pattern needs to be displayed completely, the number of arrangeable first stroke patterns on the first smooth curve is determined based on the size information of the first stroke pattern, while ensuring that there is no overlap between two adjacent arrangeable first stroke patterns on the first smooth curve, otherwise, it will result in incomplete display.
[0124] In step S803, the location information is used as the location information of the first target trajectory point to obtain the first target trajectory point set.
[0125] In this step, the position information of each arrangeable first stroke pattern is used as the position information of each first target trajectory point, thereby obtaining the set of first target trajectory points.
[0126] In the above embodiments, when determining the first target trajectory point set from the first smooth curve, the size information of the first preset brushstroke pattern to be superimposed is combined to determine the number and position information of the first target trajectory points in the first target trajectory point set, so that the final generated graffiti trajectory meets the desired display effect, and can avoid the situation where the final graffiti trajectory display effect is not ideal due to the unreasonable number and position of the first target trajectory points.
[0127] In some possible embodiments, the above-described determination of the positional information on the first smooth curve where the first stroke pattern can be arranged based on the size information of the first stroke pattern may include, for example: Figure 9 The following steps are shown:
[0128] In step S901, the lateral distance and longitudinal distance between the starting point and the ending point are determined based on the position information of the starting point and the ending point of the first smooth curve.
[0129] Here, the position information can include lateral position information and longitudinal position information. Specifically, the lateral distance between the starting point and the ending point is determined based on the lateral position information of the starting point and the ending point of the first smooth curve to be generated; the longitudinal distance between the starting point and the ending point is determined based on the longitudinal position information of the starting point and the ending point of the first smooth curve.
[0130] like Figure 10 As shown, in the two-dimensional coordinate system xy established based on the target page, the horizontal position information includes the x-axis coordinate, and the vertical position information includes the y-axis coordinate. The position information of the starting point P0 of the first smooth curve is (x0, y0), and the position information of the ending point P2 is (x2, y2). Then, the horizontal distance between the starting point P0 and the ending point P2 can be the absolute value of the difference between the horizontal coordinates of the starting point P0 and the ending point P2, that is, |x2-x0|, denoted by |△x|. Similarly, the vertical distance between the starting point P0 and the ending point P2 can be the absolute value of the difference between the vertical coordinates of the starting point P0 and the ending point P2, that is, |y2-y0|, denoted by |△y|.
[0131] In step S903, when the lateral distance is greater than or equal to the longitudinal distance, the number of first stroke patterns that can be arranged in the lateral distance and the lateral position information of each first stroke pattern are determined based on the size information of the first stroke pattern.
[0132] Here, the larger value between the horizontal distance and the vertical distance is taken to determine the number of first stroke patterns that can be arranged in the corresponding direction and the position information of each first stroke pattern in that direction. Specifically, as in step S903, when the horizontal distance is greater than or equal to the vertical distance, the number of first stroke patterns that can be arranged under the current size information of the first stroke pattern and the corresponding horizontal position information are determined based on the horizontal distance.
[0133] For example, Figure 10 As shown, when the vertical distance is greater than the horizontal distance, the number of first stroke patterns that can be arranged and their corresponding vertical coordinates are determined based on the size information of the current first stroke pattern. It is assumed that the size information of the current first stroke pattern occupies 2 units (pixels) in the vertical direction and that there is no overlap between adjacent first stroke patterns. Figure 10 It can be seen that the number of first stroke patterns that can be arranged in the vertical distance is 4, and the vertical coordinates of each first stroke pattern that can be arranged are: y3, y4, y5, y6.
[0134] In step S905, the lateral position information of each arrangeable first stroke pattern is mapped onto the first smooth curve to obtain the longitudinal position information of each arrangeable first stroke pattern.
[0135] In this step, when the horizontal distance is greater than or equal to the vertical distance, based on the horizontal position information of each arrangeable first stroke pattern obtained in the aforementioned step S903, the horizontal position information is substituted into the curve function corresponding to the first smooth curve to obtain the vertical position information of each arrangeable first stroke pattern.
[0136] like Figure 10 As shown, after obtaining the vertical coordinates y3, y4, y5, and y6 of each arrangeable first stroke pattern, the vertical coordinates y3, y4, y5, and y6 of each arrangeable first stroke pattern are mapped onto the first smooth curve, that is, substituted into the curve function corresponding to the first smooth curve, to obtain the horizontal coordinates of each arrangeable first stroke pattern: x3, x4, x5, and x6; thus, the final determined position information of each arrangeable first stroke pattern is (x3, y3), (x4, y4), (x5, y5), and (x6, y6).
[0137] The above embodiment is one way to determine the first stroke pattern that can be arranged according to this disclosure. The following is another way to determine the first stroke pattern that can be arranged according to this disclosure. In practical applications, the choice can be made flexibly.
[0138] In some possible embodiments, the above-described determination of the positional information on the first smooth curve where the first stroke pattern can be arranged based on the size information of the first stroke pattern may further include, for example: Figure 11 The following steps are shown:
[0139] In step S1101, the straight-line distance between the starting point and the ending point is determined based on the position information of the starting point and the ending point of the first smooth curve.
[0140] Here, the position information can include lateral position information and longitudinal position information. Specifically, based on the lateral and longitudinal position information of the starting point and the ending point of the first smooth curve, the straight-line distance between the starting point and the ending point is calculated.
[0141] like Figure 12 As shown, in the two-dimensional coordinate system xy established based on the target page, the horizontal position information includes the x-axis coordinate, and the vertical position information includes the y-axis coordinate; the position information of the starting point P0 of the first smooth curve is (x0, y0), and the position information of the ending point P2 is (x2, y2). The straight-line distance between the starting point P0 and the ending point P2 is calculated by the distance formula between two points, and is represented here by |P0P2|.
[0142] In step S1103, based on the linear distance and the size information of the first stroke pattern, the number of first stroke patterns that can be arranged along the linear distance and the position information of each arrangeable first stroke pattern along the linear distance are determined.
[0143] In this step, the number of first stroke patterns that can be arranged under the current size information of the first stroke pattern and the position information of each arrangeable first stroke pattern in the straight line distance are determined.
[0144] like Figure 12 As shown, assuming the size of the current first stroke pattern occupies 2 units in the straight line direction and ensuring that there is no overlap between adjacent first stroke patterns, then... Figure 10 It can be seen that the number of first stroke patterns that can be arranged along the straight line is 5, and the coordinates of each first stroke pattern that can be arranged along the straight line can be obtained.
[0145] In step S1105, the position information of each arrangeable first stroke pattern in the straight line distance is mapped onto the first smooth curve to obtain the position information of each arrangeable first stroke pattern on the first smooth curve.
[0146] In this step, when the horizontal mapping length of the straight-line distance is greater than or equal to the vertical mapping length, the horizontal position information of each arrangeable first stroke pattern in the straight-line distance is taken as its horizontal position information on the first smooth curve. Then, it is substituted into the curve function corresponding to the first smooth curve to solve for the vertical position information of each arrangeable first stroke pattern on the first smooth curve.
[0147] Similarly, when the vertical mapping length of the straight-line distance is greater than the horizontal mapping length, the vertical position information of each arrangeable first stroke pattern in the straight-line distance is taken as its vertical position information on the first smooth curve. Then, it is substituted into the curve function corresponding to the first smooth curve to obtain the horizontal position information of each arrangeable first stroke pattern on the first smooth curve. For example... Figure 12 As shown, the vertical position information y7, y8, y9, y10, and y11 of each arrangeable first stroke pattern along the straight line distance are taken and substituted into the curve function corresponding to the first smooth curve to obtain the horizontal coordinates of each arrangeable first stroke pattern: x7, x8, x9, x10, and x11. Thus, the final determined position information of each arrangeable first stroke pattern is (x7, y7), (x8, y8), (x9, y9), (x10, y10), and (x11, y11).
[0148] In the above embodiments, with the goal of uniformly arranging the first stroke patterns on the first smooth curve, the number of first stroke patterns that can be arranged on the first smooth curve and their corresponding position information are determined based on the size information of the first stroke patterns. The position information of each arrangeable first stroke pattern is used as the position information of each first target trajectory point, thus obtaining a set of first target trajectory points. In this way, not only can it be ensured that each first target trajectory point in the final set of first target trajectory points can smoothly transition to the next first target trajectory point, but also the display effect of the first graffiti trajectory formed after superimposing the first preset stroke pattern onto each first target trajectory point will not deviate from the expectation.
[0149] In this embodiment, the server saves the first target trajectory point set and the corresponding first stroke pattern used to generate the first graffiti trajectory for subsequent responses to redrawing commands of the first graffiti trajectory. Specifically, considering that the client user may intentionally or unintentionally undo the first graffiti trajectory after drawing, the user generates a redrawing command for the first graffiti trajectory by clicking the undo control provided on the target page. The server can then respond to this redrawing command by regenerating the first graffiti trajectory based on the saved first target trajectory point set and the corresponding first stroke pattern.
[0150] In some possible embodiments, the graffiti trajectory generation method of this disclosure may further include, for example: Figure 13 The following steps are shown:
[0151] In step S1301, in response to the undo operation on the first graffiti trajectory displayed on the target page, the first graffiti trajectory is removed from the target page.
[0152] In step S1303, in response to the cancellation operation of the undo operation, a redrawing instruction for the first graffiti trajectory is generated.
[0153] In step S1305, the first target trajectory point set of the first graffiti trajectory is read according to the redrawing instruction.
[0154] Here, as mentioned earlier, after reading the set of first target trajectory points of the first graffiti trajectory, the server can directly overlay the corresponding first preset brushstroke pattern with each first target trajectory point in the set of first target trajectory points to redraw and generate the first graffiti trajectory. At this time, the redrawn first graffiti trajectory is the same as the first graffiti trajectory before undoing.
[0155] In step S1307, a second smooth curve is generated based on the first target trajectory point set.
[0156] In step S1309, the set of second target trajectory points is determined from the second smooth curve.
[0157] In step S1311, each second target trajectory point in the second target trajectory point set is superimposed with the second preset brushstroke pattern to form the second graffiti trajectory.
[0158] In steps S1307 to S1311, considering that the server dynamically generates the first graffiti trajectory based on each preset number of sliding trajectory points collected, during the actual user trajectory drawing operation, the server continuously generates multiple first graffiti trajectories, meaning that a complete user drawing operation corresponds to multiple first graffiti trajectories. Therefore, in response to the redrawing instruction for the first graffiti trajectory, the server can, after reading the first target trajectory point set of the first graffiti trajectory, generate a second smooth curve based on each first target trajectory point in the first target trajectory point set using the Bézier curve generation method; then, following the method described in the previous embodiment, determine the second target trajectory point set from the second smooth curve; and then, each second target trajectory point in the second target trajectory point set can be superimposed with a second preset brushstroke pattern to form the second graffiti trajectory. Thus, the second target trajectory point set is actually obtained by secondary smoothing of the sliding trajectory points, resulting in better overall smoothness for the second graffiti trajectory compared to the first graffiti trajectory. Furthermore, the second preset brushstroke pattern can be different from the first preset brushstroke pattern. When canceling, the user can reselect a brushstroke pattern on the target page. The server will then determine the reselected brushstroke pattern as the second preset brushstroke pattern and overlay each second target trajectory point with the second preset brushstroke pattern. This will create a second graffiti trajectory that is the same as the first graffiti trajectory but has a different pattern, thus enhancing the richness of the graffiti trajectory display effect.
[0159] In summary, the graffiti trajectory generation method provided in this disclosure collects multiple sliding trajectory points generated by trajectory drawing operations, generates a first smooth curve based on the multiple sliding trajectory points, and then determines a first target trajectory point set from the first smooth curve. Finally, each first target trajectory point is superimposed with a first preset brushstroke pattern to form a first graffiti trajectory. Thus, the first target trajectory points that ultimately form the first graffiti trajectory in this disclosure are determined from the first smooth curve corresponding to multiple sliding trajectory points. The first target trajectory points not only have good smoothness but also ensure a high degree of consistency between the generated first graffiti trajectory and the actual trajectory drawn by the user.
[0160] Figure 14 This is a block diagram illustrating a graffiti trajectory generation device according to an exemplary embodiment. (Refer to...) Figure 14 The device includes a data acquisition module 1401, a first generation module 1402, a determination module 1403, and a second generation module 1404.
[0161] The acquisition module 1401 is configured to perform a trajectory drawing operation in response to the target page, and to acquire multiple sliding trajectory points generated by the trajectory drawing operation;
[0162] The first generation module 1402 is configured to generate a first smooth curve based on multiple sliding trajectory points;
[0163] The determination module 1403 is configured to determine a first set of target trajectory points from the first smooth curve;
[0164] The second generation module 1404 is configured to perform a process of superimposing each first target trajectory point in the first target trajectory point set with a first preset brushstroke pattern to form a first graffiti trajectory.
[0165] In some possible embodiments, the trajectory drawing operation includes a series of consecutive trajectory drawing sub-operations;
[0166] The acquisition module 1401 is also configured to perform actions in response to each of the multiple trajectory drawing sub-operations, acquiring at least one sliding trajectory point generated by each trajectory drawing sub-operation on the target page; and obtaining multiple sliding trajectory points based on the at least one sliding trajectory point corresponding to each trajectory drawing sub-operation.
[0167] In some possible embodiments, the first generation module 1402 is further configured to count the collected sliding trajectory points; when the number of collected sliding trajectory points reaches a preset number, a first smooth curve is generated based on the preset number of sliding trajectory points.
[0168] In some possible embodiments, the sliding trajectory points carry sequence identifiers; the first generation module 1402 is further configured to execute the sequence identifier of each sliding trajectory point in a preset number of sliding trajectory points, determine the start point and the end point from the preset number of sliding trajectory points; using a Bézier curve generation method, the start point is used as the start point of the first smooth curve, the end point is used as the end point of the first smooth curve, and the sliding trajectory points other than the start point and the end point in the preset number of sliding trajectory points are used as the control points of the first smooth curve to generate the first smooth curve.
[0169] In some possible embodiments, the first preset brushstroke pattern includes the first brushstroke pattern currently selected in the target page; the determining module 1403 is further configured to perform a determination based on the size information of the first brushstroke pattern to determine the position information on the first smooth curve where the first brushstroke pattern can be arranged; and use the position information as the position information of the first target trajectory point to obtain the first target trajectory point set.
[0170] In some possible embodiments, the position information includes lateral position information and longitudinal position information; the determining module 1403 is further configured to perform the following: determining the lateral distance and longitudinal distance between the starting point and the ending point based on the position information of the starting point and the ending point of the first smooth curve; when the lateral distance is greater than or equal to the longitudinal distance, determining the number of first stroke patterns that can be arranged on the lateral distance and the lateral position information of each arrangeable first stroke pattern based on the size information of the first stroke pattern; mapping the lateral position information of each arrangeable first stroke pattern onto the first smooth curve to obtain the longitudinal position information of each arrangeable first stroke pattern.
[0171] In some possible embodiments, the determining module 1403 is further configured to perform the following actions: determining the straight-line distance between the starting point and the ending point based on the position information of the starting point and the ending point of the first smooth curve; determining the number of first stroke patterns that can be arranged along the straight-line distance and the position information of each arrangeable first stroke pattern along the straight-line distance based on the straight-line distance and the size information of the first stroke pattern; and mapping the position information of each arrangeable first stroke pattern along the straight-line distance onto the first smooth curve to obtain the position information of each arrangeable first stroke pattern on the first smooth curve.
[0172] In some possible embodiments, the second generation module 1404 is further configured to: remove the first graffiti trajectory from the target page in response to an undo operation on the first graffiti trajectory displayed on the target page; generate a redrawing instruction for the first graffiti trajectory in response to a cancellation operation on the undo operation; read the first target trajectory point set of the first graffiti trajectory according to the redrawing instruction; generate a second smooth curve based on the first target trajectory point set; determine the second target trajectory point set from the second smooth curve; and superimpose each second target trajectory point in the second target trajectory point set with a second preset brushstroke pattern to form a second graffiti trajectory.
[0173] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0174] Figure 15 This is a block diagram illustrating an electronic device for generating graffiti tracks according to an exemplary embodiment.
[0175] This electronic device can be a server or a terminal device, and its internal structure diagram can be as follows: Figure 15 As shown, the electronic device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a graffiti trajectory generation method.
[0176] Those skilled in the art will understand that Figure 15 The structure shown is merely a block diagram of a portion of the structure related to the present disclosure and does not constitute a limitation on the electronic device to which the present disclosure is applied. A specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0177] In an exemplary embodiment, an electronic device is also provided, including: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the graffiti trajectory generation method as described in the embodiments of this disclosure.
[0178] In an exemplary embodiment, a computer-readable storage medium is also provided, which, when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform the graffiti trajectory generation method of the present disclosure embodiments.
[0179] In an exemplary embodiment, a computer program product is also provided, comprising a computer program stored in a readable storage medium, wherein at least one processor of a computer device reads from the readable storage medium and executes the computer program, causing the computer device to perform the graffiti trajectory generation method of the present disclosure embodiments.
[0180] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0181] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.
[0182] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A method for generating graffiti trails, characterized in that, include: In response to a trajectory drawing operation based on a target page, multiple sliding trajectory points generated by the trajectory drawing operation are collected; A first smooth curve is generated based on the multiple sliding trajectory points collected within a preset number or preset time. Determine the first target trajectory point set from the first smooth curve; Each first target trajectory point in the first target trajectory point set is superimposed with a first preset brushstroke pattern to form a first graffiti trajectory; The generation of a first smooth curve based on a preset number or a preset time period of the multiple sliding trajectory points includes: Based on the sequence identifier of each sliding trajectory point among the sliding trajectory points collected within a preset number or preset time, the start point and end point are determined from the preset number of sliding trajectory points; Using the Bézier curve generation method, the starting point is taken as the starting point of the first smooth curve, and the ending point is taken as the ending point of the first smooth curve. Among the sliding trajectory points collected within a preset number or preset time, the sliding trajectory points other than the starting point and the ending point are taken as the control points of the first smooth curve to generate the first smooth curve; the first preset stroke pattern includes the first stroke pattern currently selected in the target page. Determining the first target trajectory point set from the first smooth curve includes: Based on the position information of the starting point and the ending point of the first smooth curve, determine the horizontal distance and the vertical distance between the starting point and the ending point. When the horizontal distance is greater than or equal to the vertical distance, the number of first stroke patterns that can be arranged in the horizontal distance and the horizontal position information of each first stroke pattern are determined according to the size information of the first stroke pattern. The horizontal position information of each first stroke pattern is mapped onto the first smooth curve to obtain the vertical position information of each first stroke pattern. Alternatively, when the vertical distance is greater than the horizontal distance, determine the number of first stroke patterns that can be arranged under the current size information of the first stroke pattern and the corresponding vertical coordinates based on the vertical distance. Substitute the horizontal position information into the curve function corresponding to the first smooth curve to obtain the vertical position information of each arrangeable first stroke pattern. The horizontal and vertical position information are used as the position information of the first target trajectory point to obtain the first target trajectory point set.
2. The graffiti trajectory generation method according to claim 1, characterized in that, The trajectory drawing operation includes multiple consecutive trajectory drawing sub-operations; The response to the trajectory drawing operation based on the target page includes collecting multiple sliding trajectory points generated by the trajectory drawing operation, including: In response to each of the plurality of trajectory drawing sub-operations, at least one sliding trajectory point generated by each trajectory drawing sub-operation in the target page is collected; The plurality of sliding trajectory points are obtained based on at least one sliding trajectory point corresponding to each trajectory drawing sub-operation.
3. The graffiti trajectory generation method according to claim 1, characterized in that, The generation of the first smooth curve based on the plurality of sliding trajectory points includes: Count the collected sliding trajectory points; When the number of collected sliding trajectory points reaches a preset number, the first smooth curve is generated based on the preset number of sliding trajectory points.
4. The graffiti trajectory generation method according to claim 3, characterized in that, The sliding trajectory points carry sequence identifiers; The generation of the first smooth curve based on the preset number of sliding trajectory points includes: Based on the sequence identifier of each sliding trajectory point in the preset number of sliding trajectory points, the start point and the end point are determined from the preset number of sliding trajectory points; Using the Bézier curve generation method, the starting point is taken as the starting point of the first smooth curve, the ending point is taken as the ending point of the first smooth curve, and the sliding trajectory points other than the starting point and the ending point from the preset number of sliding trajectory points are taken as the control points of the first smooth curve to generate the first smooth curve.
5. The graffiti trajectory generation method according to claim 1, characterized in that, The first preset brushstroke pattern includes the first brushstroke pattern currently selected on the target page; Determining the first target trajectory point set from the first smooth curve includes: Based on the size information of the first stroke pattern, determine the position information on the first smooth curve where the first stroke pattern can be arranged; The location information is used as the location information of the first target trajectory point to obtain the first target trajectory point set.
6. The graffiti trajectory generation method according to claim 5, characterized in that, The step of determining the position information on the first smooth curve where the first stroke pattern can be arranged based on the size information of the first stroke pattern includes: Based on the position information of the starting point and the position information of the ending point of the first smooth curve, the straight-line distance between the starting point and the ending point is determined. Based on the straight-line distance and the size information of the first stroke pattern, determine the number of first stroke patterns that can be arranged on the straight-line distance and the position information of each arrangeable first stroke pattern on the straight-line distance; The position information of each of the arrangeable first stroke patterns on the straight line distance is mapped onto the first smooth curve to obtain the position information of each of the arrangeable first stroke patterns on the first smooth curve.
7. The graffiti trajectory generation method according to claim 1, characterized in that, The method further includes: In response to an undo operation on the first graffiti trajectory displayed on the target page, the first graffiti trajectory is removed from the target page; In response to the cancellation operation of the undo operation, a redrawing instruction for the first graffiti trajectory is generated; According to the redrawing instruction, read the first target trajectory point set of the first graffiti trajectory; A second smooth curve is generated based on the first set of target trajectory points; Determine the set of second target trajectory points from the second smooth curve; Each second target trajectory point in the second target trajectory point set is superimposed with a second preset brushstroke pattern to form a second graffiti trajectory.
8. A graffiti trajectory generation device, characterized in that, include: The acquisition module is configured to perform a trajectory drawing operation in response to the target page and acquire multiple sliding trajectory points generated by the trajectory drawing operation; The first generation module is configured to generate a first smooth curve based on the multiple sliding trajectory points collected within a preset number or preset time. The determination module is configured to determine a first set of target trajectory points from the first smooth curve; The second generation module is configured to perform a process of superimposing each first target trajectory point in the first target trajectory point set with a first preset brushstroke pattern to form a first graffiti trajectory; The generation of a first smooth curve based on a preset number or a preset time period of the multiple sliding trajectory points includes: Based on the sequence identifier of each sliding trajectory point among the sliding trajectory points collected within a preset number or preset time, the start point and end point are determined from the preset number of sliding trajectory points; Using the Bézier curve generation method, the starting point is taken as the starting point of the first smooth curve, and the ending point is taken as the ending point of the first smooth curve. Among the sliding trajectory points collected within a preset number or preset time, the sliding trajectory points other than the starting point and the ending point are taken as the control points of the first smooth curve to generate the first smooth curve; the first preset stroke pattern includes the first stroke pattern currently selected in the target page. Determining the first target trajectory point set from the first smooth curve includes: Based on the position information of the starting point and the ending point of the first smooth curve, determine the horizontal distance and the vertical distance between the starting point and the ending point. When the horizontal distance is greater than or equal to the vertical distance, the number of first stroke patterns that can be arranged in the horizontal distance and the horizontal position information of each first stroke pattern are determined according to the size information of the first stroke pattern. The horizontal position information of each first stroke pattern is mapped onto the first smooth curve to obtain the vertical position information of each first stroke pattern. Alternatively, when the vertical distance is greater than the horizontal distance, determine the number of first stroke patterns that can be arranged under the current size information of the first stroke pattern and the corresponding vertical coordinates based on the vertical distance. Substitute the horizontal position information into the curve function corresponding to the first smooth curve to obtain the vertical position information of each arrangeable first stroke pattern. The horizontal and vertical position information are used as the position information of the first target trajectory point to obtain the first target trajectory point set.
9. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the graffiti trajectory generation method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is enabled to perform the graffiti trajectory generation method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method and apparatus for drawing brush track
CN106683151A
Generation method, device and system of personalized expression
CN109656463A
Curve generation method and device applied to touch screen equipment and computer storage medium
CN111078106A
Curve drawing method and device, terminal equipment and storage medium
CN114462204A
Smooth processing method and device for drawn track, electronic equipment and storage medium
CN114612326A
