Graphics drawing method and apparatus, and electronic device

Responding to vertical synchronization signals on Android or HarmonyOS platforms, obtain the input callback instructions, obtain the touch points and draw the graphics, and copy the graphics drawing results into the frame buffer object bound by the embedded system graphics library object, using off-screen rendering combined with rapid The copying method solves the problem of handwriting effect and chiral deficiency in the prior art, and achieves more efficient graphic drawing and chiral experience.

WO2025035901A1PCT designated stage expired Publication Date: 2025-02-20HUAWEI TECH CO LTD

Patent Information

Application Number
PCT/CN2024/096668
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-08-14
Filing Date
2024-05-31
Publication Date
2025-02-20

AI Technical Summary

Technical Problem

When the prior art realizes advanced handwriting effects and chirality, it is difficult to effectively combine the rendering results of ordinary controls. Off-screen rendering using OpenGL has problems with GPU-to-CPU data copying, resulting in poor chirality.

Method used

By responding to the vertical synchronization signal, obtain the input callback instructions, obtain the touch points and draw the graphics, copy the graphics drawing results from the default frame buffer object to the frame buffer object bound by the embedded system graphics library object, and use off-screen rendering combined with rapid copying to improve handwriting effect and chirality.

Benefits of technology

It realizes the rendering on the timing of the original control view, improves the handwriting effect and handwriting and chirality of handwriting applications, and solves the problem of poor chirality in the existing technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024096668_20022025_PF_FP_ABST
    Figure CN2024096668_20022025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present application are a graphics drawing method and apparatus, and an electronic device. The graphics drawing method comprises: in response to a vertical synchronization signal, an electronic device acquiring an input callback instruction; then acquiring touch points; drawing graphics on the basis of the touch points, and drawing a graphics drawing result into a default frame buffer object (FBO); then, the electronic device copying the graphics drawing result from the default FBO to an FBO bound with eglImage; in response to the vertical synchronization signal, acquiring a callback instruction for a drawn frame; in response to the callback instruction for the drawn frame, the electronic device acquiring the graphics drawing result in the FBO bound with the eglImage; filling a created bitmap with the graphics drawing result; and finally, the electronic device drawing the filled bitmap on a canvas. Thus, rendering can be executed on a time series of an original control view by means of off-screen rendering in combination with fast copying, thereby improving the handwriting effect and handwriting following performance of a handwriting application.
Need to check novelty before this filing date? Find Prior Art

Description

Graphics drawing method, device and electronic device

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on August 14, 2023, with application number 202311020480.3 and application name “Graphics drawing method, device and electronic device”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The embodiments of the present application relate to the field of smart terminal technology, and in particular to a graphics drawing method, device, and electronic device. Background Art

[0003] When developing handwriting applications on existing Android or HarmonyOS mobile platforms, handwriting quality and hand tracking are two important experience indicators.

[0004] To achieve advanced handwriting effects (such as pen stroke effects, texture effects, transparency and / or color blending, etc.), it is often necessary to use the open graphics library (OpenGL). The Skia-based canvas open interface provided by the electronic device's operating system cannot achieve the above effects.

[0005] To achieve advanced handwriting effects using OpenGL, existing technologies offer a solution using a SurfaceView or TextureView control based on surface encapsulation. However, these two controls have independent lifecycles and rendering sequences, and often cannot be effectively combined with other conventional controls in the application. For example, color blending with the rendering results of other controls, or secondary rendering based on the drawing results of other controls, are not possible.

[0006] Another solution is to use OpenGL's off-screen rendering capabilities to allocate an independent video memory area for rendering. After the rendering is completed, the results are copied from the graphics processing unit (GPU) to the central processing unit (CPU). The image is then drawn in the CPU using the system-provided Skia-based Canvas. However, this method is limited by the data copying from the GPU to the CPU and often cannot achieve an excellent hand tracking experience.

[0007] Summary of the Invention

[0008] The embodiments of the present application provide a graphics drawing method, device, and electronic device. The embodiments of the present application also provide a computer-readable storage medium to improve the handwriting effect and handwriting tracking properties of handwriting applications.

[0009] In a first aspect, an embodiment of the present application provides a graphics drawing method, comprising: obtaining an input callback instruction in response to a vertical synchronization signal; obtaining a touch point in response to the input callback instruction; drawing a graphic based on the touch point, and drawing the graphic drawing result into a default frame buffer object; copying the graphic drawing result from the default frame buffer object to a frame buffer object bound to an embedded system graphics library object; obtaining a drawing frame callback instruction in response to the vertical synchronization signal; obtaining a graphics drawing result in the frame buffer object bound to the embedded system graphics library object in response to the drawing frame callback instruction; filling the graphics drawing result into a created bitmap; and drawing the filled bitmap onto a canvas.

[0010] In the above-mentioned graphics drawing method, the electronic device obtains an input callback instruction in response to a vertical synchronization signal, and then obtains a touch point in response to the above-mentioned input callback instruction, draws a graphic based on the above-mentioned touch point, and draws the graphic drawing result into the default frame buffer object. Then, the electronic device copies the above-mentioned graphics drawing result from the default frame buffer object to the frame buffer object bound to eglImage, obtains a callback instruction for drawing a frame in response to the above-mentioned vertical synchronization signal, and obtains the graphics drawing result in the frame buffer object bound to eglImage in response to the above-mentioned callback instruction for drawing a frame, and fills the above-mentioned graphics drawing result into the created bitmap. Finally, the electronic device draws the filled bitmap onto the canvas. In this way, it is possible to use off-screen rendering combined with rapid copy to perform rendering on the timing of the original control view, which can improve the handwriting effect and handwriting tracking of handwriting applications.

