CN114565701A - Line segment drawing method and device, electronic equipment and computer readable storage medium - Google Patents

Line segment drawing method and device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN114565701A
CN114565701A CN202210190154.6A CN202210190154A CN114565701A CN 114565701 A CN114565701 A CN 114565701A CN 202210190154 A CN202210190154 A CN 202210190154A CN 114565701 A CN114565701 A CN 114565701A
Authority
CN
China
Prior art keywords
line segment
target
user
point
line
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210190154.6A
Other languages
Chinese (zh)
Inventor
戴文波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Huasheng Software Technology Co ltd
Original Assignee
Shenzhen Huasheng Software Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Huasheng Software Technology Co ltd filed Critical Shenzhen Huasheng Software Technology Co ltd
Priority to CN202210190154.6A priority Critical patent/CN114565701A/en
Publication of CN114565701A publication Critical patent/CN114565701A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/203Drawing of straight lines or curves

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the application discloses a line segment drawing method, a line segment drawing device, electronic equipment and a computer readable storage medium, wherein the method comprises the following steps: acquiring a target line segment type according to selection operation of a user; determining a line segment starting point and a line segment end point according to the sliding operation of a user; and drawing the target line segment according to the type of the target line segment, the starting point of the line segment and the end point of the line segment. The line segment can be drawn according to the line segment type, the line segment starting point and the line segment terminal point through the determination of the line segment starting point and the line segment terminal point after the user selects the line segment type and the sliding operation. For example, when the user selects the dotted line type, the dotted line can be drawn according to the dotted line type, the line segment starting point and the line segment ending point.

Description

