Method, device, terminal equipment and storage medium for drawing lines

By detecting and dividing line trajectory segments, and using different colors to draw gradient lines, the problem of poor identification effects when line colors are similar to background colors is solved, and the identification effect of key content in the speech is improved.

CN112115679BActive Publication Date: 2024-09-06SZ PHOTOOL VISION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010816357.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-14
Publication Date
2024-09-06
Estimated Expiration
2040-08-14

AI Technical Summary

Technical Problem

During the speech process, it is difficult for the existing technology to effectively identify key content, because when the line color is the same or similar to the background color, the identification effect is poor.

Method used

By detecting the movement trajectory of the line drawing point, it is divided into multiple trajectory segments, and each trajectory segment is drawn using brushes of different colors to form gradient lines to enhance the identification effect of key content.

Benefits of technology

It achieves effective identification of key contents during the speech process, improves the identification effect, and is simple and practical.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112115679B
    Figure CN112115679B
Patent Text Reader

Abstract

The present application is applicable to the field of computer technology, and provides a method, apparatus, terminal device, and storage medium for drawing lines. The method for drawing lines comprises: after obtaining a line drawing instruction, detecting the moving trajectory of a line drawing point, wherein the moving trajectory comprises a plurality of trajectory segments; drawing the lines corresponding to each of the trajectory segments respectively, and using different colors of brushes when drawing the lines corresponding to different trajectory segments. The present application uses brushes of different colors to draw lines corresponding to different trajectory segments, and can draw lines with gradient colors, thereby marking the key content in a speech and improving the marking effect of the key content.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer technology, and in particular, relates to a method, device, terminal equipment and storage medium for drawing lines. Background Art

[0002] When people are giving a speech, they often need to project the content of the speech and mark the key points on the screen. The commonly used marking method is to draw a line under the key points of the speech. Although drawing a line can make the key points more eye-catching, when the line color is the same or similar to the background color, the marking effect of the key points is poor. Summary of the invention

[0003] In view of this, the embodiments of the present application provide a method, apparatus, terminal device and storage medium for drawing lines, which can draw gradient lines to enhance the identification effect of key content.

[0004] In a first aspect, an embodiment of the present application provides a method for drawing a line, comprising:

[0005] After obtaining the line drawing instruction, detecting the moving trajectory of the line drawing point, wherein the moving trajectory includes a plurality of trajectory segments;

[0006] The lines corresponding to each of the track segments are drawn respectively, and different colors of brushes are used when drawing the lines corresponding to different track segments.

[0007] The embodiment of the present application uses brushes of different colors to draw lines corresponding to different trajectory segments, so that gradient color lines can be obtained to mark the key content in the speech, thereby improving the marking effect of the key content.

[0008] Furthermore, the detection of the moving trajectory of the line drawing point includes:

[0009] Determine the initial position and current position of the line drawing point according to the obtained drawing point movement instruction;

[0010] Constructing a moving trajectory of the line drawing point according to the initial position and the current position;

[0011] The moving trajectory is divided to obtain the plurality of trajectory segments.

[0012] After detecting the operation of starting to draw a line, the starting point of the line is recorded, and the drawing point moving instruction is detected. Whenever a drawing point moving instruction is detected, the initial position and current position of the line drawing point are determined by the current drawing point moving instruction and the previous drawing point moving instruction (or the starting point of the line). After obtaining the initial position and current position of the line drawing point, the moving trajectory of the line drawing point can be constructed according to the two positions, and then the moving trajectory can be divided in a set manner to obtain multiple trajectory segments.

[0013] Furthermore, the moving trajectory is divided to obtain the plurality of trajectory segments including:

[0014] Obtaining coordinate values ​​of multiple position points of the moving trajectory, and sequentially passing the coordinate values ​​of the multiple position points into a pre-built callback function;

[0015] After the coordinate value of one of the position points is passed into the callback function, the coordinate value of the currently passed position point and the coordinate value of the last passed position point are processed by the callback function to obtain one of the track segments.

[0016] There are multiple position points corresponding to the moving track, and two adjacent position points can constitute a track segment. Therefore, the coordinate values ​​of multiple position points can be passed into the pre-built callback function in sequence. After the callback function obtains the coordinate value of a position point, it combines the coordinate value of the previous position point obtained to obtain a track segment.