[0011] In one possible implementation, drawing graphics according to the touch points includes: performing interpolation processing according to the touch points to generate interpolation points; and submitting the interpolation points to a graphics processor through graphics library instructions, so that the graphics processor draws graphics according to the interpolation points.

[0012] In one possible implementation, the frame buffer object bound to the embedded system graphics library object is located in the hardware cache bound to the embedded system graphics library object; obtaining the graphics drawing result in the frame buffer object bound to the embedded system graphics library object in response to the callback instruction of the drawing frame includes: obtaining the graphics drawing result from the hardware cache bound to the embedded system graphics library object in response to the callback instruction of the drawing frame.

[0013] In one possible implementation, copying the graphics drawing result from the default frame buffer object to the frame buffer object bound to the embedded system graphics library object includes: obtaining the local area to which the graphics drawing result belongs; and copying the pixels of the local area from the default frame buffer object to the frame buffer object bound to the embedded system graphics library object.

[0014] In one possible implementation, obtaining the graphics drawing result in the frame buffer object bound to the embedded system graphics library object in response to the callback instruction of the drawing frame includes: obtaining the pixels of the local area from the frame buffer object bound to the embedded system graphics library object in response to the callback instruction of the drawing frame.

[0015] In one possible implementation manner, filling the graphics drawing result into the created bitmap includes: filling the acquired pixels of the local area into the created bitmap.

[0016] In one possible implementation, before obtaining the input callback instruction in response to the vertical synchronization signal, the method further includes: starting the target application; wherein the target application includes a handwriting application; creating an off-screen rendering environment, creating an embedded system graphics library object bound to the hardware cache; and creating a frame buffer object bound to the embedded system graphics library object.

[0017] In a second aspect, embodiments of the present application provide a graphics drawing device, which is included in an electronic device and has the function of implementing the electronic device behavior described in the first aspect and possible implementations of the first aspect. The functions can be implemented in hardware or by hardware executing corresponding software implementations. The hardware or software includes one or more modules or units corresponding to the above functions, such as an acquisition module, a drawing module, and a copy module.

[0018] In a third aspect, an embodiment of the present application provides an electronic device comprising: one or more processors; a memory; multiple applications; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions, which, when executed by the electronic device, enable the electronic device to execute the method provided in the first aspect.

[0019] It should be understood that the second and third aspects of the embodiments of the present application are consistent with the technical solutions of the first aspect of the embodiments of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here.

[0020] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes the method provided in the first aspect.

[0021] In a fifth aspect, an embodiment of the present application provides a computer program, which, when executed by a computer, is used to execute the method provided in the first aspect.

[0022] In one possible design, the program in the fifth aspect may be stored in whole or in part on a storage medium packaged with the processor, or may be stored in whole or in part on a memory not packaged with the processor. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 is a flow chart showing how to use OpenGL in conjunction with SurfaceView to perform drawing;

[0024] Figure 2 is a schematic diagram of the overall rendering timing of TextureView;

[0025] Figure 3 is a flow chart of off-screen rendering via OpenGL;

[0026] Figure 4 is a rendering timing diagram for off-screen rendering via OpenGL;

[0027] FIG5 is a schematic structural diagram of an electronic device provided in one embodiment of the present application;

[0028] FIG6 is an architecture diagram of a graphics drawing method provided by one embodiment of the present application;

[0029] FIG7 is a flowchart of a graphics drawing method provided by one embodiment of the present application;

[0030] FIG8 is a schematic diagram of a local area provided by an embodiment of the present application;

[0031] FIG9 is a schematic diagram of a rapid copy provided by an embodiment of the present application;

[0032] FIG10 is a flowchart of a graphics drawing method provided by another embodiment of the present application;

[0033] FIG11 is a schematic structural diagram of an electronic device provided in another embodiment of the present application;

[0034] FIG12 is a schematic structural diagram of an electronic device provided in yet another embodiment of the present application. DETAILED DESCRIPTION

[0035] The terms used in the implementation section of this application are only used to explain the specific embodiments of this application and are not intended to limit this application.

[0036] The following first introduces the handwriting implementation solution provided in the existing related technology.

[0037] One solution offered by existing technologies is to use the Skia-based Canvas provided by the system to perform handwriting effects. This technical solution uses the default Canvas interface provided by the system framework to perform drawing, using the default drawPath and drawOval interfaces to connect points into lines, and the drawBitmap interface to achieve color blending effects.

[0038] (1) The drawPath method is a system-encapsulated way of drawing curves. It achieves the curve effect by constructing a Path object, but the drawn curve has no width change (that is, the pen stroke effect cannot be achieved);

[0039] (2) The drawOval method is originally intended to draw an ellipse. Since the width of the final curve line needs to change, the visual line width change is achieved by changing the size of the major and minor axes of the ellipse corresponding to each point. However, all calculations and display are performed on the CPU side, which is inefficient when the number of points is large.

[0040] (3) The drawBitmap method can achieve color mixing between two images by setting the color mixing mode of the Paint parameter in the interface. However, the color mixing mode cannot be customized and only the color mixing mode provided by the system can be used.

[0041] However, the above solution cannot achieve advanced handwriting effects, such as texture effects, cannot freely adjust transparency, and cannot customize the color blending mode.