Line segment drawing method and device, electronic equipment and computer readable storage medium
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a line segment drawing method and device, electronic equipment and a computer readable storage medium.
Background
With the rapid development of computer technology, the types and functions of terminal devices are increasing, wherein the terminal devices with office functions provide convenience for the work of people.
However, the current terminal equipment has limited office functions, most of which can only complete writing, so that the terminal equipment has limited office functions and is very inconvenient.
Disclosure of Invention
The embodiment of the application provides a line segment drawing method and device, electronic equipment and a computer-readable storage medium, which can realize the drawing of line segments, increase the office capacity of products and improve the convenience.
In a first aspect, an embodiment of the present application provides a line segment drawing method, including:
acquiring a target line segment type according to selection operation of a user;
determining a line segment starting point and a line segment end point according to the sliding operation of a user;
and drawing a target line segment according to the type of the target line segment, the starting point of the line segment and the end point of the line segment.
In a second aspect, an embodiment of the present application further provides a line segment drawing device, including:
the acquisition module is used for acquiring the type of the target line segment according to the selection operation of the user;
the determining module is used for determining a line segment starting point and a line segment end point according to the sliding operation of a user;
and the drawing module is used for drawing the target line segment according to the type of the target line segment, the starting point of the line segment and the end point of the line segment.
Wherein, in some embodiments of the present application, the determining module comprises:
the recording unit is used for recording the touch time of each contact in the sliding operation process of a user;
a first determining unit, configured to use a touch point with the smallest touch time as a segment starting point;
and the second determining unit is used for taking the touch point with the largest touch time as the line segment terminal point.
Wherein, in some embodiments of the present application, the rendering module comprises:
the third determining unit is used for determining a reference line segment according to the type of the target line segment and determining the reference length of the reference line segment according to preset parameters;
a fourth determining unit, configured to determine a target line segment distance according to the line segment starting point and the line segment ending point;
a fifth determining unit, configured to determine the number of reference line segments according to the target line segment distance and the reference length;
and the splicing unit is used for splicing the reference line segments with the reference line segment number to obtain the target line segment.
Among them, in some embodiments of this application, the concatenation unit includes:
a sixth determining unit, configured to determine a line segment deviation angle according to the line segment starting point and the line segment ending point;
and the splicing unit is used for splicing the reference line segments with the reference line segment quantity according to the line segment offset angle to obtain the target line segment.
Wherein, in some embodiments of the present application, the target line segment includes a target dotted line, the reference line segment includes a half-round solid line and a half-round margin line, and the half-round solid line and the half-round margin line are spliced front and back.
The splicing unit includes:
and the splicing subunit is used for splicing the reference line segments with the reference line segment number to obtain a target dotted line.
Wherein, in some embodiments of the present application, the rendering module comprises:
and the drawing unit is used for drawing the target line segment according to the type of the target line segment, the starting point of the line segment and the updated end point of the line segment when the end point of the line segment is updated.
Wherein, in some embodiments of the present application, the obtaining module comprises:
receiving a starting instruction of a user aiming at a target tool;
responding to the starting instruction, and displaying a plurality of graphic identifications in a target area;
acquiring a target line segment type according to the selection operation of a user aiming at the target graphic identifier;
the determining module comprises:
after the selection operation is completed, providing a target drawing interface for the user;
and determining a line segment starting point and a line segment end point according to the sliding operation of the user in the target drawing interface.
In a third aspect, an embodiment of the present application further provides an electronic device, where the electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps in the line segment drawing method when executing the computer program.
In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps in the line segment drawing method are implemented.
The method and the device for drawing the line segment obtain the line segment type according to the selection operation of the user, and draw the line segment according to the line segment type, the line segment starting point and the line segment ending point after the line segment starting point and the line segment ending point are determined according to the sliding operation of the user. The line segment can be drawn according to the line segment type, the line segment starting point and the line segment terminal point through the determination of the line segment starting point and the line segment terminal point after the user selects the line segment type and the sliding operation. For example, when the user selects the dotted line type, the dotted line can be drawn according to the dotted line type, the line segment starting point and the line segment ending point.
Drawings
In order to more clearly illustrate the technical solutions in the present application, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a scene schematic diagram of a line segment drawing method provided in an embodiment of the present application;
fig. 2 is a schematic flowchart of a line segment drawing method provided in an embodiment of the present application;
fig. 3 is a schematic flow chart illustrating user operation and line segment drawing in the line segment drawing method according to the embodiment of the present application;
fig. 4 is a schematic flow chart illustrating the drawing of a dotted line in the line segment drawing method according to the embodiment of the present application
Fig. 5 is a schematic structural diagram of a line segment drawing device according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
The technical solutions in the present application will be described clearly and completely with reference to the drawings in the present application, and it should be apparent that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the application provides a line segment drawing method and device, electronic equipment and a computer readable storage medium. Specifically, the embodiment of the present application provides a line segment drawing device suitable for an electronic device, where the electronic device includes a terminal or a server, where the terminal may be a computer, a personal notebook, or a mobile phone, the server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a Content Delivery Network (CDN), and a big data and artificial intelligence platform, and the server may be directly or indirectly connected in a wired or wireless communication manner.
In the embodiment of the present application, the line segment drawing method may be executed by the terminal device alone, or the line segment drawing method may be executed by the server alone, or the line segment drawing method may be executed by both the terminal device and the server, please refer to fig. 1, which takes the case that the terminal device executes the line segment drawing method alone as an example, wherein other devices may be added on the basis of the terminal device to assist in completing the line segment drawing method, and the types of the other devices are not limited herein; the terminal device and the server are connected through a network, for example, a wireless network, and the specific implementation process is as follows:
after a user selects a graphic identifier corresponding to a line segment type on the terminal device 10, the line segment type desired by the user is obtained, a line segment starting point and a line segment ending point of the line segment are determined according to a sliding operation of the user on the terminal device 10, and then the line segment is drawn according to the line segment type, the line segment starting point and the line segment ending point.
In the embodiment of the present application, the line segment type may include a dotted line, a solid line, a broken line, or the like.
In this embodiment, the graphic identifiers corresponding to various line segment types on the terminal device 10 may be obtained after data update, for example, the server issues data to update the local line segment type and the graphic identifier data of the terminal device 10.
The acquisition of the segment type of the target segment is achieved by the selection of the user on the terminal device 10 for the graphic identifier, wherein in the embodiment of the present application, the segment starting point and the segment ending point may be determined according to the position of the contact in the sliding operation process of the user on the terminal device 10.
The line segment type is obtained according to selection operation of a user, and after the line segment starting point and the line segment end point are determined according to sliding operation of the user, the line segment is drawn according to the line segment type, the line segment starting point and the line segment end point. The line segment can be drawn according to the line segment type, the line segment starting point and the line segment terminal point through the determination of the line segment starting point and the line segment terminal point after the user selects the line segment type and the sliding operation. For example, when the user selects the dotted line type, the dotted line can be drawn according to the dotted line type, the line segment starting point and the line segment ending point.
The following are detailed below. It should be noted that the description sequence of the following embodiments is not intended to limit the priority sequence of the embodiments.
Referring to fig. 2, fig. 2 is a schematic flow chart illustrating a line segment drawing method according to an embodiment of the present disclosure. The specific flow of the line segment drawing method can be as follows:
101. and acquiring the type of the target line segment according to the selection operation of the user.
The line segment type refers to a kind of a line segment, wherein in the embodiment of the present application, the line segment type may include a dotted line or a solid line, and the like.
After the user selects the type of the line segment to be drawn, the target line segment type is acquired according to the selection of the user.
In this embodiment of the present application, a user may implement obtaining each line segment type through a graphical identifier corresponding to a line segment type provided in a terminal interface, that is, optionally, in some embodiments of the present application, before the step "obtaining a target line segment type according to a selection operation of the user", the method further includes:
receiving a starting instruction of a user for a target tool;
responding to the starting instruction, and displaying a plurality of graphic identifications in a target area;
in this embodiment of the present application, each graph identifier corresponds to one line segment type, for example, the dashed line identifier corresponds to the dashed line type, and the solid line identifier corresponds to the solid line type.
In this embodiment of the present application, the tool refers to a device capable of drawing a line segment or an application installed in the device, where the device may include an electronic whiteboard, and the application may include a drawing program (APP), and the application displays a graphical identifier corresponding to each line segment type in a target area through starting the device or starting a corresponding application, so as to facilitate selection of the graphical identifier by a user.
In the embodiment of the application, the target area may include a terminal interface, and the user may select the line segment type of the line segment to be drawn as needed by displaying the graphic identifier corresponding to each line segment type on the terminal interface.
In some embodiments of the present application, the step "obtaining a target line segment type according to a selection operation of a user" includes:
acquiring a target line segment type according to the selection operation of a user for the target graphic identifier;
after the user selects the target graphic identifier from the graphic identifiers according to the requirement, the type of the target line segment can be determined according to the target graphic identifier selected by the user. For example, after the user selects a desired target graphic identifier from a plurality of graphic identifiers displayed on the terminal interface, the line segment type corresponding to the target graphic identifier may be used as the target line segment type.
102. And determining a line segment starting point and a line segment end point according to the sliding operation of the user.
The positioning of the starting point and the ending point of the line segment can be realized through the sliding operation of a user. For example, in the embodiment of the present application, after the user slides on the screen according to the desired position of the line segment, the start point and the end point of the line segment can be determined by the position of the contact point during the sliding operation of the user.
In this embodiment of the present application, the line segment starting point and the line segment ending point may be determined according to the touch time of each touch point, that is, optionally, in some embodiments of the present application, the step "determining the line segment starting point and the line segment ending point according to the sliding operation of the user" includes:
recording the touch time of each contact in the sliding operation process of a user;
taking the contact point with the minimum touch time as a starting point of the line segment;
and taking the touch point with the largest touch time as the line segment terminal point.
The touch time reflects the contact time of a user with each contact in the interface, wherein the contact time of each contact in the sliding operation process is in sequence, the contact with the previous touch time often meets the requirement of the user on the starting point of the line segment, and similarly, the contact with the later touch time meets the requirement of the user on the ending point of the line segment.
The touch point with the minimum touch time is used as the starting point of the line segment, and the touch point with the later touch time is used as the ending point of the line segment, so that the use habit of the user is better met.
In the embodiment of the present application, the starting point and the ending point of the line segment function to determine a line segment according to two position points, and therefore, in the embodiment of the present application, the starting point of the line segment may also be understood as the ending point of the line segment, and similarly, the ending point of the line segment may also be understood as the starting point of the line segment.
In the embodiment of the present application, since the touch time of the user for the touch point in the sliding operation process is continuously increased, the touch point with the later touch time may be used as the line segment end point. For example, after the user performs a sliding operation on the interface, if the touch point with the later touch time is taken as the line segment end point, there is an inaccurate condition, and therefore, in this embodiment of the present application, the line segment end point may be determined according to the interval of the touch times, for example, a difference value between adjacent touch times may be calculated, and whether the line segment end point is a touch point with the earlier touch time or a touch point with the later touch time is determined according to the difference value, that is, optionally, in some embodiments of the present application, the step "take the touch point with the largest touch time as the line segment end point" includes:
and when the difference value of the adjacent touch time is larger than a preset threshold value, taking the touch point with the previous touch time as the segment terminal point.
If the difference between the adjacent touch times is larger, it indicates that the time difference between the touch time of the next touch point and the touch time of the previous touch point is larger, and the touch time of the next touch point and the touch time of the previous touch point are more consistent with the re-touch with the interface after the user finishes the sliding operation.
Correspondingly, when the difference between the adjacent touch times is within the preset threshold, the touch point with the later touch time may still be used as the segment end point, for example, the user slides the finger slowly and slides continuously, in view of this situation, the touch point with the largest touch time may be used as the segment end point, or, when the user separates from the interface and then touches the interface quickly, in view of this situation, it may be considered that the user is unsatisfied with the position of the segment end point, and needs to adjust the segment end point, therefore, when the difference between the time when the user touches the interface again and the time when the user separates the finger from the interface last time is within the preset threshold, the touch point with the later touch time may be used as the segment end point.
In this embodiment of the present application, after the user selects the graphic identifier corresponding to the line segment type, a drawing interface may be provided for the user, so that the user can slide the drawing line in the drawing interface, that is, optionally, in some embodiments of the present application, the step "determining the starting point and the ending point of the line segment according to the sliding operation of the user" includes:
after the selection operation is completed, providing a target drawing interface for the user;
and determining a line segment starting point and a line segment end point according to the sliding operation of the user in the target drawing interface.
The drawing interface is provided, so that a user can conveniently perform finger sliding operation in the drawing interface, and further line segments are drawn and presented.
103. And drawing a target line segment according to the type of the target line segment, the starting point of the line segment and the end point of the line segment.
A line segment can be determined according to the type of the line segment, the starting point of the line segment and the end point of the line segment, so that the line segment can be drawn according to the type of the line segment, the starting point of the line segment and the end point of the line segment.
In this embodiment of the present application, for the drawing of a line segment, a manner of splicing a plurality of line segments may be adopted to implement the drawing of a final line segment, for example, by splicing a plurality of line segments back and forth, that is, optionally, in some embodiments of the present application, the step "drawing a target line segment according to the type of the target line segment, the starting point of the line segment, and the ending point of the line segment" includes:
determining a reference line segment according to the type of the target line segment, and determining the reference length of the reference line segment according to preset parameters;
determining a target line segment distance according to the line segment starting point and the line segment end point;
determining the number of reference line segments according to the target line segment distance and the reference length;
and splicing the reference line segments with the reference line segment number to obtain a target line segment.
In this embodiment, the reference line segment is a component of the target line segment, for example, in this embodiment, when the target line segment is a solid line, the reference line segment is also a solid line, and when the target line segment is a dotted line, the reference line segment may be a segment formed by splicing the solid line and a white line. And the target line segment is drawn by splicing a plurality of sections of reference line segments.
In the embodiment of the present application, the reference length of the reference line segment may be determined according to a setting of a user, for example, the user sets a parameter of the reference line segment according to a requirement, and sets a parameter such as a length, a width, and the like of the reference line segment.
The number of reference line segments required for drawing the line segment can be calculated through the reference length of the reference line segment and the distance of the target line segment, and the drawing of the target line segment is realized through the splicing of the reference line segments of the reference line segment number, for example, when the distance of the target line segment is 10cm and the reference length of the reference line segment is 1cm, the target line segment can be obtained through the splicing of ten reference line segments.
In the line segment drawing process, the reference line segments may be spliced according to the deviation angle between the line segment start point and the line segment end point, that is, optionally, in some embodiments of the present application, the step "splicing the reference line segments of the reference line segment number to obtain the target line segment" includes:
determining a line segment offset angle according to the line segment starting point and the line segment end point;
and splicing the reference line segments with the reference line segment quantity according to the line segment deviation angle to obtain a target line segment.
The line segment can be drawn by calculating the offset angle of the line segment according to the line segment starting point and the line segment end point and splicing a plurality of reference line segments according to the line segment offset angle.
In this embodiment, the target line segment type may include a dotted line type, and therefore, the target line segment may include a target dotted line, and correspondingly, for the dotted line, the reference line segment may include a half-round solid line and a half-round blank line, where the half-round solid line and the half-round blank line are spliced back and forth to form the reference line segment.
In some embodiments of the present application, the step "splicing the reference line segments of the reference line segments to obtain the target line segment" includes:
and splicing the reference line segments with the reference line segment number to obtain a target dotted line.
And the drawing of the dotted line is realized by splicing the reference line segments formed by splicing the half-wheel solid lines and the half-wheel blank lines in the front and back manner.
In the process of drawing the target line segment, the offset angle of each reference line segment can be adjusted to be the line segment offset angle, so that the target line segment can be accurately drawn.
In this embodiment of the present application, when the user slides in the interface, the line segment may be dynamically drawn along with the movement of the user's finger, that is, optionally, in some embodiments of the present application, the step "drawing the target line segment according to the target line segment type, the line segment start point, and the line segment end point" includes:
and when the line segment end point is updated, drawing a target line segment according to the type of the target line segment, the line segment start point and the updated line segment end point.
The position of the line segment end point is continuously updated along with the sliding of a user in the terminal interface, wherein the target line segment is respectively constructed through the dynamically changed line segment end point, so that the terminal interface can present a situation that the line segment continuously changes along with the movement of a user finger.
The method and the device for drawing the line segment comprise the steps of obtaining the line segment type according to selection operation of a user, determining a line segment starting point and a line segment ending point according to sliding operation of the user, and drawing the line segment according to the line segment type, the line segment starting point and the line segment ending point. The line segment can be drawn according to the line segment type, the line segment starting point and the line segment terminal point through the determination of the line segment starting point and the line segment terminal point after the user selects the line segment type and the sliding operation. For example, when the user selects the dotted line type, the dotted line can be drawn according to the dotted line type, the line segment starting point and the line segment ending point. The line segment drawing function is provided, so that the office function of the product is improved, and the convenience is improved.
Referring to fig. 3, fig. 3 is a schematic flow chart illustrating a user operation and a line segment drawing according to an embodiment of the present application, where the flow specifically includes:
111. selecting a line segment type by a user through a graphic identifier provided on the terminal equipment;
112. after the type of the online segment is determined, the terminal equipment provides a drawing interface for a user;
113. in a drawing interface, a user presses a finger and records to obtain a line segment starting point;
114. acquiring a segment end point along with the movement of the finger of the user, and calculating a segment offset angle according to the segment start point and the segment end point;
115. and drawing the line segment according to the line segment type, the line segment starting point, the line segment end point and the line segment offset angle.
The terminal device provides the graphic identification for the user and provides the drawing interface for the user after the user selects the graphic identification, so that the user can draw the line segment through the drawing interface.
The positioning of the line segment end point and the line segment starting point is realized through the sliding of the finger of a user in the drawing interface, and the line segment can be drawn according to the line segment type, the line segment starting point and the line segment end point.
In the embodiment of the application, the line segment deviation angle is calculated through the line segment starting point and the line segment end point, so that the line segment can be drawn according to the line segment deviation angle, and the accuracy of line segment drawing is improved.
Referring to fig. 4, fig. 4 is a schematic flow chart of drawing a dotted line according to an embodiment of the present application, where the specific flow of drawing the dotted line includes:
121. selecting a dotted line (including selecting a dotted line type through a graphic identifier of an interface) by a user, determining a reference line segment according to the dotted line, and setting parameters of the reference line segment according to the user to obtain the reference length of the reference line segment;
122. pressing a finger in a drawing interface by a user to obtain a segment starting point;
123. obtaining a line segment terminal point along with the sliding of the finger of the user in the drawing interface, and obtaining a line segment offset angle according to the line segment starting point and the line segment terminal point;
124. obtaining a line segment distance according to the line segment starting point and the line segment end point, and obtaining the number of reference line segments according to the line segment distance and the reference length;
125. judging whether the number of the reference line segments is greater than a preset threshold value, and executing a step 126 when the number of the reference line segments is greater than the preset threshold value; when the number of the reference line segments is smaller than the preset threshold, executing step 127;
126. splicing the reference line segments with the reference line segment number to draw a dotted line;
127. re-determining the line segment end point and the line segment offset angle according to the movement of the finger of the user, and re-drawing the dotted line according to the new line segment end point and the line segment offset angle;
128. and (6) ending.
When the user selects the dotted line, the user is indicated to desire to draw the dotted line, and correspondingly, the corresponding reference line segment can be determined according to the dotted line, wherein the determination of the starting point, the ending point and the deviation angle of the line segment is realized according to the sliding of the finger of the user in the drawing interface, and the dotted line is further drawn according to the starting point, the ending point, the deviation angle and the reference line segment.
The position of the line segment end point is continuously changed along with the continuous movement of the finger of the user, correspondingly, the drawing of the dotted line with the continuously changed offset angle can be realized according to the dynamically changed line segment end point and the corresponding line segment offset angle until the user stops the movement of the finger, and the final positioning and drawing of the dotted line are completed.
In the embodiment of the present application, by splicing a reference line segment, i.e., a line segment, with a line segment spliced by a solid line and a margin line, a solid line can be drawn to a dotted line.
In the embodiment of the present application, the dotted lines are obtained by splicing the reference line segments, and the line segment offset angle of each reference line segment is also consistent with the line segment offset angle of the final dotted line in the process of drawing the dotted lines, so the offset angle of the dotted line can be calculated according to the offset angle of each reference line segment.
In the embodiment of the present application, the offset angle of the reference line segment may be calculated by coordinate values of any two different points in the reference line segment, for example, by calculating arctangent values of the two points, the line segment offset angle of the reference line segment is obtained according to the arctangent values.
In the embodiment of the present application, when a finger of a user slides on a drawing interface, a distance between a line segment start point and a line segment end point can be obtained according to coordinates of the line segment start point and the line segment end point, and a number requirement of reference line segments can be obtained through an operation of the distance and a reference length of a reference line segment.
In the embodiment of the present application, the length of the dotted line to be drawn may be determined by determining whether the number of the reference line segments is greater than a preset threshold, for example, when the preset threshold is zero, and when the number of the reference line segments is less than zero, it indicates that the length of the dotted line to be drawn is less than the reference length, it may be understood that the length of the dotted line to be drawn is short, and when the number of the reference line segments is greater than zero, it indicates that the dotted line needs to be drawn by splicing at least one reference line segment.
In the embodiment of the present application, when the number of the reference line segments is smaller than the preset threshold, it indicates that the line segment end point of the dotted line to be drawn is not finally determined, so that the reference line segments can be spliced after the fingers of the user move further, that is, the line segment end point is further determined, that is, when the number of the reference line segments is smaller than the preset threshold, the calculation of the offset angle of the dotted line segments is performed first, and the dotted line is not specifically drawn, thereby saving the complexity of the operation of drawing the dotted line.
In the embodiment of the present application, for the drawing of a line segment, it may be understood that contacts (e.g., pixels on an electronic screen) on a connection line formed by a line segment offset angle are sequentially connected, for example, for a line segment (e.g., a horizontal line segment) with a zero line segment offset angle, an abscissa value of a next contact is a sum of an abscissa value of a previous contact and a line segment width, and an ordinate of a next contact is an ordinate of a previous contact, the positioning of each contact may be achieved by determining coordinates of each contact, and then the line segment may be drawn by connecting each contact through coordinates, where for a line segment in a non-horizontal direction, coordinates of the next contact may be calculated through the line segment offset angle and the coordinate value of the previous contact.
In the embodiment of the present application, for the drawing of a line segment in an electronic whiteboard, the line segment may be drawn by adjusting the pixel values of corresponding touch points, for example, a plurality of pixel points on the line segment are determined according to a starting point and an ending point of the line segment, and the line segment may be drawn by uniformly adjusting the pixel values of the plurality of pixel points, for example, in a reference line segment splicing process, the pixel values of corresponding pixel points may be uniformly adjusted according to the length of each reference line segment, so as to draw the line segment in the electronic whiteboard, where parameters such as the color and thickness of the line segment may be determined according to user predefinition.
In the embodiment of the present application, for the drawing of the dotted line, the characteristic of the dotted line may also be embodied in a manner of appending a reference line segment to the end of the line segment, for example, when the dotted line is spliced after the drawing, and the end of the dotted line is a half round of blank line, the characteristic that the last part of the original dotted line is the blank line may be embodied in a manner of splicing a reference line segment at the end of the dotted line again, so as to avoid that the user cannot visually observe the last blank line of the original dotted line. In the embodiment of the application, the half-wheel solid line can be spliced again only at the tail of the original dotted line, so that the number of spliced line segments is reduced, and the drawing complexity is reduced.
In order to better implement the line segment drawing method, the application also provides a line segment drawing device based on the line segment drawing method. The meaning of the third target word is the same as that in the line segment drawing method, and specific implementation details can refer to the description in the method embodiment.
Referring to fig. 5, fig. 5 is a schematic structural diagram of a line segment drawing device provided in the present application, where the line segment drawing device may include:
an obtaining module 201, configured to obtain a target line segment type according to a selection operation of a user.
The determining module 202 is configured to determine a starting point and an ending point of the line segment according to the sliding operation of the user.
And the drawing module 203 is configured to draw the target line segment according to the type of the target line segment, the starting point of the line segment, and the ending point of the line segment.
Among other things, in some embodiments of the present application, the determining module 202 includes:
the recording unit is used for recording the touch time of each contact in the sliding operation process of a user;
a first determining unit, configured to use a touch point with the smallest touch time as a segment starting point;
and the second determining unit is used for taking the touch point with the largest touch time as the line segment terminal point.
Among others, in some embodiments of the present application, the rendering module 203 includes:
the third determining unit is used for determining a reference line segment according to the type of the target line segment and determining the reference length of the reference line segment according to preset parameters;
a fourth determining unit, configured to determine a target line segment distance according to the line segment starting point and the line segment ending point;
a fifth determining unit, configured to determine the number of reference line segments according to the target line segment distance and the reference length;
and the splicing unit is used for splicing the reference line segments with the reference line segment number to obtain the target line segment.
Among them, in some embodiments of this application, the concatenation unit includes:
a sixth determining unit, configured to determine a line segment offset angle according to the line segment starting point and the line segment ending point;
and the splicing unit is used for splicing the reference line segments with the reference line segment quantity according to the line segment offset angle to obtain the target line segment.
Wherein, in some embodiments of the present application, the target line segment includes a target dotted line, the reference line segment includes a half-round solid line and a half-round margin line, and the half-round solid line and the half-round margin line are spliced front and back.
The splicing unit includes:
and the splicing subunit is used for splicing the reference line segments with the reference line segment number to obtain a target dotted line.
Among others, in some embodiments of the present application, the rendering module 203 includes:
and the drawing unit is used for drawing the target line segment according to the type of the target line segment, the starting point of the line segment and the updated end point of the line segment when the end point of the line segment is updated.
In some embodiments of the present application, the obtaining module 201 includes:
receiving a starting instruction of a user for a target tool;
responding to the starting instruction, and displaying a plurality of graphic identifications in a target area;
acquiring a target line segment type according to the selection operation of a user aiming at the target graphic identifier;
the determination module 202 includes:
after the selection operation is completed, providing a target drawing interface for the user;
and determining a line segment starting point and a line segment end point according to the sliding operation of the user in the target drawing interface.
In the embodiment of the application, the obtaining module 201 obtains the type of the line segment after the selection operation of the user is completed, then the determining module 202 determines the starting point and the ending point of the line segment according to the sliding operation of the user, and then the drawing module 203 draws the line segment according to the type of the line segment, the starting point and the ending point of the line segment, and draws the line segment with a solid line.
The method and the device for drawing the line segment comprise the steps of obtaining the line segment type according to selection operation of a user, determining a line segment starting point and a line segment ending point according to sliding operation of the user, and drawing the line segment according to the line segment type, the line segment starting point and the line segment ending point. The line segment can be drawn according to the line segment type, the line segment starting point and the line segment terminal point through the determination of the line segment starting point and the line segment terminal point after the user selects the line segment type and the sliding operation. For example, when the user selects the dotted line type, the dotted line can be drawn according to the dotted line type, the line segment starting point and the line segment ending point.
In addition, the present application also provides an electronic device, as shown in fig. 6, which shows a schematic structural diagram of the electronic device related to the present application, specifically:
the electronic device may include components such as a processor 401 of one or more processing cores, memory 402 of one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will appreciate that the electronic device configuration shown in fig. 6 does not constitute a limitation of the electronic device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
the processor 401 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, and performs various functions of the electronic device and processes data by operating or executing software programs and/or modules stored in the memory 402 and calling data stored in the memory 402. Optionally, processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 401.
The memory 402 may be used to store software programs and modules, and the processor 401 executes various functional applications and data processing by operating the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the electronic device, and the like. Further, the memory 402 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 access to the memory 402.
The electronic device further comprises a power supply 403 for supplying power to the various components, and preferably, the power supply 403 is logically connected to the processor 401 through a power management system, so that the functions of charging, discharging, and power consumption management are managed through the power management system. The power supply 403 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
The electronic device may further include an input unit 404, and the input unit 404 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
Although not shown, the electronic device may further include a display unit and the like, which are not described in detail herein. Specifically, in this embodiment, the processor 401 in the electronic device loads an executable file corresponding to a process of one or more application programs into the memory 402 according to the following instructions, and the processor 401 runs the application program stored in the memory 402, thereby implementing the steps in any line segment drawing method provided in this application.
The method and the device for drawing the line segment obtain the line segment type according to the selection operation of the user, and draw the line segment according to the line segment type, the line segment starting point and the line segment ending point after the line segment starting point and the line segment ending point are determined according to the sliding operation of the user. The line segment can be drawn according to the line segment type, the line segment starting point and the line segment terminal point through the determination of the line segment starting point and the line segment terminal point after the user selects the line segment type and the sliding operation. For example, when the user selects the dotted line type, the dotted line can be drawn according to the dotted line type, the line segment starting point and the line segment ending point.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, the present application provides a computer-readable storage medium, on which a computer program is stored, the computer program being capable of being loaded by a processor to execute the steps in any one of the line segment drawing methods provided in the present application.
Wherein the computer-readable storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
Since the instructions stored in the computer-readable storage medium can execute any step in the image processing provided by the present application, the beneficial effects that can be achieved by any line segment drawing method provided by the present application can be achieved, for details, see the foregoing embodiments, and are not described herein again.
The above detailed description is provided for a line segment drawing method, an apparatus, an electronic device, and a storage medium provided by the present application, and a specific example is applied in the present application to explain the principle and the implementation of the present invention, and the description of the above embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for those skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A line segment drawing method, comprising:
acquiring a target line segment type according to selection operation of a user;
determining a segment starting point and a segment end point according to the sliding operation of a user;
and drawing a target line segment according to the type of the target line segment, the starting point of the line segment and the end point of the line segment.
2. The method of claim 1, wherein determining a segment start point and a segment end point according to a sliding operation of a user comprises:
recording the touch time of each contact in the sliding operation process of a user;
taking the contact point with the minimum touch time as a starting point of the line segment;
and taking the touch point with the largest touch time as the line segment terminal point.
3. The method of claim 1, wherein said drawing a target line segment according to said target line segment type, said line segment start point, and said line segment end point comprises:
determining a reference line segment according to the type of the target line segment, and determining the reference length of the reference line segment according to preset parameters;
determining a target line segment distance according to the line segment starting point and the line segment end point;
determining the number of reference line segments according to the target line segment distance and the reference length;
and splicing the reference line segments with the reference line segment number to obtain a target line segment.
4. The method of claim 3, wherein the splicing the reference line segments of the reference line segment number to obtain the target line segment comprises:
determining a line segment offset angle according to the line segment starting point and the line segment end point;
and splicing the reference line segments with the reference line segment quantity according to the line segment deviation angle to obtain a target line segment.
5. The method of claim 3, wherein the target line segment comprises a target dashed line, the reference line segment comprises a half round solid line and a half round white line, and the half round solid line and the half round white line are stitched together;
the splicing the reference line segments with the reference line segment number to obtain the target line segment comprises the following steps:
and splicing the reference line segments with the reference line segment number to obtain a target dotted line.
6. The method of claim 1, wherein said drawing a target line segment according to said target line segment type, said line segment start point, and said line segment end point comprises:
and when the line segment end point is updated, drawing a target line segment according to the type of the target line segment, the line segment start point and the updated line segment end point.
7. The method of claim 1, wherein before obtaining the target line segment type according to the selection operation of the user, the method further comprises:
receiving a starting instruction of a user for a target tool;
responding to the starting instruction, and displaying a plurality of graphic identifications in a target area;
the obtaining of the target line segment type according to the selection operation of the user includes:
acquiring a target line segment type according to the selection operation of a user for the target graphic identifier;
the determining of the starting point and the ending point of the line segment according to the sliding operation of the user comprises the following steps:
after the selection operation is completed, providing a target drawing interface for the user;
and determining a line segment starting point and a line segment end point according to the sliding operation of the user in the target drawing interface.
8. A line drawing apparatus, comprising:
the acquisition module is used for acquiring the type of the target line segment according to the selection operation of the user;
the determining module is used for determining a line segment starting point and a line segment end point according to the sliding operation of a user;
and the drawing module is used for drawing the target line segment according to the type of the target line segment, the starting point of the line segment and the end point of the line segment.
9. An electronic device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the line segment drawing method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the line segment drawing method according to any one of claims 1 to 7.
CN202210190154.6A 2022-02-28 2022-02-28 Line segment drawing method and device, electronic equipment and computer readable storage medium Pending CN114565701A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210190154.6A CN114565701A (en) 2022-02-28 2022-02-28 Line segment drawing method and device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210190154.6A CN114565701A (en) 2022-02-28 2022-02-28 Line segment drawing method and device, electronic equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN114565701A true CN114565701A (en) 2022-05-31