[0017] Further, drawing the lines corresponding to each of the trajectory segments respectively includes:

[0018] Each time a trajectory segment is obtained, a brush is created in the callback function;

[0019] Assigning the color parameter of the brush to a preset color variable value;

[0020] Using the brush to draw a line corresponding to the currently acquired trajectory segment;

[0021] After drawing the line corresponding to the currently acquired trajectory segment, the color variable value is updated, and then the next trajectory segment is acquired to perform repeated operations.

[0022] In addition to dividing the moving track into multiple track segments, the callback function can also create a brush to draw the track segment. After obtaining the brush, the preset color variable value will be used to assign the color parameter of the brush, and the assigned brush will be used to draw the line corresponding to the track segment. The color value of the drawn line is the same as the current color variable value. In order to make different track segments have different colors, after drawing a track segment, the next track segment will be drawn after updating the color variable value.

[0023] Further, using the brush to draw a line corresponding to the currently acquired trajectory segment includes:

[0024] Calling a first line drawing function to draw a first line covering the track segment, wherein the first line is continuous and has a jagged edge;

[0025] A second line drawing function is called to draw a second line covering the track segment, wherein the second line is discontinuous and has no jagged edge, and the width of the second line is greater than that of the first line.

[0026] Among the commonly used line drawing functions, one type of function draws lines with good continuity, but the edges of the lines may have jagged problems; while the other type of function can draw lines with clear boundaries and no jagged edges, but the lines may be broken in the middle. Therefore, these two types of functions can be combined to draw lines, so as to draw continuous lines with no jagged edges.

[0027] Furthermore, the second line drawing function is a Drawline function, and calling the second line drawing function to draw a second line covering the track segment includes:

[0028] The Drawline function is set to smooth mode, and then the Drawline function is called to draw a second line covering the track segment.

[0029] Specifically, the second line drawing function may be a Drawline function. The line drawn by the Drawline function may have jagged edges. However, the function may be set to a smooth mode to draw a second line with clear edges and no jagged edges.

[0030] Furthermore, if an operation instruction to end drawing is detected, the operation of drawing the line is exited.

[0031] When the line drawing is completed, it will detect whether there is an operation instruction to end the drawing. For example, when drawing with a mouse, the left mouse button is pressed to draw, and when the line drawing is completed, the left mouse button is released. Then, releasing the left mouse button is the operation instruction to end the drawing. When it is detected that the user releases the left mouse button, the line drawing operation is exited.

[0032] In a second aspect, an embodiment of the present application provides a device for drawing a line, comprising:

[0033] A trajectory segment acquisition module, used for detecting a moving trajectory of a line drawing point after acquiring a line drawing instruction, wherein the moving trajectory includes a plurality of trajectory segments;

[0034] The line drawing module is used to draw the lines corresponding to each of the track segments respectively, and the colors of the brushes used when drawing the lines corresponding to different track segments are different.

[0035] In a third aspect, an embodiment of the present application provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for drawing lines proposed in the first aspect of the embodiment of the present application is implemented.

[0036] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for drawing lines proposed in the first aspect of the embodiment of the present application is implemented.

[0037] Compared with the prior art, the embodiments of the present application have the following beneficial effects: gradient color lines can be drawn to enhance the identification effect of key content, and the implementation is simple and practical. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0039] Figure 1 is a flow chart of a method for drawing lines provided in an embodiment of the present application;

[0040] Figure 2 This is a flowchart of a method for drawing lines provided by an embodiment of the present application in an actual application scenario;

[0041] Figure 3 is a structural diagram of a device for drawing lines provided in an embodiment of the present application;

[0042] Figure 4 It is a schematic diagram of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0043] In the following description, specific details such as specific device structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0044] The terms used in the following embodiments are only for the purpose of describing specific embodiments and are not intended to be limiting of the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind", "said", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear contrary indication in the context. It should also be understood that in the embodiments of the present application, "one or more" refers to one, two or more; "and / or" describes the association relationship of associated objects, indicating that three relationships may exist; for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship.

[0045] The method for drawing lines provided in the embodiments of the present application can be applied to terminal devices or servers such as mobile phones, tablet computers, medical devices, wearable devices, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, laptop computers, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (PDA), etc., and the embodiments of the present application do not impose any restrictions on the specific types of terminal devices and servers.