[0042] Another solution provided by the existing related technology is to use OpenGL combined with SurfaceView to perform rendering. Figure 1 is a flowchart of using OpenGL combined with SurfaceView to perform rendering. As shown in Figure 1, the rendering process is as follows:

[0043] (1) In the initialization phase, the embedded-system graphics library (EGL) environment is initialized through the Surface object held inside SurfaceView, where the EGL environment is the environment in which OpenGL is executed.

[0044] (2) Start a custom rendering thread to listen for rendering tasks.

[0045] (3)SurfaceView monitors touch events by registering onTouchListener

[0046] (4) Touch events are reported by the choreographer according to the vertical synchronization (Vsync) signal (when the screen refresh rate is 60Hz, it is reported every 16.6ms; when the screen refresh rate is 120Hz, it is reported every 8.3ms)

[0047] (5) After the touch event is acquired, the touch point is interpolated with the historical points to generate dense points. The interpolated points are connected together to form a fitting curve.

[0048] (6) Call OpenGL instructions to draw the points generated by interpolation;

[0049] (7) The drawing results are submitted to the surface synthesis (Surfaceflinger) through the eglSwapBuffers interface, and then sent to the screen after synthesis by SurfaceFlinger.

[0050] However, in the above solution, SurfaceView has its own rendering timing and is independent of the application's own view control tree. Therefore, it can only be at the top or bottom of the entire application window and cannot be nested in other Views.

[0051] In addition, due to the independent rendering timing of SurfaceView itself, developers are required to set up corresponding listeners to process timing-related data, which increases the workload of additional data processing; SurfaceView cannot perform actions such as translation, rotation and / or scaling.

[0052] In addition, developers need to implement the onSurfaceCreated, onSurfaceCreated, and onSurfaceDestroy interfaces in SurfaceHolder#Callback to handle data in different scenarios. For example, when the app returns to the background using the home button, the Surface object within the SurfaceView itself is destroyed, and the onSurfaceDestroy method is executed, requiring the developer to save the data. When the app returns to the foreground, the Surface object is rebuilt, and the onSurfaceCreated method is re-executed, requiring re-rendering. Ordinary View controls do not have this special timing processing issue.

[0053] Another solution provided by the existing related technology is to use TextureView combined with OpenGL for rendering. The overall rendering process of using TextureView combined with OpenGL for rendering is similar to SurfaceView, but after the rendering is completed and the eglSwapBuffers method is called, it is necessary to notify the user interface (UI) thread through the onFrameAvaliable method to draw the drawing result of the current frame in the next frame. Therefore, when TextureView is drawing, although the timing of the ordinary View can be combined, there will be a delay of at least one frame, which in turn affects the handwriting tracking.

[0054] Figure 2 shows the overall rendering sequence of TextureView. As shown in Figure 2, after the Nth frame is drawn, the eglSwapBuffers interface is called, which automatically calls the SurfaceTexture's onFrameAvaliable interface. The onFrameAvaliable interface calls the TextureView's invalidate() method to subscribe to the next frame's Vsync signal. In frame N+1, the TextureView drawing result of frame N is rendered.

[0055] However, the above solution has poor chirality. The drawing result of the current frame will not be displayed until the next frame, and there is a one-frame delay by default.

[0056] Another solution provided by existing related technologies is to use OpenGL off-screen rendering, rendering in a separate GPU memory. After the rendering is completed, the result is copied from the GPU to the CPU, and then the CPU sends it to the display through the Canvas drawBitmap method. Figure 3 is a flowchart of off-screen rendering using OpenGL. As shown in Figure 3, the rendering process may include:

[0057] (1) Initialization phase: initialize the off-screen rendering environment through eglCreatePBufferSurface;

[0058] (2) In the drawing phase, submit the rendering task in onTouchEvent;

[0059] (3) The rendering task performs interpolation of the points and calls the graphics library (GL) instructions to draw the rendering results into the off-screen video memory;

[0060] (4) Read the rendering result from the GPU off-screen buffer to the CPU to form a bitmap through glReadPixels;

[0061] (5) When the callback instruction of Choreographer's drawing frame (doFrame) arrives, the rendering result read out is drawn onto the Canvas through the native drawBitmap method of Canvas.

[0062] Figure 4 is a rendering timing diagram for off-screen rendering through OpenGL. As shown in Figure 4, after the OpenGL rendering task is completed, the image data is directly read out from the off-screen rendering buffer through the glReadPixels method. This process blocks the UI thread so that the rendering result of the Nth frame is submitted to the GPU texture in the drawFrame of the Nth frame. If the UI thread is not blocked, the result of the Nth frame will also be drawn in the N+1 frame.

[0063] In other words, the above solution has poor chirality due to the data copy from GPU to CPU.

[0064] Based on the above problems, an embodiment of the present application provides a graphics drawing method, which can solve the problem that the native Canvas drawing of the Android platform or HarmonyOS platform cannot achieve pen stroke effects, texture effects, free transparency adjustment and / or color mixing effects, and can solve the problem of poor handwriting tracking when using off-screen rendering, thereby improving the handwriting effect and handwriting tracking.

[0065] The graphics drawing method provided in the embodiments of the present application can be applied to electronic devices, wherein the above-mentioned electronic devices can be smart phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, laptop computers, ultra-mobile personal computers (UMPCs), netbooks or personal digital assistants (PDAs), etc.; the embodiments of the present application do not impose any restrictions on the specific type of electronic devices.

[0066] For example, Figure 5 is a schematic structural diagram of an electronic device provided by an embodiment of the present application. As shown in Figure 5, 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.

[0067] It should be understood that the structures illustrated in the embodiments of the present application do 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, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0068] 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 processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.

[0069] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0070] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.

[0071] In some embodiments, the processor 110 may include one or more interfaces. The interfaces 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.

[0072] The I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (DCL). In some embodiments, the processor 110 may include multiple I2C busses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, and the like via different I2C bus interfaces. For example, the processor 110 may be coupled to the touch sensor 180K via the I2C interface, enabling communication between the processor 110 and the touch sensor 180K via the I2C bus interface, thereby implementing the touch function of the electronic device 100.

[0073] 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 enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the I2S interface, enabling the function of answering calls through a Bluetooth headset.

[0074] 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, enabling the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0075] The UART interface is a universal serial data bus used for asynchronous communication. This 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 typically 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 via the UART interface to implement Bluetooth functionality. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the UART interface, enabling the function of playing music through Bluetooth headphones.

[0076] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display 194 and the camera 193. MIPI interfaces include the camera serial interface (CSI) and the display serial interface (DSI). In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the camera function of the electronic device 100. The processor 110 and the display 194 communicate via the DSI interface to implement the display function of the electronic device 100.

[0077] The GPIO interface can be configured via software. The GPIO interface can be configured as either a control signal or a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 to the camera 193, display 194, wireless communication module 160, audio module 170, 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.

[0078] The USB interface 130 is an interface that complies with USB standards and may be a Mini USB interface, a Micro USB interface, a USB Type-C interface, or the like. The USB interface 130 can be used to connect a charger to charge the electronic device 100, or to transfer data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio. This interface can also be used to connect other electronic devices, such as augmented reality devices.

[0079] It is understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is merely an illustrative 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 from the above embodiments, or a combination of multiple interface connection methods.

[0080] The charging management module 140 is configured to receive charging input from a charger. The charger can be either a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 can receive wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also provide power to the electronic device 100 via the power management module 141.

[0081] 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 provides power to the processor 110, the internal memory 121, the display 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 count, and battery health status (leakage, impedance). 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.

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

[0083] 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 antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.

[0084] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G 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 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can 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 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0085] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted 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 being processed by the baseband processor, the low-frequency baseband signal is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the 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.

[0086] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency 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, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0087] 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 a network and other devices through wireless communication technologies. The wireless communication technologies 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).

[0088] Electronic device 100 implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.

[0089] Display screen 194 is used to display images, videos, and the like. 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 (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED). In some embodiments, electronic device 100 may include one or N display screens 194, where N is a positive integer greater than one.

[0090] The electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.

[0091] The ISP processes data fed back by camera 193. For example, when taking a photo, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, which is then passed to the ISP for processing and converted into a visible image. The ISP can also perform algorithmic optimization on image noise, brightness, and skin tone. It can also optimize parameters such as exposure and color temperature of the captured scene. In some embodiments, the ISP can be located within camera 193.

[0092] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then passes the electrical signal to the ISP for conversion 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.

[0093] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0094] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. This allows electronic device 100 to play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.

[0095] The NPU is a neural network (NN) computing processor. Drawing on the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it rapidly processes input information and can continuously self-learn. The NPU can enable intelligent cognitive applications in electronic device 100, such as image recognition, face recognition, speech recognition, and text comprehension.

[0096] 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 via the external memory interface 120 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.

[0097] The internal memory 121 can be used to store computer executable program codes, which include instructions. 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 application 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. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121 and / or instructions stored in a memory provided in the processor.

[0098] The electronic device 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0099] 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 provided in the processor 110, or some functional modules of the audio module 170 can be provided in the processor 110.

[0100] The speaker 170A, also called a "speaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or listen to hands-free calls through the speaker 170A.

[0101] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or a voice message, the user can place the receiver 170B close to the ear to hear the voice.

[0102] Microphone 170C, also known as "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 the microphone 170C to input the sound signal into the 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 source of sound, realize directional recording function, etc.

[0103] The headphone jack 170D is used to connect a wired headphone and can be the USB interface 130 or a 3.5mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0104] Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 180A can be located on display screen 194. There are many types of pressure sensors 180A, such as resistive, inductive, and capacitive. A capacitive pressure sensor can include at least two parallel plates made of conductive material. When force acts on pressure sensor 180A, the capacitance between the electrodes changes. Electronic device 100 determines the intensity of the pressure based on this change in capacitance. When a touch operation is applied to display screen 194, electronic device 100 detects the touch intensity based on pressure sensor 180A. Electronic device 100 can also calculate the touch location based on the detection signal from pressure sensor 180A. In some embodiments, touch operations applied to the same touch location but with different touch intensities can correspond to different operation instructions. For example, when a touch operation with an intensity less than a first pressure threshold is applied to a short message application icon, a command to view short messages is executed. When a touch operation with an intensity greater than or equal to the first pressure threshold is applied to a short message application icon, a command to create a new short message is executed.

[0105] The gyroscope 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 gyroscope sensor 180B. The gyroscope sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyroscope 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 gyroscope sensor 180B can also be used for navigation and somatosensory game scenes.

[0106] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude using the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.

[0107] 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 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 based on the magnetic sensor 180D. Based on the detected opening and closing status of the case or flip cover, features such as automatic unlocking of the flip cover can be configured.

[0108] Accelerometer 180E can detect the magnitude of acceleration of electronic device 100 in all directions (generally three axes). It can also detect the magnitude and direction of gravity when electronic device 100 is stationary. It can also be used to identify the electronic device's posture, enabling applications such as switching between landscape and portrait modes and pedometers.

[0109] The distance sensor 180F is used to measure distance. The electronic device 100 can measure distance using infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure distance to achieve fast focusing.

[0110] 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 is holding 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.

[0111] Ambient light sensor 180L is used to sense ambient light brightness. Electronic device 100 can adaptively adjust the brightness of display screen 194 based on the perceived ambient light. Ambient light sensor 180L can also be used to automatically adjust white balance when taking photos. Ambient light sensor 180L can also work with proximity light sensor 180G to detect whether electronic device 100 is in a pocket to prevent accidental touches.

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

[0113] 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 the 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 prevent the electronic device 100 from shutting down abnormally 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 prevent abnormal shutdown due to low temperature.

[0114] The touch sensor 180K is also called a "touch-sensitive device." The touch sensor 180K can be disposed on the display screen 194. 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 applied thereto or in the vicinity thereof. The touch sensor can transmit the detected touch operations to the application processor to determine the type of touch event. Visual output related to the touch operations can be provided via the display screen 194. In other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 100, at a location different from that of the display screen 194.

[0115] The bone conduction sensor 180M can obtain vibration signals. In some embodiments, the bone conduction sensor 180M can obtain vibration signals from the vibrating bones of the human body. The bone conduction sensor 180M can also contact the human pulse to receive blood pressure pulse signals. In some embodiments, the bone conduction sensor 180M can also be set in headphones to form bone conduction headphones. The audio module 170 can parse out voice signals based on the vibration signals of the vibrating bones of the human body obtained by the bone conduction sensor 180M to implement voice functions. The application processor can parse heart rate information based on the blood pressure pulse signals obtained by the bone conduction sensor 180M to implement heart rate detection functions.

[0116] The buttons 190 include a power button, a volume button, and the like. The buttons 190 may be mechanical buttons or touch buttons. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.

[0117] 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 acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0118] The indicator 192 may be an indicator light, which may be used to indicate the charging status, power level changes, messages, missed calls, notifications, etc.

[0119] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to or disconnected from the electronic device 100 by inserting it into or removing it 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 eSIM, 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.

[0120] For ease of understanding, the following embodiments of the present application will take an electronic device having the structure shown in FIG5 as an example, and combine the accompanying drawings and application scenarios to specifically explain the graphics drawing method provided in the embodiments of the present application.

[0121] Figure 6 is an architecture diagram of a graphics drawing method provided by an embodiment of the present application. As shown in Figure 6, the above architecture may include: an application (App), a handwriting control View, a handwriting capability layer and a GPU; wherein, the handwriting control View is integrated in the App, the handwriting capability layer is located in the CPU, and the handwriting capability layer may include: an interpolation module, a GL rendering module and a fast copy module.

[0122] As shown in Figure 6, after the handwriting control View receives a touch point, it passes the touch point to the interpolation module. The interpolation module then calls GL instructions for drawing. The GL rendering module executes these instructions and draws the graphics to the GPU's off-screen memory. After the handwriting control View sends a notification to the fast copy module to read the drawing result, the fast copy module reads the drawing result from the GPU's hardware buffer and returns it to the handwriting control View, completing the drawing.

[0123] The following describes the graphics drawing method provided in the embodiment of the present application in conjunction with the architecture shown in FIG6 .

[0124] FIG7 is a flowchart of a graphics drawing method provided by an embodiment of the present application. As shown in FIG7 , the graphics drawing method may include:

[0125] Step 701: When a handwriting app is started, the handwriting environment is initialized. The app initiates the initialization and notifies the handwriting capability layer through the handwriting control View.

[0126] Step 702, initialization phase, the handwriting capability layer creates a PbufferSurface in the main thread (UI thread) by calling the eglCreatePBufferSurface interface and initializes the off-screen rendering environment.

[0127] In other words, for subsequent off-screen rendering tasks, the handwriting capability layer uses the main thread to handle them, thereby taking advantage of the main thread being allocated as a medium core or a large core in the CPU to improve the execution speed of rendering tasks.

[0128] Step 703: The handwriting capability layer creates an embedded-system graphics library image (eglImage) bound to the hardware buffer (HardwareBuffer).

[0129] Step 704 : The handwriting capability layer creates a frame buffer object (FBO) bound to the embedded system graphics library object.

[0130] Step 705: The handwriting capability layer returns a message indicating that initialization is complete to the App via the handwriting control View.

[0131] Step 706: During the handwriting process of the handwriting application, the App responds to the Vsync signal of the Choreographer to obtain the input callback instruction, and the App passes the touch event (onTouchEvent) to the handwriting control View, and the handwriting control View passes the touch point to the handwriting capability layer.

[0132] In step 707, the handwriting capability layer interpolates the touch points through the interpolation module to generate a series of interpolation points, and sends the interpolation points to the GPU through GL instructions for rendering.

[0133] In step 708, the GL rendering module in the handwriting capability layer executes GL instructions to save the drawing result to the default FBO, and then copies the local area where the drawing result is located from the default FBO to the FBO bound to eglImage through glBlitFramebuffer.

[0134] Specifically, referring to FIG8 , this embodiment only copies the local area where the drawing result is located, rather than the entire area. In FIG8 , the filled area is the local area where the drawing result is located. FIG8 is a schematic diagram of a local area provided by an embodiment of the present application.

[0135] Step 709: The handwriting capability layer completes submitting the GL instruction and inserts a fence instruction.

[0136] Step 710: After the drawing is completed, the handwriting capability layer notifies the App of the drawing completion through the handwriting control View.

[0137] In step 711, the App responds to the Vsync signal of the Choreographer, obtains the callback instruction of drawing the frame (doFrame), and then sends the drawing canvas (onDraw(Canvas)) instruction to the handwriting control View. The handwriting control View sends a notification of reading the drawing result to the handwriting capability layer.

[0138] Step 712: The handwriting capability layer activates a fence instruction.

[0139] In step 713 , the handwriting capability layer copies the local rendering result from the GPU to the CPU through the fast copy module, and returns the local rendering result to the handwriting control View.

[0140] Specifically, Figure 9 is a schematic diagram of a rapid copy provided by one embodiment of the present application. Referring to Figure 9, the GL rendering module in the handwriting capability layer executes GL instructions to save the drawing results to the default FBO. Then, using glBlitFramebuffer, the local area containing the drawing results is copied from the default FBO to the FBO bound to the eglImage. The handwriting capability layer then uses the rapid copy module to copy the local drawing results from the hardware buffer bound to the eglImage.

[0141] Step 714: The handwriting control View fills the local drawing result into the created bitmap.

[0142] As described above, in this embodiment, the local drawing result can be the local area where the current drawing result is located. That is, when copying, only the local area where the current drawing is located is copied, and there is no need to copy the entire area, thereby increasing the copying speed and improving the hand tracking performance.

[0143] Step 715: The handwriting control View draws the filled bitmap onto the canvas through the Canvas.drawBitmap instruction.

[0144] The graphics drawing method provided in the embodiments of this application can achieve the effects of a variety of brushes with textures and strokes, such as fountain pens, ballpoint pens, pencils, and / or highlighters, and can customize brush transparency, while greatly improving chirality. Furthermore, the embodiments of this application use the main thread to handle rendering tasks, leveraging the advantage of the main thread being assigned to a medium or large core in the CPU to increase the execution speed of rendering tasks; using local rendering and rapid copying methods, it reduces the latency of copying data between the GPU and the CPU, improving chirality; and using OpenGL off-screen rendering methods, it achieves a variety of custom brush effects (strokes, textures, transparency, and / or color blending, etc.).

[0145] FIG10 is a flowchart of a graphics drawing method provided by another embodiment of the present application. As shown in FIG10 , the graphics drawing method may include:

[0146] Step 1001: The electronic device 100 obtains an input callback instruction in response to a vertical synchronization signal.

[0147] Furthermore, before step 1001, the electronic device 100 may also start a target application; wherein the target application includes a handwriting application; then, the electronic device 100 creates an off-screen rendering environment, creates an eglImage bound to the hardware cache, and creates a frame buffer object bound to the eglImage.

[0148] Step 1002: The electronic device 100 obtains the touch point in response to the input callback instruction.

[0149] In step 1003 , the electronic device 100 draws graphics according to the touch points, and draws the graphics drawing result into a default frame buffer object.

[0150] Specifically, drawing graphics according to the above touch points can be: the electronic device 100 performs interpolation processing according to the above touch points to generate interpolation points, and submits the above interpolation points to the graphics processor through graphics library instructions, so that the graphics processor draws graphics according to the above interpolation points.

[0151] Step 1004 : The electronic device 100 copies the graphics drawing result from the default frame buffer object to the frame buffer object bound to eglImage.

[0152] Step 1005 : The electronic device 100 obtains a callback instruction for drawing a frame in response to the vertical synchronization signal.

[0153] Step 1006 : The electronic device 100 obtains the graphics drawing result in the frame buffer object bound to the eglImage in response to the callback instruction of the drawing frame.

[0154] Among them, the frame buffer object bound to the above-mentioned eglImage is located in the hardware cache bound to the above-mentioned eglImage; in this way, in response to the callback instruction of the above-mentioned drawing frame, obtaining the graphics drawing result in the frame buffer object bound to the above-mentioned eglImage can be: in response to the callback instruction of the above-mentioned drawing frame, obtaining the graphics drawing result from the hardware cache bound to the eglImage.

[0155] Step 1007: The electronic device 100 fills the above-mentioned graphic drawing result into the created bitmap.

[0156] In step 1008 , the electronic device 100 draws the filled bitmap onto the canvas.

[0157] In a specific implementation, step 1004 may be: the electronic device 100 obtains the local area to which the above-mentioned graphics drawing result belongs, and copies the pixels of the above-mentioned local area from the default frame buffer object to the frame buffer object bound to eglImage. In this way, step 1006 may be: the electronic device 100 obtains the pixels of the above-mentioned local area from the frame buffer object bound to eglImage in response to the callback instruction of the above-mentioned drawing frame. Step 1007 may be: the electronic device 100 fills the obtained pixels of the above-mentioned local area into the created bitmap. That is to say, in this embodiment, when the electronic device 100 copies the graphics drawing result, it can only copy the local area where the current drawing is located, without copying the entire area, thereby increasing the copying speed and improving the hand tracking performance.

[0158] In the above-mentioned graphics drawing method, the electronic device 100 obtains an input callback instruction in response to a vertical synchronization signal, and then obtains a touch point in response to the above-mentioned input callback instruction, draws a graphic based on the above-mentioned touch point, and draws the graphic drawing result into the default frame buffer object. Then, the electronic device 100 copies the above-mentioned graphics drawing result from the default frame buffer object to the frame buffer object bound to eglImage, obtains a callback instruction for drawing a frame in response to the above-mentioned vertical synchronization signal, and obtains the graphics drawing result in the frame buffer object bound to eglImage in response to the above-mentioned callback instruction for drawing a frame, and fills the above-mentioned graphics drawing result into the created bitmap. Finally, the electronic device 100 draws the filled bitmap onto the canvas. In this way, it is possible to use off-screen rendering combined with rapid copy to perform rendering on the timing of the original control view, which can improve the handwriting effect and handwriting tracking of handwriting applications.

[0159] It is understood that some or all of the steps or operations in the above embodiments are merely examples, and the present application embodiments may also perform other operations or variations of various operations. In addition, the various steps may be performed in a different order than those presented in the above embodiments, and it is possible that not all of the operations in the above embodiments need to be performed.

[0160] It is understandable that, in order to realize the above functions, the electronic device includes hardware and / or software modules corresponding to the execution of each function. In combination with the algorithm steps of each example described in the embodiments disclosed in this application, this 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. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered to be beyond the scope of this application.

[0161] This embodiment can divide the electronic device into functional modules based on the above-mentioned method embodiment. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is illustrative and is only a logical functional division. In actual implementation, other division methods may be used.

[0162] FIG11 is a schematic diagram of the structure of an electronic device provided in another embodiment of the present application. In the case where each functional module is divided according to each function, FIG11 shows a possible schematic diagram of the composition of an electronic device 1100 involved in the above embodiment. As shown in FIG11 , the electronic device 1100 may include: an acquisition module 1101, a drawing module 1102, and a copy module 1103;

[0163] The acquisition module 1101 is configured to acquire an input callback instruction in response to a vertical synchronization signal; and acquire a touch point in response to the input callback instruction.

[0164] The drawing module 1102 is used to draw graphics according to the touch points and draw the graphics drawing results into the default frame buffer object; specifically, the function of the drawing module 1102 can be implemented by the interpolation module and GL rendering module in Figure 6;

[0165] A copy module 1103 is used to copy the above-mentioned graphics drawing result from the default frame buffer object to the frame buffer object bound to eglImage; specifically, the function of the copy module 1103 can be implemented by the GL rendering module in Figure 6;

[0166] The acquisition module 1101 is further configured to obtain a frame drawing callback instruction in response to the vertical synchronization signal; and obtain the graphics drawing result in the frame buffer object bound to the eglImage in response to the frame drawing callback instruction. Specifically, the functions of the acquisition module 1101 can be implemented by the fast copy module in FIG6 .

[0167] The drawing module 1102 is further configured to fill the above-mentioned graphic drawing result into the created bitmap; and draw the filled bitmap onto the canvas.

[0168] It should be noted that all relevant contents of each step involved in the method embodiment shown in Figure 10 of this application can be referred to the functional description of the corresponding functional module and will not be repeated here.

[0169] The electronic device 1100 provided in this embodiment is used to execute the graphics drawing method provided in the embodiment shown in FIG. 10 of the present application, and thus can achieve the same effect as the above method.

[0170] FIG12 is a schematic diagram of the structure of an electronic device provided in yet another embodiment of the present application. Compared with the electronic device 1100 shown in FIG11 , the difference lies in that the drawing module 1102 may include: a generating submodule 11021 and a submitting submodule 11022;

[0171] The generating submodule 11021 is configured to perform interpolation processing based on the touch points to generate interpolation points.

[0172] The submitting submodule 11022 is configured to submit the interpolation points to the graphics processor through graphics library instructions, so that the graphics processor can draw graphics based on the interpolation points.

[0173] In this embodiment, the frame buffer object bound to the eglImage is located in the hardware cache bound to the eglImage; thus, the acquisition module 1101 is specifically configured to obtain the graphics drawing result from the hardware cache bound to the eglImage in response to the callback instruction of the drawing frame.

[0174] The copy module 1103 is specifically configured to obtain the local area to which the graphics drawing result belongs, and copy the pixels of the local area from the default frame buffer object to the frame buffer object bound to eglImage.

[0175] The acquisition module 1101 is specifically configured to obtain the pixels of the local area from the frame buffer object bound to the eglImage in response to the callback instruction of the drawing frame. Thus, the drawing module 1102 is specifically configured to fill the pixels of the local area obtained by the acquisition module 1101 into the created bitmap.

[0176] Furthermore, the electronic device 1100 may further include: a starting module 1104 and a creating module 1105;

[0177] A starting module 1104 is used to start a target application; wherein the target application includes a handwriting application;

[0178] The creation module 1105 is used to create an off-screen rendering environment, create an eglImage bound to the hardware cache, and create a frame buffer object bound to the eglImage.

[0179] It should be noted that all relevant contents of each step involved in the method embodiment shown in Figure 10 of this application can be referred to the functional description of the corresponding functional module and will not be repeated here.

[0180] The electronic device 1100 provided in this embodiment is used to execute the graphics drawing method provided in the embodiment shown in FIG. 10 of the present application, and thus can achieve the same effect as the above method.

[0181] It should be understood that the electronic device 1100 may correspond to the electronic device 100 shown in Figure 5. The functions of the acquisition module 1101, the drawing module 1102, the copy module 1103, the start module 1104 and the creation module 1105 may be implemented by the processor 110 in the electronic device 100 shown in Figure 5.

[0182] In the case of adopting an integrated unit, the electronic device 1100 may include a processing module, a storage module, and a communication module.

[0183] The processing module can be used to control and manage the actions of the electronic device 1100. For example, it can be used to support the electronic device 1100 in executing the steps performed by the acquisition module 1101, the drawing module 1102, the copy module 1103, the startup module 1104, and the creation module 1105. The storage module can be used to support the electronic device 1100 in storing program code and data. The communication module can be used to support communication between the electronic device 1100 and other devices.

[0184] Among them, the processing module can be a processor or a controller, which can implement or execute the various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, and so on. The storage module can be a memory. The communication module can specifically be a device that interacts with other electronic devices, such as a radio frequency circuit, a Bluetooth chip and / or a Wi-Fi chip.

[0185] In one embodiment, when the processing module is a processor and the storage module is a memory, the electronic device 1100 involved in this embodiment may be a device having the structure shown in FIG. 5 .

[0186] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer-readable storage medium is run on a computer, it enables the computer to execute the method provided in the embodiment shown in Figure 10 of the present application.

[0187] An embodiment of the present application also provides a computer program product, which includes a computer program. When the computer program is run on a computer, it enables the computer to execute the method provided by the embodiment shown in Figure 10 of the present application.

[0188] In the embodiments of the present application, "at least one" refers to one or more, and "more" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can represent: a, b, c, a and b, a and c, b and c or a and b and c, where a, b, c can be single or multiple.

[0189] Those skilled in the art will appreciate that the various units and algorithm steps described in the embodiments disclosed herein can be implemented using a combination of electronic hardware, 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. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0190] Those skilled in the art will 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.

[0191] In the several embodiments provided in this application, if any function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of this application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0192] The above description is merely a specific embodiment of the present application. Any person skilled in the art may easily conceive of variations or substitutions within the technical scope disclosed in this application, and such variations or substitutions shall be within the scope of protection of this application. The scope of protection of this application shall be subject to the scope of protection of the claims.

Claims

1. A graphics drawing method, characterized in that: include: In response to a vertical synchronization signal, obtaining an input callback instruction; In response to the input callback instruction, acquiring a touch point; Draw a graphic according to the touch point, and draw the graphic drawing result into a default frame buffer object; Copying the graphics drawing result from the default frame buffer object to the frame buffer object bound to the embedded system graphics library object; In response to the vertical synchronization signal, obtaining a callback instruction for drawing a frame; In response to the callback instruction of the drawing frame, obtaining the graphics drawing result in the frame buffer object bound to the embedded system graphics library object; Fill the graphics drawing result into the created bitmap; Draw the filled bitmap onto the canvas.

2. The method according to claim 1, characterized in that Drawing a graphic according to the touch point includes: Performing interpolation processing according to the touch points to generate interpolation points; The interpolation points are submitted to a graphics processor through a graphics library instruction, so that the graphics processor draws graphics according to the interpolation points.

3. The method according to claim 1, characterized in that The frame buffer object bound to the embedded system graphics library object is located in the hardware cache bound to the embedded system graphics library object; The obtaining of the graphics drawing result in the frame buffer object bound to the embedded system graphics library object in response to the callback instruction of the drawing frame comprises: In response to the callback instruction of the drawing frame, the graphics drawing result is obtained from the hardware buffer bound to the embedded system graphics library object.

4. The method according to claim 1, characterized in that: The step of copying the graphics drawing result from the default frame buffer object to the frame buffer object bound to the embedded system graphics library object comprises: Obtaining the local area to which the graphic drawing result belongs; The pixels of the local area are copied from the default frame buffer object to the frame buffer object bound to the embedded system graphics library object.

5. The method according to claim 4, characterized in that The obtaining of the graphics drawing result in the frame buffer object bound to the embedded system graphics library object in response to the callback instruction of the drawing frame comprises: In response to the callback instruction of drawing the frame, the pixels of the local area are obtained from the frame buffer object bound to the embedded system graphics library object.

6. The method according to claim 5, characterized in that Filling the graphics drawing result into the created bitmap comprises: The acquired pixels of the local area are filled into the created bitmap.

7. The method according to any one of claims 1 to 6, characterized in that: Before obtaining the input callback instruction in response to the vertical synchronization signal, the method further includes: Starting a target application; wherein the target application includes a handwriting application; Create an off-screen rendering environment and create an embedded system graphics library object bound to the hardware cache; A frame buffer object is created that is bound to the embedded system graphics library object.

8. A graphics drawing device, characterized in that: include: An acquisition module, used for acquiring an input callback instruction in response to a vertical synchronization signal; and obtaining the touch point in response to the input callback instruction; A drawing module, used for drawing graphics according to the touch points, and drawing the graphics drawing results into a default frame buffer object; A copy module, used for copying the graphics drawing result from the default frame buffer object to the frame buffer object bound to the embedded system graphics library object; The acquisition module is further used to obtain a callback instruction for drawing a frame in response to the vertical synchronization signal; and to obtain a graphics drawing result in a frame buffer object bound to the embedded system graphics library object in response to the callback instruction for drawing a frame; The drawing module is further used to fill the graphics drawing result into the created bitmap; and draw the filled bitmap into the drawing On cloth.

9. An electronic device, characterized in that: include: one or more processors; Memory; Multiple applications; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions, which, when executed by the electronic device, enable the electronic device to perform the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed on a computer, enables the computer to execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Graph drawing method and device and electronic equipment

    CN119494767A

  • Method and system for optimizing screen handwriting following performance

    CN105677107A

  • Graffiti method for restoring handwriting based on H5 Canvas

    CN113760432A

  • Handwriting implementation method and system for ink screen equipment

    CN115756294A

  • Handwriting recognition method and device based on VIEW control

    CN116301555A

Cited By

  • Display method for loading animation and related equipment

    CN121616732A