WO2024066949A1 - Graphic drawing method and apparatus - Google Patents

Graphic drawing method and apparatus Download PDF

Info

Publication number
WO2024066949A1
WO2024066949A1 PCT/CN2023/116929 CN2023116929W WO2024066949A1 WO 2024066949 A1 WO2024066949 A1 WO 2024066949A1 CN 2023116929 W CN2023116929 W CN 2023116929W WO 2024066949 A1 WO2024066949 A1 WO 2024066949A1
Authority
WO
WIPO (PCT)
Prior art keywords
line
vertex
drawn
state
point
Prior art date
Application number
PCT/CN2023/116929
Other languages
French (fr)
Chinese (zh)
Inventor
卞苏成
胡凯
杨婉艺
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2024066949A1 publication Critical patent/WO2024066949A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04845Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range for image manipulation, e.g. dragging, rotation, expansion or change of colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures
    • G06F3/04883Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures for inputting data by handwriting, e.g. gesture or text
    • 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

Definitions

  • Embodiments of the present application relate to the field of electronic devices, and more specifically, to a method and device for drawing graphics.
  • the user can pause after drawing a graphic with a stylus, and the default pause of the electronic device can trigger recognition, recognize the hand-drawn graphic and correct it.
  • this implementation can meet the user's demand for quickly drawing regular graphics, it cannot meet the user's demand for graphic diversity when adjusting the hand-drawn graphics.
  • the embodiments of the present application provide a method and device for drawing graphics, in order to improve the speed at which the user draws the target graphics during the process of the user drawing the target graphics.
  • a method for drawing a graphic includes: determining a state of a vertex, the vertex being an intersection of N lines in a drawn graphic, where N is an integer greater than or equal to 2; if the state of the vertex is an unlocked state, redrawing a first line of the N lines according to the state of the vertex; if the state of the vertex is a locked state, redrawing the N lines according to the state of the vertex.
  • the user can flexibly control the number of lines that need to be redrawn according to the state of the vertices, which can improve the speed at which the user draws the target graphics.
  • a first line among the N lines is selected; and a state of the vertex is determined, the vertex being an endpoint of the first line.
  • the user when it is determined that the state of the vertex is unlocked, for example, the first line among N lines is unlocked with other lines, the user can redraw only the first line.
  • the state of the vertex is locked, for example, all lines among N lines are locked, the user can redraw all locked lines, which can meet the user's diverse needs for adjusting graphics.
  • the state of the intersection in the drawn graphic is an unlocked state.
  • the method further includes: when a first line among the N lines is selected, switching the state of the vertex to a locked state, so that the N lines are locked with the vertex.
  • the state of the vertex can be switched, so when the user needs to lock multiple lines together for adjustment, the user can lock the lines associated with the vertex, thereby redrawing all the locked lines to meet the user's diverse needs for adjusting graphics.
  • the state of the intersection in the drawn graphic is a locked state.
  • the state of the vertex when a first line among N lines is selected, the state of the vertex is switched to an unlocked state, and the first line is unlocked from lines among the N lines except the first line, or all the N lines are unlocked.
  • the state of the vertex can be switched, so when the user needs to adjust a certain line, the line associated with the vertex can be unlocked, and the line that the user wants to adjust can be redrawn, thereby meeting the user's diverse needs for adjusting graphics.
  • the method further includes: when drawing a second line with the vertex as a starting point, an auxiliary point is displayed on a third line, and the third line is a line in the drawn figure that is about to intersect with the second line.
  • the drawn figure is a triangle
  • a second line e.g., an auxiliary line
  • an auxiliary point is displayed on a third line (e.g., the opposite side of the vertex, which is the line between two intersection points in the triangle other than the vertex).
  • a third line e.g., the opposite side of the vertex, which is the line between two intersection points in the triangle other than the vertex.
  • a midline is displayed on the opposite side of the vertex.
  • an angle bisector point is displayed on the opposite side of the vertex.
  • guided interaction can increase the speed at which users add auxiliary lines to drawn graphics and reduce Difficulty of operation for users.
  • the third line is the first line in the drawn graphic that is about to intersect with the second line.
  • auxiliary points can be displayed only on the first line that is about to intersect with the second line, saving computing resources for the auxiliary points.
  • the auxiliary point includes any one of the following: a midpoint, an angle bisector point, M-bisector points, or a vertical point, where M is an integer greater than or equal to 2.
  • the drawing mode before drawing a second line with the vertex as a starting point, the drawing mode is switched to an auxiliary line drawing mode.
  • the angle and/or line length in the drawn figure is displayed.
  • the angle and/or line length of the drawn figure is displayed, which can provide the user with intuitive feedback during the drawing process, allowing the user to draw the target figure more quickly and reduce the difficulty of the user's drawing of the target figure.
  • the displayed angle and/or line length is associated with a first anchor point, which is a point that moves when drawing a line.
  • the drawn figure is a triangle
  • the first anchor point is an intersection of the triangle.
  • the angle and/or line length associated with the first anchor point is displayed on the triangle.
  • the angle and/or line length associated with the first anchor point can be understood as the line length and/or angle that will change when the first anchor point is moved.
  • the method also includes: adding a second anchor point on the fourth line in the drawn figure, and displaying the ratio of the first distance and the second distance, the first distance being the distance between the second anchor point and the first endpoint of the fourth line, and the second distance being the distance between the second anchor point and the second endpoint of the fourth line.
  • the drawn figure is a triangle
  • the fourth line is an edge of the drawn triangle
  • the second anchor point can be understood as a newly added anchor point on the edge
  • lines can be subsequently drawn with the anchor point as the starting point.
  • the first endpoint and the second endpoint are the original endpoints of the edge in the drawn triangle.
  • the aforementioned first anchor point can be any one of the first endpoint and the second endpoint, or it can be an endpoint other than the first endpoint and the second endpoint, and this application does not impose any restrictions on this.
  • users can add one or more anchor points to the lines of the drawn graphics as needed to meet the diverse drawing needs of users.
  • a method for drawing a graphic includes: when drawing a second line with a vertex in a drawn graphic as a starting point, an auxiliary point is displayed on a third line, the third line is a line in the drawn graphic that is about to intersect with the second line, and the vertex is an intersection point of N lines in the drawn graphic, where N is an integer greater than or equal to 2.
  • the drawn figure is a triangle
  • a second line e.g., an auxiliary line
  • an auxiliary point is displayed on a third line (e.g., the opposite side of the vertex, which is the line between two intersection points in the triangle other than the vertex).
  • a third line e.g., the opposite side of the vertex, which is the line between two intersection points in the triangle other than the vertex.
  • a midline is displayed on the opposite side of the vertex.
  • an angle bisector point is displayed on the opposite side of the vertex.
  • the third line is the first line in the drawn graphic that is about to intersect with the second line.
  • auxiliary points can be displayed only on the first line that is about to intersect with the second line, saving computing resources for the auxiliary points.
  • the auxiliary point includes any one of the following: a midpoint, an angle bisector point, M-bisector points, or a vertical point, where M is an integer greater than or equal to 2.
  • the drawing mode before drawing a second line with the vertex as a starting point, the drawing mode is switched to an auxiliary line drawing mode.
  • a method for drawing a graphic comprises: when adjusting a drawn graphic through a first anchor point on the graphic, Calculate and display angles and/or line lengths in drawn shapes.
  • the first anchor point can be understood as a point that moves during the process of adjusting the drawn graphics.
  • the angle and/or line length in the drawn graphics are displayed, which can provide users with intuitive feedback during the drawing process, increase the speed at which users draw the target graphics, and reduce the difficulty of users drawing the target graphics.
  • the method also includes: adding a second anchor point on the line in the drawn figure, and displaying the ratio of the first distance and the second distance, the first distance being the distance between the second anchor point and the first endpoint of the line, and the second distance being the distance between the second anchor point and the second endpoint of the line.
  • the second anchor point can be understood as a newly added anchor point on a line in the drawn graphic, and a line can be subsequently drawn with the second anchor point as the starting point, and the first endpoint and the second endpoint are the original endpoints of the line in the drawn graphic.
  • the aforementioned first anchor point can be any endpoint of the first endpoint and the second endpoint, or an endpoint other than the first endpoint and the second endpoint, and this application does not limit this.
  • users can add one or more anchor points to the lines of the drawn graphics as needed to meet the diverse drawing needs of users.
  • a device which includes modules/units for executing any one of the above-mentioned first to third aspects or any one of the possible designs of the first to third aspects; these modules/units can be implemented by hardware, or the corresponding software can be implemented by hardware.
  • an electronic device which includes one or more processors; one or more memories; the one or more memories store one or more computer programs, and the one or more computer programs include instructions.
  • the instructions are executed by the one or more processors, the method in any aspect of the first to third aspects or any possible implementation of the first to third aspects is executed.
  • a chip which includes a processor and a communication interface, wherein the communication interface is used to receive a signal and transmit the signal to the processor, and the processor processes the signal so that the method in any aspect of the first to third aspects or any possible implementation manner of the first to third aspects is executed.
  • a computer-readable storage medium characterized in that the computer-readable storage medium includes a computer program or instructions, and when the computer program or instructions are run on a computer, the method of any aspect of the first to third aspects or any possible implementation scheme of the first to third aspects is executed.
  • a computer program product in an eighth aspect, characterized in that the computer program product includes a computer program or instructions, and when the computer program or instructions are run on a computer, the method of any aspect of the first to third aspects or any possible implementation scheme of the first to third aspects is executed.
  • FIG1 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.
  • FIG. 2 is a software structure block diagram of an electronic device provided in an embodiment of the present application.
  • FIG. 3 is a flowchart of a method 300 for drawing graphics provided in an embodiment of the present application.
  • FIG. 4 is a schematic diagram of displaying an angle in a drawn graphic provided in an embodiment of the present application.
  • FIG. 5 is a schematic diagram of displaying line length in a drawn graphic provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram showing angles and line lengths in a drawn graphic provided by an embodiment of the present application.
  • FIG. 7 is a specific flow chart of method 300 provided in an embodiment of the present application.
  • FIG. 8 is a flowchart of a method 800 for drawing graphics provided in an embodiment of the present application.
  • 9-10 are schematic diagrams of displaying auxiliary points in a drawn graphic provided by an embodiment of the present application.
  • FIG. 11 is a schematic diagram showing the proportion of lines in a drawn graphic provided by an embodiment of the present application
  • FIG. 12 is a specific flow chart of method 800 provided in an embodiment of the present application.
  • FIG. 13 is a flowchart of a method 1300 for drawing graphics provided in an embodiment of the present application.
  • 17-18 are schematic diagrams of drawing or adjusting graphics under Scheme 2 provided in an embodiment of the present application.
  • FIG. 19 is a specific flow chart of method 1300 provided in an embodiment of the present application.
  • FIG. 20 is a schematic diagram of the structure of the device 2000 provided in an embodiment of the present application.
  • FIG. 21 is a schematic diagram of the structure of an electronic device 2100 provided in an embodiment of the present application.
  • first and second are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features.
  • a feature defined as “first” or “second” may explicitly or implicitly include one or more of the features.
  • plural means two or more.
  • the method provided in the embodiments of the present application can be applied to electronic devices such as mobile phones, tablet computers, 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.
  • electronic devices such as mobile phones, tablet computers, 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.
  • the embodiments of the present application do not impose any restrictions on the specific types of electronic devices.
  • FIG1 shows a schematic diagram of the structure of an electronic device 100.
  • the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
  • SIM subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
  • the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100.
  • the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently.
  • the components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and/or a neural-network processing unit (NPU), etc.
  • AP application processor
  • GPU graphics processor
  • ISP image signal processor
  • controller a memory
  • video codec a digital signal processor
  • DSP digital signal processor
  • NPU neural-network processing unit
  • Different processing units may be independent devices or integrated in one or more processors.
  • the controller may be the nerve center and command center of the electronic device 100.
  • the controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
  • the processor 110 may also be provided with a memory for storing instructions and data.
  • the memory in the processor 110 is a cache memory.
  • the memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
  • the processor 110 may include one or more interfaces.
  • the interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (SIM) interface, and/or a universal serial bus (USB) interface, etc.
  • I2C inter-integrated circuit
  • I2S inter-integrated circuit sound
  • PCM pulse code modulation
  • UART universal asynchronous receiver/transmitter
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB universal serial bus
  • the I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL).
  • the processor 110 may include multiple groups of I2C buses.
  • the processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces.
  • the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface, thereby realizing the touch function of the electronic device 100.
  • the I2S interface can be used for audio communication.
  • the processor 110 can include multiple I2S buses.
  • the processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170.
  • the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.
  • the PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals.
  • the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface.
  • the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
  • the UART interface is a universal serial data bus for asynchronous communication.
  • the bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication.
  • the UART interface is generally used to connect the processor 110 and the wireless communication module 160.
  • the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function.
  • the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.
  • the MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193.
  • the MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc.
  • the processor 110 and the camera 193 communicate via the CSI interface to implement the shooting function of the electronic device 100.
  • the processor 110 and the display screen 194 communicate via the DSI interface to implement the display function of the electronic device 100.
  • the GPIO interface can be configured by software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • the GPIO interface can be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc.
  • the GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
  • the USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc.
  • the USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones.
  • the interface can also be used to connect other electronic devices, such as AR devices, etc.
  • the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100.
  • the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
  • the charging management module 140 is used to receive charging input from a charger.
  • the charger may be a wireless charger or a wired charger.
  • the charging management module 140 may receive charging input from a wired charger through the USB interface 130.
  • the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
  • the power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110.
  • the power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160.
  • the power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc.
  • the power management module 141 can also be set in the processor 110.
  • the power management module 141 and the charging management module 140 can also be set in the same device.
  • the wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
  • Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas.
  • antenna 1 can be reused as a wireless local area network.
  • Diversity Antenna In some other embodiments, the antenna can be used in conjunction with a tuning switch.
  • the mobile communication module 150 can provide solutions for wireless communications including 2G/3G/4G/5G, etc., applied to the electronic device 100.
  • the mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc.
  • the mobile communication module 150 may receive electromagnetic waves from the antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
  • the mobile communication module 150 may also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1.
  • at least some of the functional modules of the mobile communication module 150 may be arranged in the processor 110.
  • at least some of the functional modules of the mobile communication module 150 may be arranged in the same device as at least some of the modules of the processor 110.
  • the modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal.
  • the demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194.
  • the modem processor may be an independent device.
  • the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR) and the like applied to the electronic device 100.
  • WLAN wireless local area networks
  • BT wireless fidelity
  • GNSS global navigation satellite system
  • FM frequency modulation
  • NFC near field communication
  • IR infrared
  • the wireless communication module 160 can be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110.
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
  • the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and/or IR technology.
  • the GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and/or a satellite based augmentation system (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • BDS Beidou navigation satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite based augmentation system
  • the electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor.
  • the GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations for graphics rendering.
  • the processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
  • the display screen 194 is used to display images, videos, etc.
  • the display screen 194 includes a display panel.
  • the display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diodes (QLED), etc.
  • the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
  • the electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
  • the ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye.
  • the ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
  • the camera 193 is used to capture still images or videos.
  • the object is projected onto the photosensitive element through the lens to generate an optical image.
  • the photosensitive element can It is a charge coupled device (CCD) or complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CCD charge coupled device
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the light signal into an electrical signal, and then transmits the electrical signal to the ISP to be converted into a digital image signal.
  • the ISP outputs the digital image signal to the DSP for processing.
  • the DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format.
  • the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
  • the digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
  • Video codecs are used to compress or decompress digital videos.
  • the electronic device 100 may support one or more video codecs. In this way, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
  • MPEG Moving Picture Experts Group
  • MPEG2 MPEG2, MPEG3, MPEG4, etc.
  • NPU is a neural network (NN) computing processor.
  • NN neural network
  • applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
  • the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100.
  • the external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos can be stored in the external memory card.
  • the internal memory 121 can be used to store computer executable program codes, which include instructions.
  • the processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121.
  • the internal memory 121 may include a program storage area and a data storage area.
  • the program storage area may store an operating system, an App required for at least one function (such as a sound playback function, an image playback function, etc.), etc.
  • the data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc.
  • the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
  • UFS universal flash storage
  • the electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
  • the audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals.
  • the audio module 170 can also be used to encode and decode audio signals.
  • the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
  • the speaker 170A also called a "speaker" is used to convert an audio electrical signal into a sound signal.
  • the electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.
  • the receiver 170B also called a "earpiece" is used to convert audio electrical signals into sound signals.
  • the voice can be received by placing the receiver 170B close to the human ear.
  • Microphone 170C also called “microphone” or “microphone” is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to microphone 170C to input the sound signal into microphone 170C.
  • the electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the sound source, realize directional recording function, etc.
  • the earphone interface 170D is used to connect a wired earphone.
  • the earphone interface 170D may be the USB interface 130, or may be a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA
  • the pressure sensor 180A is used to sense pressure signals and can convert pressure signals into electrical signals.
  • the pressure sensor 180A can be set on the display screen 194.
  • a capacitive pressure sensor can be a parallel plate including at least two conductive materials.
  • the electronic device 100 determines the intensity of the pressure based on the change in capacitance.
  • the electronic device 100 detects the intensity of the touch operation based on the pressure sensor 180A.
  • the electronic device 100 can also calculate the position of the touch based on the detection signal of the pressure sensor 180A.
  • touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when the touch operation intensity is less than the first pressure When a touch operation with a strength greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a strength greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.
  • the gyro sensor 180B can be used to determine the motion posture of the electronic device 100.
  • the angular velocity of the electronic device 100 around three axes i.e., x, y, and z axes
  • the gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake.
  • the gyro sensor 180B can also be used for navigation and somatosensory game scenes.
  • the air pressure sensor 180C is used to measure air pressure.
  • the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.
  • the magnetic sensor 180D includes a Hall sensor.
  • the electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip leather case.
  • the electronic device 100 when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover according to the magnetic sensor 180D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover can be automatically unlocked.
  • the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.
  • the distance sensor 180F is used to measure the distance.
  • the electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
  • the proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode.
  • the light emitting diode may be an infrared light emitting diode.
  • the electronic device 100 emits infrared light outward through the light emitting diode.
  • the electronic device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100.
  • the electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power.
  • the proximity light sensor 180G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.
  • the ambient light sensor 180L is used to sense the ambient light brightness.
  • the electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
  • the fingerprint sensor 180H is used to collect fingerprints.
  • the electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
  • the temperature sensor 180J is used to detect temperature.
  • the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
  • the touch sensor 180K is also called a "touch panel”.
  • the touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen”.
  • the touch sensor 180K is used to detect touch operations acting on or near it.
  • the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
  • Visual output related to the touch operation can be provided through the display screen 194.
  • the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
  • the bone conduction sensor 180M can obtain a vibration signal. In some embodiments, the bone conduction sensor 180M can obtain a vibration signal of a vibrating bone block of the vocal part of the human body. The bone conduction sensor 180M can also contact the human pulse to receive a blood pressure beat signal. In some embodiments, the bone conduction sensor 180M can also be set in an earphone and combined into a bone conduction earphone.
  • the audio module 170 can parse out a voice signal based on the vibration signal of the vibrating bone block of the vocal part obtained by the bone conduction sensor 180M to realize a voice function.
  • the application processor can parse the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 180M to realize a heart rate detection function.
  • the key 190 includes a power key, a volume key, etc.
  • the key 190 may be a mechanical key or a touch key.
  • the electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.
  • Motor 191 can generate vibration prompts.
  • Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback.
  • Touch operations applied to different applications e.g., taking photos, playing audio, etc.
  • Touch operations applied to different areas of the display screen 194 may also correspond to different vibration feedback effects for the motor 191.
  • Different application scenarios e.g., time reminders, receiving messages, alarm clocks, games, etc.
  • the touch vibration feedback effect may also support customization.
  • Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
  • the SIM card interface 195 is used to connect a SIM card.
  • the SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195.
  • the electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
  • the SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different.
  • the SIM card interface 195 can also be compatible with different types of SIM cards.
  • the SIM card interface 195 can also be compatible with external memory cards.
  • the electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications.
  • the electronic device 100 uses an embedded SIM (eSIM) card, i.e., an embedded SIM card.
  • the eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
  • phone cards in the embodiments of the present application include but are not limited to SIM cards, eSIM cards, universal subscriber identity modules (USIM), universal integrated circuit cards (UICC), and the like.
  • the software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture.
  • the embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device 100.
  • FIG2 is a software structure diagram of the electronic device 100 of an embodiment of the present application.
  • the layered architecture divides the software into several layers, each layer has a clear role and division of labor.
  • the layers communicate with each other through software interfaces.
  • the Android system is divided into four layers, from top to bottom, namely, the application layer, the application framework layer, the Android runtime (Android runtime) and the system library, and the kernel layer.
  • the application layer can include a series of application packages.
  • the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
  • the application framework layer provides application programming interface (API) and programming framework for the applications in the application layer.
  • API application programming interface
  • the application framework layer includes some predefined functions.
  • the application framework layer may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, and the like.
  • the window manager is used to manage window programs.
  • the window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
  • Content providers are used to store and retrieve data and make it accessible to applications.
  • the data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
  • the view system includes visual controls, such as controls for displaying text, controls for displaying images, etc.
  • the view system can be used to build applications.
  • a display interface can be composed of one or more views.
  • a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
  • the phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including connecting, hanging up, etc.).
  • the resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
  • the notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc.
  • the notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
  • Android Runtime includes core libraries and virtual machines. Android Runtime is responsible for the scheduling and management of the Android system.
  • the core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
  • the application layer and the application framework layer run in a virtual machine.
  • the virtual machine executes the Java files of the application layer and the application framework layer as binary files.
  • the virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
  • the system library can include multiple functional modules, such as surface manager, media libraries, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
  • functional modules such as surface manager, media libraries, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
  • the surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
  • a 2D graphics engine is a drawing engine for 2D drawings.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
  • the target graphic is the graphic that the user wants to draw, for example, the target graphic is an isosceles triangle
  • the user can first use the drawing tool to draw a triangle.
  • the electronic device can recognize the triangle and adjust it to a standard graphic (for example, the line segments of a hand-drawn triangle may be curved, and after adjusting to the standard graphic, the three line segments of the triangle are all straight and have no curves), but the standard graphic is not necessarily the target graphic.
  • the user draws a triangle using a drawing tool
  • the drawing tool in the embodiments of the present application is, for example, a stylus, a finger, or an external device such as a mouse or a touchpad.
  • the present application does not limit the type and specific form of the drawing tool.
  • the user can judge by eye that the angles are approximately equal, and it is difficult to accurately draw an isosceles triangle.
  • an embodiment of the present application provides a graphics drawing method, which is intended to increase the speed at which the user draws the target graphics and reduce the difficulty of the user's operation during the process of the user drawing the target graphics.
  • FIG. 3 is a method for drawing a graph provided by an embodiment of the present application.
  • the method 300 illustrated in FIG. 3 includes the following steps:
  • an angle associated with the anchor point is calculated.
  • Another possible implementation is to calculate the line length associated with the anchor point when adjusting the drawn graphic through the anchor point on the graphic.
  • the angle and line length associated with the anchor point are calculated.
  • the anchor points of the drawn graphic can be displayed. Selecting any anchor point with a stylus and moving it can change the angle and/or line length in the drawn graphic. During the process of changing the angle and/or line length, the value of the angle and/or line length can be calculated in real time.
  • the drawn figure can be understood as a figure that has been drawn before adjusting or editing the figure.
  • the drawn figure can be a closed figure composed of lines, such as a polygon, a circle, a five-pointed star, etc., or the drawn figure can also be a non-closed figure, but the non-closed figure includes the intersection of the lines.
  • the line can include a line segment or a curve, and the embodiment of the present application does not limit the above.
  • Possible implementation #1 annotate the calculated angle onto the drawn figure.
  • the drawn figure is 401
  • the user selects the line segment A1C1, and the anchor points A1 and C1 (402) are displayed.
  • the anchor point A1 is selected to adjust the triangle.
  • the angle value in the triangle can be displayed, such as 403.
  • each angle value can be changed in units of 1°, and the present application does not impose any restrictions on this.
  • a horizontal auxiliary line can be displayed.
  • the horizontal auxiliary line can be adsorbed, and the threshold can be set by oneself.
  • the horizontal auxiliary line can be adsorbed to help the user move the anchor point A1 horizontally (404).
  • a vertical auxiliary line can be displayed.
  • the vertical auxiliary line can be adsorbed, and the threshold can be set by oneself. For example, if the angle between the moving direction of the stylus point and the vertical auxiliary line is within the range of ⁇ 5°, the vertical auxiliary line can be adsorbed to help the user move the anchor point A1 vertically (405).
  • the horizontal (and/or vertical) auxiliary line can be displayed.
  • the horizontal (and/or vertical) auxiliary line can be adsorbed.
  • the threshold can be set by oneself, for example, the threshold can be set to ⁇ 5° to help the user align the anchor points (406).
  • the drawn figure is 411
  • the user selects the line segment A2B2
  • the anchor points A2 and B2 are displayed (412)
  • the anchor point A2 is selected to adjust the quadrilateral (413)
  • the angle value in the quadrilateral is displayed during the adjustment process, such as 414.
  • a horizontal auxiliary line can be displayed to help the user move the anchor point A2 horizontally (414).
  • a vertical auxiliary line can be displayed to help the user move the anchor point A2 vertically (415).
  • a horizontal (and/or vertical) auxiliary line can be displayed to help the user align the anchor points (416).
  • auxiliary lines displayed when the anchor point is moved may also be parallel lines.
  • parallel lines A1B1 may be displayed at the position of C1.
  • the vertical auxiliary line in the embodiment of the present application can be understood as a vertical line relative to a certain edge of the drawn figure, and vertical means vertical relative to a certain drawn edge, as shown by 417 in Figure 4, and the vertical auxiliary line is not vertical relative to the horizontal line.
  • the vertical auxiliary lines described below are also understood in the same way.
  • all angles in the drawn graphics can be displayed, such as 403/404/405/406. Or only the angles associated with the moved anchor point can be displayed, such as 414/415/416. This application does not limit this.
  • the angle associated with the moved anchor point can be understood as the angle whose size will change when the anchor point is moved.
  • Possible implementation #2 is to mark the calculated line length onto the drawn graphic.
  • the drawn figure is 501
  • the user selects the line segment A1C1
  • the anchor points A1 and C1 are displayed (402).
  • the anchor point A1 is selected to adjust the triangle, and the length of the line segment in the triangle is displayed during the adjustment process, such as 503.
  • the line segment length value can be changed in units of 1 mm (millimeter), and the present application does not impose any restrictions on this.
  • a horizontal auxiliary line can be displayed.
  • the horizontal auxiliary line can be adsorbed, and the threshold can be set by oneself (504).
  • a vertical auxiliary line can be displayed.
  • the vertical auxiliary line can be adsorbed, and the threshold can be set by oneself (505).
  • the anchor point A1 is moved to be horizontal (and/or vertical) with another anchor point B1
  • a horizontal (and/or vertical) auxiliary line can be displayed.
  • the horizontal (and/or vertical) auxiliary line can be adsorbed.
  • the threshold can be set by oneself (506).
  • the drawn figure is 511
  • the user selects the line segment A2B2
  • the anchor points A2 and B2 are displayed (512)
  • the anchor point A2 is selected to adjust the quadrilateral (513).
  • the line segment length value in the quadrilateral can be displayed, such as 514.
  • a horizontal auxiliary line can be displayed (514).
  • a vertical auxiliary line can be displayed (515).
  • the anchor point A2 is moved to be horizontal (and/or vertical) with another anchor point B2, a horizontal (and/or vertical) auxiliary line can be displayed (516).
  • auxiliary lines displayed when the anchor point is moved there is no restriction on the auxiliary lines displayed when the anchor point is moved.
  • the auxiliary lines displayed when the anchor point is moved may also be parallel lines.
  • the lengths of all line segments in the drawn graphics can be displayed, such as 503/504/505/506.
  • the line lengths associated with the moved anchor point can be displayed, such as 514/515/516. This application does not limit this.
  • the line length associated with the moved anchor point can be understood as a line whose length changes when the anchor point is moved.
  • the special line segment state of the drawn graphics can have an emphasized display effect, for example, when the lengths of two line segments are equal, the two equal line segments can be displayed in a prominent color, or the line segment length value can be enlarged, or the color of the line segment length value can be changed to distinguish it from the color of the drawn graphics.
  • a slight movement of the anchor point by the stylus pen will not cause an immediate change in the line segment length value, and the line segment length will continue to change when the stylus pen moves a distance exceeding a certain threshold.
  • Possible implementation #3 is to annotate the calculated angle and line length onto the drawn figure.
  • the above different implementations can be implemented by switching drawing modes.
  • possible implementation #1 can be implemented in angle adjustment mode
  • possible implementation #2 can be implemented in line adjustment mode
  • possible implementation #3 can be implemented in angle and line adjustment mode.
  • the above modes can be switched under the operation of the stylus, and the present application does not limit the switching method.
  • the application does not impose any restrictions on the names of the above modes.
  • the above three modes may be sub-modes of the graphic adjustment mode, and the application does not impose any restrictions on this.
  • the status of the endpoints of the line may be displayed.
  • the selected line may have a special display effect, for example, the color of the selected line is different from the colors of other lines.
  • the color of the line segment can change, and the state identifier of the endpoint can also be displayed near the two endpoints of the line segment.
  • the state identifier can be used to determine whether the endpoint is in a locked state or an unlocked state.
  • the states of the endpoints A1 and C1 are both in a locked state, that is, A1 and C1 are anchor points in the locked state.
  • Endpoint A1 being in a locked state can be understood as: lines A1B1 and A1C1 are locked, and when endpoint A1 is moved, lines A1B1 and A1C1 will change with the movement of A1.
  • Endpoint A1 being in an unlocked state can be understood as: lines A1B1 and A1C1 are unlocked, that is, when A1 is moved, only one of lines A1B1 and A1C1 will change with the movement of A1, if A1B1 is selected, A1B1 will change with the movement of A1, and if A1C1 is selected, A1C1 will change with the movement of A1.
  • the locked state and unlocked state of the endpoints in the embodiment of the present application are understood in the same way.
  • the status identification of endpoints, vertices or anchor points in the example diagram of the embodiment of the present application takes a small lock as an example, a closed lock as an example of a locked state, and an open lock as an example of an unlocked state.
  • the present application does not impose any restrictions on the display symbols of the status identification.
  • the line when the user redraws a line associated with an endpoint by moving the endpoint, the line may have a special display effect, for example, the color of the line associated with the endpoint may be different from that of other lines.
  • an endpoint can be understood as an endpoint of a line.
  • a vertex can be understood as an overlapping endpoint or an intersection of endpoints.
  • An anchor point can be understood as an editable endpoint or vertex in a drawn graphic.
  • the anchor point can be edited, for example, a line can be drawn with the anchor point as the starting point, or the drawn graphic can be adjusted by moving the anchor point, etc.
  • the state of the anchor point can be a locked state or an unlocked state, and the present application does not limit this.
  • the understanding of an anchor point or a vertex being in a locked state or an unlocked state is similar to the understanding of an endpoint being in a locked state or an unlocked state, and will not be repeated.
  • execution subject of method 300 can be drawing software or an electronic device installed with drawing software, and this application does not limit this.
  • the solution provided by method 300 displays the angle and/or line length in the drawn graphics during the drawing process, which can provide the user with intuitive feedback during the drawing process, increase the speed at which the user draws the target graphics, and reduce the difficulty of the user drawing the target graphics.
  • the specific process of adjusting the graphics according to the anchor point is described in detail below by using the example of FIG. 7 , but it should be understood that FIG. 7 is only an example and does not limit the protection scope of the present application.
  • the method 700 includes the following steps:
  • the stylus falls on the display screen of the electronic device.
  • the process determines whether the system is in the angle adjustment mode. If it is determined to be in the angle adjustment mode, the process proceeds to 703. If it is determined not to be in the angle adjustment mode, the process may be switched to the angle adjustment mode according to the needs of the user.
  • the landing point of the stylus pen is the anchor point of the drawn figure, then enter 704. If it is determined that the landing point of the stylus pen is not the anchor point of the drawn figure, the landing point of the stylus pen can be moved according to the user's needs so that it falls on the anchor point of the drawn figure.
  • the angle affected by the anchor point during the graphic adjustment process is calculated. Or calculate all angles on the figure during the figure adjustment process.
  • the mode is angle and line length adjustment
  • the angle and line length affected by the anchor point during the graphic adjustment process are calculated, or all angles and line lengths on the graphic during the graphic adjustment process are calculated.
  • step 709 if the movement of the stylus pen is detected, the process proceeds to step 709 , and if the movement of the stylus pen is not detected, the process proceeds to step 710 .
  • the line associated with the anchor point is also updated.
  • step 711 If it is determined that the stylus has left the graphic, the process proceeds to step 711 ; if it is determined that the stylus has not left the graphic, the process proceeds to step 706 again.
  • 711 can be understood as the adjustment of the angle and/or line length of the drawn graphic is completed.
  • the angle and/or line length may no longer be displayed on the drawn graphic.
  • the execution subject of the process illustrated in FIG. 7 may be drawing software or an electronic device on which drawing software is installed, and this application does not impose any limitation on this.
  • the user can conveniently and quickly adjust the angle or line length in the drawn graphics to the target value without the aid of other auxiliary tools, thereby improving the interactive efficiency of graphics drawing.
  • FIG8 is another method for drawing a graph provided by an embodiment of the present application.
  • the method 800 illustrated in FIG8 includes the following steps:
  • line #1 is drawn with a vertex on the drawn figure as a starting point, where the vertex is an intersection of N2 lines in the drawn figure, or a point on the drawn figure, where N2 is an integer greater than or equal to 2.
  • an auxiliary point is displayed on line #2 on the drawn graphic that is about to intersect with the extension line of line #1.
  • Possible implementation #1 There are multiple lines on the drawn figure that are about to intersect with the extension line of line #1, and auxiliary points are displayed on the multiple lines.
  • Possible implementation #2 is to display an auxiliary point on the first line of the drawn figure that is about to intersect with the extension line of line #1.
  • auxiliary points include midpoints, angle bisectors, M-bisectors, or perpendicular points, etc.
  • the user can add any auxiliary line to the drawn graphic when the drawn graphic is in the auxiliary line drawing mode.
  • the method 800 can guide the user to quickly draw any auxiliary line.
  • the drawn figure is a triangle, and when the landing point of the stylus is close to vertex A, automatic adsorption auxiliary lines, such as horizontal and vertical auxiliary lines, can be displayed.
  • the angle between the line segment and the two sides can be displayed (901 or 911).
  • the vertical point (902 or 912) can be displayed on the line segment BC.
  • the angle bisector point (903 or 913) can be displayed on the line segment BC.
  • the midpoint When the line segment AO drawn from vertex A is close to the midline, the midpoint (904 or 914) can be displayed on the line segment BC.
  • the midpoint can also be displayed on the line segment AC.
  • the type information of the auxiliary point can also be displayed next to the auxiliary point, such as the midpoint, the angle bisector point, the M-segment point, or the vertical point.
  • the line segment showing the auxiliary point is the first line segment that will intersect with the extension line of AO, namely BC.
  • the line segment showing the auxiliary point is the first line segment that will intersect with the extension line of AO, namely BD.
  • the line segment showing the auxiliary point is the first line segment that will intersect with the extension line of AO, namely CD.
  • the drawn figure is a circle
  • there may be automatic adsorption auxiliary lines such as horizontal and vertical auxiliary lines (1001).
  • the horizontal and vertical auxiliary lines may be displayed and may be automatically adsorbed at the center of the circle (1002).
  • the midpoint auxiliary line (1003) may be displayed.
  • the vertical auxiliary line (1004) may be displayed.
  • a radius is drawn with the center of a circle as the vertex (1005).
  • the remaining equal points can be displayed for the trend analysis drawn by the user. For example, if the angle between the second radius drawn by the user and the first radius is close to 120°, then a 3-equal point is displayed (1006). The user can draw other radii based on the displayed 3-equal points, and after drawing, it is shown as 1007. For example, if the angle between the second radius drawn by the user and the first radius is close to 72°, then a 5-equal point is displayed (1008). The user can draw other radii based on the displayed 5-equal points, and after drawing, it is shown as 1009.
  • the drawn figure is a triangle. After entering the triangle editing state, you can long press the line segment to generate a new anchor point, and display the proportional relationship between the new anchor point and the two endpoints of the line segment (1101), or display the line length between the new anchor point and the two endpoints of the line segment, 1101 is not shown.
  • the drawn figure is a quadrilateral. After entering the quadrilateral editing state, you can long press the line segment to generate a new anchor point, and display the proportional relationship between the new anchor point and the two endpoints of the line segment (1102), or display the specific line length, 1102 is not shown.
  • the drawn figure is a circle. After entering the editing state, you can long press the line to generate a new anchor point, and display the proportional relationship between the new anchor point and the two lines between point A (1103), or display the specific line length, 1103 is not shown.
  • the embodiment of the present application can also adjust the size of the drawn graphics through the anchor points on the drawn graphics.
  • the drawing tool can change the shape of the drawn graphics by holding down the anchor point and dragging it, or the user holds down the anchor point through the drawing tool, that is, there is a first contact point between the drawing tool and the display screen, and adds a contact point with the display screen, such as pressing the display screen with a finger to add a second contact point.
  • the drawing tool can enlarge or reduce the drawn graphics by dragging the anchor point.
  • the drawn graphics are circles
  • the user holds down the anchor point with the stylus pen
  • the stylus can enlarge or reduce the circle in proportion by dragging the anchor point.
  • the drawn graphics are parallelograms
  • the user holds down the anchor point with the stylus pen, and holds down the display screen with a finger
  • the stylus can drag the anchor point to the diagonal direction of the parallelogram to enlarge or reduce the parallelogram in proportion.
  • the drawn figure is a parallelogram.
  • the graphics adjustment mode and the auxiliary line drawing mode can be switched, for example, by double-clicking the stylus or clicking a corresponding mode switching button on the display screen, or by clicking a corresponding mode switching button on the display screen with a mouse. This application does not limit this.
  • the execution subject of method 800 may be drawing software or an electronic device with drawing software installed, and this application does not impose any limitation on this.
  • the solution provided by method 800 can improve the speed at which users add auxiliary lines to drawn graphics through guided interaction, and can reduce the difficulty of user operations.
  • the method 1200 includes the following steps:
  • step 1203 If it is determined that the system is in the auxiliary line drawing mode, the process proceeds to step 1203 . If it is determined that the system is not in the auxiliary line drawing mode, the system may be switched to the auxiliary line drawing mode according to the needs of the user.
  • the landing point of the stylus pen is a vertex of the drawn figure, then enter 1204. If it is determined that the landing point of the stylus pen is not a vertex of the drawn figure, the landing point of the stylus pen can be moved according to the user's needs so that it falls on the vertex of the drawn figure. Exemplarily, the landing point of the stylus pen can be detected by detecting an ACTION_DOWN event.
  • the process proceeds to 1206 , and if the movement of the stylus pen is not detected, the process proceeds to 1210 .
  • step 1207 is an optional step, and the angle between the connecting line and the line associated with the vertex (starting point) may not be calculated and marked. Specific marking examples can be found in FIG9 .
  • the process proceeds to 1211; if it is determined that the stylus has not left the graphic, the process proceeds to 1205.
  • the execution subject of the process illustrated in FIG. 12 may be drawing software or an electronic device on which drawing software is installed, and this application does not impose any limitation on this.
  • the user can easily and quickly add additional auxiliary lines to the graphic.
  • FIG. 13 is another method for drawing a graph provided in an embodiment of the present application.
  • the method 1300 illustrated in FIG. 13 includes the following steps:
  • a locked state and an unlocked state are introduced for the endpoints of a line.
  • the locked state of the endpoint of the first line can be displayed, and then the state of the vertex is determined to be a locked state or an unlocked state.
  • the vertex is the endpoint of the first line that intersects with other lines.
  • S1320 Redraw the line with the vertex as the endpoint according to the state of the vertex.
  • the selected line is line #1 (corresponding to the first line), and the status of the endpoints of line #1 is displayed.
  • the endpoints of line #1 include the vertex. If it is determined that the status of the vertex is unlocked, redraw line #1.
  • the selected line is line #1, and the status of the endpoints of line #1 is displayed.
  • the endpoints of line #1 include the vertex. If the status of the vertex is determined to be locked, all lines with the vertex as endpoints are redrawn, that is, the N3 lines mentioned above.
  • Solution 1 By default, the intersection of lines in the drawn graphics is unlocked.
  • the user can select any line as needed and click the small lock icon near the vertex of the line to lock the vertex.
  • the locking operation is to lock all lines connected to the vertex
  • the unlocking operation is to unlock all lines connected to the vertex.
  • the drawn figure is a triangle, such as 1401, and when the landing point of the stylus is close to the vertex a, there may be automatic adsorption auxiliary lines, such as horizontal and vertical auxiliary lines.
  • the line segment ao drawn from the vertex a reaches a certain length, the angle between the line segment and the two sides can be displayed (1402).
  • a line segment bo is drawn from another vertex b of the triangle, and bo and ao intersect at point o (1403). After drawing the line, the line bo can be selected to display the states of both endpoints are unlocked (1404). Click the small lock attached to o to switch the state of o to locked (1405).
  • the angle can be displayed in the figure during the movement (1406), or the line length can also be displayed, or the angle and line length can be displayed at the same time.
  • the angle and/or line length that change with the movement of the vertex o can be displayed, or all the angles and/or line lengths in the drawn figure can be displayed.
  • the specific method can refer to the relevant description in the embodiment shown in FIG. 7.
  • the drawn figure is a triangle 1501.
  • the state of the intersection on the drawn figure is unlocked.
  • Select other lines bo, and the locks of the two endpoints of bo are displayed to be unlocked (1505).
  • the intersection o can be switched from unlocked state to locked state (1506), then the vertex o is selected, and all lines with o as endpoint are locked state (1507), the vertex o is moved, and all lines with o as endpoint are re-edited (1508).
  • the angle can be displayed in the figure during the movement (1508), or the line length can also be displayed, or the angle and line length can be displayed at the same time.
  • only the angle and/or line length that changes with the movement of the vertex o can be displayed, or all angles and/or line lengths in the drawn figure can be displayed, and this application does not limit this.
  • the endpoints of the line ad in the drawn figure 1601 are in an unlocked state, the vertex a is moved as shown in example 1602, and the vertex c is moved (the vertex c is in a locked state) as shown in example 1603.
  • the endpoints of the line ad in the drawn figure 1604 are in a locked state, the vertex a is moved as shown in example 1605, and the vertex c is moved (the vertex c is in a locked state) as shown in example 1606.
  • Solution 2 By default, the intersections of lines in a drawn graphic are locked.
  • the user can select any line as needed and click the small lock icon near the vertex to unlock the vertex.
  • the unlocking operation is to switch the selected line from the locked state to the unlocked state
  • the locking operation is to switch the selected line from the unlocked state to the locked state.
  • the drawn figure is a triangle in 1701.
  • there can be automatic adsorption auxiliary lines such as horizontal and vertical auxiliary lines.
  • the line segment ao drawn with vertex a as the starting point reaches a certain length, the angle between the line segment and the two sides can be displayed (1701).
  • vertex a is in a locked state (1702).
  • a line segment bo is drawn with another vertex b of the triangle as the starting point, and bo and ao are compared to point o (1703).
  • the line segment bo can be selected to display that the states of the two endpoints are both locked (1704).
  • the endpoints of line ad in the drawn figure 1801 are in a locked state, vertex a is moved as shown in 1802, and vertex c is moved (vertex c is in a locked state) as shown in 1803.
  • the endpoints of line ad in the drawn figure 1804 are in an unlocked state, the upper endpoint of line segment ad is moved as shown in 1805, line segment ac is selected, and vertices a and c are both in a locked state (1806); vertex a is moved as shown in 1807, the state of endpoint d in 1807 is switched to a locked state, and vertex c in 1807 is continued to be moved as shown in 1808.
  • the angles and/or line lengths that change with the movement of the vertices may be displayed, or all angles and/or line lengths in the drawn figure may be displayed, and this application does not impose any limitation on this.
  • Solution 3 By default, the intersection of lines in the drawn graphics is unlocked.
  • the user can select any line as needed and click the small lock icon near the vertex to unlock the vertex.
  • the locking operation is to switch the selected line from the unlocked state to the locked state
  • the unlocking operation is to switch the selected line from the locked state to the unlocked state.
  • Solution 4 By default, the intersections of lines in a drawn graphic are locked.
  • the user can select any line as needed and click the small lock icon near the vertex to lock the vertex.
  • the unlocking operation unlocks all lines connected to the vertex, and the locking operation locks all lines connected to the vertex.
  • the embodiment of the present application does not limit the display timing of the endpoint status indicator (such as the lock indicator, the unlock indicator).
  • the status indicator of the line endpoint can be displayed when the line is selected, and the status indicator of the endpoint can also be displayed during the process of moving the line endpoint.
  • a locked state and an unlocked state are introduced for the endpoints of a line, so that the user can adjust the length and/or angle associated with one or more lines as needed each time.
  • the execution subject of method 1300 may be drawing software or an electronic device with drawing software installed, and this application does not impose any limitation on this.
  • the user can flexibly control the number of lines that need to be redrawn according to the locking status of the intersections in the drawn graphics, which can improve the speed at which the user draws the target graphics.
  • the specific process of drawing a graphic when a vertex is locked or unlocked is described in detail below by using the example of FIG. 19 , but it should be understood that FIG. 19 is only an example and does not limit the scope of protection of the present application.
  • the method 1900 includes the following steps:
  • step 1903 If it is determined that the vertex adjustment mode is in progress, the process proceeds to step 1903. If it is determined that the vertex adjustment mode is not in progress, the process proceeds to step 1903 according to the user's It needs to be switched to vertex adjustment mode.
  • the landing point of the stylus pen is determined to be a vertex of the drawn figure, then enter 1904. If the landing point of the stylus pen is determined not to be a vertex of the drawn figure, the landing point of the stylus pen can be moved according to the user's needs so that it falls on the vertex of the drawn figure. Exemplarily, the landing point of the stylus pen can be detected by detecting an ACTION_DOWN event.
  • the process proceeds to 1906 , and if the movement of the stylus pen is not detected, the process proceeds to 1909 .
  • 1908 is an optional step, and the angle and/or line length associated with the vertex after the vertex is adjusted may not be calculated and marked, or all angles and/or line lengths in the drawn figure after the vertex is adjusted may not be calculated and marked. Specific marking examples can be seen in Figures 14-18.
  • step 1910 If it is determined that the stylus has left the graphic, the process proceeds to step 1910 . If it is determined that the stylus has not left the graphic, the process continues to proceed to step 1908 until the stylus has left the graphic.
  • step 1908 i.e., marking the angle and/or line length associated with the adjusted vertex during the vertex adjustment process, or marking all angles and/or line lengths in the drawn graphics during the vertex adjustment process, then after the editing is finished, the angle and/or line length may no longer be displayed on the drawn graphics.
  • the execution subject of the process illustrated in FIG. 19 may be drawing software or an electronic device on which drawing software is installed, and this application does not impose any limitation on this.
  • the user can flexibly control the number of lines that need to follow the movement of the stylus, and more conveniently adjust the drawn graphics, thereby improving the interaction efficiency of the user in adjusting the shape of complex graphics.
  • UI user interface
  • there is no restriction on the icons when the lock state is locked and unlocked for example, there is no restriction on the mode icon that appears on the display screen when the mode is switched.
  • the methods 300, 800, and 1300 provided in the embodiments of the present application can be used alone, or in combination, or the methods 300, 800, and 1300 can be used together.
  • the method 300 and the implementation in the method 1300 are used in combination, or the method 800 and the implementation in the method 1300 are used in combination, or there are other combinations, which are not exemplified here one by one.
  • the execution subject of the above method includes a hardware structure and/or software module corresponding to each function in order to realize the above functions.
  • the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware 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 the present application.
  • the embodiment of the present application can divide the processor in the execution subject into functional modules according to the above method example.
  • each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module.
  • the above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
  • Figure 20 shows a structural schematic diagram of a device 2000 provided in an embodiment of the present application.
  • the device 2000 includes: a transceiver unit 2010 and a processing unit 2020.
  • the transceiver unit 2010 may include a sending unit and a receiving unit.
  • the sending unit is used to execute the sending operation of the execution subject described in the above method 300, 700, 800, 1200, 1300 or 1900
  • the receiving unit is used to execute the receiving operation of the execution subject described in the above method 300, 700, 800, 1200, 1300 or 1900
  • the processing unit is used to execute the internal processing operation (such as determination, judgment, calculation, etc.) in the execution subject described in the above method 300, 700, 800, 1200, 1300 or 1900.
  • the embodiment of the present application also provides an electronic device, including: a processor, a memory, an application program, and a computer program.
  • the above-mentioned devices can be connected via one or more communication buses.
  • the one or more computer programs are stored in the above-mentioned memory and are configured to be executed by the one or more processors, and the one or more computer programs include instructions, and the above-mentioned instructions can be used to make the electronic device perform each step of the electronic device in the above-mentioned embodiments.
  • the structural diagram of the electronic device 2100 shown in FIG21 includes: one or more processors 2110, one or more memories 2120, and the one or more memories 2120 store one or more computer programs, and the one or more computer programs include instructions.
  • the electronic device 2100 executes the technical solutions in the embodiments of FIG3, FIG7, FIG8, FIG12, FIG13 or FIG19, or the electronic device 2100 executes the technical solutions in the above-mentioned methods 300, 700, 800, 1200, 1300 or 1900.
  • An embodiment of the present application also provides a chip, which includes a processor and a communication interface, wherein the communication interface is used to receive a signal and transmit the signal to the processor, and the processor processes the signal so that the method for drawing graphics described in any possible implementation method described in the foregoing is executed.
  • This embodiment also provides a computer-readable storage medium, in which computer instructions are stored.
  • the computer instructions When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the method for drawing graphics in the above-mentioned embodiment.
  • This embodiment also provides a computer program product.
  • the computer program product When the computer program product is run on a computer, the computer is caused to execute the above-mentioned related steps to implement the method for drawing graphics in the above-mentioned embodiment.
  • the term “when" or “after" may be interpreted to mean “if" or “after" or “in response to determining" or “in response to detecting", depending on the context.
  • the phrase “upon determining" or “if (the stated condition or event) is detected” may be interpreted to mean “if determining" or “in response to determining" or “upon detecting (the stated condition or event)” or “in response to detecting (the stated condition or event)", depending on the context.
  • the disclosed systems, devices and methods can be implemented in other ways.
  • the device embodiments described above are only schematic.
  • the division of the 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 system, 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.
  • 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.
  • 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 functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium.
  • the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art.
  • the computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.