[0046] Drawing lines is a basic function of computer systems, but most of the current lines are solid color lines. During a speech, if the background color of the current presentation content is the same or similar to the line color, the marking effect of marking the key points in the speech by drawing lines is poor. In order to solve this problem, this application proposes a new method for drawing lines, which can draw gradient color lines and improve the marking effect of key points.

[0047] See also Figure 1 , Figure 1 A flow chart of a method for drawing a line provided by the present application is shown, comprising:

[0048] 101. After obtaining a line drawing instruction, detecting a moving trajectory of a line drawing point, wherein the moving trajectory includes a plurality of trajectory segments;

[0049] First, obtain a line drawing instruction, that is, obtain a signal to enter the line drawing mode. Specifically, when a mouse is used to draw a line, the line drawing instruction may be to press the left mouse button; when a brush or finger is used to draw a line on a touch screen, the line drawing instruction may be to touch the touch screen with a brush or finger and continue to drag the touch point. After detecting the line drawing instruction, the current position of the instruction, that is, the starting point of the line, is recorded. Then, the moving trajectory formed by the dragging of the line drawing point is detected, and the moving trajectory includes multiple trajectory segments. Specifically, the line drawing point may be the touch point of the mouse cursor or the touch screen.

[0050] In one embodiment, taking drawing a line with a mouse as an example, detecting the moving trajectory of the line drawing point includes:

[0051] 201. Determine the initial position and current position of the line drawing point according to the obtained drawing point movement instruction;

[0052] The drawing point movement instruction can be a mouse movement message (WM_MOUSEMOVE) generated by the computer system after detecting the movement of the mouse. In the process of drawing a line, multiple mouse movement messages will be generated, and a movement track can be constructed based on two adjacent mouse movement messages. Specifically, each time a mouse movement message is obtained, the movement track of the line drawing point between the two mouse movement messages can be obtained in combination with the previous mouse movement message. For example, the current position of the movement track is obtained according to the current mouse movement message, and the initial position of the movement track is obtained according to the previous mouse movement message.

[0053] 202. Construct a moving trajectory of the line drawing point according to the initial position and the current position;

[0054] With the initial position and current position of the moving track, the moving track can be constructed. The initial position and current position of the moving track mentioned here are relative. For example, the initial position of the first moving track segment is the starting point of the line, and the current position is the position corresponding to the first mouse move message; the initial position of the second moving track segment is the position corresponding to the first mouse move message, and the current position is the position corresponding to the second mouse move message, and so on.

[0055] 203. Divide the movement trajectory to obtain the multiple trajectory segments.

[0056] In the process of drawing lines, in order to avoid the line gradient effect being unclear when the moving track is too long, drawn at a low speed or the drawn line is too short, the moving track can be split into multiple track segments, and then the track segments are drawn separately to enhance the line gradient effect.

[0057] In one embodiment, dividing the moving trajectory to obtain the plurality of trajectory segments includes:

[0058] Obtaining coordinate values ​​of multiple position points of the moving trajectory, and sequentially passing the coordinate values ​​of the multiple position points into a pre-built callback function;

[0059] After the coordinate value of one of the position points is passed into the callback function, the coordinate value of the currently passed position point and the coordinate value of the last passed position point are processed by the callback function to obtain one of the track segments.

[0060] In this embodiment, the moving trajectory is divided by the coordinate values ​​of multiple position points of the moving trajectory. Therefore, before dividing the moving trajectory, it is necessary to obtain multiple coordinate values ​​of multiple position points of the moving trajectory. Specifically, the LineDDA function can be used to obtain the coordinate values ​​of the position points. The LineDDA function is an interface (API) of the Windows system. Its main function is to obtain the moving trajectory data between two known coordinate points, that is, to obtain the coordinate values ​​of multiple position points of the moving trajectory. After the LineDDA function obtains the coordinate values ​​of multiple position points, a callback function (LineDDACallback function) can be defined for the LineDDA function to split the moving trajectory and draw the trajectory fragments obtained by splitting. The callback function is a function called by a function pointer, which is called by another party when a specific event or condition occurs, and is used to respond to the specific event or condition. In this embodiment, to call the LineDDACallback function to divide the moving trajectory, it is necessary to obtain multiple coordinate values ​​in the LineDDA function, and pass the coordinate values ​​as parameters to the LineDDACallback function in sequence. When the coordinate values ​​of 2 or more position points are passed in, the LineDDACallback function responds to the coordinate values ​​of the passed in position points and divides the moving trajectory. Specifically, after the coordinate value of a position point is passed in, the LineDDACallback function obtains one of the track segments according to the currently passed in parameters and the coordinate value of the last passed in position point. As the coordinate values ​​of the position points are continuously passed in, multiple track segments can be obtained.

[0061] 102. Draw a line corresponding to each of the trajectory segments respectively, and use a different color of brush to draw the lines corresponding to different trajectory segments.

[0062] Each time a trajectory segment is obtained, a line corresponding to the trajectory segment can be drawn. In order to make the drawn line have a color gradient effect, different color brushes can be used to draw different trajectory segments. Specifically, in one embodiment, drawing the line corresponding to each trajectory segment includes:

[0063] (1) each time a trajectory segment is obtained, a brush is created in the callback function;

[0064] (2) assigning the color parameter of the brush to a preset color variable value;

[0065] (3) using the brush to draw a line corresponding to the currently acquired trajectory segment;

[0066] (4) After drawing the line corresponding to the currently acquired trajectory segment, the color variable value is updated, and then the next trajectory segment is acquired to perform repeated operations.

[0067] To use brushes of different colors to draw different trajectory segments, a brush can be created separately each time the line corresponding to the trajectory segment is drawn, and the brush can be assigned a color different from that of the previous trajectory segment. Specifically, the color parameter of the brush can be assigned to a preset color variable value, and the color variable value will be updated after each drawing of the currently obtained trajectory segment. Preferably, the color variable value can be updated according to a preset color change rule. For example, the color change rule can be RGB (250, 0, 0) -> RGB (250, 250, 0) -> RGB (0, 250, 0) -> RGB (0, 250, 250) -> RGB (0, 0, 250) -> RGB (250, 0, 250) -> RGB (250, 0, 0), preferably, the step size of the color variable value is set to 5, so that the color gradient effect of the line is more obvious.

[0068] Among them, since creating a brush requires calling the operating system API, the API needs to be called by the operating system to complete the function, and the system needs to enter the kernel space when calling the API, and then switch to the user space after the end. Therefore, frequent new brush creation will cause the system to frequently switch between user mode and kernel mode, resulting in excessive system resources (CPU resources and memory resources). In order to reduce the consumption of system resources, the system resources currently occupied by creating brushes to draw lines can be released after each drawing of the obtained trajectory fragment, thereby improving the efficiency of line drawing.

[0069] In order to draw a smooth line, in one embodiment, using the brush to draw a line corresponding to the currently acquired trajectory segment includes:

[0070] Calling a first line drawing function to draw a first line covering the track segment, wherein the first line is continuous and has a jagged edge;

[0071] A second line drawing function is called to draw a second line covering the track segment, wherein the second line is discontinuous and has no jagged edge, and the width of the second line is greater than that of the first line.

[0072] Among the commonly used line drawing functions, one type of function draws lines with good continuity, but the edges of the lines may have jagged problems; and another type of function can draw lines with clear boundaries and no jagged edges, but the lines may be broken in the middle. Therefore, these two types of functions can be combined to draw lines, so as to draw continuous lines with no jagged edges. Specifically, the first line drawing function can be used to draw a first line with good continuity but jagged edges; and the second line drawing function can be used to draw a second line with clear boundaries and no jagged edges, but there will be a break in the middle of the line and poor continuity, so that the two lines cover the currently drawn trajectory segment, and the width of the second line is set to be greater than the width of the first line, so that when the two line segments cover the trajectory segment, the boundary of the second line can cover the jagged part of the first line, and the middle of the first line can fill the break in the middle of the second line, so as to draw a smooth line.

[0073] Specifically, in one embodiment, the second line drawing function is a Drawline function, and calling the second line drawing function to draw a second line covering the track segment may include:

[0074] The Drawline function is set to smooth mode, and then the Drawline function is called to draw a second line covering the track segment.

[0075] In actual operation, the Drawline function can be set to smooth mode to draw lines with clear boundaries and no jagged edges. Combined with the first line drawing function, the lines corresponding to the track segment can be smooth and continuous. For ease of understanding, for example, assume that the first line drawing function is the MoveToEx function and the LineTo function. In actual use, the first line drawn by MoveToEx and LineTo (Fun1) has serious jagged edges, but the continuity of the middle part of the line is good; the DrawLine function is set to smooth mode, and the second line drawn has clear boundaries and no jagged edges, but there will be a break at the connection in the middle, resulting in discontinuous lines. Use the two together to make the width of the second line drawn by the Drawline function larger than the first line drawn by the MoveToEx function and the LineTo function. When the two parts of the line cover the track segment, a smooth continuous line can be obtained.

[0076] When a moving track is finished, it will detect whether there is a new drawing point moving instruction. If a new drawing point moving instruction is detected, a new moving track will be constructed, and the above splitting, drawing and other operations will be repeated for the moving track. If no new drawing point moving instruction is detected, it will detect whether there is an operation instruction to end the line drawing. When the operation instruction to end the line drawing is obtained, the line drawing operation will be exited. Taking the mouse to draw a line as an example, the operation instruction to end the line drawing is to release the left mouse button. When the release of the left mouse button is detected, it means that the line drawing is completed and the line drawing operation is exited.

[0077] The embodiment of the present application uses brushes of different colors to draw lines corresponding to different trajectory segments, so as to draw gradient color lines to mark the key content of the speech, thereby improving the effect of marking the key content.

[0078] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0079] For ease of understanding, the method for drawing lines proposed in this application is explained below using a practical application scenario.

[0080] The flowchart of the method for drawing lines proposed in this application in a practical application scenario is as follows Figure 2 Specifically, take drawing a line with a mouse in a Windows operating system as an example.

[0081] exist Figure 2 In the software, first, the software will detect whether the user presses the left mouse button to draw a line. When it detects that the user presses the left mouse button, it enters the line drawing mode. After entering the line drawing mode, the software will first record the starting point of the line and monitor whether the operating system generates a mouse movement message. When the first mouse movement message is detected, it will be fed back to the software. The software will determine the initial position and current position of the mouse pointer based on the starting point of the line and the first mouse movement message. Based on these two positions, the movement trajectory can be constructed. After that, the software will call the lineDAA function to obtain the coordinate values ​​of multiple position points of the movement trajectory.

[0082] Then, the coordinate values ​​of the multiple position points obtained will be passed to the preset callback function in sequence, and the moving trajectory will be divided into multiple trajectory segments. For example, assuming that there are a total of 8 position points, the coordinate values ​​of the 1st, 2nd, 3rd...8th position points will be passed to the callback function in sequence. When the callback function receives the coordinate value of the 2nd position point, it will divide the first trajectory segment from the moving trajectory according to the coordinate value of the position point that has been obtained. When the first trajectory segment is drawn, the second trajectory segment will be divided from the moving trajectory according to the coordinate value of the 3rd position point and the coordinate value of the 2nd position point. By analogy, 7 trajectory segments can be obtained through the coordinate values ​​of the 8 position points and each trajectory segment can be drawn.

[0083] Specifically, after obtaining the first track segment, the software will call the pre-built callback function to draw the segment. The specific process of drawing can be, first, create a brush in the callback function, and assign the color parameter of the brush to the color variable value. Assuming that the color change rule is "red→yellow→blue→green→cyan→blue→purple", then the brush color at this time is red, and the line color corresponding to the first track segment drawn by the brush is red. Since the functions called in the drawing process are the MoveToEx function and the LineTo function, the drawn line has serious jagged edges, but the continuity in the middle of the line is good, so it is necessary to call the DrawLine function set to smooth mode to draw a line with clear boundaries and no jagged edges to cover the original line, so that the drawn line is continuous and has smooth edges. Also take the example of obtaining 7 track segments, when the first track segment is drawn, the system resources occupied by drawing the first track segment will be released, and the color variable value will be updated to yellow, and then the corresponding drawing operation will be performed on the second track segment. Similarly, when all seven trajectory segments are drawn, the line corresponding to the first moving trajectory can be obtained, and the gradient of the line color is the same as the preset color change rule, which is the gradient rule of "red→yellow→blue→green→cyan→blue→purple". When more trajectory segments are obtained, the color value variable can be cyclically updated according to the color change rule. Among them, it can be judged whether the trajectory segment is drawn by whether the end coordinate value of the obtained trajectory segment is the same as the current coordinate value of the moving trajectory. If they are the same, it means that the line corresponding to a moving trajectory has been drawn, that is, the obtained trajectory segment has been drawn; if they are not the same, it means that there are still trajectory segments that have not been drawn, and the corresponding drawing operation will be performed on the next trajectory segment.

[0084] Finally, when the multiple trajectory segments are drawn, the software will detect whether it has received a new mouse movement message from the system. If it is detected, the corresponding steps of building, dividing and drawing the above movement trajectory will be repeated; if no new mouse movement message is detected, when the operation of releasing the left mouse button is detected, it means that the line drawing is completed, and the software will exit the line drawing mode.

[0085] Figure 3 A structural block diagram of a device for drawing lines provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.

[0086] Reference Figure 3 , the device comprises:

[0087] A trajectory segment acquisition module 301 is used to detect the moving trajectory of the line drawing point after acquiring the line drawing instruction, and the moving trajectory includes a plurality of trajectory segments;

[0088] The line drawing module 302 is used to draw the lines corresponding to each of the track segments respectively, and the colors of the brushes used when drawing the lines corresponding to different track segments are different.

[0089] Furthermore, the trajectory segment acquisition module 301 may include:

[0090] A moving track endpoint determination unit, used to determine the initial position and current position of the line drawing point according to the obtained drawing point movement instruction;

[0091] A moving track construction unit, used for constructing a moving track of the line drawing point according to the initial position and the current position;

[0092] The trajectory segment division unit is used to divide the moving trajectory to obtain the plurality of trajectory segments.

[0093] Furthermore, the trajectory segment division unit may include:

[0094] The coordinate value passing subunit is used to obtain the coordinate values ​​of multiple position points of the moving track, and pass the coordinate values ​​of the multiple position points into the pre-built callback function in sequence;

[0095] The track segment acquisition subunit is used to process the coordinate value of the currently transmitted position point and the coordinate value of the last transmitted position point through the callback function after the coordinate value of the position point is transmitted to the callback function to obtain the track segment.

[0096] Furthermore, the line drawing module 302 may include:

[0097] A brush creation unit, used for creating a brush in the callback function each time a trajectory segment is obtained;

[0098] A color parameter setting unit, used for assigning the color parameter of the brush to a preset color variable value;

[0099] A trajectory segment drawing unit, used for drawing a line corresponding to the currently acquired trajectory segment using the brush;

[0100] The color variable value updating unit is used to update the color variable value after drawing the line corresponding to the currently acquired trajectory segment, and then acquire the next trajectory segment to perform repeated operations.

[0101] Furthermore, the trajectory segment drawing unit may include:

[0102] A first line drawing subunit, configured to call a first line drawing function to draw a first line covering the track segment, wherein the first line is continuous and has a jagged edge;

[0103] The second line drawing subunit is used to call a second line drawing function to draw a second line covering the track segment, wherein the second line is discontinuous and has no jagged edges, and the width of the second line is greater than that of the first line.

[0104] Furthermore, the second line drawing subunit may also be used to set the Drawline function to a smooth mode, and then call the Drawline function to draw a second line covering the track segment.

[0105] Furthermore, the device may also include:

[0106] The line drawing exit module is used to exit the line drawing operation if an operation instruction to end drawing is detected.

[0107] An embodiment of the present application also provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of each method for drawing lines proposed in the present application when executing the computer program.

[0108] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the various line drawing methods proposed in the present application are implemented.

[0109] The embodiment of the present application also provides a computer program product. When the computer program product is run on a terminal device, the terminal device executes the steps of each line drawing method proposed in the present application.

[0110] Figure 4 This is a schematic diagram of the structure of a terminal device provided in an embodiment of the present application. Figure 4 As shown, the terminal device 4 of this embodiment includes: at least one processor 40 ( Figure 4 Only one is shown in the figure) a processor, a memory 41, and a computer program 42 stored in the memory 41 and executable on the at least one processor 40, wherein the processor 40 implements the steps in any of the above-mentioned method embodiments for drawing lines when executing the computer program 42.

[0111] The terminal device 4 may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, or a wearable device such as a smart watch or a smart bracelet. The terminal device may include, but is not limited to, a processor 40 and a memory 41. Those skilled in the art will appreciate that Figure 4 It is only an example of the terminal device 4 and does not constitute a limitation on the terminal device 4. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.

[0112] The processor 40 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0113] In some embodiments, the memory 41 may be an internal storage unit of the terminal device 4, such as a hard disk or memory of the terminal device 4. In other embodiments, the memory 41 may also be an external storage device of the terminal device 4, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 4. Further, the memory 41 may also include both an internal storage unit and an external storage device of the terminal device 4. The memory 41 is used to store operating devices, application programs, boot loaders (BootLoader), data and other programs, such as program codes of the computer program, etc. The memory 41 may also be used to temporarily store data that has been output or is to be output.

[0114] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0115] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0116] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0117] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0118] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0119] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0120] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying the computer program code to the terminal device, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0121] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for drawing lines, It is characterized in that include: After obtaining the line drawing instruction, detecting the moving trajectory of the line drawing point, wherein the moving trajectory includes a plurality of trajectory segments; Drawing the lines corresponding to each of the track segments respectively, and using different brush colors when drawing the lines corresponding to different track segments; Wherein, the detection of the moving trajectory of the line drawing point includes: Determine the initial position and current position of the line drawing point according to the acquired drawing point moving instruction; the drawing point moving instruction is a mouse moving message; Constructing a moving trajectory of the line drawing point according to the initial position and the current position; Obtaining coordinate values ​​of multiple position points of the moving trajectory, and sequentially passing the coordinate values ​​of the multiple position points into a pre-built callback function; After the coordinate value of one of the position points is passed into the callback function, the coordinate value of the currently passed position point and the coordinate value of the last passed position point are processed by the callback function to obtain one of the track segments.

2. The method for drawing a line according to claim 1, It is characterized in that Drawing lines corresponding to each of the trajectory segments respectively includes: Each time a trajectory segment is obtained, a brush is created in the callback function; Assigning the color parameter of the brush to a preset color variable value; Using the brush to draw a line corresponding to the currently acquired trajectory segment; After drawing the line corresponding to the currently acquired trajectory segment, the color variable value is updated, and then the next trajectory segment is acquired to perform repeated operations.

3. The method for drawing a line according to claim 1, It is characterized in that Using the brush to draw a line corresponding to the currently acquired trajectory segment includes: Calling a first line drawing function to draw a first line covering the track segment, wherein the first line is continuous and has a jagged edge; A second line drawing function is called to draw a second line covering the track segment, wherein the second line is discontinuous and has no jagged edge, and the width of the second line is greater than that of the first line.

4. The method for drawing a line as claimed in claim 3, It is characterized in that The second line drawing function is a Drawline function, and calling the second line drawing function to draw a second line covering the track segment includes: The Drawline function is set to smooth mode, and then the Drawline function is called to draw a second line covering the track segment.

5. The method for drawing a line according to any one of claims 1 to 4, It is characterized in that Also includes: If an operation instruction to end drawing is detected, the line drawing operation is exited.

6. A device for drawing lines, It is characterized in that include: A trajectory segment acquisition module, used for detecting a moving trajectory of a line drawing point after acquiring a line drawing instruction, wherein the moving trajectory includes a plurality of trajectory segments; A line drawing module, used to draw the lines corresponding to each of the track segments respectively, and different colors of brushes are used when drawing the lines corresponding to different track segments; The trajectory segment acquisition module includes: A moving track endpoint determination unit, used to determine the initial position and current position of the line drawing point according to the obtained drawing point movement instruction; the drawing point movement instruction is a mouse movement message; A moving track construction unit, used for constructing a moving track of the line drawing point according to the initial position and the current position; A trajectory segment division unit, used for dividing the moving trajectory to obtain the plurality of trajectory segments; The trajectory segment division unit comprises: The coordinate value passing subunit is used to obtain the coordinate values ​​of multiple position points of the moving track, and pass the coordinate values ​​of the multiple position points into the pre-built callback function in sequence; The track segment acquisition subunit is used to process the coordinate value of the currently transmitted position point and the coordinate value of the last transmitted position point through the callback function after the coordinate value of the position point is transmitted to the callback function to obtain the track segment.

7. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the method for drawing a line according to any one of claims 1 to 5 is implemented.

8. A computer-readable storage medium storing a computer program. It is characterized in that When the computer program is executed by a processor, the method for drawing a line according to any one of claims 1 to 5 is implemented.