A method, device and storage medium for displaying handwriting based on an Android system
By sharing the display buffer in the electronic whiteboard system and using the SKIA drawing engine to draw the coordinate information of handwriting operations in real time, the problem of delayed handwriting display caused by the Android display mechanism is solved, improving the response speed and experience of users' handwriting.
Patent Information
- Application Number
- CN202080002556.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-29
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2041-02-03
AI Technical Summary
When using an electronic whiteboard, the delayed display of handwriting due to the Android display mechanism affects the user's handwriting experience.
By sharing the first display buffer corresponding to the currently displayed page with the canvas of the local layer as a graphics buffer, and utilizing the SKIA graphics engine to draw the coordinate information of hand-drawn operations in real time, combined with the Triple Buffer and Choreographer mechanisms, the content of the display buffer is optimized and synchronized, reducing latency.
It enables real-time display of handwriting, improving the response speed and user experience of handwriting input.
Smart Images

Figure CN115280265B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of Android, and in particular, to a method and device for displaying handwriting based on an Android system and a storage medium. BACKGROUND
[0002] With the popularity of electronic whiteboards, electronic whiteboards can not only meet the communication in daily work, but also store and print the meeting content.
[0003] However, when using an electronic whiteboard in a meeting, due to the Android display mechanism, there is a certain time consumption in the process of waiting for a vertical synchronization (VSYNC) signal and a buffer area application release. When the time consumption is reflected on the electronic whiteboard, the line drawn by the electronic whiteboard cannot be quickly matched to the coordinates passed by the user's finger after the finger is drawn across the screen of the electronic whiteboard, thereby causing a delayed drawing effect and affecting the experience of the user's handwriting.
[0004] Therefore, how to reduce the delay of handwriting display has become a technical problem to be solved. SUMMARY
[0005] The present disclosure provides a method and device for displaying handwriting based on an Android system and a storage medium to solve the technical problem of delayed handwriting display in the prior art.
[0006] In a first aspect, to solve the above technical problem, a technical solution of a method for displaying handwriting is provided as follows:
[0007] When an application is called, a first display buffer corresponding to a current display page is shared to a canvas of a native layer as a graphics buffer of the canvas; wherein the first display buffer is one display buffer in a display cache corresponding to the current display page;
[0008] During a user's hand-drawing operation, coordinate information corresponding to the hand-drawing operation is acquired in real time;
[0009] The coordinate information is drawn into the canvas by a drawing engine SKIA to form and display a corresponding hand-drawing track.
[0010] A possible implementation manner includes the following steps:
[0011] The display cache is mapped to a virtual memory corresponding to the application; wherein the display cache includes a plurality of display buffers, and the virtual memory has the same size as the display cache;
[0012] determining a first zone number of the first display buffer;
[0013] obtaining a first virtual region corresponding to the first number from the virtual memory;
[0014] taking the first virtual region as the graphics buffer.
[0015] In a possible implementation, the display cache is mapped to the virtual memory corresponding to the application, comprising:
[0016] obtaining basic information of the display cache; wherein the basic information comprises a size of the display cache;
[0017] creating the virtual memory with the same size as the display cache according to the basic information;
[0018] mapping the display cache to the virtual cache.
[0019] In a possible implementation, before the user performs the hand-drawing operation, the method further comprises:
[0020] synchronizing data in the first display buffer to the remaining display buffers.
[0021] In a possible implementation, the coordinate information is drawn into the canvas by a drawing engine SKIA to form and display a corresponding hand-drawing track, comprising:
[0022] backing up data in the first display buffer to a temporary buffer;
[0023] when a pressing operation in the hand-drawing operation is captured, setting the coordinate information in a Path object and passing it to the canvas for track drawing, and ending the track drawing when the pressing operation is not captured, to obtain the hand-drawing track.
[0024] In a possible implementation, after the pressing operation is not captured, the method further comprises:
[0025] optimizing the hand-drawing track;
[0026] covering the second display buffer with data of the temporary buffer, and notifying SurfaceFlinger to synthesize the optimized hand-drawing track to the second display buffer;
[0027] The second display buffer is switched to the display buffer corresponding to the current display page, and when the next vertical synchronization signal arrives, the content of the second display buffer is refreshed to the current display page; wherein, in the display cache, the second display buffer is the next display buffer after the first display buffer, and the next display buffer after the last display buffer in the display cache is the first display buffer in the display cache.
[0028] One possible implementation, after refreshing the contents of the second display buffer to the current display page, further includes:
[0029] If no new hand-drawn action is captured, the temporary buffer is released and the mapping of the display cache is terminated.
[0030] Secondly, embodiments of this disclosure provide a handwriting display device based on the Android system, comprising:
[0031] A sharing unit is used to share a first display buffer corresponding to the currently displayed page with the canvas of the local layer when the application is invoked, as the graphics buffer of the canvas; wherein, the first display buffer is a display buffer in the display cache corresponding to the currently displayed page;
[0032] The acquisition unit is used to acquire the coordinate information corresponding to the hand-drawing operation in real time during the user's hand-drawing operation;
[0033] The drawing unit is used to draw the coordinate information onto the canvas using the SKIA drawing engine, forming and displaying the corresponding hand-drawn trajectory.
[0034] In one possible implementation, the shared unit is used for:
[0035] The display cache is mapped to the virtual memory corresponding to the application; wherein the display cache includes multiple display buffers, and the virtual memory is the same size as the display cache;
[0036] Determine the first zone number of the first display buffer;
[0037] Obtain the first virtual region corresponding to the first number from the virtual memory;
[0038] The first virtual region is used as the graphics buffer.
[0039] In one possible implementation, the shared unit is further configured to:
[0040] Obtain basic information about the display cache; wherein, the basic information includes the size of the display cache;
[0041] Based on the basic information, create virtual memory of the same size as the display cache;
[0042] Map the display cache to the virtual cache.
[0043] In one possible implementation, the acquisition unit is further configured to:
[0044] Before the user performs the hand-drawing operation, the data in the first display buffer is synchronized to the other display buffers.
[0045] In one possible implementation, the drawing unit is used for:
[0046] Back up the data in the first display buffer to a temporary buffer;
[0047] When a press operation is captured in the hand-drawn operation, the coordinate information is set in the Path object and passed to the canvas for trajectory drawing. When the press operation is not captured, the trajectory drawing ends, and the hand-drawn trajectory is obtained.
[0048] In one possible implementation, the drawing unit is further configured to:
[0049] After the press operation is not captured, the hand-drawn trajectory is optimized;
[0050] The data in the temporary buffer is used to overwrite the second display buffer, and SurfaceFlinger is notified to synthesize the optimized hand-drawn trajectory into the second display buffer;
[0051] The second display buffer is switched to the display buffer corresponding to the current display page, and when the next vertical synchronization signal arrives, the content of the second display buffer is refreshed to the current display page; wherein, in the display cache, the second display buffer is the next display buffer after the first display buffer, and the next display buffer after the last display buffer in the display cache is the first display buffer in the display cache.
[0052] In one possible implementation, the drawing unit is further configured to:
[0053] After refreshing the contents of the second display buffer to the current display page, if no new hand-drawn operation is captured, the temporary buffer is released and the mapping of the display cache is terminated.
[0054] Thirdly, embodiments of this disclosure also provide a handwriting display device based on the Android system, comprising:
[0055] At least one processor, and
[0056] a memory connected with the at least one processor;
[0057] The memory stores instructions executable by the at least one processor, and the at least one processor executes the instructions stored in the memory to perform the method of the first aspect.
[0058] In a fourth aspect, the embodiments of the present disclosure further provide a readable storage medium, comprising:
[0059] a memory,
[0060] The memory is configured to store instructions, and when the instructions are executed by the processor, the apparatus comprising the readable storage medium completes the method of the first aspect. BRIEF DESCRIPTION OF DRAWINGS
[0061] Figure 1 is a schematic diagram of an Android system framework;
[0062] Figure 2 is a flowchart of screen rendering in an Android system;
[0063] Figure 3 is a flowchart of a handwriting display method provided by the embodiments of the present disclosure;
[0064] Figure 4 is a schematic diagram of a mapping display buffer provided by the embodiments of the present disclosure;
[0065] Figure 5 is a schematic diagram of a plurality of display buffer corresponding images of the display memory when forming a hand-drawn track provided by the embodiments of the present disclosure;
[0066] Figure 6 is a schematic diagram of an optimized hand-drawn track in a second display buffer provided by the embodiments of the present disclosure;
[0067] Figure 7 is a schematic diagram of a plurality of display buffer corresponding images of the display memory when forming a new hand-drawn track provided by the embodiments of the present disclosure Figure 1 ;
[0068] Figure 8 is a schematic diagram of a plurality of display buffer corresponding images of the display memory when forming a new hand-drawn track provided by the embodiments of the present disclosure Figure 2 ;
[0069] Figure 9 is a schematic diagram of a plurality of display buffer corresponding images of the display memory when forming a new hand-drawn track provided by the embodiments of the present disclosure Figure 3 ;
[0070] Figure 10A final "king" character diagram provided by the embodiment of the present disclosure;
[0071] Figure 11 A structure diagram of a handwriting display device provided by the embodiment of the present disclosure. DETAILED DESCRIPTION
[0072] The embodiment of the present disclosure provides a handwriting display method and device based on an Android system and a storage medium, to solve the technical problem of handwriting delay display in the prior art.
[0073] In order to better understand the above technical solutions, the technical solutions of the present disclosure will be described in detail below through the drawings and specific embodiments. It should be understood that the specific features in the embodiments of the present disclosure and the embodiments are detailed descriptions of the technical solutions of the present disclosure, and are not limitations of the technical solutions of the present disclosure. In the case of no conflict, the technical features in the embodiments of the present disclosure and the embodiments can be combined with each other.
[0074] In order to enable those skilled in the art to fully understand the present scheme, the related technologies are briefly introduced before the present scheme is accepted.
[0075] Please refer to Figure 1 An Android system framework diagram.
[0076] The Android system includes an application layer APP, a local interface (Java Native Interface, JNI), a drawing engine (Skia), libfd_dev.so, and a Framebuffer. The libfd_dev.so is used to operate the underlying Framebuffer to realize reading and writing. The Skia framework is responsible for the drawing of the Native handwriting, and the related drawing interface is provided to the upper-layer application APP for calling through the JNI mechanism of Android.
[0077] Among them, Skia is a bottom layer graphics, image, animation, scalable vector graphics (Scalable VectorGraphics, SVG), text and other aspects of the graphics library, which is a 2D engine of the graphics system in Android. In the Android system, the native layer (Native layer) is written in C / C++ language, which communicates with the application layer (written in Java language, also called Java layer) to process relatively complex operations and access the underlying of the operating system (such as system hardware). In general, the above Skia is located in the Native layer. The 2D drawing interface provided by Android to the APP developer, such as drawing a straight line, a circle, a bitmap, etc., is the JNI encapsulation of the Skia library interface of the native layer (Native layer).
[0078] Please refer toFigure 2 Flow chart of screen rendering in Android system.
[0079] Step 201: application sends a registration request to WMS.
[0080] An application (APP) in application layer sends a request of registering a window to a window management service (WMS), so that the WMS allocates a window for the application.
[0081] Step 202: WMS sends a request of allocating a Surface to SurfaceFlinger.
[0082] The WMS sends a request of allocating a graphic interface (Surface) for the application to SurfaceFlinger according to the registration request.
[0083] Step 203: SurfaceFlinger returns allocation information to WMS.
[0084] SurfaceFlinger allocates a buffer for the application according to the request of WMS, and returns the allocation information to WMS.
[0085] Step 204: WMS returns a Surface object to the application.
[0086] The WMS generates a Surface object corresponding to the application according to the allocation information, and returns the Surface object to the application. The Surface object corresponds to a window to be rendered in the APP.
[0087] Then, the application renders on the buffer corresponding to the Surface object, and executes step 105 after the rendering is completed.
[0088] Step 205: rendering is completed, and update is notified.
[0089] After the rendering is completed, the application notifies SurfaceFlinger to update, so as to display the rendering result on the system screen.
[0090] When updating the display screen, all windows (Surface objects) of the APP will be superimposed into a bitmap memory with the same size as the display screen on the system screen, and written to the Framebuffer. When the VSYNC signal arrives after the writing is completed, the Framebuffer is displayed to the screen as the current display buffer to complete the rendering update of the display screen. Linux abstracts the Framebuffer device to provide user state processes with direct screen writing, and the Framebuffer mechanism simulates the function of a display card, abstracts the hardware structure of the display card, and can directly operate the display memory through the reading and writing of the Framebuffer.
[0091] In Android, the VSYNC signal is periodically generated by the underlying HWcomposer, and the general mainstream refresh frequency is 60 times per second, that is, the screen is refreshed once every 16 ms, and the VSYNC signal is sent once.
[0092] To solve the problem of poor UI (User Interface) smoothness of Android, the Android system introduces the design of Triple Buffer and Choreographer, which cooperates with the VSYNC signal to realize the multi-buffer mechanism, that is, only one Framebuffer content is displayed on the screen at each time, and the undisplayed cache Framebuffer is applied from the display queue for window drawing, and after the VSYNC signal arrives, it is exchanged as the front buffer for display.
[0093] In the conference whiteboard system, the most important function is to meet the user's demand for handwriting input of the conference discussion content, but due to the above-mentioned Android display mechanism, the window completed by drawing will cause a certain time consumption in the process of waiting for the VSYNC signal and the buffer application and release. When reflected on the device, that is, after the user's finger passes through the screen, the drawn line cannot be quickly corresponded to the coordinates passed by the finger, so that the effect of delayed drawing appears, which affects the user's handwriting experience.
[0094] The technical solution in the embodiment of the present disclosure solves the above technical problems by adopting the following scheme:
[0095] Please refer to Figure 3 The present embodiment provides a handwriting display method based on an Android system, and the processing process of the method is as follows.
[0096] Step 301: when the application is invoked, a first display buffer corresponding to a current display page is shared to a canvas of a native layer as a graphics buffer of the canvas; wherein the first display buffer is one of display buffers in a display cache corresponding to the current display page.
[0097] The current display page is a page currently displayed in the screen, and the first display buffer is one of display buffers in the display cache corresponding to the page. Currently, the data in the first display buffer is displayed in the screen as a bitmap.
[0098] The first display buffer corresponding to the current display page is shared to a canvas (SkCanvas) of a native layer as a graphics buffer (SkBitmap) of the canvas. This can be achieved by: mapping the display cache to a virtual memory corresponding to the application; wherein the display cache includes a plurality of display buffers, and the virtual memory has a same size as the display cache; determining a first zone number of the first display buffer; obtaining a first virtual zone corresponding to the first zone number from the virtual memory; and taking the first virtual zone as the graphics buffer.
[0099] If the electronic device adopts a double buffer mechanism, the display cache includes two display buffers. If the electronic device adopts a multi-buffer mechanism, the display cache includes three or more display buffers.
[0100] The display cache can be mapped to the virtual memory corresponding to the application by: obtaining basic information of the display cache; wherein the basic information includes a size of the display cache; creating a virtual memory having a same size as the display cache according to the basic information; and mapping the display cache to the virtual cache.
[0101] In the Android system, the size of the display cache, including the size information of the display buffer, can be obtained by calling the libfbdev.so dynamic library to open the / dev / graphics / fb0 device, and the display cache can be mapped to the virtual memory of the application layer by the mmap function to obtain an application layer pointer addr, and then the display cache is mapped to the virtual cache and encapsulated in the canvas (SkCanvas) as the graphics buffer (SkBitmap) of the canvas (SkCanvas) for subsequent hand-drawing operations in the canvas (SkCanvas) by using the drawing engine SKIA.
[0102] Please refer to Figure 4 A schematic diagram of mapping the display cache is provided in the embodiments of the present disclosure. According to the design of TripleBuffer, the display cache includes three continuous display buffers, and thus the virtual memory also includes three continuous virtual zones. In the TripleBuffer design, the first display buffer is mapped to the first virtual zone, the second display buffer is mapped to the second virtual zone, and the third display buffer is mapped to the third virtual zone. Figure 4The pointer addr is used to address virtual memory. The starting addresses of the three virtual regions in virtual memory are represented by addr1, addr2, and addr3 respectively.
[0103] Then, by calling the relevant Skia dynamic library, the canvas of the Native layer can be allocated, and the display cache mapped to virtual memory can be encapsulated by the SkBitmap object and placed in the canvas object.
[0104] Since the display cache includes multiple display buffers, and the first display buffer (front buffer) corresponding to the currently displayed page switches between multiple display buffers as the application instructs for drawing refresh, it is necessary to accurately obtain the number of the first display buffer in order to ensure that the graphics buffer used by the canvas is the first display buffer.
[0105] Determining the first number of the first display buffer can be achieved by setting up a shared memory. When switching display buffers, the display cache writes the first number into this shared memory, and the native layer reads the first number from this shared memory. Then, it retrieves the first virtual region corresponding to the first number from virtual memory, instead of using it as the canvas's graphics buffer. This allows for the direct drawing of simple 2D images from the video memory cache, ensuring consistency with the trajectory drawn using Skia.
[0106] After sharing the first display buffer corresponding to the currently displayed page with the canvas of the local layer, step 302 can be executed.
[0107] Step 302: During the user's hand-drawing operation, obtain the coordinate information corresponding to the hand-drawing operation in real time.
[0108] Hand-drawing operations can be performed directly on the screen with a finger, or by the user using a pen to perform operations on the screen.
[0109] Before the user performs a freehand drawing operation, the data in the first display buffer can be synchronized to the other display buffers.
[0110] Since this disclosure bypasses the Choreographer mechanism of the Android system for drawing, before performing the freehand drawing operation, by synchronizing the data in the first display buffer to the other display buffers, all display buffers in the display cache can be filled with the data of the currently displayed page.
[0111] The coordinate information corresponding to the hand-drawing operation can be obtained by calling the callback function. After obtaining the coordinate information of the hand-drawing operation, step 303 can be executed.
[0112] Step 303: draw the coordinate information into the canvas by using the drawing engine SKIA to form and display the corresponding hand-drawing track.
[0113] The drawing of the coordinate information into the canvas by using the drawing engine SKIA to form and display the corresponding hand-drawing track can be implemented in the following manner:
[0114] Backup the data in the first display buffer to the temporary buffer; when a press operation in the hand-drawing operation is captured, set the coordinate information in the Path object and pass it to the canvas for track drawing, and end the track drawing when the press operation is not captured to obtain the hand-drawing track. Since the first display buffer has been previously mapped to the display buffer, the above hand-drawing operation is equivalent to drawing in the first display buffer, so that the real-time displayed hand-drawing track can be obtained and the hand-drawing track can quickly follow the hand-drawing operation.
[0115] Please refer to Figure 5 , the schematic diagram of displaying the images corresponding to the plurality of display buffers of the memory when forming the hand-drawing track is provided. It is assumed that the images corresponding to all the display buffers are blank images at the initial time, Figure 5 The images numbered 1-3 in the figure are the images corresponding to the data of the three display buffers in the display cache, the arrow points to the image corresponding to the first display buffer (the same below), that is, image 1 is the image displayed by the current display page, and the other two images are not currently displayed. When the user performs a hand-drawing operation once, the track of "one" is formed in Figure 1 .
[0116] After the press operation is not captured (i.e., one hand-drawing track is completed), the hand-drawing track needs to be converted into a line that meets the system standard for display, which can be implemented in the following manner:
[0117] The application layer optimizes the hand-drawing track, covers the data of the temporary buffer to the second display buffer, and notifies the SurfaceFlinger to synthesize the optimized hand-drawing track into the image corresponding to the second display buffer; switch the second display buffer to the display buffer corresponding to the current display page, and refresh the content of the second display buffer to the current display page when the next vertical synchronization signal arrives; wherein, in the display cache, the second display buffer is the next display buffer of the first display buffer, and the next display buffer of the last display buffer in the display cache is the first display buffer in the display cache.
[0118] Please refer to Figure 6 , the schematic diagram of the optimized hand-drawing track in the second display buffer is provided. After the hand-drawing track shown in Figure 5 is formed, the hand-drawing track displayed in the current display page isFigure 6 image 2 in FIG. 2 (i.e. the second display buffer corresponding image).
[0119] After the content of the second display buffer is refreshed to the current display page, the temporary buffer is released and the mapping of the display cache is ended without capturing a new hand-drawing operation. In this way, the stability of the system can be maintained.
[0120] Suppose the user draws a "Wang" character on the screen, please refer to Figure 5 , Figures 7-10 . Figure 7 A schematic diagram of displaying multiple display buffer corresponding images of the display memory when a new hand-drawing trajectory is formed is provided for the embodiments of the present disclosure Figure 1 , Figure 8 A schematic diagram of displaying multiple display buffer corresponding images of the display memory when a new hand-drawing trajectory is formed is provided for the embodiments of the present disclosure Figure 2 , Figure 9 A schematic diagram of displaying multiple display buffer corresponding images of the display memory when a new hand-drawing trajectory is formed is provided for the embodiments of the present disclosure Figure 3 , Figure 10 A final "Wang" character schematic diagram is provided for the embodiments of the present disclosure.
[0121] After the user performs a first hand-drawing operation to form the first "Yi" in the "Wang" character (denoted as hand-drawing trajectory 1), as shown in Figure 5 , when the hand-drawing trajectory 1 is completed, the application layer optimizes the hand-drawing trajectory 1 to obtain an optimized hand-drawing trajectory 1, then covers the data in the second display buffer with the data in the temporary buffer (the data of the first display buffer backed up before the hand-drawing trajectory 1 is drawn), and notifies the SurfaceFlinger to synthesize the optimized hand-drawing trajectory 1 into the second display buffer corresponding image, switches the second display buffer to the display buffer corresponding to the current display page, and upon arrival of the next vertical synchronization signal, completes the drawing refresh to refresh the data in the second display buffer to the current display page currently displayed on the screen.
[0122] Suppose the user points to the screen again at this time and performs a new hand-drawing operation on the screen to form the hand-drawing trajectory 2 (i.e. the second "Yi" in the "Wang" character) as shown in Figure 7 , at this time, the optimized hand-drawing trajectory 1 and the hand-drawing trajectory 2 will be displayed on the screen simultaneously. When the hand-drawing trajectory 2 is completed, the application layer optimizes the hand-drawing trajectory 2 to obtain an optimized hand-drawing trajectory 2, then covers the data in the second display buffer with the data in the temporary buffer (the data of the second display buffer backed up before the hand-drawing trajectory 2 is drawn, i.e. Figure 6The data in the third display buffer is overwritten by the image 2) in [ ], and it is notified to SurfaceFlinger that the optimized hand-drawn trajectory 2 is synthesized into the image corresponding to the third display buffer. The third display buffer is switched to the display buffer corresponding to the current display page, and after the next vertical synchronization signal arrives, the drawing refresh is completed, and the data in the third display buffer is refreshed to the current display page currently shown on the screen.
[0123] Then, the user touches the screen again and performs a new hand-drawing operation on the screen, forming a hand-drawn trajectory 3 as shown in Figure 8 in [ ] (i.e., the "︱" in the character "王"). At this time, the optimized hand-drawn trajectory 1 and the optimized hand-drawn trajectory 2, as well as the hand-drawn trajectory 3, will be shown on the screen simultaneously. After the hand-drawn trajectory 3 is completed, the application layer optimizes the hand-drawn trajectory 3 to obtain the optimized hand-drawn trajectory 3. Then, the data in the temporary buffer (the data of the third display buffer backed up before drawing the hand-drawn trajectory 3) is used to overwrite the data in the first display buffer, and it is notified to SurfaceFlinger that the optimized hand-drawn trajectory 3 is synthesized into the image corresponding to the first display buffer. The first display buffer is switched to the display buffer corresponding to the current display page, and after the next vertical synchronization signal arrives, the drawing refresh is completed, and the data in the first display buffer is refreshed to the current display page currently shown on the screen.
[0124] Finally, the user touches the screen again and performs a new hand-drawing operation on the screen, forming a hand-drawn trajectory 4 as shown in Figure 9 in [ ] (i.e., the third "一" in the character "王"). At this time, the optimized hand-drawn trajectories 1 to the optimized hand-drawn trajectory 3, as well as the hand-drawn trajectory 4, will be shown on the screen simultaneously, forming the character "王". After the hand-drawn trajectory 4 is completed, the application layer optimizes the hand-drawn trajectory to obtain the optimized hand-drawn trajectory 4. Then, the data in the temporary buffer (the data of the first display buffer backed up before drawing the hand-drawn trajectory 4) is used to overwrite the data in the second display buffer, and it is notified to SurfaceFlinger that the optimized hand-drawn trajectory 4 is synthesized into the image corresponding to the second display buffer. The second display buffer is switched to the display buffer corresponding to the current display page, and after the next vertical synchronization signal arrives, the drawing refresh is completed, and the data in the second display buffer is refreshed to the current display page currently shown on the screen, as shown in Figure 10 shown.
[0125] It should be noted that in order to indicate Figures 5-10 which trajectory is the trajectory being drawn by the user in [ ], a "hand" of the user is indicated at the position of the trajectory being drawn. This "hand" is not actually a part of the image. For the convenience of distinction, the hand-drawn trajectory is indicated by a thin line, and the optimized hand-drawn trajectory is indicated by a thick line.
[0126] The method can be used not only for an electronic whiteboard, but also for electronic devices such as a television and a mobile phone.
[0127] Based on the same inventive concept, an apparatus for handwriting display based on an Android system is provided in an embodiment of the present disclosure, and the specific implementation of the handwriting display method of the apparatus can be referred to the description of the method embodiment part, and the repeated part will not be described herein again, please refer to Figure 11 The apparatus comprises:
[0128] A sharing unit 1101 is configured to share a first display buffer corresponding to a current display page to a canvas of a native layer as a graphics buffer of the canvas when an application is invoked, wherein the first display buffer is one display buffer corresponding to the current display page in a display cache.
[0129] An obtaining unit 1102 is configured to obtain coordinate information corresponding to a hand-drawing operation in real time during the hand-drawing operation performed by a user.
[0130] A drawing unit 1103 is configured to draw the coordinate information into the canvas by using a drawing engine SKIA to form and display a corresponding hand-drawing track.
[0131] In a possible implementation, the sharing unit 1101 is configured to:
[0132] map the display cache to a virtual memory corresponding to the application, wherein the display cache comprises a plurality of display buffers, and the virtual memory has the same size as the display cache.
[0133] determine a first zone number of the first display buffer;
[0134] obtain a first virtual region corresponding to the first number from the virtual memory;
[0135] use the first virtual region as the graphics buffer.
[0136] In a possible implementation, the sharing unit 1101 is further configured to:
[0137] obtain basic information of the display cache, wherein the basic information comprises a size of the display cache;
[0138] create the virtual memory having the same size as the display cache according to the basic information;
[0139] map the display cache to the virtual cache.
[0140] In a possible implementation, the obtaining unit 1102 is further configured to:
[0141] Synchronize the data in the first display buffer to the rest of the display buffers before the user performs the hand-drawing operation.
[0142] In a possible implementation, the drawing unit 1103 is configured to:
[0143] backup the data in the first display buffer to a temporary buffer;
[0144] set the coordinate information in a Path object and pass the Path object to the canvas for trajectory drawing when a pressing operation in the hand-drawing operation is captured, and end the trajectory drawing when the pressing operation is not captured, to obtain the hand-drawing trajectory.
[0145] In a possible implementation, the drawing unit 1103 is further configured to:
[0146] optimize the hand-drawing trajectory after the pressing operation is not captured;
[0147] cover the second display buffer with the data of the temporary buffer, and notify the SurfaceFlinger to synthesize the optimized hand-drawing trajectory into an image corresponding to the second display buffer;
[0148] switch the second display buffer to a display buffer corresponding to the current display page, and refresh the content of the second display buffer to the current display page when a next vertical synchronization signal arrives; in the display cache, the second display buffer is a next display buffer of the first display buffer, and a next display buffer of a last display buffer in the display cache is a first display buffer in the display cache.
[0149] In a possible implementation, the drawing unit 1103 is further configured to:
[0150] after the content of the second display buffer is refreshed to the current display page, release the temporary buffer and end the mapping of the display cache when no new hand-drawing operation is captured.
[0151] Based on the same inventive concept, the disclosure provides an apparatus for displaying handwriting based on an Android system, including at least one processor, and
[0152] a memory connected to the at least one processor;
[0153] The memory stores instructions executable by the at least one processor, and the at least one processor executes the instructions stored in the memory to perform the handwriting display method.
[0154] Based on the same inventive concept, the embodiment of the present disclosure further provides a readable storage medium comprising:
[0155] a memory,
[0156] The memory is configured to store instructions, which, when executed by a processor, cause an apparatus comprising the readable storage medium to perform the handwriting display method as described above.
[0157] Those skilled in the art should understand that the embodiments of the present disclosure can be provided as a method, a system, or a computer program product. Therefore, the embodiments of the present disclosure can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present disclosure can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, etc.) containing computer-usable program code.
[0158] The embodiments of the present disclosure are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as a combination of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus generate a means for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the functions specified in one or more flows and / or blocks.
[0159] These computer program instructions can also be stored in a computer-readable memory that can direct the computer or other programmable data processing apparatus to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product comprising an instruction apparatus that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the functions specified in one or more flows and / or blocks.
[0160] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus, so that a series of operation steps are performed on the computer or other programmable data processing apparatus to produce a computer-implemented process, so that the instructions executed on the computer or other programmable data processing apparatus provide a means for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the functions specified in one or more flows and / or blocks.
[0161] It will be apparent to those skilled in the art that various modifications and variations can be made to the disclosed embodiments without departing from the spirit or scope of the disclosure. Thus, it is intended that the present disclosure cover the modifications and variations of this disclosure provided they come within the scope of the appended claims and their equivalents.
Claims
1. A method of displaying a handwriting based on an Android system, wherein, include: When the application is invoked, the first display buffer corresponding to the currently displayed page is shared with the canvas of the local layer as the canvas's graphics buffer; wherein, the first display buffer is a display buffer in the display cache corresponding to the currently displayed page; During the user's hand-drawing operation, the coordinate information corresponding to the hand-drawing operation is obtained in real time; The coordinate information is drawn onto the canvas using the SKIA drawing engine to form and display the corresponding hand-drawn trajectory; Specifically, the first display buffer corresponding to the currently displayed page is shared with the local layer's canvas as the canvas's graphics buffer, including: The display cache is mapped to the virtual memory corresponding to the application, and a shared memory is set up; wherein, the display cache includes multiple display buffers, the virtual memory is the same size as the display cache, and when the display cache switches display buffers, the number of the display buffer that is now switched to the current display page is written into the shared memory; The number read from the shared memory by the local layer determines the first number of the first display buffer; Obtain the first virtual region corresponding to the first number from the virtual memory; The first virtual region is used as the graphics buffer.
2. The method of claim 1, wherein, Mapping the display cache to the application's corresponding virtual memory includes: Obtain basic information about the display cache; wherein, the basic information includes the size of the display cache; Based on the basic information, create virtual memory of the same size as the display cache; Map the display cache to the virtual memory.
3. The method of claim 1, wherein, Before the user performs the hand-drawing operation, the method further includes: The data in the first display buffer is synchronized to the remaining display buffers.
4. The method of any one of claims 1-3, wherein, The coordinate information is drawn onto the canvas using the SKIA drawing engine to form and display the corresponding hand-drawn trajectory, including: Back up the data in the first display buffer to a temporary buffer; When a press operation is captured in the hand-drawn operation, the coordinate information is set in the Path object and passed to the canvas for trajectory drawing. When the press operation is not captured, the trajectory drawing ends, and the hand-drawn trajectory is obtained.
5. The method of claim 4, wherein, After the press operation is not detected, the following is also included: The hand-drawn trajectory was optimized; The data in the temporary buffer is used to overwrite the second display buffer, and SurfaceFlinger is notified to synthesize the optimized hand-drawn trajectory into the image corresponding to the second display buffer; The second display buffer is switched to the display buffer corresponding to the current display page, and when the next vertical synchronization signal arrives, the content of the second display buffer is refreshed to the current display page; wherein, in the display cache, the second display buffer is the next display buffer after the first display buffer, and the next display buffer after the last display buffer in the display cache is the first display buffer in the display cache.
6. The method of claim 5, wherein, After refreshing the contents of the second display buffer to the current display page, the method further includes: When no new hand-drawing operation is captured, the temporary buffer is released, and the mapping of the display cache is ended.
7. An apparatus for display of handwriting based on an Android system, wherein, The method comprises the following steps: The sharing unit is configured to share a first display buffer corresponding to a current display page to a canvas of the native layer as a graphics buffer of the canvas when an application is invoked; wherein the first display buffer is one display buffer corresponding to the current display page in a display cache. The obtaining unit is configured to obtain coordinate information corresponding to a hand-drawing operation in real time during the hand-drawing operation performed by a user. The drawing unit is configured to draw the coordinate information into the canvas by using a drawing engine SKIA to form and display a corresponding hand-drawing track. The sharing unit is specifically configured to map the display cache to a virtual memory corresponding to the application, and set a shared memory; wherein the display cache comprises a plurality of display buffers, the virtual memory has the same size as the display cache, the display cache writes a number of a display buffer newly switched as a current display page into the shared memory when the display buffer is switched; the native layer determines a first number of the first display buffer according to the number read from the shared memory; obtains a first virtual area corresponding to the first number from the virtual memory; and takes the first virtual area as the graphics buffer.
8. An apparatus for display of handwriting based on an Android system, wherein, The method comprises the following steps: At least one processor, and A memory connected with the at least one processor; The memory stores instructions executable by the at least one processor, and the at least one processor executes the instructions stored in the memory to perform the method in any one of claims 1-6.
9. A readable storage medium, wherein, The memory is configured to store instructions, and when the instructions are executed by a processor, the apparatus comprising the readable storage medium completes the method in any one of claims 1-6. The memory is configured to store instructions, and when the instructions are executed by a processor, the apparatus comprising the readable storage medium completes the method in any one of claims 1-6.
Citation Information
Patent Citations
Method and system for drawing waveforms under grid background
CN103927770A
Method and system for optimizing screen handwriting following performance
CN105677107A