Abstract

Provided in the embodiments of the present application are a graphic drawing method and apparatus. The method comprises: determining the state of a vertex, wherein the vertex is the intersection point of N lines in a drawn graphic, N being an integer greater than or equal to 2; and according to the state of the vertex, re-drawing a line with the vertex serving as an endpoint. By means of the solution provided in the embodiments of the present application, the speed at which a user draws a target graphic can be improved during the process of drawing the target graphic by the user.

Description

一种绘制图形的方法和装置A method and device for drawing graphics
本申请要求于2022年09月29日提交中国专利局、申请号为202211212440.4、发明名称为“一种绘制图形的方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed with the China Patent Office on September 29, 2022, with application number 202211212440.4 and invention name “A method and device for drawing graphics”, the entire contents of which are incorporated by reference in this application.
技术领域Technical Field
本申请实施例涉及电子设备领域,并且,更具体地,涉及一种绘制图形的方法和装置。Embodiments of the present application relate to the field of electronic devices, and more specifically, to a method and device for drawing graphics.
背景技术Background technique
用户使用手写笔在电子设备(例如平板电脑)上绘图时,想要画出规则的线条和图形比较有难度。有一种可能的实施方式,用户使用手写笔手绘出图形后可以停顿一下,电子设备默认停顿可以触发识别,识别手绘的图形并将其修正。该实施方式虽然可以满足用户快速绘制出规则图形的诉求,但在调整手绘图形时,无法满足用户对图形多样性的诉求。When a user uses a stylus to draw on an electronic device (such as a tablet), it is difficult to draw regular lines and graphics. In one possible implementation, the user can pause after drawing a graphic with a stylus, and the default pause of the electronic device can trigger recognition, recognize the hand-drawn graphic and correct it. Although this implementation can meet the user's demand for quickly drawing regular graphics, it cannot meet the user's demand for graphic diversity when adjusting the hand-drawn graphics.
发明内容Summary of the invention
本申请实施例提供一种绘制图形的方法和装置,在用户绘制目标图形的过程中,以期提高用户绘制目标图形的速度。The embodiments of the present application provide a method and device for drawing graphics, in order to improve the speed at which the user draws the target graphics during the process of the user drawing the target graphics.
第一方面,提供了一种图形绘制方法。该方法包括:确定顶点的状态,该顶点为已绘制图形中N个线条的交点,其中,N为大于或等于2的整数;若该顶点的状态为解锁状态,根据该顶点的状态重新绘制N个线条中的第一线条;若该顶点的状态为锁定状态,根据该顶点的状态重新绘制N个线条。In a first aspect, a method for drawing a graphic is provided. The method includes: determining a state of a vertex, the vertex being an intersection of N lines in a drawn graphic, where N is an integer greater than or equal to 2; if the state of the vertex is an unlocked state, redrawing a first line of the N lines according to the state of the vertex; if the state of the vertex is a locked state, redrawing the N lines according to the state of the vertex.
基于上述方案,用户可根据顶点的状态灵活控制需要重新绘制的线条数量,能够提高用户绘制目标图形的速度。Based on the above solution, the user can flexibly control the number of lines that need to be redrawn according to the state of the vertices, which can improve the speed at which the user draws the target graphics.
结合第一方面,在第一方面的某些实现方式中,选中N个线条中的第一线条;确定该顶点的状态,该顶点为第一线条的端点。In combination with the first aspect, in some implementations of the first aspect, a first line among the N lines is selected; and a state of the vertex is determined, the vertex being an endpoint of the first line.
基于上述方案,当确定该顶点的状态为解锁状态,例如N个线条中的第一线条与其他线条解锁,此时用户可以仅重新绘制第一线条,当确定该顶点的状态为锁定状态,例如N个线条中的所有线条锁定,此时用户可以重新绘制锁定的所有线条,能够满足用户调整图形的多样性需求。Based on the above scheme, when it is determined that the state of the vertex is unlocked, for example, the first line among N lines is unlocked with other lines, the user can redraw only the first line. When it is determined that the state of the vertex is locked, for example, all lines among N lines are locked, the user can redraw all locked lines, which can meet the user's diverse needs for adjusting graphics.
结合第一方面,在第一方面的某些实现方式中,已绘制图形中交点的状态为解锁状态。In combination with the first aspect, in some implementations of the first aspect, the state of the intersection in the drawn graphic is an unlocked state.
结合第一方面,在第一方面的某些实现方式中,方法还包括:在选中N个线条中的第一线条时,将该顶点的状态切换为锁定状态,则N个线条与该顶点锁定。In combination with the first aspect, in some implementations of the first aspect, the method further includes: when a first line among the N lines is selected, switching the state of the vertex to a locked state, so that the N lines are locked with the vertex.
基于上述方案,顶点的状态可以切换,因此用户可以在需要将多个线条锁定一起调整时,将顶点关联的线条锁定,从而重新绘制锁定的所有线条,满足用户调整图形的多样性需求。Based on the above scheme, the state of the vertex can be switched, so when the user needs to lock multiple lines together for adjustment, the user can lock the lines associated with the vertex, thereby redrawing all the locked lines to meet the user's diverse needs for adjusting graphics.
结合第一方面,在第一方面的某些实现方式中,已绘制图形中交点的状态为锁定状态。In combination with the first aspect, in certain implementations of the first aspect, the state of the intersection in the drawn graphic is a locked state.
结合第一方面,在第一方面的某些实现方式中,在选中N个线条中的第一线条时,将该顶点的状态切换为解锁状态,则该第一线条与N个线条中除第一线条之外的线条解锁,或者N个线条全部解锁。In combination with the first aspect, in some implementations of the first aspect, when a first line among N lines is selected, the state of the vertex is switched to an unlocked state, and the first line is unlocked from lines among the N lines except the first line, or all the N lines are unlocked.
基于上述方案,顶点的状态可以切换,因此用户可以在需要调整某一个线条时,可以将顶点关联的线条解锁,从而重新绘制用户想要调整的线条,从而满足用户调整图形的多样性需求。Based on the above scheme, the state of the vertex can be switched, so when the user needs to adjust a certain line, the line associated with the vertex can be unlocked, and the line that the user wants to adjust can be redrawn, thereby meeting the user's diverse needs for adjusting graphics.
结合第一方面,在第一方面的某些实现方式中,方法还包括:以该顶点为起点绘制第二线条时,第三线条上显示辅助点,第三线条为已绘制图形中即将与第二线条相交的线条。In combination with the first aspect, in certain implementations of the first aspect, the method further includes: when drawing a second line with the vertex as a starting point, an auxiliary point is displayed on a third line, and the third line is a line in the drawn figure that is about to intersect with the second line.
示例地,已绘制图形为三角形,用户在通过三角形的顶点绘制第二线条(例如辅助线)的过程中,第三线条(例如该顶点的对边,对边即该三角形中除该顶点之外的两个交点之间的线条)上显示辅助点。例如,用户在通过三角形的顶点绘制中线的过程中,该顶点的对边上显示中点。再例如,用户在通过三角形的顶点绘制角平分线的过程中,该顶点的对边上显示角平分线点。For example, the drawn figure is a triangle, and when the user draws a second line (e.g., an auxiliary line) through the vertex of the triangle, an auxiliary point is displayed on a third line (e.g., the opposite side of the vertex, which is the line between two intersection points in the triangle other than the vertex). For example, when the user draws a midline through the vertex of the triangle, a midpoint is displayed on the opposite side of the vertex. For another example, when the user draws an angle bisector through the vertex of the triangle, an angle bisector point is displayed on the opposite side of the vertex.
基于上述方案,通过引导式交互,可以提高用户给已绘制图形添加辅助线的速度,并且可以降低 用户的操作难度。Based on the above solution, guided interaction can increase the speed at which users add auxiliary lines to drawn graphics and reduce Difficulty of operation for users.
结合第一方面,在第一方面的某些实现方式中,第三线条为已绘制图形中即将与第二线条相交的第一个线条。In combination with the first aspect, in some implementations of the first aspect, the third line is the first line in the drawn graphic that is about to intersect with the second line.
基于上述方案,可以仅在即将与第二线条相交的第一个线条上显示辅助点,节省辅助点的计算资源。Based on the above solution, auxiliary points can be displayed only on the first line that is about to intersect with the second line, saving computing resources for the auxiliary points.
结合第一方面,在第一方面的某些实现方式中,辅助点包括以下任一项:中点,角平分点,M等分点,或垂点,M为大于或等于2的整数。In combination with the first aspect, in certain implementations of the first aspect, the auxiliary point includes any one of the following: a midpoint, an angle bisector point, M-bisector points, or a vertical point, where M is an integer greater than or equal to 2.
结合第一方面,在第一方面的某些实现方式中,以该顶点为起点绘制第二线条之前,将绘图模式切换为辅助画线模式。In combination with the first aspect, in some implementations of the first aspect, before drawing a second line with the vertex as a starting point, the drawing mode is switched to an auxiliary line drawing mode.
结合第一方面,在第一方面的某些实现方式中,绘制线条时,显示已绘制图形中的角度和/或线长。In combination with the first aspect, in certain implementations of the first aspect, when drawing a line, the angle and/or line length in the drawn figure is displayed.
基于上述方案,在绘图过程中,显示已绘制图形中的角度和/或线长,可以直观为用户提供绘图过程中的反馈,使得用户更加快速的绘制出目标图形,并可以降低用户绘制目标图形的操作难度。Based on the above scheme, during the drawing process, the angle and/or line length of the drawn figure is displayed, which can provide the user with intuitive feedback during the drawing process, allowing the user to draw the target figure more quickly and reduce the difficulty of the user's drawing of the target figure.
结合第一方面,在第一方面的某些实现方式中,显示的角度和/或线长与第一锚点关联,第一锚点为绘制线条时移动的点。In combination with the first aspect, in some implementations of the first aspect, the displayed angle and/or line length is associated with a first anchor point, which is a point that moves when drawing a line.
示例地,已绘制图形为三角形,第一锚点为三角形的某一个交点,当用户移动第一锚点时,三角形上显示与第一锚点关联的角度和/或线长,与第一锚点关联的角度和/或线长可以理解为移动第一锚点时会发生变化的线长和/或角度。For example, the drawn figure is a triangle, and the first anchor point is an intersection of the triangle. When the user moves the first anchor point, the angle and/or line length associated with the first anchor point is displayed on the triangle. The angle and/or line length associated with the first anchor point can be understood as the line length and/or angle that will change when the first anchor point is moved.
结合第一方面,在第一方面的某些实现方式中,显示已绘制图形中的所有角度和/或所有线长。In combination with the first aspect, in certain implementations of the first aspect, all angles and/or all line lengths in the drawn graphics are displayed.
基于上述方案,可以仅显示用户调整图形的过程中会发生变化的角度和/或线长,节省角度和/或线长的计算资源。Based on the above solution, only the angles and/or line lengths that will change during the user's adjustment of the graphics can be displayed, saving calculation resources for the angles and/or line lengths.
结合第一方面,在第一方面的某些实现方式中,方法还包括:在已绘制图形中的第四线条上新增第二锚点,并显示第一距离和第二距离的比例,第一距离为第二锚点和第四线条的第一端点之间的距离,第二距离为第二锚点和第四线条的第二端点之间的距离。In combination with the first aspect, in certain implementations of the first aspect, the method also includes: adding a second anchor point on the fourth line in the drawn figure, and displaying the ratio of the first distance and the second distance, the first distance being the distance between the second anchor point and the first endpoint of the fourth line, and the second distance being the distance between the second anchor point and the second endpoint of the fourth line.
示例地,已绘制图形为三角形,第四线条为已绘制三角形中的某条边,第二锚点可以理解为该边上新增的锚点,后续可以以该锚点为起点绘制线条,第一端点和第二端点为已绘制三角形中该边原有的端点,前述第一锚点可以是第一端点和第二端点中的任一端点,也可以是除第一端点和第二端点之外的端点,本申请对此不做限制。For example, the drawn figure is a triangle, the fourth line is an edge of the drawn triangle, the second anchor point can be understood as a newly added anchor point on the edge, and lines can be subsequently drawn with the anchor point as the starting point. The first endpoint and the second endpoint are the original endpoints of the edge in the drawn triangle. The aforementioned first anchor point can be any one of the first endpoint and the second endpoint, or it can be an endpoint other than the first endpoint and the second endpoint, and this application does not impose any restrictions on this.
基于上述方案,用户可以按需在已绘制图形的线条上增加一个或多个锚点,满足用户绘图的多样性需求。Based on the above solution, users can add one or more anchor points to the lines of the drawn graphics as needed to meet the diverse drawing needs of users.
第二方面,提供了一种图形绘制方法。该方法包括:以已绘制图形中的顶点为起点绘制第二线条时,第三线条上显示辅助点,第三线条为已绘制图形中即将与第二线条相交的线条,该顶点为已绘制图形中N个线条的交点,其中,N为大于或等于2的整数。In a second aspect, a method for drawing a graphic is provided. The method includes: when drawing a second line with a vertex in a drawn graphic as a starting point, an auxiliary point is displayed on a third line, the third line is a line in the drawn graphic that is about to intersect with the second line, and the vertex is an intersection point of N lines in the drawn graphic, where N is an integer greater than or equal to 2.
示例地,已绘制图形为三角形,用户在通过三角形的顶点绘制第二线条(例如辅助线)的过程中,第三线条(例如该顶点的对边,对边即该三角形中除该顶点之外的两个交点之间的线条)上显示辅助点。例如,用户在通过三角形的顶点绘制中线的过程中,该顶点的对边上显示中点。再例如,用户在通过三角形的顶点绘制角平分线的过程中,该顶点的对边上显示角平分线点。For example, the drawn figure is a triangle, and when the user draws a second line (e.g., an auxiliary line) through the vertex of the triangle, an auxiliary point is displayed on a third line (e.g., the opposite side of the vertex, which is the line between two intersection points in the triangle other than the vertex). For example, when the user draws a midline through the vertex of the triangle, a midpoint is displayed on the opposite side of the vertex. For another example, when the user draws an angle bisector through the vertex of the triangle, an angle bisector point is displayed on the opposite side of the vertex.
基于上述方案,通过引导式交互,可以提高用户给已绘制图形添加辅助线的速度,并且可以降低用户的操作难度。Based on the above solution, through guided interaction, the speed at which users add auxiliary lines to drawn graphics can be increased, and the difficulty of user operation can be reduced.
结合第二方面,在第二方面的某些实现方式中,第三线条为已绘制图形中即将与第二线条相交的第一个线条。In combination with the second aspect, in some implementations of the second aspect, the third line is the first line in the drawn graphic that is about to intersect with the second line.
基于上述方案,可以仅在即将与第二线条相交的第一个线条上显示辅助点,节省辅助点的计算资源。Based on the above solution, auxiliary points can be displayed only on the first line that is about to intersect with the second line, saving computing resources for the auxiliary points.
结合第二方面,在第二方面的某些实现方式中,辅助点包括以下任一项:中点,角平分点,M等分点,或垂点,M为大于或等于2的整数。In combination with the second aspect, in certain implementations of the second aspect, the auxiliary point includes any one of the following: a midpoint, an angle bisector point, M-bisector points, or a vertical point, where M is an integer greater than or equal to 2.
结合第二方面,在第二方面的某些实现方式中,以该顶点为起点绘制第二线条之前,将绘图模式切换为辅助画线模式。In combination with the second aspect, in some implementations of the second aspect, before drawing a second line with the vertex as a starting point, the drawing mode is switched to an auxiliary line drawing mode.
第三方面,提供了一种图形绘制方法。该方法包括:通过图形上的第一锚点调整已绘制图形时,计 算并显示已绘制图形中的角度和/或线长。In a third aspect, a method for drawing a graphic is provided. The method comprises: when adjusting a drawn graphic through a first anchor point on the graphic, Calculate and display angles and/or line lengths in drawn shapes.
基于上述方案,第一锚点可以理解为调整已绘制图形过程中移动的点,在绘图过程中,显示已绘制图形中的角度和/或线长,可以直观为用户提供绘图过程中的反馈,提高用户绘制出目标图形的速度,降低用户绘制目标图形的操作难度。Based on the above scheme, the first anchor point can be understood as a point that moves during the process of adjusting the drawn graphics. During the drawing process, the angle and/or line length in the drawn graphics are displayed, which can provide users with intuitive feedback during the drawing process, increase the speed at which users draw the target graphics, and reduce the difficulty of users drawing the target graphics.
结合第三方面,在第三方面的某些实现方式中,显示的角度和/或线长与该第一锚点关联。In combination with the third aspect, in certain implementations of the third aspect, the displayed angle and/or line length is associated with the first anchor point.
基于上述方案,可以仅显示用户调整图形的过程中会发生变化的角度和/或线长,节省角度和/或线长的计算资源。Based on the above solution, only the angles and/or line lengths that will change during the user's adjustment of the graphics can be displayed, saving calculation resources for the angles and/or line lengths.
结合第三方面,在第三方面的某些实现方式中,方法还包括:在已绘制图形中的线条上新增第二锚点,并显示第一距离和第二距离的比例,第一距离为第二锚点和该线条的第一端点之间的距离,第二距离为第二锚点和该线条的第二端点之间的距离。In combination with the third aspect, in certain implementations of the third aspect, the method also includes: adding a second anchor point on the line in the drawn figure, and displaying the ratio of the first distance and the second distance, the first distance being the distance between the second anchor point and the first endpoint of the line, and the second distance being the distance between the second anchor point and the second endpoint of the line.
示例地,第二锚点可以理解为已绘制图形中的某线条上新增的锚点,后续可以以该第二锚点为起点绘制线条,第一端点和第二端点为已绘制图形中该线条原有的端点。前述第一锚点可以是第一端点和第二端点中的任一端点,也可以是除第一端点和第二端点之外的端点,本申请对此不做限制。For example, the second anchor point can be understood as a newly added anchor point on a line in the drawn graphic, and a line can be subsequently drawn with the second anchor point as the starting point, and the first endpoint and the second endpoint are the original endpoints of the line in the drawn graphic. The aforementioned first anchor point can be any endpoint of the first endpoint and the second endpoint, or an endpoint other than the first endpoint and the second endpoint, and this application does not limit this.
基于上述方案,用户可以按需在已绘制图形的线条上增加一个或多个锚点,满足用户绘图的多样性需求。Based on the above solution, users can add one or more anchor points to the lines of the drawn graphics as needed to meet the diverse drawing needs of users.
第四方面,提供了一种装置,该装置包括执行上述第一方面至第三方面中任一方面或者第一方面至第三方面中任意一种可能的设计的方法的模块/单元;这些模块/单元可以通过硬件实现,也可以通过硬件执行相应的软件实现。In a fourth aspect, a device is provided, which includes modules/units for executing any one of the above-mentioned first to third aspects or any one of the possible designs of the first to third aspects; these modules/units can be implemented by hardware, or the corresponding software can be implemented by hardware.
第五方面,提供了一种电子设备,该电子设备包括一个或多个处理器;一个或多个存储器;该一个或多个存储器存储有一个或多个计算机程序,该一个或多个计算机程序包括指令,当该指令被上述一个或多个处理器执行时,使得上述第一方面至第三方面中的任一方面或者第一方面至第三方面中任意一种可能的实施方式中的方法被执行。In a fifth aspect, an electronic device is provided, which includes one or more processors; one or more memories; the one or more memories store one or more computer programs, and the one or more computer programs include instructions. When the instructions are executed by the one or more processors, the method in any aspect of the first to third aspects or any possible implementation of the first to third aspects is executed.
第六方面,提供了一种芯片,该芯片包括处理器和通信接口,该通信接口用于接收信号,并将信号传输至处理器,该处理器处理该信号,使得上述第一方面至第三方面中的任一方面或者第一方面至第三方面中任意一种可能的实施方式中的方法被执行。In the sixth aspect, a chip is provided, which includes a processor and a communication interface, wherein the communication interface is used to receive a signal and transmit the signal to the processor, and the processor processes the signal so that the method in any aspect of the first to third aspects or any possible implementation manner of the first to third aspects is executed.
第七方面,提供了一种计算机可读存储介质,其特征在于,该计算机可读存储介质包括计算机程序或指令,当该计算机程序或指令在计算机上运行时,使得上述第一方面至第三方面中的任一方面或者第一方面至第三方面中任意一种可能的实施方式中的方法被执行。In the seventh aspect, a computer-readable storage medium is provided, characterized in that the computer-readable storage medium includes a computer program or instructions, and when the computer program or instructions are run on a computer, the method of any aspect of the first to third aspects or any possible implementation scheme of the first to third aspects is executed.
第八方面,提供了一种计算机程序产品,其特征在于,该计算机程序产品包括计算机程序或指令,当该计算机程序或指令在计算机上运行时,使得上述第一方面至第三方面中的任一方面或者第一方面至第三方面中任意一种可能的实施方式中的方法被执行。In an eighth aspect, a computer program product is provided, characterized in that the computer program product includes a computer program or instructions, and when the computer program or instructions are run on a computer, the method of any aspect of the first to third aspects or any possible implementation scheme of the first to third aspects is executed.
上述第四方面至第八方面带来的有益效果可以参考第一方面至第三方面中有益效果的描述,不再赘述。The beneficial effects brought about by the fourth to eighth aspects mentioned above can be referred to the description of the beneficial effects in the first to third aspects and will not be repeated here.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1是本申请实施例提供的一种电子设备的硬件结构示意图。FIG1 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.
图2是本申请实施例提供的一种电子设备的软件结构框图。FIG. 2 is a software structure block diagram of an electronic device provided in an embodiment of the present application.
图3是本申请实施例提供的一种绘制图形的方法300的流程图。FIG. 3 is a flowchart of a method 300 for drawing graphics provided in an embodiment of the present application.
图4是本申请实施例提供的在已绘制图形中显示角度的示意图。FIG. 4 is a schematic diagram of displaying an angle in a drawn graphic provided in an embodiment of the present application.
图5是本申请实施例提供的在已绘制图形中显示线长的示意图。FIG. 5 is a schematic diagram of displaying line length in a drawn graphic provided by an embodiment of the present application.
图6是本申请实施例提供的在已绘制图形中显示角度和线长的示意图。FIG. 6 is a schematic diagram showing angles and line lengths in a drawn graphic provided by an embodiment of the present application.
图7是本申请实施例提供的方法300的具体流程图。FIG. 7 is a specific flow chart of method 300 provided in an embodiment of the present application.
图8是本申请实施例提供的一种绘制图形的方法800的流程图。FIG. 8 is a flowchart of a method 800 for drawing graphics provided in an embodiment of the present application.
图9-10是本申请实施例提供的在已绘制图形中显示辅助点的示意图。9-10 are schematic diagrams of displaying auxiliary points in a drawn graphic provided by an embodiment of the present application.
图11是本申请实施例提供的在已绘制图形中显示线条比例的示意图FIG. 11 is a schematic diagram showing the proportion of lines in a drawn graphic provided by an embodiment of the present application
图12是本申请实施例提供的方法800的具体流程图。FIG. 12 is a specific flow chart of method 800 provided in an embodiment of the present application.
图13是本申请实施例提供的一种绘制图形的方法1300的流程图。 FIG. 13 is a flowchart of a method 1300 for drawing graphics provided in an embodiment of the present application.
图14-16是本申请实施例提供的方案1情形下绘制或调整图形的示意图。14-16 are schematic diagrams of drawing or adjusting graphics under Scheme 1 provided in an embodiment of the present application.
图17-18是本申请实施例提供的方案2情形下绘制或调整图形的示意图。17-18 are schematic diagrams of drawing or adjusting graphics under Scheme 2 provided in an embodiment of the present application.
图19是本申请实施例提供的方法1300的具体流程图。FIG. 19 is a specific flow chart of method 1300 provided in an embodiment of the present application.
图20是本申请实施例提供的装置2000结构示意图。FIG. 20 is a schematic diagram of the structure of the device 2000 provided in an embodiment of the present application.
图21是本申请实施例提供的电子设备2100的结构示意图。FIG. 21 is a schematic diagram of the structure of an electronic device 2100 provided in an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。其中,在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,在本申请实施例的描述中,“复数个”或者“多个”是指两个或多于两个。The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. In the description of the embodiments of the present application, unless otherwise specified, "/" means or, for example, A/B can mean A or B; "and/or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and/or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "plurality" or "multiple" refers to two or more than two.
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。在本实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this embodiment, unless otherwise specified, "plurality" means two or more.
本申请实施例提供的方法可以应用于手机、平板电脑、可穿戴设备、车载设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)等电子设备上,本申请实施例对电子设备的具体类型不作任何限制。The method provided in the embodiments of the present application can be applied to electronic devices such as mobile phones, tablet computers, 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. The embodiments of the present application do not impose any restrictions on the specific types of electronic devices.
示例性的,图1示出了电子设备100的结构示意图。电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户身份识别(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。Exemplarily, FIG1 shows a schematic diagram of the structure of an electronic device 100. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and/or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated in one or more processors.
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了***的效率。The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户身份识别(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。 In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (SIM) interface, and/or a universal serial bus (USB) interface, etc.
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K,充电器,闪光灯,摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example, the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface, thereby realizing the touch function of the electronic device 100.
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.
MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等***器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate via the DSI interface to implement the display function of the electronic device 100.
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与***设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.
可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的 分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a wireless local area network. Diversity Antenna In some other embodiments, the antenna can be used in conjunction with a tuning switch.
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。The mobile communication module 150 can provide solutions for wireless communications including 2G/3G/4G/5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 may receive electromagnetic waves from the antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 may also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be arranged in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be arranged in the same device as at least some of the modules of the processor 110.
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星***(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR) and the like applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯***(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位***(global positioning system,GPS),全球导航卫星***(global navigation satellite system,GLONASS),北斗卫星导航***(beidou navigation satellite system,BDS),准天顶卫星***(quasi-zenith satellite system,QZSS)和/或星基增强***(satellite based augmentation systems,SBAS)。In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and/or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and/or a satellite based augmentation system (SBAS).
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diodes (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可 以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。The camera 193 is used to capture still images or videos. The object is projected onto the photosensitive element through the lens to generate an optical image. The photosensitive element can It is a charge coupled device (CCD) or complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then transmits the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos can be stored in the external memory card.
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作***,至少一个功能所需的App(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an App required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to microphone 170C to input the sound signal into microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the sound source, realize directional recording function, etc.
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。The earphone interface 170D is used to connect a wired earphone. The earphone interface 170D may be the USB interface 130, or may be a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力 阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。The pressure sensor 180A is used to sense pressure signals and can convert pressure signals into electrical signals. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation based on the pressure sensor 180A. The electronic device 100 can also calculate the position of the touch based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when the touch operation intensity is less than the first pressure When a touch operation with a strength greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a strength greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.
气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.
磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备100是翻盖机时,电子设备100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip leather case. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover according to the magnetic sensor 180D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover can be automatically unlocked.
加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.
距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备100通过发光二极管向外发射红外光。电子设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备100附近有物体。当检测到不充分的反射光时,电子设备100可以确定电子设备100附近没有物体。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.
环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池142加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。在一些实施例中,骨传导传感器180M也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于所述骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于所述骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。The bone conduction sensor 180M can obtain a vibration signal. In some embodiments, the bone conduction sensor 180M can obtain a vibration signal of a vibrating bone block of the vocal part of the human body. The bone conduction sensor 180M can also contact the human pulse to receive a blood pressure beat signal. In some embodiments, the bone conduction sensor 180M can also be set in an earphone and combined into a bone conduction earphone. The audio module 170 can parse out a voice signal based on the vibration signal of the vibrating bone block of the vocal part obtained by the bone conduction sensor 180M to realize a voice function. The application processor can parse the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 180M to realize a heart rate detection function.
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如, 作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, Touch operations applied to different applications (e.g., taking photos, playing audio, etc.) may correspond to different vibration feedback effects. Touch operations applied to different areas of the display screen 194 may also correspond to different vibration feedback effects for the motor 191. Different application scenarios (e.g., time reminders, receiving messages, alarm clocks, games, etc.) may also correspond to different vibration feedback effects. The touch vibration feedback effect may also support customization.
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
SIM卡接口195用于连接SIM卡。SIM卡可以通过***SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时***多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备100采用嵌入式SIM(embedded-SIM,eSIM)卡,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备100中,不能和电子设备100分离。The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 100 uses an embedded SIM (eSIM) card, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
应理解,本申请实施例中的电话卡包括但不限于SIM卡、eSIM卡、全球用户识别卡(universal subscriber identity module,USIM)、通用集成电话卡(universal integrated circuit card,UICC)等等。It should be understood that the phone cards in the embodiments of the present application include but are not limited to SIM cards, eSIM cards, universal subscriber identity modules (USIM), universal integrated circuit cards (UICC), and the like.
电子设备100的软件***可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本申请实施例以分层架构的Android***为例,示例性说明电子设备100的软件结构。The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device 100.
图2是本申请实施例的电子设备100的软件结构框图。分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android***分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和***库,以及内核层。应用程序层可以包括一系列应用程序包。FIG2 is a software structure diagram of the electronic device 100 of an embodiment of the present application. The layered architecture divides the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, namely, the application layer, the application framework layer, the Android runtime (Android runtime) and the system library, and the kernel layer. The application layer can include a series of application packages.
如图2所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。As shown in FIG. 2 , the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。The application framework layer provides application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
如图2所示,应用程序框架层可以包括窗口管理器,内容提供器,视图***,电话管理器,资源管理器,通知管理器等。As shown in FIG. 2 , the application framework layer may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, and the like.
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
视图***包括可视控件,例如显示文字的控件,显示图片的控件等。视图***可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
电话管理器用于提供电子设备100的通信功能。例如通话状态的管理(包括接通,挂断等)。The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including connecting, hanging up, etc.).
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在***顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
Android Runtime包括核心库和虚拟机。Android runtime负责安卓***的调度和管理。Android Runtime includes core libraries and virtual machines. Android Runtime is responsible for the scheduling and management of the Android system.
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。 The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
***库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(media libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。The system library can include multiple functional modules, such as surface manager, media libraries, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
表面管理器用于对显示子***进行管理,并且为多个应用程序提供了2D和3D图层的融合。The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
2D图形引擎是2D绘图的绘图引擎。A 2D graphics engine is a drawing engine for 2D drawings.
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
用户在使用绘图工具在电子设备上绘制目标图形(目标图形即为用户想要绘制的图形,例如目标图形为等腰三角形)的过程中,可以先使用绘图工具绘制一个三角形,电子设备可以识别该三角形将其调整为标准图形(例如,手绘的三角形的线段可能有弯曲,调整为标准图形后三角形的3条线段都是笔直的,没有弯曲),但该标准图形不一定是目标图形。When a user uses a drawing tool to draw a target graphic on an electronic device (the target graphic is the graphic that the user wants to draw, for example, the target graphic is an isosceles triangle), the user can first use the drawing tool to draw a triangle. The electronic device can recognize the triangle and adjust it to a standard graphic (for example, the line segments of a hand-drawn triangle may be curved, and after adjusting to the standard graphic, the three line segments of the triangle are all straight and have no curves), but the standard graphic is not necessarily the target graphic.
一种可能的实施方式,用户使用绘图工具绘制三角形以后,点击电子设备的显示屏幕选中三角形,并通过绘图工具选中三角形的顶点(例如线条的交点)移动,以此来改变三角形的形状,将手绘的三角形调整为等腰三角形。In one possible implementation, after the user draws a triangle using a drawing tool, he clicks on the display screen of the electronic device to select the triangle, and uses the drawing tool to select the vertices of the triangle (such as the intersection of lines) and move them to change the shape of the triangle, thereby adjusting the hand-drawn triangle to an isosceles triangle.
本申请实施例中的绘图工具例如是手写笔,手指,或鼠标、触摸板等外部设备,本申请对绘图工具的种类和具体形态不做限制。The drawing tool in the embodiments of the present application is, for example, a stylus, a finger, or an external device such as a mouse or a touchpad. The present application does not limit the type and specific form of the drawing tool.
在该实施方式中,用户可以通过眼睛判断角度大约相等,很难准确绘制等腰三角形。In this embodiment, the user can judge by eye that the angles are approximately equal, and it is difficult to accurately draw an isosceles triangle.
鉴于此,本申请实施例提供一种图形绘制方法,在用户绘制目标图形的过程中,以期提高用户绘制目标图形的速度,降低用户操作的难度。In view of this, an embodiment of the present application provides a graphics drawing method, which is intended to increase the speed at which the user draws the target graphics and reduce the difficulty of the user's operation during the process of the user drawing the target graphics.
图3是本申请实施例提供的一种绘制图形的方法,图3示例的方法300包括如下步骤:FIG. 3 is a method for drawing a graph provided by an embodiment of the present application. The method 300 illustrated in FIG. 3 includes the following steps:
S310,通过图形上的锚点调整已绘制图形时,计算与该锚点关联的角度和/或线长,该锚点是已绘制图形中N1个线条的交点,N1为大于或等于2的整数。S310, when adjusting a drawn graphic through an anchor point on the graphic, calculate the angle and/or line length associated with the anchor point, the anchor point is the intersection of N1 lines in the drawn graphic, and N1 is an integer greater than or equal to 2.
一种可能的实施方式,通过图形上的锚点调整已绘制图形时,计算与该锚点关联的角度。In one possible implementation, when adjusting a drawn graphic through an anchor point on the graphic, an angle associated with the anchor point is calculated.
另一种可能的实施方式,通过图形上的锚点调整已绘制图形时,计算与该锚点关联的线长。Another possible implementation is to calculate the line length associated with the anchor point when adjusting the drawn graphic through the anchor point on the graphic.
又一种可能的实施方式,通过图形上的锚点调整已绘制图形时,计算与该锚点关联的角度和线长。In another possible implementation, when adjusting a drawn graphic through an anchor point on the graphic, the angle and line length associated with the anchor point are calculated.
示例地,当已绘制图形处于编辑状态时,可以显示已绘制图形的锚点,用手写笔选中任意一个锚点并移动可以改变已绘制图形中的角度和/或线条长度,在角度和/或线条长度改变过程中可以实时计算角度和/或线条长度的值。For example, when a drawn graphic is in an editing state, the anchor points of the drawn graphic can be displayed. Selecting any anchor point with a stylus and moving it can change the angle and/or line length in the drawn graphic. During the process of changing the angle and/or line length, the value of the angle and/or line length can be calculated in real time.
当锚点的状态为锁定状态时,可以理解为与锚点关联的线条处于锁定状态,移动锚点时,与锚点锁定的线条会随着锚点的移动发生变化。已绘制图形可以理解为在调整或编辑图形前已经绘制的图形,已绘制图形可以是由线条组成的封闭图形,例如多边形、圆、五角星等,或者已绘制图形也可以是非封闭图形,但该非封闭图形中包括线条的交点。线条可以包括线段或曲线,本申请实施例对上述不做限制。When the state of the anchor point is locked, it can be understood that the line associated with the anchor point is in a locked state. When the anchor point is moved, the line locked with the anchor point will change with the movement of the anchor point. The drawn figure can be understood as a figure that has been drawn before adjusting or editing the figure. The drawn figure can be a closed figure composed of lines, such as a polygon, a circle, a five-pointed star, etc., or the drawn figure can also be a non-closed figure, but the non-closed figure includes the intersection of the lines. The line can include a line segment or a curve, and the embodiment of the present application does not limit the above.
S320,将计算得到的角度或线长标注到已绘制图形上。S320, marking the calculated angle or line length on the drawn figure.
可能的实施方式#1,将计算得到的角度标注到已绘制图形上。Possible implementation #1: annotate the calculated angle onto the drawn figure.
示例地,如图4所示,已绘制图形为401,用户选中线段A1C1,显示锚点A1、C1(402),选择锚点A1调整三角形,在调整的过程中可以显示三角形中的角度值,如403,在调整三角形的过程中,各角度值可以以1°为单位进行变化,本申请对此不做限制。当用户水平移动锚点A1时,可以显示水平辅助线,手写笔落点的移动方向与水平辅助线的夹角在阈值范围内时,可以吸附水平辅助线,阈值可自行设置。例如,手写笔落点的移动方向与水平辅助线的夹角在±5°范围内,可以吸附水平辅助线,帮助用户水平移动锚点A1(404)。当用户垂直移动锚点A1时,可以显示垂直辅助线,手写笔落点的移动方向与垂直辅助线的夹角在阈值范围内时,可以吸附垂直辅助线,阈值可自行设置。例如,手写笔落点的移动方向与垂直辅助线的夹角在±5°范围内,可以吸附垂直辅助线,帮助用户垂直移动锚点A1(405)。当移动锚点A1至与另一锚点B1水平(和/或垂直)后,可以显示水平(和/或垂直)辅助线,手写笔落点与另一锚点的连线与水平(和/或垂直)辅助线的夹角在阈值范围内时,可以吸附水平(和/或垂直)辅助线,阈值可自行设置,例如阈值可设置为±5°,用于帮助用户对齐锚点(406)。 For example, as shown in FIG4 , the drawn figure is 401, the user selects the line segment A1C1, and the anchor points A1 and C1 (402) are displayed. The anchor point A1 is selected to adjust the triangle. During the adjustment process, the angle value in the triangle can be displayed, such as 403. During the adjustment of the triangle, each angle value can be changed in units of 1°, and the present application does not impose any restrictions on this. When the user moves the anchor point A1 horizontally, a horizontal auxiliary line can be displayed. When the angle between the moving direction of the stylus landing point and the horizontal auxiliary line is within the threshold range, the horizontal auxiliary line can be adsorbed, and the threshold can be set by oneself. For example, when the angle between the moving direction of the stylus landing point and the horizontal auxiliary line is within the range of ±5°, the horizontal auxiliary line can be adsorbed to help the user move the anchor point A1 horizontally (404). When the user moves the anchor point A1 vertically, a vertical auxiliary line can be displayed. When the angle between the moving direction of the stylus landing point and the vertical auxiliary line is within the threshold range, the vertical auxiliary line can be adsorbed, and the threshold can be set by oneself. For example, if the angle between the moving direction of the stylus point and the vertical auxiliary line is within the range of ±5°, the vertical auxiliary line can be adsorbed to help the user move the anchor point A1 vertically (405). After the anchor point A1 is moved to be horizontal (and/or vertical) with another anchor point B1, the horizontal (and/or vertical) auxiliary line can be displayed. When the angle between the line connecting the stylus point and another anchor point and the horizontal (and/or vertical) auxiliary line is within the threshold range, the horizontal (and/or vertical) auxiliary line can be adsorbed. The threshold can be set by oneself, for example, the threshold can be set to ±5° to help the user align the anchor points (406).
再例如,已绘制图形为411,用户选中线段A2B2,显示锚点A2、B2(412),选择锚点A2调整四边形(413),在调整的过程中显示四边形中的角度值,如414。当用户水平移动锚点A2时,可以显示水平辅助线,帮助用户水平移动锚点A2(414)。当用户垂直移动锚点A2时,可以显示垂直辅助线,帮助用户垂直移动锚点A2(415)。当移动锚点A2至与另一锚点B2水平(和/或垂直)后,可以显示水平(和/或垂直)辅助线,用于帮助用户对齐锚点(416)。For another example, the drawn figure is 411, the user selects the line segment A2B2, the anchor points A2 and B2 are displayed (412), the anchor point A2 is selected to adjust the quadrilateral (413), and the angle value in the quadrilateral is displayed during the adjustment process, such as 414. When the user moves the anchor point A2 horizontally, a horizontal auxiliary line can be displayed to help the user move the anchor point A2 horizontally (414). When the user moves the anchor point A2 vertically, a vertical auxiliary line can be displayed to help the user move the anchor point A2 vertically (415). After moving the anchor point A2 to be horizontal (and/or vertical) with another anchor point B2, a horizontal (and/or vertical) auxiliary line can be displayed to help the user align the anchor points (416).
本申请实施例对移动锚点时显示的辅助线不做限制,例如移动锚点时显示的辅助线还可以是平行线。例如,在402中当移动锚点C1时,可以在C1的位置处可以显示A1B1的平行线。The embodiment of the present application does not limit the auxiliary lines displayed when the anchor point is moved. For example, the auxiliary lines displayed when the anchor point is moved may also be parallel lines. For example, in 402, when the anchor point C1 is moved, parallel lines A1B1 may be displayed at the position of C1.
本申请实施例中的垂直辅助线可以理解为相对已绘制图形某条边的垂直线,垂直是指相对某条已绘制边垂直,如图4中417所示,垂直辅助线并非相对于水平线垂直。后文描述的垂直辅助线也同此理解。The vertical auxiliary line in the embodiment of the present application can be understood as a vertical line relative to a certain edge of the drawn figure, and vertical means vertical relative to a certain drawn edge, as shown by 417 in Figure 4, and the vertical auxiliary line is not vertical relative to the horizontal line. The vertical auxiliary lines described below are also understood in the same way.
可以理解,在上述实施方式#1中,在通过锚点调整已绘制图形的过程中,可以显示已绘制图形中的所有角度,例如403/404/405/406。或者也可以只显示与移动的锚点关联的角度,例如414/415/416。本申请对此不做限制。与移动的锚点关联的角度,可以理解为移动该锚点时大小会发生变化的角度。It can be understood that in the above implementation #1, in the process of adjusting the drawn graphics through the anchor point, all angles in the drawn graphics can be displayed, such as 403/404/405/406. Or only the angles associated with the moved anchor point can be displayed, such as 414/415/416. This application does not limit this. The angle associated with the moved anchor point can be understood as the angle whose size will change when the anchor point is moved.
还可以理解,在上述实施方式#1中,在通过锚点调整已绘制图形的过程中,针对已绘制图形的特殊角度状态可以有强调显示效果,例如两个角度相等时,可以将相等的两个角度用突出的颜色显示、或者放大角度值、或者改变角度值的颜色使之与已绘制图形的颜色区分。可选的,此时手写笔轻微的移动锚点不会造成角度的立即变化,手写笔移动距离超过一定阈值时角度会继续变化。It can also be understood that in the above implementation #1, in the process of adjusting the drawn graphics through the anchor point, there can be an emphasis display effect for the special angle state of the drawn graphics. For example, when two angles are equal, the two equal angles can be displayed in a prominent color, or the angle value can be enlarged, or the color of the angle value can be changed to distinguish it from the color of the drawn graphics. Optionally, at this time, a slight movement of the anchor point by the stylus pen will not cause an immediate change in the angle, and the angle will continue to change when the stylus pen moves a distance exceeding a certain threshold.
可能的实施方式#2,将计算得到的线长标注到已绘制图形上。Possible implementation #2 is to mark the calculated line length onto the drawn graphic.
示例地,如图5所示,已绘制图形为501,用户选中线段A1C1,显示锚点A1、C1(402),选择锚点A1调整三角形,在调整的过程中显示三角形中的线段长度,如503,在调整三角形的过程中,线段长度值可以以1mm(毫米)为单位进行变化,本申请对此不做限制。当用户水平移动锚点A1时,可以显示水平辅助线,手写笔落点的移动方向与水平辅助线的夹角在阈值范围内时,可以吸附水平辅助线,阈值可自行设置(504)。当用户垂直移动锚点A1时,可以显示垂直辅助线,手写笔落点的移动方向与垂直辅助线的夹角在阈值范围内时,可以吸附垂直辅助线,阈值可自行设置(505)。当移动锚点A1至与另一锚点B1水平(和/或垂直)后,可以显示水平(和/或垂直)辅助线,手写笔落点与另一锚点的连线与水平(和/或垂直)辅助线的夹角在阈值范围内时,可以吸附水平(和/或垂直)辅助线,阈值可自行设置(506)。For example, as shown in FIG5 , the drawn figure is 501, the user selects the line segment A1C1, and the anchor points A1 and C1 are displayed (402). The anchor point A1 is selected to adjust the triangle, and the length of the line segment in the triangle is displayed during the adjustment process, such as 503. During the adjustment of the triangle, the line segment length value can be changed in units of 1 mm (millimeter), and the present application does not impose any restrictions on this. When the user moves the anchor point A1 horizontally, a horizontal auxiliary line can be displayed. When the angle between the moving direction of the stylus landing point and the horizontal auxiliary line is within the threshold range, the horizontal auxiliary line can be adsorbed, and the threshold can be set by oneself (504). When the user moves the anchor point A1 vertically, a vertical auxiliary line can be displayed. When the angle between the moving direction of the stylus landing point and the vertical auxiliary line is within the threshold range, the vertical auxiliary line can be adsorbed, and the threshold can be set by oneself (505). When the anchor point A1 is moved to be horizontal (and/or vertical) with another anchor point B1, a horizontal (and/or vertical) auxiliary line can be displayed. When the angle between the line connecting the stylus landing point and another anchor point and the horizontal (and/or vertical) auxiliary line is within a threshold range, the horizontal (and/or vertical) auxiliary line can be adsorbed. The threshold can be set by oneself (506).
再例如,已绘制图形为511,用户选中线段A2B2,显示锚点A2、B2(512),选择锚点A2调整四边形(513),在调整的过程中可以显示四边形中的线段长度值,如514。当用户水平移动锚点A2时,可以显示水平辅助线(514)。当用户垂直移动锚点A2时,可以显示垂直辅助线(515)。当移动锚点A2至与另一锚点B2水平(和/或垂直)后,可以显示水平(和/或垂直)辅助线(516)。For another example, the drawn figure is 511, the user selects the line segment A2B2, the anchor points A2 and B2 are displayed (512), and the anchor point A2 is selected to adjust the quadrilateral (513). During the adjustment process, the line segment length value in the quadrilateral can be displayed, such as 514. When the user moves the anchor point A2 horizontally, a horizontal auxiliary line can be displayed (514). When the user moves the anchor point A2 vertically, a vertical auxiliary line can be displayed (515). When the anchor point A2 is moved to be horizontal (and/or vertical) with another anchor point B2, a horizontal (and/or vertical) auxiliary line can be displayed (516).
在该实施方式中,对移动锚点时显示的辅助线不做限制,例如移动锚点时显示的辅助线还可以是平行线。In this embodiment, there is no restriction on the auxiliary lines displayed when the anchor point is moved. For example, the auxiliary lines displayed when the anchor point is moved may also be parallel lines.
可以理解,在上述实施方式#2中,在通过锚点调整已绘制图形的过程中,可以显示已绘制图形中的所有线段长度,例如503/504/505/506。或者也可以只显示与移动的锚点关联的线长,例如514/515/516。本申请对此不做限制。与移动的锚点关联的线长,可以理解为移动该锚点时长度会发生变化的线条。It can be understood that in the above implementation #2, in the process of adjusting the drawn graphics through the anchor point, the lengths of all line segments in the drawn graphics can be displayed, such as 503/504/505/506. Alternatively, only the line lengths associated with the moved anchor point can be displayed, such as 514/515/516. This application does not limit this. The line length associated with the moved anchor point can be understood as a line whose length changes when the anchor point is moved.
还可以理解,在上述实施方式#2中,在通过锚点调整已绘制图形的过程中,针对已绘制图形的特殊线段状态可以有强调显示效果,例如两个线段长度相等时,可以将相等的两个线段用突出的颜色显示、或者放大线段长度值、或者改变线段长度值的颜色使之与已绘制图形的颜色区分。可选的,此时手写笔轻微的移动锚点不会造成线段长度值的立即变化,手写笔移动距离超过一定阈值时线段长度会继续变化。It can also be understood that in the above implementation #2, in the process of adjusting the drawn graphics through the anchor point, the special line segment state of the drawn graphics can have an emphasized display effect, for example, when the lengths of two line segments are equal, the two equal line segments can be displayed in a prominent color, or the line segment length value can be enlarged, or the color of the line segment length value can be changed to distinguish it from the color of the drawn graphics. Optionally, at this time, a slight movement of the anchor point by the stylus pen will not cause an immediate change in the line segment length value, and the line segment length will continue to change when the stylus pen moves a distance exceeding a certain threshold.
可能的实施方式#3,将计算得到的角度和线长标注到已绘制图形上。Possible implementation #3 is to annotate the calculated angle and line length onto the drawn figure.
该实施方式#3结合了上两种实施方式,如图6所示。关于实施方式#3的具体描述,可以参见上述实施方式#1和实施方式#2中的相关表述,在此不做赘述。This implementation #3 combines the above two implementations, as shown in Figure 6. For a detailed description of implementation #3, please refer to the relevant descriptions in the above implementation #1 and implementation #2, which will not be repeated here.
示例地,上述不同的实施方式可以通过绘图模式的切换实现,例如,可能的实施方式#1可以在角度调节模式下实现,可能的实施方式#2可以在线条调节模式下实现,可能的实施方式#3可以在角度和线条调节模式下实现,上述模式可以在手写笔的操作下进行切换,本申请对切换的方式不做限制。本 申请对上述模式的名称也不做限制。上述3种模式可以是图形调节模式下的子模式,本申请对此也不做限制。For example, the above different implementations can be implemented by switching drawing modes. For example, possible implementation #1 can be implemented in angle adjustment mode, possible implementation #2 can be implemented in line adjustment mode, and possible implementation #3 can be implemented in angle and line adjustment mode. The above modes can be switched under the operation of the stylus, and the present application does not limit the switching method. The application does not impose any restrictions on the names of the above modes. The above three modes may be sub-modes of the graphic adjustment mode, and the application does not impose any restrictions on this.
可选地,在上述实施方式#1、#2、#3的示例中,选中线条后,可以显示线条的端点的状态。Optionally, in the examples of implementation modes #1, #2, and #3 above, after a line is selected, the status of the endpoints of the line may be displayed.
可选地,在上述实施方式#1、#2、#3的示例中,被选中的线条可以有特殊显示效果,例如被选中的线条的颜色与其他线条的颜色不同。Optionally, in the examples of implementation modes #1, #2, and #3 above, the selected line may have a special display effect, for example, the color of the selected line is different from the colors of other lines.
例如,选中线段后,该线段的颜色可以发生变化,该线段的两个端点附近也可以显示端点的状态标识。状态标识可以用于确定端点处于锁定状态还是解锁状态。如图4中的402所示,选中线段A1C1后,显示端点A1、C1的状态都处于锁定状态,即A1、C1都为锁定状态的锚点。端点A1处于锁定状态可以理解为:线条A1B1和A1C1是锁定的,移动端点A1时线条A1B1和A1C1都会随A1的移动发生变化。端点A1处于解锁状态可以理解为:线条A1B1和A1C1是解锁的,即移动A1时线条A1B1和A1C1中只有一个线条会随着A1的移动发生变化,如果选中的是A1B1,则A1B1随A1的移动发生变化,如果选中的是A1C1,则A1C1随A1的移动发生变化。本申请实施例中端点的锁定状态和解锁状态同此理解。For example, after a line segment is selected, the color of the line segment can change, and the state identifier of the endpoint can also be displayed near the two endpoints of the line segment. The state identifier can be used to determine whether the endpoint is in a locked state or an unlocked state. As shown in 402 in Figure 4, after the line segment A1C1 is selected, the states of the endpoints A1 and C1 are both in a locked state, that is, A1 and C1 are anchor points in the locked state. Endpoint A1 being in a locked state can be understood as: lines A1B1 and A1C1 are locked, and when endpoint A1 is moved, lines A1B1 and A1C1 will change with the movement of A1. Endpoint A1 being in an unlocked state can be understood as: lines A1B1 and A1C1 are unlocked, that is, when A1 is moved, only one of lines A1B1 and A1C1 will change with the movement of A1, if A1B1 is selected, A1B1 will change with the movement of A1, and if A1C1 is selected, A1C1 will change with the movement of A1. The locked state and unlocked state of the endpoints in the embodiment of the present application are understood in the same way.
需要说明的是,本申请实施例的示例图中端点、顶点或锚点的状态标识以小锁为示例,以关闭的锁示例锁定状态,以打开的锁示例解锁状态,本申请对状态标识的显示符号不做限制。It should be noted that the status identification of endpoints, vertices or anchor points in the example diagram of the embodiment of the present application takes a small lock as an example, a closed lock as an example of a locked state, and an open lock as an example of an unlocked state. The present application does not impose any restrictions on the display symbols of the status identification.
可选地,在上述实施方式#1、#2、#3的示例中,用户通过移动某端点重新绘制与该端点关联的线条的过程中,该线条可以有特殊显示效果,例如与该端点关联的线条的颜色与其他线条的颜色不同。Optionally, in the examples of implementations #1, #2, and #3 above, when the user redraws a line associated with an endpoint by moving the endpoint, the line may have a special display effect, for example, the color of the line associated with the endpoint may be different from that of other lines.
在本申请实施例中,端点可以理解为线条的端点。顶点可以理解为重合的端点或端点中的交点。锚点可以理解为已绘制图形中可编辑的端点或顶点,锚点可编辑例如可以以锚点为起点绘制线条,或者可以通过移动锚点调整已绘制图形等,锚点的状态可以是锁定状态,也可以是解锁状态,本申请对此不做限制。锚点或顶点处于锁定状态或解锁状态的理解与端点处于锁定状态或解锁状态的理解类似,不再赘述。In the embodiments of the present application, an endpoint can be understood as an endpoint of a line. A vertex can be understood as an overlapping endpoint or an intersection of endpoints. An anchor point can be understood as an editable endpoint or vertex in a drawn graphic. The anchor point can be edited, for example, a line can be drawn with the anchor point as the starting point, or the drawn graphic can be adjusted by moving the anchor point, etc. The state of the anchor point can be a locked state or an unlocked state, and the present application does not limit this. The understanding of an anchor point or a vertex being in a locked state or an unlocked state is similar to the understanding of an endpoint being in a locked state or an unlocked state, and will not be repeated.
可以理解,方法300的执行主体可以是绘图软件或者安装了绘图软件的电子设备,本申请对此不做限制。It can be understood that the execution subject of method 300 can be drawing software or an electronic device installed with drawing software, and this application does not limit this.
方法300提供的方案,在绘图过程中,在已绘制图形中显示角度和/或线长,可以直观为用户提供绘图过程中的反馈,提高用户绘制出目标图形的速度,降低用户绘制目标图形的操作难度。The solution provided by method 300 displays the angle and/or line length in the drawn graphics during the drawing process, which can provide the user with intuitive feedback during the drawing process, increase the speed at which the user draws the target graphics, and reduce the difficulty of the user drawing the target graphics.
下面通过图7的示例详细描述根据锚点调整图形的具体流程,但应理解,图7仅为示例,不对本申请的保护范围造成限制。方法700包括如下步骤:The specific process of adjusting the graphics according to the anchor point is described in detail below by using the example of FIG. 7 , but it should be understood that FIG. 7 is only an example and does not limit the protection scope of the present application. The method 700 includes the following steps:
701,检测到手写笔操作。701, a stylus operation is detected.
例如,检测到手写笔落在电子设备的显示屏幕上。示例性的,可以通过检测ACTION_DOWN事件确定手写笔落在电子设备的显示屏幕上。For example, it is detected that the stylus falls on the display screen of the electronic device. Exemplarily, it can be determined that the stylus falls on the display screen of the electronic device by detecting an ACTION_DOWN event.
702,判断是否处于角度调节模式和/或线长调节模式?702, determine whether it is in the angle adjustment mode and/or the line length adjustment mode?
例如,判断是否处于角度调节模式,若判断处于角度调节模式则进入703,若判断没有处于角度调节模式,则可以根据用户的需要将其切换为角度调节模式。For example, it is determined whether the system is in the angle adjustment mode. If it is determined to be in the angle adjustment mode, the process proceeds to 703. If it is determined not to be in the angle adjustment mode, the process may be switched to the angle adjustment mode according to the needs of the user.
或者判断是否处于线长调节模式,若判断处于线长调节模式则进入703,若判断没有处于线长调节模式,则可以根据用户的需要将其切换为线长调节模式。Or determine whether it is in the line length adjustment mode. If it is determined to be in the line length adjustment mode, enter 703. If it is determined not to be in the line length adjustment mode, it can be switched to the line length adjustment mode according to user needs.
或者判断是否处于角度和线长调节模式,若判断处于角度和线长调节模式则进入703,若判断没有处于角度和线长调节模式,则可以根据用户的需要将其切换为角度和线长调节模式。Or determine whether it is in the angle and line length adjustment mode. If it is determined to be in the angle and line length adjustment mode, enter 703. If it is determined not to be in the angle and line length adjustment mode, it can be switched to the angle and line length adjustment mode according to user needs.
703,判断手写笔落点是否为图形锚点。703, determining whether the landing point of the stylus pen is a graphic anchor point.
例如,判断手写笔的落点是已绘制图形的锚点,则进入704,若判断手写笔的落点不是已绘制图形的锚点,可根据用户的需要移动手写笔的落点使其落在已绘制图形的锚点上。For example, if it is determined that the landing point of the stylus pen is the anchor point of the drawn figure, then enter 704. If it is determined that the landing point of the stylus pen is not the anchor point of the drawn figure, the landing point of the stylus pen can be moved according to the user's needs so that it falls on the anchor point of the drawn figure.
704,确定该锚点是当前用户编辑的锚点。704 , determining that the anchor point is the anchor point currently edited by the user.
705,确定图形调整过程中受该锚点影响的其他锚点。705 , determining other anchor points affected by the anchor point during the graphic adjustment process.
例如,图形调整过程中,由于该锚点的移动,一些锚点关联的角度和/或线长会变化,则这些锚点即为受该锚点影响的其他锚点。For example, during the graphic adjustment process, the angles and/or line lengths associated with some anchor points may change due to the movement of the anchor point, and these anchor points are the other anchor points affected by the anchor point.
706,计算图形调整过程中受该锚点影响的角度和/或线长。706 , calculating the angle and/or line length affected by the anchor point during the graphic adjustment process.
例如,若702中判断是处于角度调节模式,则706中计算图形调整过程中受该锚点影响的角度, 或者计算图形调整过程中该图形上所有的角度。For example, if it is determined in 702 that the angle adjustment mode is in progress, then in 706 the angle affected by the anchor point during the graphic adjustment process is calculated. Or calculate all angles on the figure during the figure adjustment process.
若702中判断是处于线长调节模式,则706中计算图形调整过程中受该锚点影响的线长,或者计算图形调整过程中该图形上所有的线长。If it is determined in 702 that the mode is in line length adjustment mode, then in 706 the line length affected by the anchor point during the graphic adjustment process is calculated, or the length of all lines on the graphic during the graphic adjustment process is calculated.
若702中判断是处于角度和线长调节模式,则706中计算图形调整过程中受该锚点影响的角度和线长,或者计算图形调整过程中该图形上所有的角度和线长。If it is determined in 702 that the mode is angle and line length adjustment, then in 706 the angle and line length affected by the anchor point during the graphic adjustment process are calculated, or all angles and line lengths on the graphic during the graphic adjustment process are calculated.
707,将计算得到的角度和/或线长标注到该图形相应的位置上。707, marking the calculated angle and/or line length at the corresponding position of the graphic.
例如,若702中判断是处于角度调节模式,则707中标注的是受该锚点影响的角度,或者该图形上所有的角度。For example, if it is determined in 702 that the angle adjustment mode is in progress, then what is marked in 707 is the angle affected by the anchor point, or all the angles on the graph.
若702中判断是处于线长调节模式,则707中标注的是受该锚点影响的线长,或者该图形上所有的线长。If it is determined in 702 that the line length adjustment mode is in progress, then what is marked in 707 is the line length affected by the anchor point, or all the line lengths on the graph.
若702中判断是处于角度和线长调节模式,则707中标注的是受该锚点影响的角度和线长,或者所有的角度和线长。If it is determined in 702 that the mode is angle and line length adjustment, then what is marked in 707 is the angle and line length affected by the anchor point, or all angles and line lengths.
具体标注的示例可参见图4、图5和图6。For specific marking examples, please refer to Figures 4, 5 and 6.
708,是否检测到手写笔笔迹移动?708, Is stylus pen movement detected?
例如,若检测到手写笔笔迹移动,则进入709,若没有检测到手写笔笔迹移动,则进入710。For example, if the movement of the stylus pen is detected, the process proceeds to step 709 , and if the movement of the stylus pen is not detected, the process proceeds to step 710 .
709,基于锚点的新位置重新绘制图形。709, redraw the graphic based on the new position of the anchor point.
例如,该锚点移动到某新位置,与该锚点关联的线条也会更新。For example, if the anchor point moves to a new location, the line associated with the anchor point is also updated.
710,判断手写笔落点是否离开该图形?710, determine whether the landing point of the stylus pen leaves the graphic?
例如,可以通过判断手写笔是否抬起,或判断手写笔是否离开电子设备的屏幕,从而判断手写笔落点是否离开该图形。示例性的,可以通过检测ACTION_UP事件确定手写笔是否离开该图形。For example, it is possible to determine whether the stylus is lifted or whether the stylus leaves the screen of the electronic device, thereby determining whether the stylus point leaves the graphic. Exemplarily, it is possible to determine whether the stylus leaves the graphic by detecting an ACTION_UP event.
若判断手写笔离开该图形,则进入711;若判断手写笔没有离开该图形,则重新进入706。If it is determined that the stylus has left the graphic, the process proceeds to step 711 ; if it is determined that the stylus has not left the graphic, the process proceeds to step 706 again.
711,结束编辑。711, end of editing.
其中,711可以理解为已绘制图形的角度和/或线长调节结束。可选的,结束编辑后,已绘制的图形上可以不再显示角度和/或线长。Among them, 711 can be understood as the adjustment of the angle and/or line length of the drawn graphic is completed. Optionally, after the editing is completed, the angle and/or line length may no longer be displayed on the drawn graphic.
图7示例的流程的执行主体可以是绘图软件或者安装了绘图软件的电子设备,本申请对此不做限制。The execution subject of the process illustrated in FIG. 7 may be drawing software or an electronic device on which drawing software is installed, and this application does not impose any limitation on this.
基于方法300或图7示例的流程,可以使得用户在不借助其他辅助工具的情况下,方便快捷的将已绘制图形中的角度或线长调整为目标数值,可以提升图形绘制的交互效率。Based on the process of method 300 or the example of FIG. 7 , the user can conveniently and quickly adjust the angle or line length in the drawn graphics to the target value without the aid of other auxiliary tools, thereby improving the interactive efficiency of graphics drawing.
图8是本申请实施例提供的另一种绘制图形的方法,图8示例的方法800包括如下步骤:FIG8 is another method for drawing a graph provided by an embodiment of the present application. The method 800 illustrated in FIG8 includes the following steps:
S810,以已绘制图形上的顶点为起点绘制线条。S810, drawing a line with a vertex on the drawn figure as a starting point.
示例地,以已绘制图形上的顶点为起点绘制线条#1,该顶点为已绘制图形中N2个线条的交点,或者是已绘制图形上的点,其中,N2为大于或等于2的整数。For example, line #1 is drawn with a vertex on the drawn figure as a starting point, where the vertex is an intersection of N2 lines in the drawn figure, or a point on the drawn figure, where N2 is an integer greater than or equal to 2.
S820,在该已绘制图形上即将与该线条的延长线相交的线条上显示辅助点。S820, displaying an auxiliary point on a line of the drawn graphic that is about to intersect with an extension line of the line.
示例地,在该已绘制图形上即将与该线条#1的延长线相交的线条#2上显示辅助点。For example, an auxiliary point is displayed on line #2 on the drawn graphic that is about to intersect with the extension line of line #1.
可能的实施方式#1,已绘制图形上即将与该线条#1的延长线相交的线条有多个,在该多个线条上都显示辅助点。Possible implementation #1: There are multiple lines on the drawn figure that are about to intersect with the extension line of line #1, and auxiliary points are displayed on the multiple lines.
可能的实施方式#2,在已绘制图形上即将与该线条#1的延长线相交的第一个线条上显示辅助点。Possible implementation #2 is to display an auxiliary point on the first line of the drawn figure that is about to intersect with the extension line of line #1.
示例地,辅助点包括中点,角平分点,M等分点,或垂点等。For example, the auxiliary points include midpoints, angle bisectors, M-bisectors, or perpendicular points, etc.
基于方法800,用户可以在已绘制图形处于辅助画线模式时,给已绘制图形添加任意辅助线条,方法800可以引导用户快速的绘制出任意辅助线条。Based on the method 800 , the user can add any auxiliary line to the drawn graphic when the drawn graphic is in the auxiliary line drawing mode. The method 800 can guide the user to quickly draw any auxiliary line.
如图9所示,已绘制图形为三角形,手写笔的落点靠近顶点A时可以显示有自动吸附辅助线,例如水平和垂直辅助线。当以顶点A为起点绘制的线段达到一定长度后可以显示该线段与两边的夹角(901或911)。当以顶点A为起点绘制的线段AO接近垂直线时,可以在线段BC上显示垂直点(902或912)。当以顶点A为起点绘制的线段AO接近角平分线时,可以在线段BC上显示角平分点(903或913)。当以顶点A为起点绘制的线段AO接近中线时,可以在线段BC上显示中点(904或914),示例性的,在914中,线段AC上也可以显示中点。此外,示例性的,除了显示辅助点之外,还可以在辅助点旁边显示辅助点的类型信息,例如中点,角平分点,M等分点,或垂点等。 As shown in FIG. 9 , the drawn figure is a triangle, and when the landing point of the stylus is close to vertex A, automatic adsorption auxiliary lines, such as horizontal and vertical auxiliary lines, can be displayed. When the line segment drawn from vertex A reaches a certain length, the angle between the line segment and the two sides can be displayed (901 or 911). When the line segment AO drawn from vertex A is close to the vertical line, the vertical point (902 or 912) can be displayed on the line segment BC. When the line segment AO drawn from vertex A is close to the angle bisector, the angle bisector point (903 or 913) can be displayed on the line segment BC. When the line segment AO drawn from vertex A is close to the midline, the midpoint (904 or 914) can be displayed on the line segment BC. For example, in 914, the midpoint can also be displayed on the line segment AC. In addition, for example, in addition to displaying the auxiliary point, the type information of the auxiliary point can also be displayed next to the auxiliary point, such as the midpoint, the angle bisector point, the M-segment point, or the vertical point.
在912/913/914中,显示辅助点的线段为与AO的延长线即将相交的第一个线段即BC。在915/917中显示辅助点的线段为与AO的延长线即将相交的第一个线段即BD,在916中显示辅助点的线段为与AO的延长线即将相交的第一个线段即CD。当915/916/917中手写笔的笔迹回跑到912/913/914的状态时,即AO即将与BC相交,显示辅助点的线段依然是BC。In 912/913/914, the line segment showing the auxiliary point is the first line segment that will intersect with the extension line of AO, namely BC. In 915/917, the line segment showing the auxiliary point is the first line segment that will intersect with the extension line of AO, namely BD. In 916, the line segment showing the auxiliary point is the first line segment that will intersect with the extension line of AO, namely CD. When the handwriting of the stylus in 915/916/917 returns to the state of 912/913/914, that is, AO is about to intersect with BC, the line segment showing the auxiliary point is still BC.
例如,已绘制图形为圆,手写笔的落点靠近顶点A(圆上与垂直线相交的点)时可以有自动吸附辅助线,例如水平和垂直辅助线(1001)。当以顶点A为起点绘制的线段AO接近圆心时,可以显示水平、垂直辅助线,可以自动吸附在圆心位置(1002)。当以顶点A为起点绘制的线段AO接近水平中点时,可以显示中点辅助线(1003)。当以顶点A为起点绘制的线段AO接近垂直点时,可以显示垂直辅助线(1004)。For example, if the drawn figure is a circle, when the landing point of the stylus is close to vertex A (the point on the circle that intersects with the vertical line), there may be automatic adsorption auxiliary lines, such as horizontal and vertical auxiliary lines (1001). When the line segment AO drawn with vertex A as the starting point approaches the center of the circle, the horizontal and vertical auxiliary lines may be displayed and may be automatically adsorbed at the center of the circle (1002). When the line segment AO drawn with vertex A as the starting point approaches the horizontal midpoint, the midpoint auxiliary line (1003) may be displayed. When the line segment AO drawn with vertex A as the starting point approaches the vertical point, the vertical auxiliary line (1004) may be displayed.
再例如,以圆心为顶点绘制半径(1005),当通过圆心绘制第二条半径时,针对用户绘制的趋向分析,可以显示剩余的等分点。例如用户绘制的第二条半径和第一条半径之间的夹角接近120°,即显示3等分点(1006),用户可以根据显示的3等分点绘制其他半径,绘制完成后如1007。例如用户绘制的第二条半径和第一条半径之间的夹角接近72°,即显示5等分点(1008),用户可以根据显示的5等分点绘制其他半径,绘制完成后如1009。For another example, a radius is drawn with the center of a circle as the vertex (1005). When a second radius is drawn through the center of the circle, the remaining equal points can be displayed for the trend analysis drawn by the user. For example, if the angle between the second radius drawn by the user and the first radius is close to 120°, then a 3-equal point is displayed (1006). The user can draw other radii based on the displayed 3-equal points, and after drawing, it is shown as 1007. For example, if the angle between the second radius drawn by the user and the first radius is close to 72°, then a 5-equal point is displayed (1008). The user can draw other radii based on the displayed 5-equal points, and after drawing, it is shown as 1009.
在方法800中,还可以添加特殊锚点。例如,图11所示,已绘制图形为三角形,进入三角形编辑状态后,可以长按线段产生新锚点,并显示该新锚点与线段的两个端点的比例关系(1101),或者显示该新锚点与线段的两个端点间的线条长度,1101未示出。已绘制图形为四边形,进入四边形编辑状态后,可以长按线段产生新锚点,并显示该新锚点与线段的两个端点的比例关系(1102),或者显示具体的线条长度,1102未示出。已绘制图形为圆,进入编辑状态后,可以长按线条产生新锚点,并显示该新锚点与A点间两个线条的比例关系(1103),或者也可以显示具体的线条长度,1103未示出。In method 800, special anchor points can also be added. For example, as shown in FIG11, the drawn figure is a triangle. After entering the triangle editing state, you can long press the line segment to generate a new anchor point, and display the proportional relationship between the new anchor point and the two endpoints of the line segment (1101), or display the line length between the new anchor point and the two endpoints of the line segment, 1101 is not shown. The drawn figure is a quadrilateral. After entering the quadrilateral editing state, you can long press the line segment to generate a new anchor point, and display the proportional relationship between the new anchor point and the two endpoints of the line segment (1102), or display the specific line length, 1102 is not shown. The drawn figure is a circle. After entering the editing state, you can long press the line to generate a new anchor point, and display the proportional relationship between the new anchor point and the two lines between point A (1103), or display the specific line length, 1103 is not shown.
本申请实施例还可以通过已绘制图形上的锚点调整已绘制图形的大小。绘图工具按住锚点拖拽可以改变已绘制图形的形状,或者用户通过绘图工具按住锚点,即绘图工具与显示屏幕之间有第一个接触点,并且增加一个与显示屏幕之间的接触点,例如用手指按住显示屏幕增加第二个接触点,此时绘图工具通过拖拽锚点可将已绘制图形放大或缩小。例如,图11中的1104,已绘制图形为圆,用户通过手写笔按住锚点,并且用手指按住显示屏幕,此时手写笔通过拖拽锚点可将圆等比例放大或缩小。再例如,图11中的1105,已绘制图形为平行四边形,用户通过手写笔按住锚点,并且用手指按住显示屏幕,此时手写笔拖拽锚点向该平行四边形的对角线方向移动可将平行四边形等比例放大或缩小。又例如,图11中的1106,已绘制图形为平行四边形,用手指按住屏幕,手写笔拖拽锚点水平移动,可以做到平行四边形的高不变,长度增加。并且手写笔拖拽锚点垂直移动,可以做到平行四边形长度不变,高度增加,图11未示出这种情况。The embodiment of the present application can also adjust the size of the drawn graphics through the anchor points on the drawn graphics. The drawing tool can change the shape of the drawn graphics by holding down the anchor point and dragging it, or the user holds down the anchor point through the drawing tool, that is, there is a first contact point between the drawing tool and the display screen, and adds a contact point with the display screen, such as pressing the display screen with a finger to add a second contact point. At this time, the drawing tool can enlarge or reduce the drawn graphics by dragging the anchor point. For example, 1104 in Figure 11, the drawn graphics are circles, the user holds down the anchor point with the stylus pen, and holds down the display screen with a finger, and the stylus can enlarge or reduce the circle in proportion by dragging the anchor point. For another example, 1105 in Figure 11, the drawn graphics are parallelograms, the user holds down the anchor point with the stylus pen, and holds down the display screen with a finger, and the stylus can drag the anchor point to the diagonal direction of the parallelogram to enlarge or reduce the parallelogram in proportion. For another example, in 1106 in FIG. 11 , the drawn figure is a parallelogram. By pressing the screen with a finger and dragging the anchor point horizontally with the stylus, the height of the parallelogram remains unchanged and the length increases. And by dragging the anchor point vertically with the stylus, the length of the parallelogram remains unchanged and the height increases. This situation is not shown in FIG. 11 .
可以理解,图形调节模式和辅助画线模式之间可以切换,例如可以通过双击手写笔或者点击显示屏幕上对应的模式切换按钮来完成,或者可以通过鼠标点击显示屏幕上对应的模式切换按钮来完成。本申请对此不做限制。It is understood that the graphics adjustment mode and the auxiliary line drawing mode can be switched, for example, by double-clicking the stylus or clicking a corresponding mode switching button on the display screen, or by clicking a corresponding mode switching button on the display screen with a mouse. This application does not limit this.
方法800的执行主体可以是绘图软件或者安装了绘图软件的电子设备,本申请对此不做限制。The execution subject of method 800 may be drawing software or an electronic device with drawing software installed, and this application does not impose any limitation on this.
方法800提供的方案,可以通过引导式交互,提高用户给已绘制图形添加辅助线的速度,并且可以降低用户的操作难度。The solution provided by method 800 can improve the speed at which users add auxiliary lines to drawn graphics through guided interaction, and can reduce the difficulty of user operations.
下面通过图12的示例详细描述画辅助线的具体流程,但应理解,图12仅为示例,不对本申请的保护范围造成限制。方法1200包括如下步骤:The specific process of drawing auxiliary lines is described in detail below through the example of FIG12 , but it should be understood that FIG12 is only an example and does not limit the protection scope of the present application. The method 1200 includes the following steps:
1201,检测到手写笔操作。1201, stylus operation is detected.
例如,检测到手写笔落在电子设备的显示屏幕上。For example, it is detected that a stylus falls on a display screen of an electronic device.
1202,判断是否处于辅助画线模式?1202, determine whether it is in auxiliary line drawing mode?
例如,若判断处于辅助画线模式则进入1203,若判断没有处于辅助画线模式,则可以根据用户的需要将其切换为辅助画线模式。For example, if it is determined that the system is in the auxiliary line drawing mode, the process proceeds to step 1203 . If it is determined that the system is not in the auxiliary line drawing mode, the system may be switched to the auxiliary line drawing mode according to the needs of the user.
1203,判断手写笔落点是否为图形顶点?1203. Determine whether the point where the stylus pen lands is a vertex of a graphic?
例如,判断手写笔的落点是已绘制图形的顶点,则进入1204,若判断手写笔的落点不是已绘制图形的顶点,可根据用户的需要移动手写笔的落点使其落在已绘制图形的顶点上。示例性的,可以通过检测ACTION_DOWN事件检测手写笔的落点。 For example, if it is determined that the landing point of the stylus pen is a vertex of the drawn figure, then enter 1204. If it is determined that the landing point of the stylus pen is not a vertex of the drawn figure, the landing point of the stylus pen can be moved according to the user's needs so that it falls on the vertex of the drawn figure. Exemplarily, the landing point of the stylus pen can be detected by detecting an ACTION_DOWN event.
1204,确定该顶点是当前用户画线的起点。1204, determine that the vertex is the starting point of the line drawn by the current user.
1205,是否检测到手写笔笔迹移动?1205, Is stylus pen movement detected?
例如,若检测到手写笔笔迹移动,则进入1206,若没有检测到手写笔笔迹移动,则进入1210。For example, if the movement of the stylus pen is detected, the process proceeds to 1206 , and if the movement of the stylus pen is not detected, the process proceeds to 1210 .
1206,绘制起点到手写笔笔迹位置之间的连线。1206, draw a line from the starting point to the position of the handwriting of the stylus.
1207,计算并标注该连线与顶点(起点)关联的线条之间的夹角。1207, calculate and mark the angle between the connecting line and the line associated with the vertex (starting point).
可以理解,1207为可选步骤,可以不计算并标注该连线与顶点(起点)关联的线条之间的夹角。具体标注的示例可参见图9。It can be understood that step 1207 is an optional step, and the angle between the connecting line and the line associated with the vertex (starting point) may not be calculated and marked. Specific marking examples can be found in FIG9 .
1208,计算该连线的延长线与已绘制图形上线条的交点。1208, calculating the intersection of the extension line of the connecting line and the line on the drawn figure.
1209,计算并标注该连线的延长线与图形相交线条上的辅助点。1209, calculate and mark the auxiliary points on the line where the extension line of the connecting line intersects with the figure.
具体标注的示例可参见图9,图10。For specific marking examples, please refer to Figures 9 and 10.
1210,判断手写笔落点是否离开该图形?1210, determine whether the landing point of the stylus pen leaves the graphic?
例如,可以通过判断手写笔是否抬起、或判断手写笔是否离开电子设备的屏幕,从而判断手写笔落点是否离开该图形。示例性的,可以通过检测ACTION_UP事件确定手写笔是否离开该图形。若判断手写笔离开该图形,则进入1211;若判断手写笔没有离开该图形,则进入1205。For example, it is possible to determine whether the stylus has left the graphic by determining whether the stylus is lifted or whether the stylus has left the screen of the electronic device. Exemplarily, it is possible to determine whether the stylus has left the graphic by detecting an ACTION_UP event. If it is determined that the stylus has left the graphic, the process proceeds to 1211; if it is determined that the stylus has not left the graphic, the process proceeds to 1205.
1211,结束编辑。1211, end of editing.
1211可以理解为辅助划线结束。1211 can be understood as the end of auxiliary line drawing.
图12示例的流程的执行主体可以是绘图软件或者安装了绘图软件的电子设备,本申请对此不做限制。The execution subject of the process illustrated in FIG. 12 may be drawing software or an electronic device on which drawing software is installed, and this application does not impose any limitation on this.
基于方法800或图12示例的流程,可以使得用户简单快速的给图形添加额外的辅助线条。Based on the method 800 or the process illustrated in FIG. 12 , the user can easily and quickly add additional auxiliary lines to the graphic.
图13是本申请实施例提供的又一种绘制图形的方法,图13示例的方法1300包括如下步骤:FIG. 13 is another method for drawing a graph provided in an embodiment of the present application. The method 1300 illustrated in FIG. 13 includes the following steps:
S1310,确定顶点的状态,顶点为已绘制图形中N3个线条的交点,其中,N3为大于或等于2的整数。S1310, determining the state of a vertex, where a vertex is an intersection of N3 lines in a drawn figure, where N3 is an integer greater than or equal to 2.
例如,为线条的端点引入锁定状态和解锁状态,选中N3个线条中的第一线条,可以显示该第一线条的端点的锁定状态,进而确定顶点的状态是锁定状态还是解锁状态,该顶点为该第一线条的端点中与其他线条相交的端点。For example, a locked state and an unlocked state are introduced for the endpoints of a line. By selecting the first line among N3 lines, the locked state of the endpoint of the first line can be displayed, and then the state of the vertex is determined to be a locked state or an unlocked state. The vertex is the endpoint of the first line that intersects with other lines.
S1320,根据顶点的状态重新绘制以该顶点为端点的线条。S1320: Redraw the line with the vertex as the endpoint according to the state of the vertex.
例如,选中的线条是线条#1(对应第一线条),显示线条#1的端点的状态,线条#1的端点包括该顶点,若确定该顶点的状态为解锁状态,重新绘制线条#1。For example, the selected line is line #1 (corresponding to the first line), and the status of the endpoints of line #1 is displayed. The endpoints of line #1 include the vertex. If it is determined that the status of the vertex is unlocked, redraw line #1.
又例如,选中的线条是线条#1,显示线条#1的端点的状态,线条#1的端点包括该顶点,若确定该顶点的状态为锁定状态,重新绘制以该顶点为端点的所有线条,即上述N3个线条。For another example, the selected line is line #1, and the status of the endpoints of line #1 is displayed. The endpoints of line #1 include the vertex. If the status of the vertex is determined to be locked, all lines with the vertex as endpoints are redrawn, that is, the N3 lines mentioned above.
方法1300分以下几种方案示例:Method 1300 points The following are some examples of solutions:
方案1:默认已绘制图形中线条的交点是解锁状态。Solution 1: By default, the intersection of lines in the drawn graphics is unlocked.
在方案1中,用户可以根据需求选中任意线条后、点击线条顶点附近的小锁图标进行顶点锁定。示例性的,在此方案中锁定操作是将顶点连接的所有线条锁定,解锁操作是将将顶点连接的所有线条解锁。In solution 1, the user can select any line as needed and click the small lock icon near the vertex of the line to lock the vertex. For example, in this solution, the locking operation is to lock all lines connected to the vertex, and the unlocking operation is to unlock all lines connected to the vertex.
例如,如图14所示,已绘制图形为三角形,如1401,手写笔的落点靠近顶点a时可以有自动吸附辅助线,例如水平和垂直辅助线。当以顶点a为起点绘制的线段ao达到一定长度后可以显示该线段与两边的夹角(1402)。以三角形另一顶点b为起点绘制线段bo,bo与ao相交于点o(1403)。绘制线条后,可选中线条bo,显示两个端点的状态都是解锁状态(1404)。点击o附件的小锁将o的状态切换为锁定状态(1405)。移动顶点o,bo与ao会随之变化,示例性的,在移动的过程中可在图形中显示角度(1406),或者还可以显示线长,或者可以同时显示角度和线长。可选的,可以只显示随着顶点o的移动发生变化的角度和/或线长,也可以显示已绘制图形中所有的角度和/或线长,具体方法可以参照图7所示实施例中的相关描述。For example, as shown in FIG. 14 , the drawn figure is a triangle, such as 1401, and when the landing point of the stylus is close to the vertex a, there may be automatic adsorption auxiliary lines, such as horizontal and vertical auxiliary lines. When the line segment ao drawn from the vertex a reaches a certain length, the angle between the line segment and the two sides can be displayed (1402). A line segment bo is drawn from another vertex b of the triangle, and bo and ao intersect at point o (1403). After drawing the line, the line bo can be selected to display the states of both endpoints are unlocked (1404). Click the small lock attached to o to switch the state of o to locked (1405). Move the vertex o, bo and ao will change accordingly. For example, the angle can be displayed in the figure during the movement (1406), or the line length can also be displayed, or the angle and line length can be displayed at the same time. Optionally, only the angle and/or line length that change with the movement of the vertex o can be displayed, or all the angles and/or line lengths in the drawn figure can be displayed. The specific method can refer to the relevant description in the embodiment shown in FIG. 7.
如图15所示,已绘制图形为三角形为1501,默认已绘制的图形上的交点的状态为解锁状态,可通过选中线条oc,点击显示的小锁将交点o的状态切换为锁定状态(1502)。当用户需要单独编辑线条oc时,可再次点击显示的小锁将交点o的状态切换为解锁状态(1503),移动笔迹,重新编辑线条oc(1504)。选择其他线条bo,显示bo的两个端点的锁定为解锁状态(1505),当用户想要编辑以o为 端点的所有线条时,可以将交点o由解锁状态切换为锁定状态(1506),此时选择顶点o,以o为端点的所有线条为锁定状态(1507),移动顶点o,重新编辑以o为端点的所有线条(1508)。示例性的,在移动的过程中可在图形中显示角度(1508),或者还可以显示线长,或者可以同时显示角度和线长。可选的,可以只显示随着顶点o的移动发生变化的角度和/或线长,也可以显示已绘制图形中所有的角度和/或线长,本申请对此不做限制。As shown in Figure 15, the drawn figure is a triangle 1501. By default, the state of the intersection on the drawn figure is unlocked. You can select the line oc and click the displayed small lock to switch the state of the intersection o to the locked state (1502). When the user needs to edit the line oc separately, you can click the displayed small lock again to switch the state of the intersection o to the unlocked state (1503), move the handwriting, and re-edit the line oc (1504). Select other lines bo, and the locks of the two endpoints of bo are displayed to be unlocked (1505). When the user wants to edit the line with o as the center, When editing all lines with endpoints, the intersection o can be switched from unlocked state to locked state (1506), then the vertex o is selected, and all lines with o as endpoint are locked state (1507), the vertex o is moved, and all lines with o as endpoint are re-edited (1508). Exemplarily, the angle can be displayed in the figure during the movement (1508), or the line length can also be displayed, or the angle and line length can be displayed at the same time. Optionally, only the angle and/or line length that changes with the movement of the vertex o can be displayed, or all angles and/or line lengths in the drawn figure can be displayed, and this application does not limit this.
如图16所示,已绘制图形1601中的线条ad的端点处于解锁状态,移动顶点a例如1602所示,移动顶点c(顶点c处于锁定状态)例如1603所示。或者已绘制图形1604中的线条ad的端点处于锁定状态,移动顶点a例如1605所示,移动顶点c(顶点c处于锁定状态)例如1606所示。As shown in FIG16 , the endpoints of the line ad in the drawn figure 1601 are in an unlocked state, the vertex a is moved as shown in example 1602, and the vertex c is moved (the vertex c is in a locked state) as shown in example 1603. Alternatively, the endpoints of the line ad in the drawn figure 1604 are in a locked state, the vertex a is moved as shown in example 1605, and the vertex c is moved (the vertex c is in a locked state) as shown in example 1606.
方案2:默认已绘制图形中线条的交点是锁定状态。Solution 2: By default, the intersections of lines in a drawn graphic are locked.
在方案2中,用户可以根据需求选中任意线条后点击顶点附近的小锁图标进行顶点解锁。示例性的,在方案2中解锁操作是将选中的线条从锁定状态切换为解锁状态,锁定操作是将选中的线条从解锁状态切换为锁定状态。In solution 2, the user can select any line as needed and click the small lock icon near the vertex to unlock the vertex. For example, in solution 2, the unlocking operation is to switch the selected line from the locked state to the unlocked state, and the locking operation is to switch the selected line from the unlocked state to the locked state.
例如,如图17所示,已绘制图形为1701中的三角形,手写笔的落点靠近顶点a时可以有自动吸附辅助线,例如水平和垂直辅助线。当以顶点a为起点绘制的线段ao达到一定长度后可以显示该线段与两边的夹角(1701)。线段ao绘制后,顶点a为锁定状态(1702)。以三角形另一顶点b为起点绘制线段bo,bo与ao相较于点o(1703)。绘制线段后,可选中线段bo,显示两个端点的状态都是锁定状态(1704)。继续绘制其他线段例如1705。选中线段oc,显示顶点o和c的状态都是锁定状态(1706)。点击o附近的小锁可以将线段oc中o的状态切换为解锁状态(1707)。移动线段oc的顶点o至o’位置(1708)。选中线段bo,显示两个端点o和b的状态都是锁定状态(1709)。For example, as shown in FIG. 17 , the drawn figure is a triangle in 1701. When the landing point of the stylus is close to vertex a, there can be automatic adsorption auxiliary lines, such as horizontal and vertical auxiliary lines. When the line segment ao drawn with vertex a as the starting point reaches a certain length, the angle between the line segment and the two sides can be displayed (1701). After the line segment ao is drawn, vertex a is in a locked state (1702). A line segment bo is drawn with another vertex b of the triangle as the starting point, and bo and ao are compared to point o (1703). After drawing the line segment, the line segment bo can be selected to display that the states of the two endpoints are both locked (1704). Continue to draw other line segments such as 1705. Select the line segment oc, and the states of vertices o and c are both locked (1706). Click the small lock near o to switch the state of o in the line segment oc to the unlocked state (1707). Move the vertex o of the line segment oc to the o' position (1708). Select the line segment bo, and the states of the two endpoints o and b are both locked (1709).
如图18所示,已绘制图形1801中的线条ad的端点处于锁定状态,移动顶点a如1802所示,移动顶点c(顶点c处于锁定状态)如1803所示。或者已绘制图形1804中的线条ad的端点处于解锁状态,移动线段ad的上端点如1805所示,选中线段ac,显示顶点a和c都是锁定状态(1806);移动顶点a如1807所示,将1807中的端点d的状态切换为锁定状态,继续移动1807中的顶点c如1808所示。在移动过程中,可以只显示随着顶点的移动发生变化的角度和/或线长,也可以显示已绘制图形中所有的角度和/或线长,本申请对此不做限制。As shown in FIG. 18 , the endpoints of line ad in the drawn figure 1801 are in a locked state, vertex a is moved as shown in 1802, and vertex c is moved (vertex c is in a locked state) as shown in 1803. Alternatively, the endpoints of line ad in the drawn figure 1804 are in an unlocked state, the upper endpoint of line segment ad is moved as shown in 1805, line segment ac is selected, and vertices a and c are both in a locked state (1806); vertex a is moved as shown in 1807, the state of endpoint d in 1807 is switched to a locked state, and vertex c in 1807 is continued to be moved as shown in 1808. During the movement process, only the angles and/or line lengths that change with the movement of the vertices may be displayed, or all angles and/or line lengths in the drawn figure may be displayed, and this application does not impose any limitation on this.
方案3:默认已绘制图形中线条的交点是解锁状态。Solution 3: By default, the intersection of lines in the drawn graphics is unlocked.
在方案3中,用户可以根据需求选中任意线条后点击顶点附近的小锁图标进行顶点解锁,在方案3中锁定操作是将选中的线条从解锁状态切换为锁定状态,解锁操作是将选中的线条从锁定状态切换为解锁状态。In Solution 3, the user can select any line as needed and click the small lock icon near the vertex to unlock the vertex. In Solution 3, the locking operation is to switch the selected line from the unlocked state to the locked state, and the unlocking operation is to switch the selected line from the locked state to the unlocked state.
方案3中的具体实施方式可参见方案1和方案2中的相关描述和示例,在此不做赘述。The specific implementation of Scheme 3 can be found in the relevant descriptions and examples in Schemes 1 and 2, and will not be elaborated here.
方案4:默认已绘制图形中线条的交点是锁定状态。Solution 4: By default, the intersections of lines in a drawn graphic are locked.
在方案4中,用户可以根据需求选中任意线条后点击顶点附近的小锁图标进行顶点锁定,在此方案中解锁操作是将顶点连接的所有线条解锁,锁定操作是将将顶点连接的所有线条锁定。In solution 4, the user can select any line as needed and click the small lock icon near the vertex to lock the vertex. In this solution, the unlocking operation unlocks all lines connected to the vertex, and the locking operation locks all lines connected to the vertex.
同样地,方案4中的具体实施方式可参见方案1和方案2中的相关描述和示例,在此不做赘述。Similarly, the specific implementation of Scheme 4 can refer to the relevant descriptions and examples in Schemes 1 and 2, and will not be repeated here.
可以理解,本申请实施例对端点的状态标识(例如锁定标识、解锁标识)的显示时机不做限制,可以在选中线条时显示线条端点的状态标识,也可以在移动线条的端点的过程中显示端点的状态标识。It can be understood that the embodiment of the present application does not limit the display timing of the endpoint status indicator (such as the lock indicator, the unlock indicator). The status indicator of the line endpoint can be displayed when the line is selected, and the status indicator of the endpoint can also be displayed during the process of moving the line endpoint.
在方法1300中,为线条的端点引入锁定状态和解锁状态,可以使得用户每次按需调整一个或多个线条关联的长度和/或角度。In method 1300 , a locked state and an unlocked state are introduced for the endpoints of a line, so that the user can adjust the length and/or angle associated with one or more lines as needed each time.
方法1300的执行主体可以是绘图软件或者安装了绘图软件的电子设备,本申请对此不做限制。The execution subject of method 1300 may be drawing software or an electronic device with drawing software installed, and this application does not impose any limitation on this.
通过方法1300提供的方案,用户可根据已绘制图形中交点的锁定状态灵活控制需要重新绘制的线条数量,能够提高用户绘制目标图形的速度。Through the solution provided by method 1300, the user can flexibly control the number of lines that need to be redrawn according to the locking status of the intersections in the drawn graphics, which can improve the speed at which the user draws the target graphics.
下面通过图19的示例详细描述顶点锁定或解锁时绘制图形的具体流程,但应理解,图19仅为示例,不对本申请的保护范围造成限制。方法1900包括如下步骤:The specific process of drawing a graphic when a vertex is locked or unlocked is described in detail below by using the example of FIG. 19 , but it should be understood that FIG. 19 is only an example and does not limit the scope of protection of the present application. The method 1900 includes the following steps:
1901,检测到手写笔操作。1901, stylus operation detected.
例如,检测到手写笔落在电子设备的显示屏幕上。For example, it is detected that a stylus falls on a display screen of an electronic device.
1902,判断是否处于顶点调整模式?1902, determine whether it is in vertex adjustment mode?
例如,若判断处于顶点调整模式则进入1903,若判断没有处于顶点调整模式,则可以根据用户的 需要将其切换为顶点调整模式。For example, if it is determined that the vertex adjustment mode is in progress, the process proceeds to step 1903. If it is determined that the vertex adjustment mode is not in progress, the process proceeds to step 1903 according to the user's It needs to be switched to vertex adjustment mode.
1903,判断手写笔落点是否为图形顶点?1903. Determine whether the point where the stylus falls is a vertex of a graphic?
例如,判断手写笔的落点是已绘制图形的顶点,则进入1904,若判断手写笔的落点不是已绘制图形的顶点,可根据用户的需要移动手写笔的落点使其落在已绘制图形的顶点上。示例性的,可以通过检测ACTION_DOWN事件检测手写笔的落点。For example, if the landing point of the stylus pen is determined to be a vertex of the drawn figure, then enter 1904. If the landing point of the stylus pen is determined not to be a vertex of the drawn figure, the landing point of the stylus pen can be moved according to the user's needs so that it falls on the vertex of the drawn figure. Exemplarily, the landing point of the stylus pen can be detected by detecting an ACTION_DOWN event.
1904,确定该顶点是当前用户画线的起点。1904, determine that the vertex is the starting point of the line drawn by the current user.
1905,是否检测到手写笔笔迹移动?1905, Is stylus movement detected?
例如,若检测到手写笔笔迹移动,则进入1906,若没有检测到手写笔笔迹移动,则进入1909。For example, if the movement of the stylus pen is detected, the process proceeds to 1906 , and if the movement of the stylus pen is not detected, the process proceeds to 1909 .
1906,判断顶点是否处于锁定状态?1906. Determine whether the vertex is in a locked state?
例如,若确定顶点处于锁定状态,则进入1907,若确定顶点处于解锁状态,则进入1907’。For example, if it is determined that the vertex is in a locked state, proceed to 1907, and if it is determined that the vertex is in an unlocked state, proceed to 1907'.
1907,重新绘制以该顶点为端点且处于锁定的所有线条。1907, redraw all lines that end at this vertex and are locked.
1907’,重新绘制以该顶点为端点的线条。1907’, redraw the line with this vertex as its endpoint.
可以理解,1907’中重新绘制的连线是处于解锁状态的线条。It can be understood that the lines redrawn in 1907’ are lines in an unlocked state.
1908,计算并标注该顶点调整后所关联的角度和/或线长。1908. Calculate and mark the angle and/or line length associated with the adjusted vertex.
可以理解,1908为可选步骤,可以不计算并标注该顶点调整后与该顶点所关联的角度和/或线长,或可以不计算并标注该顶点调整后该已绘制图形中的所有角度和/或线长。具体标注的示例可参见图14-18。It can be understood that 1908 is an optional step, and the angle and/or line length associated with the vertex after the vertex is adjusted may not be calculated and marked, or all angles and/or line lengths in the drawn figure after the vertex is adjusted may not be calculated and marked. Specific marking examples can be seen in Figures 14-18.
1909,判断手写笔落点是否离开该图形?1909, determine whether the landing point of the stylus pen leaves the graphic?
例如,可以通过判断手写笔是否抬起,或判断手写笔是否离开电子设备的屏幕,从而判断手写笔落点是否离开该图形。示例性的,可以通过检测ACTION_UP事件确定手写笔是否离开该图形。For example, it is possible to determine whether the stylus is lifted or whether the stylus leaves the screen of the electronic device, thereby determining whether the stylus point leaves the graphic. Exemplarily, it is possible to determine whether the stylus leaves the graphic by detecting an ACTION_UP event.
若判断手写笔离开该图形,则进入1910,若判断手写笔没有离开该图形,则继续回到1908,直到手写笔离开该图形。If it is determined that the stylus has left the graphic, the process proceeds to step 1910 . If it is determined that the stylus has not left the graphic, the process continues to proceed to step 1908 until the stylus has left the graphic.
1910,结束编辑。1910, end of editing.
其中,1910可以理解为顶点调整结束。若方法1900包括步骤1908,即顶点调整过程中标注该顶点调整后顶点所关联的角度和/或线长,或标注顶点调整过程中已绘制图形中所有的角度和/或线长,则结束编辑后,已绘制图形上可以不再显示角度和/或线长。If method 1900 includes step 1908, i.e., marking the angle and/or line length associated with the adjusted vertex during the vertex adjustment process, or marking all angles and/or line lengths in the drawn graphics during the vertex adjustment process, then after the editing is finished, the angle and/or line length may no longer be displayed on the drawn graphics.
图19示例的流程的执行主体可以是绘图软件或者安装了绘图软件的电子设备,本申请对此不做限制。The execution subject of the process illustrated in FIG. 19 may be drawing software or an electronic device on which drawing software is installed, and this application does not impose any limitation on this.
基于方法1300或图19示例的流程,用户可灵活控制需要跟随手写笔移动的线条数量,更方便的对已绘制的图形进行调整。可以提升用户调整复杂图形形状的交互效率。Based on method 1300 or the process of the example in FIG19 , the user can flexibly control the number of lines that need to follow the movement of the stylus, and more conveniently adjust the drawn graphics, thereby improving the interaction efficiency of the user in adjusting the shape of complex graphics.
本申请实施例中,对用户界面(user interface,UI)风格不做限制,例如对锁定状态为锁定和解锁时的图标不做限制。再例如,对模式切换时出现在显示屏幕上的模式图标不做限制。又例如,对显示的角度值和/或线长值的颜色或字体大小不做限制。In the embodiments of the present application, there is no restriction on the user interface (UI) style, for example, there is no restriction on the icons when the lock state is locked and unlocked. For another example, there is no restriction on the mode icon that appears on the display screen when the mode is switched. For another example, there is no restriction on the color or font size of the displayed angle value and/or line length value.
可以理解,本申请实施例提供的方法300、800、1300可以单独使用,也可以两两结合使用,或者方法300、800、1300一起结合使用。两两结合使用时,例如方法300和方法1300中的实施方式结合使用,或者,方法800和方法1300中的实施方式结合使用,或者还有其他的结合方式,在此不一一示例。It is understood that the methods 300, 800, and 1300 provided in the embodiments of the present application can be used alone, or in combination, or the methods 300, 800, and 1300 can be used together. When used in combination, for example, the method 300 and the implementation in the method 1300 are used in combination, or the method 800 and the implementation in the method 1300 are used in combination, or there are other combinations, which are not exemplified here one by one.
上述主要从方法的角度对本申请实施例提供的一种绘制图形的方法进行了介绍。可以理解的是,上述方法的执行主体为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。The above mainly introduces a method for drawing graphics provided by an embodiment of the present application from the perspective of the method. It is understandable that the execution subject of the above method includes a hardware structure and/or software module corresponding to each function in order to realize the above functions. Those skilled in the art should easily realize that, in combination with the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware 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 the present application.
本申请实施例可以根据上述方法示例对执行主体中的处理器进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。需要说明的是,本申请实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。 The embodiment of the present application can divide the processor in the execution subject into functional modules according to the above method example. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
在采用了对应各个功能的划分各个功能模块的情况下,图20示出了本申请实施例提供的一种装置2000结构示意图,如图20所示,装置2000包括:收发单元2010,处理单元2020。In the case of dividing each functional module corresponding to each function, Figure 20 shows a structural schematic diagram of a device 2000 provided in an embodiment of the present application. As shown in Figure 20, the device 2000 includes: a transceiver unit 2010 and a processing unit 2020.
可选的,收发单元2010可以包括发送单元和接收单元。Optionally, the transceiver unit 2010 may include a sending unit and a receiving unit.
示例地,发送单元用于执行上述方法300、700、800、1200、1300或1900中描述的执行主体的发送操作,接收单元用于执行上述方法300、700、800、1200、1300或1900中描述的执行主体的接收操作,处理单元用于执行上述方法300、700、800、1200、1300或1900中描述的执行主体中的内部处理操作(例如确定、判断、计算等操作)。For example, the sending unit is used to execute the sending operation of the execution subject described in the above method 300, 700, 800, 1200, 1300 or 1900, the receiving unit is used to execute the receiving operation of the execution subject described in the above method 300, 700, 800, 1200, 1300 or 1900, and the processing unit is used to execute the internal processing operation (such as determination, judgment, calculation, etc.) in the execution subject described in the above method 300, 700, 800, 1200, 1300 or 1900.
可以理解,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。本申请实施例提供的电子设备,用于执行上述实施例提供的绘制图形的方法,因此可以达到与上述相同的效果。It is understood that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, and will not be repeated here. The electronic device provided in the embodiment of the present application is used to execute the method for drawing graphics provided in the above embodiment, so it can achieve the same effect as above.
本申请实施例还提供了一种电子设备,包括:处理器、存储器、应用程序以及计算机程序。上述各器件可以通过一个或多个通信总线连接。其中,该一个或多个计算机程序被存储在上述存储器中并被配置为被该一个或多个处理器执行,该一个或多个计算机程序包括指令,上述指令可以用于使电子设备执行上述各实施例中电子设备的各个步骤。The embodiment of the present application also provides an electronic device, including: a processor, a memory, an application program, and a computer program. The above-mentioned devices can be connected via one or more communication buses. Among them, the one or more computer programs are stored in the above-mentioned memory and are configured to be executed by the one or more processors, and the one or more computer programs include instructions, and the above-mentioned instructions can be used to make the electronic device perform each step of the electronic device in the above-mentioned embodiments.
例如,图21所示的电子设备2100的结构示意图,该电子设备2100包括:一个或多个处理器2110,一个或多个存储器2120,该一个或多个存储器存储2120存储有一个或多个计算机程序,该一个或多个计算机程序包括指令。当该指令被所述一个或多个处理器2110运行时,使得电子设备2100执行上述图3、图7、图8、图12、图13或图19的实施例中的技术方案,或者,使得电子设备2100执行上述方法300、700、800、1200、1300或1900中的技术方案。For example, the structural diagram of the electronic device 2100 shown in FIG21 includes: one or more processors 2110, one or more memories 2120, and the one or more memories 2120 store one or more computer programs, and the one or more computer programs include instructions. When the instructions are executed by the one or more processors 2110, the electronic device 2100 executes the technical solutions in the embodiments of FIG3, FIG7, FIG8, FIG12, FIG13 or FIG19, or the electronic device 2100 executes the technical solutions in the above-mentioned methods 300, 700, 800, 1200, 1300 or 1900.
本申请实施例还提供一种芯片,所述芯片包括处理器和通信接口,所述通信接口用于接收信号,并将所述信号传输至所述处理器,所述处理器处理所述信号,使得如前文中任一种可能的实现方式中所述的绘制图形的方法被执行。An embodiment of the present application also provides a chip, which includes a processor and a communication interface, wherein the communication interface is used to receive a signal and transmit the signal to the processor, and the processor processes the signal so that the method for drawing graphics described in any possible implementation method described in the foregoing is executed.
本实施例还提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机指令,当该计算机指令在电子设备上运行时,使得电子设备执行上述相关方法步骤实现上述实施例中的绘制图形的方法。This embodiment also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the method for drawing graphics in the above-mentioned embodiment.
本实施例还提供了一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述相关步骤,以实现上述实施例中的绘制图形的方法。This embodiment also provides a computer program product. When the computer program product is run on a computer, the computer is caused to execute the above-mentioned related steps to implement the method for drawing graphics in the above-mentioned embodiment.
以上实施例中所用,根据上下文,术语“当…时”或“在…后”可以被解释为意思是“如果…”或“当…后”或“响应于确定…”或“响应于检测到…”。类似地,根据上下文,短语“在确定…时”或“如果检测到(所陈述的条件或事件)”可以被解释为意思是“如果确定…”或“响应于确定…”或“在检测到(所陈述的条件或事件)时”或“响应于检测到(所陈述的条件或事件)”。As used in the above embodiments, the term "when..." or "after..." may be interpreted to mean "if..." or "after..." or "in response to determining..." or "in response to detecting...", depending on the context. Similarly, the phrase "upon determining..." or "if (the stated condition or event) is detected" may be interpreted to mean "if determining..." or "in response to determining..." or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)", depending on the context.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。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.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的***、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的***、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个***,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in the present application, it should be understood that the disclosed systems, 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 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 system, 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.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。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.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。 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.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。 The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims (18)

  1. 一种绘制图形的方法,其特征在于,A method for drawing a graph, characterized in that:
    确定顶点的状态,所述顶点为已绘制图形中N个线条的交点,其中,所述N为大于或等于2的整数;Determine the state of a vertex, where the vertex is an intersection of N lines in a drawn figure, where N is an integer greater than or equal to 2;
    若所述顶点的状态为解锁状态,根据所述顶点的状态重新绘制所述N个线条中的第一线条;If the state of the vertex is unlocked, redraw the first line of the N lines according to the state of the vertex;
    若所述顶点的状态为锁定状态,根据所述顶点的状态重新绘制所述N个线条。If the state of the vertex is a locked state, the N lines are redrawn according to the state of the vertex.
  2. 根据权利要求1所述的方法,其特征在于,所述确定顶点的状态,包括:The method according to claim 1, characterized in that determining the state of the vertex comprises:
    选中所述第一线条;Select the first line;
    确定所述顶点的状态,所述顶点为所述第一线条的端点。A state of the vertex is determined, where the vertex is an endpoint of the first line.
  3. 根据权利要求1或2所述的方法,其特征在于,已绘制图形中交点的状态为解锁状态。The method according to claim 1 or 2 is characterized in that the state of the intersection in the drawn figure is an unlocked state.
  4. 根据权利要求3所述的方法,其特征在于,所述方法还包括:The method according to claim 3, characterized in that the method further comprises:
    在选中所述第一线条时,将所述顶点的状态切换为锁定状态,则所述N个线条与所述顶点锁定。When the first line is selected, the state of the vertex is switched to a locked state, and the N lines are locked with the vertex.
  5. 根据权利要求1所述的方法,其特征在于,已绘制图形中交点的状态为锁定状态。The method according to claim 1 is characterized in that the state of the intersection in the drawn figure is a locked state.
  6. 根据权利要求5所述的方法,其特征在于,所述方法还包括:The method according to claim 5, characterized in that the method further comprises:
    在选中所述第一线条时,将所述顶点的状态切换为解锁状态,则所述第一线条与所述N个线条中除所述第一线条之外的线条解锁,或者所述N个线条全部解锁。When the first line is selected, the state of the vertex is switched to an unlocked state, so that the first line is unlocked from the lines of the N lines except the first line, or all of the N lines are unlocked.
  7. 根据权利要求1至6中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 6, characterized in that the method further comprises:
    以所述顶点为起点绘制第二线条时,第三线条上显示辅助点,所述第三线条为已绘制图形中即将与所述第二线条相交的线条。When the second line is drawn with the vertex as the starting point, an auxiliary point is displayed on a third line, and the third line is a line in the drawn figure that is about to intersect with the second line.
  8. 根据权利要求7中任一项所述的方法,其特征在于,所述第三线条为已绘制图形中即将与所述第二线条相交的第一个线条。The method according to any one of claim 7, characterized in that the third line is the first line in the drawn figure that is about to intersect with the second line.
  9. 根据权利要求7或8中任一项所述的方法,其特征在于,所述辅助点包括以下任一项:中点,角平分点,M等分点,或垂点,所述M为大于或等于2的整数。The method according to any one of claims 7 or 8 is characterized in that the auxiliary point includes any one of the following: a midpoint, an angle bisector point, an M-bisector point, or a vertical point, wherein M is an integer greater than or equal to 2.
  10. 根据权利要求7至9中任一项所述的方法,其特征在于,以所述顶点为起点绘制第二线条之前,所述方法还包括:The method according to any one of claims 7 to 9, characterized in that before drawing the second line with the vertex as the starting point, the method further comprises:
    将绘图模式切换为辅助画线模式。Switch the drawing mode to auxiliary line drawing mode.
  11. 根据权利要求1至10中任一项所述的方法,其特征在于,绘制线条时,显示所述已绘制图形中的角度和/或线长。The method according to any one of claims 1 to 10 is characterized in that when drawing a line, the angle and/or line length in the drawn figure is displayed.
  12. 根据权利要求11所述的方法,其特征在于,所述显示的角度和/或线长与第一锚点关联,所述第一锚点为绘制线条时移动的点。The method according to claim 11 is characterized in that the displayed angle and/or line length is associated with a first anchor point, and the first anchor point is a point that moves when drawing a line.
  13. 根据权利要求1至12中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 12, characterized in that the method further comprises:
    在已绘制图形中的第四线条上新增第二锚点,并显示第一距离和第二距离的比例,所述第一距离为所述第二锚点和所述第四线条的第一端点之间的距离,所述第二距离为所述第二锚点和所述第四线条的第二端点之间的距离。A second anchor point is added to the fourth line in the drawn figure, and the ratio of the first distance and the second distance is displayed, where the first distance is the distance between the second anchor point and the first endpoint of the fourth line, and the second distance is the distance between the second anchor point and the second endpoint of the fourth line.
  14. 一种装置,其特征在于,包括:用于实现如权利要求1至13中任一项所述的方法的模块。A device, characterized in that it comprises: a module for implementing the method as claimed in any one of claims 1 to 13.
  15. 一种电子设备,其特征在于,包括一个或多个处理器;一个或多个存储器;所述一个或多个存储器存储有一个或多个计算机程序,所述一个或多个计算机程序包括指令,当所述指令被所述一个或多个处理器执行时,使得如权利要求1至13中任一项所述的方法被执行。An electronic device, characterized in that it includes one or more processors; one or more memories; the one or more memories store one or more computer programs, and the one or more computer programs include instructions, and when the instructions are executed by the one or more processors, the method described in any one of claims 1 to 13 is executed.
  16. 一种芯片,其特征在于,所述芯片包括处理器和通信接口,所述通信接口用于接收信号,并将所述信号传输至所述处理器,所述处理器处理所述信号,使得如权利要求1至13中任一项所述的方法被执行。A chip, characterized in that the chip includes a processor and a communication interface, the communication interface is used to receive a signal and transmit the signal to the processor, and the processor processes the signal so that the method as described in any one of claims 1 to 13 is executed.
  17. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机指令,当所述计算机指令在计算机上运行时,使得如权利要求1至13中任一项所述的方法被执行。A computer-readable storage medium, characterized in that computer instructions are stored in the computer-readable storage medium, and when the computer instructions are run on a computer, the method according to any one of claims 1 to 13 is executed.
  18. 一种包含指令的计算机程序产品,其特征在于,当所述计算机程序产品在计算机上运行时,使得所述计算机执行如权利要求1至13中任一项所述的方法。 A computer program product comprising instructions, characterized in that when the computer program product is run on a computer, the computer is caused to execute the method according to any one of claims 1 to 13.
PCT/CN2023/116929 2022-09-29 2023-09-05 Graphic drawing method and apparatus WO2024066949A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211212440.4 2022-09-29
CN202211212440.4A CN117827067A (en) 2022-09-29 2022-09-29 Method and device for drawing graph

Publications (1)

Publication Number Publication Date
WO2024066949A1 true WO2024066949A1 (en) 2024-04-04

Family

ID=90475987

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/116929 WO2024066949A1 (en) 2022-09-29 2023-09-05 Graphic drawing method and apparatus

Country Status (2)

Country Link
CN (1) CN117827067A (en)
WO (1) WO2024066949A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101719057A (en) * 2009-11-27 2010-06-02 广东威创视讯科技股份有限公司 Method and device for drawing geometric figures
US20150046826A1 (en) * 2013-08-08 2015-02-12 Alcatel Lucent Canada, Inc. Visual Rendering of Diameter Network Topology
CN111951349A (en) * 2019-05-17 2020-11-17 珠海金山办公软件有限公司 Method and device for adjusting graph vertex type and electronic equipment
CN114565701A (en) * 2022-02-28 2022-05-31 深圳市华胜软件技术有限公司 Line segment drawing method and device, electronic equipment and computer readable storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101719057A (en) * 2009-11-27 2010-06-02 广东威创视讯科技股份有限公司 Method and device for drawing geometric figures
US20150046826A1 (en) * 2013-08-08 2015-02-12 Alcatel Lucent Canada, Inc. Visual Rendering of Diameter Network Topology
CN111951349A (en) * 2019-05-17 2020-11-17 珠海金山办公软件有限公司 Method and device for adjusting graph vertex type and electronic equipment
CN114565701A (en) * 2022-02-28 2022-05-31 深圳市华胜软件技术有限公司 Line segment drawing method and device, electronic equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN117827067A (en) 2024-04-05

Similar Documents

Publication Publication Date Title
WO2021036571A1 (en) Desktop editing method and electronic device
WO2020259452A1 (en) Full-screen display method for mobile terminal, and apparatus
WO2021000881A1 (en) Screen splitting method and electronic device
CN113645351B (en) Application interface interaction method, electronic device and computer-readable storage medium
WO2020077511A1 (en) Method for displaying image in photographic scene and electronic device
CN111176506A (en) Screen display method and electronic equipment
WO2021082835A1 (en) Method for activating function and electronic device
CN112714901A (en) Display control method of system navigation bar, graphical user interface and electronic equipment
WO2021008589A1 (en) Application running mehod and electronic device
WO2022001258A1 (en) Multi-screen display method and apparatus, terminal device, and storage medium
WO2022012418A1 (en) Photographing method and electronic device
WO2021218429A1 (en) Method for managing application window, and terminal device and computer-readable storage medium
CN112698756A (en) Display method of user interface and electronic equipment
CN112068907A (en) Interface display method and electronic equipment
WO2021042878A1 (en) Photography method and electronic device
WO2022143180A1 (en) Collaborative display method, terminal device, and computer readable storage medium
WO2021190524A1 (en) Screenshot processing method, graphic user interface and terminal
CN115016697A (en) Screen projection method, computer device, readable storage medium, and program product
WO2021037034A1 (en) Method for switching state of application, and terminal device
WO2022078116A1 (en) Brush effect picture generation method, image editing method and device, and storage medium
EP4160372A1 (en) Method for determining screenshot area, and related apparatus
WO2022022406A1 (en) Always-on display method and electronic device
WO2024066949A1 (en) Graphic drawing method and apparatus
CN114995715A (en) Control method of floating ball and related device
CN113495733A (en) Theme pack installation method and device, electronic equipment and computer readable storage medium