Family

ID=81715871

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210190154.6A Pending CN114565701A (en) 2022-02-28 2022-02-28 Line segment drawing method and device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN114565701A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115082592A (en) * 2022-07-15 2022-09-20 广州鑫景信息科技服务有限公司 Curve generation method, system, computer equipment and storage medium
CN115237289A (en) * 2022-07-01 2022-10-25 杭州涂鸦信息技术有限公司 Hot area range determining method, device, equipment and storage medium
WO2024066949A1 (en) * 2022-09-29 2024-04-04 华为技术有限公司 Graphic drawing method and apparatus

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115237289A (en) * 2022-07-01 2022-10-25 杭州涂鸦信息技术有限公司 Hot area range determining method, device, equipment and storage medium
CN115237289B (en) * 2022-07-01 2024-02-23 杭州涂鸦信息技术有限公司 Hot zone range determining method, device, equipment and storage medium
CN115082592A (en) * 2022-07-15 2022-09-20 广州鑫景信息科技服务有限公司 Curve generation method, system, computer equipment and storage medium
WO2024066949A1 (en) * 2022-09-29 2024-04-04 华为技术有限公司 Graphic drawing method and apparatus

Similar Documents

Publication Publication Date Title
CN114565701A (en) Line segment drawing method and device, electronic equipment and computer readable storage medium
CN108958633B (en) Split screen display method and device, storage medium and electronic equipment
US8749586B2 (en) Method and apparatus for providing folder item information based on touch operation
JP6364893B2 (en) Terminal device, electronic whiteboard system, electronic whiteboard input support method, and program
CN112114734B (en) Online document display method, device, terminal and storage medium
CN112587925A (en) Display method and device of guide information, storage medium and computer equipment
CN114063858A (en) Image processing method, image processing device, electronic equipment and storage medium
CN113126875B (en) Virtual gift interaction method and device, computer equipment and storage medium
CN113065317B (en) Editing content recovery method and device, electronic equipment, medium and product
CN112698762B (en) Icon display method and device and electronic equipment
CN107291564B (en) Information copying and pasting method and device and electronic equipment
CN117131299A (en) Page layout method and device based on user
CN114723855A (en) Image generation method and apparatus, device and medium
CN111831203B (en) Information processing method, information processing apparatus, storage medium, and electronic device
CN114564924A (en) Data insertion method, device, equipment and storage medium
CN113126867A (en) Browser control method and device, browser, terminal and storage medium
CN111752428A (en) Icon arrangement method and device, electronic equipment and medium
KR101811344B1 (en) Method and apparatus for display control, and computer program recorded on computer readable recording medium for executing the method
CN113407888B (en) Browser size adjusting method and device, storage medium and computer equipment
CN104951223A (en) Method and device for achieving magnifying lens on touch screen and host
CN114115528B (en) Virtual object control method, device, computer equipment and storage medium
CN112543249B (en) Screen display method, device, terminal and storage medium
CN111797933B (en) Template matching method, device, electronic equipment and storage medium
CN113900758B (en) Content display method, apparatus, computer device, and computer-readable storage medium
CN115100328A (en) Video production method, video production device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination