Graph drawing method and device and electronic equipment
By responding to vertical synchronization signals and performing graphic drawing on Android or HarmonyOS mobile platforms, it solves the problem of difficult to achieve high-level handwriting effects and chirality in the existing technology, and realizes efficient rendering on the timing of the original control view, improving the Handwriting effect and chirality.
Patent Information
- Application Number
- CN202311020480.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-14
- Publication Date
- 2025-02-21
AI Technical Summary
The prior art is difficult to achieve advanced handwriting effects and chirality on Android or HarmonyOS mobile platforms, especially when combined with rendering timing of ordinary controls.
By responding to the vertical synchronization signal, the input callback instruction is obtained and the graphics is drawn, and the graphics drawing result is copied from the default frame buffer object to the frame buffer object bound by the embedded system graphics library object, and obtained and filled under the callback instruction to draw the frame In the bitmap, finally draw the bitmap onto the canvas.
It realizes rendering on the timing of the original control view, improving the handwriting effect, handwriting and chirality of handwriting applications.
Smart Images

Figure CN119494767A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of intelligent terminal technology, and in particular to a graphics drawing method, device and electronic device. Background Art
[0002] When developing handwriting applications on the existing Android or HarmonyOS mobile platforms, handwriting effect and hand tracking are two important experience indicators.
[0003] 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 operating system of the electronic device cannot achieve the above effects.
[0004] To achieve advanced handwriting effects using OpenGL, one solution provided by existing related technologies is to use a SurfaceView or TextureView control based on surface encapsulation. However, these two controls have independent life cycles and rendering timings, and often cannot be effectively combined with other conventional controls in the application, for example: mixing colors with the rendering results of other controls, or performing secondary rendering based on the drawing results of other controls.
[0005] Another solution is to use OpenGL's off-screen rendering capability to open up an independent video memory area for rendering. After the rendering is completed, the result is copied from the graphics processing unit (GPU) to the central processing unit (CPU), and then the image is drawn in the CPU through the Skia-based Canvas provided by the system. However, this method is limited by the data copying from GPU to CPU, and often cannot achieve an excellent hand tracking experience. Summary of the invention
[0006] 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.
[0007] 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 according to 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 the graphic 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 graphic drawing result into a created bitmap; and drawing the filled bitmap onto a canvas.
[0008] 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 according to 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 the 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 the 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. Thus, it is possible to use off-screen rendering combined with rapid copying to perform rendering on the timing of the original control view, which can improve the handwriting effect and handwriting tracking of handwriting applications.
[0009] In one possible implementation, drawing graphics according to the touch points includes: performing interpolation processing according to the touch points to generate interpolation points; submitting the interpolation points to a graphics processor through graphics library instructions, so that the graphics processor draws graphics according to the interpolation points.
[0010] 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; 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 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.
[0011] 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.
[0012] 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.
[0013] 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.
[0014] 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.
[0015] In a second aspect, an embodiment of the present application provides a graphics drawing device, which is included in an electronic device, and has the function of implementing the electronic device behavior in the first aspect and the possible implementation of the first aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above functions. For example, an acquisition module, a drawing module, and a copy module, etc.
[0016] 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.
[0017] 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.
[0018] 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.
[0019] 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.
[0020] In one possible design, the program in the fifth aspect may be stored in whole or in part on a storage medium packaged together with the processor, or may be stored in whole or in part on a memory not packaged together with the processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 Flowchart for using OpenGL in conjunction with SurfaceView to perform drawing;
[0022] Figure 2 This is a schematic diagram of the overall rendering timing of TextureView;
[0023] Figure 3 This is a flowchart for off-screen rendering via OpenGL;
[0024] Figure 4 This is a rendering timing diagram for off-screen rendering via OpenGL;
[0025] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present application;
[0026] Figure 6 An architectural diagram of a graphics drawing method provided in one embodiment of the present application;
[0027] Figure 7 A flowchart of a graphics drawing method provided for one embodiment of the present application;
[0028] Figure 8 A schematic diagram of a local area provided for one embodiment of the present application;
[0029] Fig. 9 A schematic diagram of rapid copying provided by an embodiment of the present application;
[0030] Fig.10 A flowchart of a graphics drawing method provided for another embodiment of the present application;
[0031] Fig.11 A schematic diagram of the structure of an electronic device provided in another embodiment of the present application;
[0032] Fig.12A schematic diagram of the structure of an electronic device provided in yet another embodiment of the present application. DETAILED DESCRIPTION
[0033] 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.
[0034] The following first introduces the handwriting implementation solution provided in the existing related technology.
[0035] One solution provided by the existing related technology is to use the Skia-based Canvas provided by the system to perform handwriting effect drawing. This technical solution uses the default Canvas interface provided by the system framework to perform drawing, uses the default drawPath and drawOval interfaces to achieve the drawing of connecting points into lines, and uses the drawBitmap interface to achieve the color mixing effect.
[0036] (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);
[0037] (2) The drawOval method is 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.
[0038] (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.
[0039] However, the above solution cannot achieve advanced handwriting effects, such as texture effects, cannot freely adjust transparency, and cannot customize the color mixing mode.
[0040] Another solution provided by the existing related technology is to use OpenGL in combination with SurfaceView to perform drawing. Figure 1 This is a flowchart for using OpenGL in conjunction with SurfaceView to perform drawing, such as Figure 1 As shown, the rendering process is as follows:
[0041] (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.
[0042] (2) Start a custom rendering thread to listen for rendering tasks.
[0043] (3)SurfaceView monitors touch events by registering onTouchListener
[0044] (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)
[0045] (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.
[0046] (6) Call OpenGL instructions to draw the points generated by interpolation;
[0047] (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.
[0048] However, in the above solution, SurfaceView has its own rendering timing and is independent of the application's own view control tree, so it can only be at the top or bottom of the entire application window and cannot be nested in other Views for use.
[0049] 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.
[0050] In addition, developers need to implement onSurfaceCreated, onSurfaceCreated and onSurfaceDestroy interfaces in SurfaceHolder#Callback to process data in different scenarios. For example, when the application retreats to the background through the home key, the Surface object inside SurfaceView itself will be destroyed, so the onSurfaceDestroy method will be executed, and the developer needs to save the data at this time; and when the application returns to the foreground again, the Surface object will be rebuilt, so the onSurfaceCreated method will be re-executed, and the rendering will be required again. Ordinary View controls do not have the special processing issues mentioned above.
[0051] 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.
[0052] Figure 2 This is a schematic diagram of the overall rendering timing of TextureView, such as Figure 2 As shown in the figure, after the Nth frame is drawn, the onFrameAvaliable interface of SurfaceTexture is automatically called through the eglSwapBuffers interface, and the invalidate() method of TextureView is called in the onFrameAvaliable interface to subscribe to the Vsync signal of the next frame. In the N+1 frame, the drawing result of the TextureView of the Nth frame is rendered.
[0053] However, the above solution has poor chirality, and the drawing result of the current frame can only be displayed in the next frame, with a default delay of one frame.
[0054] Another solution provided by the existing related technology is to use OpenGL off-screen rendering to render in an independent GPU video 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 drawBitmap method of Canvas. Figure 3This is a flowchart for off-screen rendering through OpenGL, such as Figure 3 As shown, the rendering process may include:
[0055] (1) Initialization phase: initialize the off-screen rendering environment through eglCreatePBufferSurface;
[0056] (2) In the drawing phase, submit the rendering task in onTouchEvent;
[0057] (3) The rendering task performs interpolation of the execution points and calls the graphics library (GL) instructions to draw the rendering results to the off-screen video memory.
[0058] (4) Read the rendering result from the GPU off-screen buffer to the CPU to form a bitmap through glReadPixels;
[0059] (5) When the callback instruction of Choreographer's drawing frame (doFrame) arrives, the read rendering result is drawn onto the Canvas through the Canvas's native drawBitmap method.
[0060] Figure 4 This is a rendering timing diagram for off-screen rendering through OpenGL, such as Figure 4 As shown, after the OpenGL rendering task is completed, the image data is directly read 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 not be actually drawn until the N+1 frame.
[0061] In other words, the above solution has poor chirality due to the existence of data copying from GPU to CPU.
[0062] 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 the 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.
[0063] 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 (UMPC), netbooks or personal digital assistants (PDA) and other devices; the embodiments of the present application do not impose any restrictions on the specific types of electronic devices.
[0064] For example, Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present application is shown as follows: Figure 5 As shown, 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.
[0065] 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.
[0066] 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 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 into one or more processors.
[0067] 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.
[0068] 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.
[0069] 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.
[0070] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (DCL). 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.
[0071] 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.
[0072] 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.
[0073] 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.
[0074] 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.
[0075] 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.
[0076] 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 transfer 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.
[0077] 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.
[0078] 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 100 through the power management module 141.
[0079] 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 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.
[0080] 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.
[0081] 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 antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0082] 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 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.
[0083] 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.
[0084] 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 integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0085] 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).
[0086] 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.
[0087] 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, a quantum dot light-emitting diode (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.
[0088] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0089] ISP is used to process the data fed back by 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 ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.
[0090] 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 optical signal into an electrical signal, and then passes 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.
[0091] 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.
[0092] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, 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.
[0093] 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.
[0094] 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, such as storing music, video and other files in the external memory card.
[0095] 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.
[0096] 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.
[0097] 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.
[0098] 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.
[0099] 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.
[0100] 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.
[0101] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0102] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. 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. The 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 according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the touch operation intensity according to the pressure sensor 180A. The electronic device 100 can also calculate the touch position according to 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 a touch operation with a touch operation intensity less than 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 touch operation intensity 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.
[0103] 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.
[0104] 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 positioning and navigation.
[0105] 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.
[0106] 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.
[0107] 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.
[0108] 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.
[0109] 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.
[0110] 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.
[0111] 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 performs a boost on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
[0112] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control 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.
[0113] 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.
[0114] 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.
[0115] 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.
[0116] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
[0117] 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 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.
[0118] For ease of understanding, the following embodiments of the present application will be described in detail with Figure 5 Taking the electronic device with the structure shown as an example, the graphics drawing method provided in the embodiment of the present application is specifically described in combination with the accompanying drawings and application scenarios.
[0119] Figure 6 The architecture diagram of the graphics drawing method provided by one embodiment of the present application is as follows: Figure 6 As shown, the above architecture may include: application (App), handwriting control View, handwriting capability layer and 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: interpolation module, GL rendering module and fast copy module.
[0120] See also Figure 6 After the handwriting control View obtains the touch point, it passes the touch point to the interpolation module. Then, the interpolation module calls the GL instruction to draw, and the GL rendering module executes the GL instruction to draw the graphics to the GPU 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 hardware buffer, and then the fast copy module returns the drawing result to the handwriting control View to complete the graphics drawing.
[0121] Combine the following Figure 6 The architecture shown illustrates the graphics drawing method provided in the embodiment of the present application.
[0122] Figure 7 A flowchart of a graphics drawing method provided by an embodiment of the present application, such as Figure 7 As shown, the above-mentioned graphics drawing method may include:
[0123] Step 701, when the handwriting app is started, the handwriting environment is initialized. The initialization is initiated by the app and the handwriting capability layer is notified through the handwriting control View.
[0124] Step 702, initialization phase, the handwriting capability layer creates PbufferSurface in the main thread (UI thread) by calling the eglCreatePBufferSurface interface and initializes the off-screen rendering environment.
[0125] 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 the rendering tasks.
[0126] Step 703: The handwriting capability layer creates an embedded-system graphics library object (eglImage) bound to the hardware buffer (HardwareBuffer).
[0127] Step 704: the handwriting capability layer creates a framebuffer object (FBO) bound to the embedded system graphics library object.
[0128] Step 705: The handwriting capability layer returns a message indicating that initialization is complete to the App via the handwriting control View.
[0129] Step 706, during the handwriting process of the handwriting application, the App responds to the Vsync signal of the Choreographer, obtains 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.
[0130] Step 707: The handwriting capability layer interpolates the touch points to generate a series of interpolation points through the interpolation module, and sends the interpolation points to the GPU for drawing through GL instructions.
[0131] Step 708: The GL rendering module in the handwriting capability layer executes the GL instruction 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.
[0132] Specifically, see Figure 8 In this embodiment, when copying, only the local area where the drawing result is located is copied, not the entire area. Figure 8In the figure, the filled area is the local area where the drawing result is located. Figure 8 A schematic diagram of a local area provided for one embodiment of the present application.
[0133] Step 709: the handwriting capability layer completes submitting the GL instruction and inserts a fence instruction.
[0134] Step 710: After the drawing is completed, the handwriting capability layer notifies the App of the drawing completion through the handwriting control View.
[0135] Step 711, the App responds to the above-mentioned Vsync signal of Choreographer, obtains the callback instruction of drawing frame (doFrame), and then sends the drawing canvas (onDraw(Canvas)) instruction to the handwriting control View, and the handwriting control View sends a notification of reading the drawing result to the handwriting capability layer.
[0136] Step 712: The handwriting capability layer activates a fence instruction.
[0137] Step 713: The handwriting capability layer copies the local drawing result from the GPU to the CPU through the fast copy module, and returns the local drawing result to the handwriting control View.
[0138] Specifically, Fig. 9 A schematic diagram of a rapid copy provided by an embodiment of the present application is shown in FIG. Fig. 9 , the GL rendering module in the handwriting capability layer executes GL instructions to save the drawing results to the default FBO, and then copies the local area where the drawing results are located from the default FBO to the FBO bound to eglImage through glBlitFramebuffer. Then, the handwriting capability layer copies the local drawing results from the hardware buffer bound to eglImage through the fast copy module.
[0139] Step 714: The handwriting control View fills the local drawing result into the created bitmap.
[0140] 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.
[0141] Step 715: The handwriting control View draws the filled bitmap onto the canvas through the Canvas.drawBitmap instruction.
[0142] The graphics drawing method provided in the embodiment of the present application can realize the effects of various brushes with textures and pen tips, such as fountain pens, ballpoint pens, pencils and / or highlighters, and can customize the transparency of the brush, and greatly improve the hand-following performance. In addition, the embodiment of the present application uses the main thread to process rendering tasks, 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; using local drawing and rapid copying methods, the delay of data copying between the GPU and the CPU is reduced, the hand-following performance is improved, and the OpenGL off-screen rendering method is used to achieve a variety of custom brush effects (pen tips, textures, transparency and / or color mixing, etc.).
[0143] Fig.10 A flowchart of a graphics drawing method provided by another embodiment of the present application is as follows: Fig.10 As shown, the above-mentioned graphics drawing method may include:
[0144] Step 1001: the electronic device 100 obtains an input callback instruction in response to a vertical synchronization signal.
[0145] 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.
[0146] Step 1002: The electronic device 100 obtains the touch point in response to the input callback instruction.
[0147] Step 1003: the electronic device 100 draws graphics according to the touch points, and draws the graphics drawing results into a default frame buffer object.
[0148] Specifically, drawing graphics according to the touch points may be as follows: the electronic device 100 performs interpolation processing according to the touch points to generate interpolation points, and submits the interpolation points to the graphics processor through graphics library instructions, so that the graphics processor draws graphics according to the interpolation points.
[0149] Step 1004: 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.
[0150] Step 1005 : The electronic device 100 obtains a callback instruction for drawing a frame in response to the vertical synchronization signal.
[0151] 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.
[0152] 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.
[0153] Step 1007: The electronic device 100 fills the above-mentioned graphic drawing results into the created bitmap.
[0154] Step 1008 : The electronic device 100 draws the filled bitmap onto the canvas.
[0155] 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 responds to the callback instruction of the above-mentioned drawing frame, and obtains the pixels of the above-mentioned local area from the frame buffer object bound to eglImage. 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.
[0156] 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 according to 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 the 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 the 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. Thus, it is possible to use off-screen rendering combined with rapid copying to perform rendering on the timing of the original control view, which can improve the handwriting effect and handwriting tracking properties of handwriting applications.
[0157] It is to be 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 different orders presented in the above embodiments, and it is possible that not all of the operations in the above embodiments need to be performed.
[0158] 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, 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. 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 exceed the scope of this application.
[0159] This embodiment can divide the electronic device into functional modules according to the above 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 integrated module can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0160] Fig.11 A schematic diagram of the structure of an electronic device provided in another embodiment of the present application, in which each functional module is divided according to each function, Fig.11 A possible schematic diagram of the composition of the electronic device 1100 involved in the above embodiment is shown. Fig.11 As shown, the electronic device 1100 may include: an acquisition module 1101, a drawing module 1102 and a copy module 1103;
[0161] The acquisition module 1101 is used 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;
[0162] The drawing module 1102 is used to draw graphics according to the above touch points and draw the graphics drawing results into the default frame buffer object; specifically, the function of the drawing module 1102 can be achieved through Figure 6 The interpolation module and GL rendering module are implemented in;
[0163] The 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 achieved by Figure 6 GL rendering module implementation in;
[0164] The acquisition module 1101 is also used to respond to the vertical synchronization signal to obtain the callback instruction of the drawing frame; and respond to the callback instruction of the drawing frame to obtain the graphics drawing result in the frame buffer object bound to eglImage; specifically, the function of the acquisition module 1101 can be achieved through Figure 6 The rapid copy module is implemented in ;
[0165] The drawing module 1102 is further used to fill the above-mentioned graphic drawing results into the created bitmap; and draw the filled bitmap onto the canvas.
[0166] It should be noted that this application Fig.10 All relevant contents of each step involved in the illustrated method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.
[0167] The electronic device 1100 provided in this embodiment is used to execute the present application Fig.10 The graphics drawing method provided by the illustrated embodiment can therefore achieve the same effect as the above-mentioned method.
[0168] Fig.12 A schematic diagram of the structure of an electronic device provided in another embodiment of the present application, Fig.11 Compared with the electronic device 1100 shown in the figure, the difference is that the drawing module 1102 may include: a generating submodule 11021 and a submitting submodule 11022;
[0169] The generating submodule 11021 is used to perform interpolation processing according to the above touch points to generate interpolation points;
[0170] The submitting submodule 11022 is used to submit the interpolation points to the graphics processor through graphics library instructions, so that the graphics processor draws graphics according to the interpolation points.
[0171] 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 used to obtain the graphics drawing result from the hardware cache bound to the eglImage in response to the callback instruction of the drawing frame.
[0172] The copy module 1103 is specifically used to obtain the local area to which the above-mentioned graphic drawing result belongs, and copy the pixels of the above-mentioned local area from the default frame buffer object to the frame buffer object bound to eglImage.
[0173] The acquisition module 1101 is specifically used to respond to the callback instruction of the drawing frame and obtain the pixels of the local area from the frame buffer object bound to the eglImage. Thus, the drawing module 1102 is specifically used to fill the pixels of the local area obtained by the acquisition module 1101 into the created bitmap.
[0174] Furthermore, the electronic device 1100 may further include: a starting module 1104 and a creating module 1105;
[0175] A starting module 1104 is used to start a target application; wherein the target application includes a handwriting application;
[0176] 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.
[0177] It should be noted that this application Fig.10 All relevant contents of each step involved in the illustrated method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.
[0178] The electronic device 1100 provided in this embodiment is used to execute the present application Fig.10 The graphics drawing method provided by the illustrated embodiment can therefore achieve the same effect as the above-mentioned method.
[0179] It should be understood that the electronic device 1100 may correspond to Figure 5 The electronic device 100 shown in FIG. Among them, the functions of the acquisition module 1101, the drawing module 1102, the copy module 1103, the start module 1104 and the creation module 1105 can be Figure 5 The processor 110 in the electronic device 100 is shown implemented.
[0180] In the case of adopting an integrated unit, the electronic device 1100 may include a processing module, a storage module, and a communication module.
[0181] 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 to execute the steps executed 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 to store program codes and data, etc. The communication module can be used to support the communication between the electronic device 1100 and other devices.
[0182] Among them, the processing module can be a processor or a controller, which can implement or execute various exemplary logic boxes, 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.
[0183] 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 can be a device having Figure 5 Device of the structure shown.
[0184] The present application also 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 present application. Fig.10 The method provided by the illustrated embodiment.
[0185] The present application also provides a computer program product, which includes a computer program, which, when executed on a computer, enables the computer to execute the present application. Fig.10 The method provided by the illustrated embodiment.
[0186] In the embodiments of the present application, "at least one" refers to one or more, and "more than one" 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 be represented by: 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.
[0187] Those of ordinary skill in the art will appreciate that the various units and algorithm steps described in the embodiments disclosed herein can be implemented in 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. 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.
[0188] 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.
[0189] In several embodiments provided in the present application, any function can be stored in a computer-readable storage medium if it is implemented in the form of a software functional unit and sold or used as an independent product. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence or in other words, the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present 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.
[0190] The above is only a specific implementation of the present application. Any person skilled in the art 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. The protection scope of the present application should be based on the protection scope 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 onto the canvas.
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
Cited By
Graphics drawing method and apparatus, and electronic device
EP4726643A1
Graphics drawing method and apparatus, and electronic device
WO2025035901A1