WO2022087981A1 - Handwriting displaying method and apparatus based on android system, and storage medium - Google Patents

Handwriting displaying method and apparatus based on android system, and storage medium Download PDF

Info

Publication number
WO2022087981A1
WO2022087981A1 PCT/CN2020/124930 CN2020124930W WO2022087981A1 WO 2022087981 A1 WO2022087981 A1 WO 2022087981A1 CN 2020124930 W CN2020124930 W CN 2020124930W WO 2022087981 A1 WO2022087981 A1 WO 2022087981A1
Authority
WO
WIPO (PCT)
Prior art keywords
display
buffer
display buffer
hand
drawn
Prior art date
Application number
PCT/CN2020/124930
Other languages
French (fr)
Chinese (zh)
Inventor
汪然
Original Assignee
京东方科技集团股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 京东方科技集团股份有限公司 filed Critical 京东方科技集团股份有限公司
Priority to PCT/CN2020/124930 priority Critical patent/WO2022087981A1/en
Priority to CN202080002556.8A priority patent/CN115280265A/en
Publication of WO2022087981A1 publication Critical patent/WO2022087981A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/03Arrangements for converting the position or the displacement of a member into a coded form
    • G06F3/041Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

A handwriting displaying method and apparatus based on an Android system, and a storage medium, which are used for solving the technical problem in the prior art of delayed displaying of handwriting. The method comprises: when an application is invoked, sharing a first display buffer area, corresponding to the current display page, to a canvas of a local layer to act as a graphic buffer area of the canvas, wherein the first display buffer area is a display buffer area, in a display buffer, corresponding to the current display page (301); when a user is performing a hand drawing operation, acquiring, in real time, coordinate information corresponding to the hand drawing operation (302); and drawing the coordinate information into the canvas by means of a graphics engine SKIA, and forming and displaying a corresponding hand drawing trajectory (303).

Description

一种基于安卓系统的笔迹显示的方法、装置及存储介质A method, device and storage medium for handwriting display based on Android system 技术领域technical field
本公开涉及安卓技术领域,尤其是涉及一种基于安卓系统的笔迹显示的方法、装置及存储介质。The present disclosure relates to the field of Android technology, and in particular, to a method, device and storage medium for handwriting display based on an Android system.
背景技术Background technique
随着电子白板的普及,电子白板既能满足日常工作中的会议交流,又能方便的将会议讨论内容进行存储和打印。With the popularization of the electronic whiteboard, the electronic whiteboard can not only meet the meeting communication in daily work, but also conveniently store and print the content of the meeting.
然而,在会议中使用电子白板时,受限于安卓(Android)显示机制,使得在等待垂直同步(Vertical Synchronization,VSYNC)信号和缓冲区申请释放的过程中,有一定的时间消耗,而该时间消耗反映到电子白板上时,会造成用户手指划过电子白板的屏幕后,电子白板绘制的线条无法快速对应到手指经过的坐标,从而造成延迟绘制的效果,影响用户手写笔迹的体验。However, when the electronic whiteboard is used in the conference, it is limited by the Android display mechanism, so that there is a certain time consumption in the process of waiting for the vertical synchronization (VSYNC) signal and the buffer application release, and this time When the consumption is reflected on the electronic whiteboard, after the user's finger swipes the screen of the electronic whiteboard, the lines drawn by the electronic whiteboard cannot quickly correspond to the coordinates passed by the finger, resulting in a delayed drawing effect and affecting the user's handwriting experience.
鉴于此,如何减少笔迹延迟显示,成为一个亟待解决的技术问题。In view of this, how to reduce the delayed display of handwriting has become an urgent technical problem to be solved.
发明内容SUMMARY OF THE INVENTION
本公开提供一种基于安卓系统的笔迹显示的方法、装置及存储介质,用以解决现有技术中存在的笔迹延迟显示的技术问题。The present disclosure provides a method, device and storage medium for handwriting display based on an Android system, which are used to solve the technical problem of delayed display of handwriting existing in the prior art.
第一方面,为解决上述技术问题,本公开实施例提供的一种笔迹显示的方法的技术方案如下:In the first aspect, in order to solve the above technical problems, the technical solution of a method for displaying handwriting provided by the embodiments of the present disclosure is as follows:
在调用应用时,将与当前显示页面对应的第一显示缓冲区共享给本地层的画布,作为所述画布的图形缓冲区;其中,所述第一显示缓冲区是显示缓存中与所述当前显示页面对应的一个显示缓冲区;When calling the application, the first display buffer corresponding to the current display page is shared with the canvas of the local layer as the graphics buffer of the canvas; wherein, the first display buffer is the same as the current display buffer in the display buffer. A display buffer corresponding to the display page;
在用户执行手绘操作期间,实时获取所述手绘操作对应的坐标信息;During the period when the user performs the hand-drawing operation, obtain the coordinate information corresponding to the hand-drawing operation in real time;
用绘图引擎SKIA将所述坐标信息绘制到所述画布中,形成并显示对应的手绘轨迹。The coordinate information is drawn into the canvas by the drawing engine SKIA, and the corresponding hand-drawn track is formed and displayed.
一种可能的实施方式,将与当前显示页面对应的第一显示缓冲区共享给本地层的画布,作为所述画布的图形缓冲区,包括:In a possible implementation manner, the first display buffer corresponding to the current display page is shared with the canvas of the local layer as the graphics buffer of the canvas, including:
将所述显示缓存映射到所述应用对应的虚拟内存;其中,所述显示缓存包括多个显示缓冲区,所述虚拟内存与所述显示缓存等大小;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 is the same size as the display cache;
确定所述第一显示缓冲区的第一区编号;determining the first area number of the first display buffer;
从所述虚拟内存中获取与所述第一编号对应的第一虚拟区域;Obtain a first virtual area corresponding to the first number from the virtual memory;
将所述第一虚拟区域作为所述图形缓冲区。The first virtual area is used as the graphics buffer.
一种可能的实施方式,将所述显示缓存映射到应用对应的虚拟内存,包括:A possible implementation is to map the display cache to the virtual memory corresponding to the application, including:
获取所述显示缓存的基本信息;其中,所述基本信息包括所述显示缓存的大小;Acquire basic information of the display cache; wherein the basic information includes the size of the display cache;
根据所述基本信息,创建与所述显示缓存等大小的所述虚拟内存;According to the basic information, create the virtual memory of the same size as the display cache;
将所述显示缓存映射到所述虚拟缓存。The display cache is mapped to the virtual cache.
一种可能的实施方式,在所述用户执行所述手绘操作前,还包括:A possible implementation manner, before the user performs the hand-drawing operation, further includes:
将所述第一显示缓冲区中的数据同步给其余所述显示缓冲区。Synchronizing the data in the first display buffer to the remaining display buffers.
一种可能的实施方式,用绘图引擎SKIA将所述坐标信息绘制到所述画布中,形成并显示对应的手绘轨迹,包括:A possible implementation is to use the drawing engine SKIA to draw the coordinate information into the canvas to form and display the corresponding hand-drawn trajectory, including:
将所述第一显示缓冲区中的数据备份到临时缓冲区;backing up the data in the first display buffer to the temporary buffer;
在捕获到所述手绘操作中的按压操作时,将所述坐标信息设置在Path对象中,并传递到所述画布中进行轨迹绘制,在未捕获到所述按压操作时结束所述轨迹绘制,获得所述手绘轨迹。When a pressing operation in the hand-drawing operation is captured, the coordinate information is set in the Path object, and transferred to the canvas for trajectory drawing, and when the pressing operation is not captured, the trajectory drawing is ended, The hand-drawn trajectory is obtained.
一种可能的实施方式,在未捕获到所述按压操作之后,还包括:A possible implementation manner, after the pressing operation is not captured, further includes:
对所述手绘轨迹进行优化;optimizing the hand-drawn trajectory;
用所述临时缓冲区的数据覆盖所述第二显示缓冲区,并通知SurfaceFlinger将优化后的手绘轨迹合成到所述第二显示缓冲区;Overwrite the second display buffer with the data of the temporary buffer, and notify SurfaceFlinger to synthesize the optimized hand-drawn trajectory into the second display buffer;
将所述第二显示缓冲区切换为与所述当前显示页面对应的显示缓冲区,并在下一垂直同步信号到来时,将所述第二显示缓冲区的内容刷新到所述当 前显示页面;其中,在所述显示缓存中,所述第二显示缓冲区为所述第一显示缓冲区的下一个显示缓冲区,所述显示缓存中最后一个显示缓冲区的下一个显示缓冲区为所述显示缓存中的首个显示缓冲区。Switching the second display buffer to a display buffer corresponding to the current display page, and refreshing the content of the second display buffer to the current display page when the next vertical synchronization signal arrives; wherein , in the display buffer, 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 buffer is the display buffer The first display buffer in the cache.
一种可能的实施方式,将所述第二显示缓冲区的内容刷新到所述当前显示页面之后,还包括:A possible implementation manner, after refreshing the content of the second display buffer to the current display page, further includes:
在没有捕获到新的手绘操作时,释放所述临时缓冲区,并结束所述显示缓存的映射。When no new hand-drawing operation is captured, the temporary buffer is released, and the mapping of the display buffer is ended.
第二方面,本公开实施例提供了一种基于安卓系统的笔迹显示的装置,包括:In a second aspect, an embodiment of the present disclosure provides a device for displaying handwriting based on an Android system, including:
共享单元,用于在调用应用时,将与当前显示页面对应的第一显示缓冲区共享给本地层的画布,作为所述画布的图形缓冲区;其中,所述第一显示缓冲区是显示缓存中与所述当前显示页面对应的一个显示缓冲区;The sharing unit is used to share the first display buffer corresponding to the current display page to the canvas of the local layer as the graphics buffer of the canvas when the application is called; wherein, the first display buffer is the display buffer A display buffer corresponding to the currently displayed page in the;
获取单元,用于在用户执行手绘操作期间,实时获取所述手绘操作对应的坐标信息;an obtaining unit, configured to obtain coordinate information corresponding to the hand-drawn operation in real time during the period when the user performs the hand-drawn operation;
绘制单元,用于用绘图引擎SKIA将所述坐标信息绘制到所述画布中,形成并显示对应的手绘轨迹。The drawing unit is used to draw the coordinate information on the canvas by using the drawing engine SKIA, and form and display the corresponding hand-drawn track.
一种可能的实施方式,所述共享单元用于:A possible implementation manner, the shared unit is used for:
将所述显示缓存映射到所述应用对应的虚拟内存;其中,所述显示缓存包括多个显示缓冲区,所述虚拟内存与所述显示缓存等大小;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 is the same size as the display cache;
确定所述第一显示缓冲区的第一区编号;determining the first area number of the first display buffer;
从所述虚拟内存中获取与所述第一编号对应的第一虚拟区域;Obtain a first virtual area corresponding to the first number from the virtual memory;
将所述第一虚拟区域作为所述图形缓冲区。The first virtual area is used as the graphics buffer.
一种可能的实施方式,所述共享单元还用于:In a possible implementation manner, the shared unit is also used for:
获取所述显示缓存的基本信息;其中,所述基本信息包括所述显示缓存的大小;Acquire basic information of the display cache; wherein the basic information includes the size of the display cache;
根据所述基本信息,创建与所述显示缓存等大小的所述虚拟内存;According to the basic information, create the virtual memory of the same size as the display cache;
将所述显示缓存映射到所述虚拟缓存。The display cache is mapped to the virtual cache.
一种可能的实施方式,所述获取单元还用于:A possible implementation manner, the obtaining unit is further used for:
在所述用户执行所述手绘操作前,将所述第一显示缓冲区中的数据同步给其余所述显示缓冲区。Before the user performs the hand-drawing operation, the data in the first display buffer is synchronized to the remaining display buffers.
一种可能的实施方式,所述绘制单元用于:A possible implementation manner, the drawing unit is used for:
将所述第一显示缓冲区中的数据备份到临时缓冲区;backing up the data in the first display buffer to the temporary buffer;
在捕获到所述手绘操作中的按压操作时,将所述坐标信息设置在Path对象中,并传递到所述画布中进行轨迹绘制,在未捕获到所述按压操作时结束所述轨迹绘制,获得所述手绘轨迹。When a pressing operation in the hand-drawing operation is captured, the coordinate information is set in the Path object, and transferred to the canvas for trajectory drawing, and when the pressing operation is not captured, the trajectory drawing is ended, The hand-drawn trajectory is obtained.
一种可能的实施方式,所述绘制单元还用于:A possible implementation manner, the drawing unit is also used for:
在未捕获到所述按压操作之后,对所述手绘轨迹进行优化;After the pressing operation is not captured, optimizing the hand-drawn trajectory;
用所述临时缓冲区的数据覆盖所述第二显示缓冲区,并通知SurfaceFlinger将优化后的手绘轨迹合成到所述第二显示缓冲区;Overwrite the second display buffer with the data of the temporary buffer, and notify SurfaceFlinger to synthesize the optimized hand-drawn trajectory into the second display buffer;
将所述第二显示缓冲区切换为与所述当前显示页面对应的显示缓冲区,并在下一垂直同步信号到来时,将所述第二显示缓冲区的内容刷新到所述当前显示页面;其中,在所述显示缓存中,所述第二显示缓冲区为所述第一显示缓冲区的下一个显示缓冲区,所述显示缓存中最后一个显示缓冲区的下一个显示缓冲区为所述显示缓存中的首个显示缓冲区。Switching the second display buffer to a display buffer corresponding to the current display page, and refreshing the content of the second display buffer to the current display page when the next vertical synchronization signal arrives; wherein , in the display buffer, 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 buffer is the display buffer The first display buffer in the cache.
一种可能的实施方式,所述绘制单元还用于:A possible implementation manner, the drawing unit is also used for:
将所述第二显示缓冲区的内容刷新到所述当前显示页面之后,在没有捕获到新的手绘操作时,释放所述临时缓冲区,并结束所述显示缓存的映射。After the content of the second display buffer is refreshed to the current display page, when no new hand-drawing operation is captured, the temporary buffer is released, and the mapping of the display buffer is ended.
第三方面,本公开实施例还提供一种基于安卓系统的笔迹显示的装置,包括:In a third aspect, an embodiment of the present disclosure further provides a device for displaying handwriting based on an Android system, including:
至少一个处理器,以及at least one processor, and
与所述至少一个处理器连接的存储器;a memory connected to the at least one processor;
其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述至少一个处理器通过执行所述存储器存储的指令,执行如上述第一方面所述的方法。Wherein, the memory stores instructions executable by the at least one processor, and the at least one processor executes the method according to the first aspect above by executing the instructions stored in the memory.
第四方面,本公开实施例还提供一种可读存储介质,包括:In a fourth aspect, an embodiment of the present disclosure further provides a readable storage medium, including:
存储器,memory,
所述存储器用于存储指令,当所述指令被处理器执行时,使得包括所述可读存储介质的装置完成如上述第一方面所述的方法。The memory is used to store instructions that, when executed by the processor, cause an apparatus including the readable storage medium to perform the method as described in the first aspect above.
附图说明Description of drawings
图1为安卓系统框架示意图;Figure 1 is a schematic diagram of the Android system framework;
图2为安卓系统中屏幕绘制的流程图;Fig. 2 is the flow chart of screen drawing in the Android system;
图3为本公开实施例提供的笔迹显示方法的流程图;3 is a flowchart of a method for displaying handwriting provided by an embodiment of the present disclosure;
图4为本公开实施例提供的映射显示缓存的示意图;FIG. 4 is a schematic diagram of a mapping display cache provided by an embodiment of the present disclosure;
图5为本公开实施例提供的在形成手绘轨迹时显示内存的多个显示缓冲区对应图像的示意图;5 is a schematic diagram of displaying images corresponding to multiple display buffers in a memory when a hand-drawn track is formed according to an embodiment of the present disclosure;
图6为本公开实施例提供的第二显示缓冲区中优化后的手绘轨迹的示意图;6 is a schematic diagram of an optimized hand-drawn trajectory in a second display buffer provided by an embodiment of the present disclosure;
图7为本公开实施例提供的在形成新的手绘轨迹时显示内存的多个显示缓冲区对应图像的示意图一;7 is a schematic diagram 1 of displaying images corresponding to multiple display buffers in a memory when a new hand-drawn track is formed according to an embodiment of the present disclosure;
图8为本公开实施例提供的在形成新的手绘轨迹时显示内存的多个显示缓冲区对应图像的示意图二;8 is a schematic diagram 2 of displaying images corresponding to multiple display buffers in memory when a new hand-drawn track is formed according to an embodiment of the present disclosure;
图9为本公开实施例提供的在形成新的手绘轨迹时显示内存的多个显示缓冲区对应图像的示意图三;9 is a schematic diagram 3 of displaying images corresponding to multiple display buffers in memory when a new hand-drawn track is formed according to an embodiment of the present disclosure;
图10为本公开实施例提供的最终“王”字示意图;10 is a schematic diagram of the final "王" character provided by the embodiment of the present disclosure;
图11为本公开实施例提供的一种笔迹显示装置的结构示意图。FIG. 11 is a schematic structural diagram of a handwriting display device according to an embodiment of the present disclosure.
具体实施方式Detailed ways
本公开实施列提供一种基于安卓系统的笔迹显示的方法、装置及存储介质,用以解决现有技术中存在的笔迹延迟显示的技术问题。Embodiments of the present disclosure provide a method, device and storage medium for handwriting display based on an Android system, so as to solve the technical problem of delayed display of handwriting existing in the prior art.
为了更好的理解上述技术方案,下面通过附图以及具体实施例对本公开 技术方案做详细的说明,应当理解本公开实施例以及实施例中的具体特征是对本公开技术方案的详细的说明,而不是对本公开技术方案的限定,在不冲突的情况下,本公开实施例以及实施例中的技术特征可以相互组合。In order to better understand the above technical solutions, the technical solutions of the present disclosure will be described in detail below through the accompanying drawings and specific embodiments. It is not intended to limit the technical solutions of the present disclosure, and the embodiments of the present disclosure and the technical features in the embodiments may be combined with each other if there is no conflict.
为了是本领域的技术人员能充分理解本方案,下接受本方案前先简单介绍相关技术。In order for those skilled in the art to fully understand the solution, the related technologies are briefly introduced before accepting the solution.
请参见图1为安卓系统框架示意图。Please refer to FIG. 1 for a schematic diagram of the Android system framework.
安卓系统包括应用层的APP、本地接口(Java Native Interface,JNI)、绘图引擎(Skia)、libfd_dev.so、Framebuffer。通过libfd_dev.so对底层Framebuffer进行操作,实现读取、写入;由Skia框架负责Native笔迹的绘制,相关绘制接口通过Android的JNI机制提供给上层应用APP进行调用。The Android system includes the APP of the application layer, the local interface (Java Native Interface, JNI), the drawing engine (Skia), libfd_dev.so, and Framebuffer. The underlying Framebuffer is operated through libfd_dev.so to realize reading and writing; the Skia framework is responsible for the drawing of Native handwriting, and the relevant drawing interface is provided to the upper-layer application APP for calling through the JNI mechanism of Android.
其中,Skia是一个底层的图形、图像、动画、可缩放矢量图形(Scalable Vector Graphics,SVG)、文本等多方面的图形库,是Android中图形系统的2D引擎。安卓系统中,本地层(Native层)是采用C/C++语言编写的,它与应用层(采用Java语言编写的,也叫Java层)进行通信,用于处理较为复杂的运算以及访问操作系统的底层(比如系统硬件)。通常情况下,上述Skia即位于Native层。Android向APP开发程序员提供的2D绘制接口,例如绘制直线、圆形、位图(Bitmap)等,均是对本地层(Native层)的Skia库接口进行JNI封装。Among them, Skia is a low-level graphics, image, animation, scalable vector graphics (Scalable Vector Graphics, SVG), text and other aspects of the graphics library, is the 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), which is used to process more complex operations and access the operating system. Bottom layer (such as system hardware). Usually, the above Skia is located in the Native layer. The 2D drawing interfaces provided by Android to APP development programmers, such as drawing lines, circles, bitmaps, etc., are JNI encapsulation of the Skia library interface of the native layer (Native layer).
请参见图2为安卓系统中屏幕绘制的流程图。Please refer to FIG. 2 for a flowchart of screen drawing in the Android system.
步骤201:应用向WMS发送注册请求。Step 201: The application sends a registration request to the WMS.
应用层的应用(Application,APP)向窗口管理服务(WindowManagerService,WMS)发送注册窗口的请求,使WMS为该应用分窗口。An application (Application, APP) at the application layer sends a request for registering a window to a window management service (WindowManagerService, WMS), so that the WMS divides the application into a window.
步骤202:WMS向SurfaceFlinger发送请求分配Surface。Step 202: The WMS sends a request to SurfaceFlinger to allocate a Surface.
WMS根据注册请求向SurfaceFlinger发送为应用分配图形界面(Surface)的请求。WMS sends SurfaceFlinger a request to assign a graphical interface (Surface) to the application according to the registration request.
步骤203:SurfaceFlinger向WMS返回分配信息。Step 203: SurfaceFlinger returns allocation information to WMS.
SurfaceFlinger根据WMS的请求为应用分配buffer,并返回分配信息给WMS。SurfaceFlinger allocates buffers for the application according to the request of WMS, and returns the allocation information to WMS.
步骤204:WMS返回Surface对象给应用。Step 204: The WMS returns the Surface object to the application.
WMS根据分配信息生成应用对应的Surface对象,并返回给应用。其中,Surface对象对应APP中所需绘制的窗口。The WMS generates the Surface object corresponding to the application according to the allocation information, and returns it to the application. Among them, the Surface object corresponds to the window to be drawn in the APP.
之后,应用在该Surface对象对应的buffer上进行绘制,在绘制完成后执行步骤105。After that, the application draws on the buffer corresponding to the Surface object, and after the drawing is completed, step 105 is performed.
步骤205:绘制完成,通知更新。Step 205: The drawing is completed, and the update is notified.
应用在绘制完成后,通知SurfaceFlinger进行更新,以便将绘制结果显示到系统屏幕上。After the application finishes drawing, it notifies SurfaceFlinger to update it so that the drawing result can be displayed on the system screen.
在更新显示画面时,APP的所有窗口(Surface对象)将被叠加成一种与系统屏幕上显示画面大小相同的位图内存之中,并写入到Framebuffer,在写入完成后的VSYNC信号到来时,将该Framebuffer作为当前显示buffer显示到屏幕上,完成显示画面的渲染更新。其中,Linux抽象出Framebuffer这个设备来供用户态进程实现直接写屏,而Framebuffer机制模仿显卡的功能,将显卡硬件结构抽象掉,可以通过Framebuffer的读写直接对显存进行操作。When the display screen is updated, all the windows (Surface objects) of the APP will be superimposed into a bitmap memory with the same size as the screen displayed on the system screen, and written to the Framebuffer. When the VSYNC signal after writing is completed, the arrival of , the Framebuffer is displayed on the screen as the current display buffer, and the rendering update of the display screen is completed. Among them, Linux abstracts the Framebuffer device for user-mode processes to directly write the screen, while the Framebuffer mechanism imitates the function of the graphics card, abstracts the hardware structure of the graphics card, and can directly operate the video memory through the reading and writing of the Framebuffer.
在Android中,VSYNC信号是由底层HWcomposer进行周期性产生的,目前一般主流的刷新频率为60次/秒,即每16ms刷新一次,发送一次VSYNC信号。In Android, the VSYNC signal is periodically generated by the underlying HWcomposer. At present, the general mainstream refresh rate is 60 times/second, that is, every 16ms, the VSYNC signal is sent once.
为解决Android的用户界面(User Interface,UI)流畅性差的问题,Android系统引入了Triple Buffer和Choreographer的设计,与VSYNC信号进行配合,实现多缓冲区机制,即每一时刻只有一个Framebuffer内容显示在屏幕上,而未显示的缓存Framebuffer被从显示队列中申请出来,用于窗口绘制,在VSYNC信号到来后,被交换作为front buffer进行显示。In order to solve the problem of poor fluency of Android's user interface (User Interface, UI), 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 at each moment. On the screen, the cached Framebuffer that is not displayed is applied from the display queue for window drawing. After the VSYNC signal arrives, it is exchanged as a front buffer for display.
在会议白板系统中,最主要的功能是满足用户对会议讨论内容的手写输入的需求,但是由于上述的Android显示机制,使得完成绘制的窗口在等待VSYNC信号和缓冲区申请释放的过程中,将造成一定的时间消耗。反映到设 备上时,即为用户手指划过屏幕后,绘制的线条无法快速对应到手指经过的坐标,使得出现延迟绘制的效果,影响用户的手写笔迹的体验。In the conference whiteboard system, the main function is to meet the user's demand for handwritten input of the content of the conference discussion. However, due to the above-mentioned Android display mechanism, the drawn window is waiting for the VSYNC signal and the buffer application to be released. cause a certain amount of time consumption. When reflected on the device, that is, after the user's finger swipes across the screen, the drawn line cannot quickly correspond to the coordinates the finger passes through, resulting in a delayed drawing effect and affecting the user's handwriting experience.
本公开实施例中的技术方案为解决上述的技术问题,采用了下列方案:In order to solve the above-mentioned technical problems, the technical solutions in the embodiments of the present disclosure adopt the following solutions:
请参考图3,本公开实施例提供一种基于安卓系统的笔迹显示方法,该方法的处理过程如下。Referring to FIG. 3 , an embodiment of the present disclosure provides a method for displaying handwriting based on an Android system, and the processing process of the method is as follows.
步骤301:在调用应用时,将与当前显示页面对应的第一显示缓冲区共享给本地层的画布,作为画布的图形缓冲区;其中,第一显示缓冲区是显示缓存中与当前显示页面对应的一个显示缓冲区。Step 301: When calling the application, share the first display buffer corresponding to the current display page to the canvas of the local layer as a graphics buffer of the canvas; wherein, the first display buffer is the display buffer corresponding to the current display page. of a display buffer.
当前在屏幕中显示的画面即为当前显示页面,第一显示缓冲区为与平面对应的显示缓存中的一个显示缓冲区。当前,屏幕中显示的是第一显示缓冲区中的数据对应的位图。The picture currently displayed on the screen is the current display page, and the first display buffer is a display buffer in the display buffer corresponding to the plane. Currently, what is displayed on the screen is a bitmap corresponding to the data in the first display buffer.
将与当前显示页面对应的第一显示缓冲区共享给本地层(Native层)的画布(即SkCanvas),作为画布的图形缓冲区(即SkBitmap),可以通过下列方实现:将显示缓存映射到应用对应的虚拟内存;其中,显示缓存包括多个显示缓冲区,虚拟内存与显示缓存等大小;确定第一显示缓冲区的第一区编号;从虚拟内存中获取与第一编号对应的第一虚拟区域;将第一虚拟区域作为图形缓冲区。Share the first display buffer corresponding to the current display page to the canvas (ie SkCanvas) of the native layer (Native layer) as the graphics buffer of the canvas (ie SkBitmap), which can be achieved by the following methods: mapping the display buffer to the application Corresponding virtual memory; wherein, the display cache includes a plurality of display buffers, and the virtual memory and the display cache have the same size; determine the first area number of the first display buffer; obtain the first virtual memory corresponding to the first number from the virtual memory area; use the first virtual area as a graphics buffer.
若电子设备采用的是双缓存机制,则显示缓存中的显示缓冲区为2个,若电子设备采用的是多缓冲机制,则显示缓存中的显示缓冲区例如可以为三个或更多。If the electronic device adopts the double-buffering mechanism, the number of display buffers in the display buffer is 2, and if the electronic device adopts the multi-buffering mechanism, the display buffers in the display buffer may be, for example, three or more.
将显示缓存映射到应用对应的虚拟内存,可以通过下列方式实现:获取显示缓存的基本信息;其中,基本信息包括显示缓存的大小;根据基本信息,创建与显示缓存等大小的虚拟内存;将显示缓存映射到虚拟缓。Mapping the display cache to the virtual memory corresponding to the application can be achieved in the following ways: obtain the basic information of the display cache; the basic information includes the size of the display cache; create a virtual memory of the same size as the display cache according to the basic information; Caches are mapped to virtual caches.
在安卓系统中,可以通过调用libfbdev.so动态库,打开/dev/graphics/fb0设备,获取显示缓存的大小,包括显示缓冲区的尺寸信息等,并通过mmap函数映射到应用层的虚拟内存的应用层指针addr,进而将显示缓存映射到虚拟缓存并封装在画布(SkCanvas)中作为画布(SkCanvas)的图形缓冲区 (SkBitmap),以便后续使用绘图引擎SKIA在画布(SkCanvas)中进行手绘操作。In the Android system, you can open the /dev/graphics/fb0 device by calling the libfbdev.so dynamic library, obtain the size of the display buffer, including the size information of the display buffer, etc., and map it to the virtual memory of the application layer through the mmap function. The application layer pointer addr maps the display buffer to the virtual buffer and encapsulates it in the canvas (SkCanvas) as the graphics buffer (SkBitmap) of the canvas (SkCanvas), so that the drawing engine SKIA can be used to perform hand-painting operations in the canvas (SkCanvas).
请参见图4为本公开实施例提供的映射显示缓存的示意图。根据TripleBuffer的设计,显示缓存包括3个连续的显示缓冲区,因此虚拟内存也包括3个连续的虚拟区域,在图4中指针addr用于对虚拟内存进行寻址,虚拟内存中的3个虚拟区域的首地址依次用addr1、addr2、addr3示意。Please refer to FIG. 4 , a schematic diagram of a mapping display cache provided by an embodiment of the present disclosure. According to the design of TripleBuffer, the display cache includes 3 consecutive display buffers, so the virtual memory also includes 3 consecutive virtual areas. In Figure 4, the pointer addr is used to address the virtual memory. The 3 virtual memory in the virtual memory The first address of the area is indicated by addr1, addr2, and addr3 in sequence.
之后,便可通过调用Skia相关动态库,分配Native层的画布,并通过SkBitmap对象将映射到虚拟内存中的显示缓存进行封装,放置在画布对象之中。After that, you can allocate the canvas of the Native layer by calling the Skia-related dynamic library, and encapsulate the display cache mapped to the virtual memory through the SkBitmap object and place it in the canvas object.
由于显示缓存中包括多个显示缓冲区,而与当前显示页面对应的第一显示缓冲区(front buffer)会随应用指示的绘制刷新在多个显示缓冲区中切换,为了保证画布使用的图形缓冲区是第一显示缓冲区,需要准确获取第一显示缓冲区的编号。Since the display buffer includes multiple display buffers, the first display buffer (front buffer) corresponding to the current display page will be switched among the multiple display buffers according to the drawing refresh indicated by the application. In order to ensure the graphics buffer used by the canvas The area is the first display buffer, and the number of the first display buffer needs to be obtained accurately.
确定第一显示缓冲区的第一编号,可以通过设置一个共享内存,让显示缓存在切换显示缓冲区时,将第一编号写入该共享内存中,而本地层从该共享内存中读取第一编号,进而从虚拟内存中获取与第一编号对应的第一虚拟区域,并非将其作为画布的图形缓冲区。这样,就可以实现在显存缓存中直接进行简单2D图像的绘制,并保证与调用Skia绘制的轨迹一致。To determine the first number of the first display buffer, a shared memory can be set, so that when the display buffer is switched, the display cache writes the first number into the shared memory, and the local layer reads the first number from the shared memory. A number is obtained, and the first virtual area corresponding to the first number is obtained from the virtual memory instead of using it as a graphics buffer of the canvas. In this way, it is possible to directly draw a simple 2D image in the video memory cache, and ensure that it is consistent with the trajectory drawn by calling Skia.
在将与当前显示页面对应的第一显示缓冲区共享给本地层的画布后,便可执行步骤302。After the first display buffer corresponding to the current display page is shared with the canvas of the local layer, step 302 can be executed.
步骤302:在用户执行手绘操作期间,实时获取手绘操作对应的坐标信息。Step 302: During the period when the user performs the hand-drawing operation, obtain the coordinate information corresponding to the hand-drawing operation in real time.
手绘操作可以是手指直接在屏幕上执行的操作,也可以是用户通过手绘笔在屏幕上执行的操作。The hand-drawn operation can be an operation performed by a finger directly on the screen, or an operation performed by a user on the screen with a hand-drawn pen.
在用户执行手绘操作前,还可以将第一显示缓冲区中的数据同步给其余显示缓冲区。Before the user performs the hand-drawing operation, the data in the first display buffer can also be synchronized to the remaining display buffers.
由于本公开绕过了安卓系统的Choreographer机制进行绘制,因此执行手绘操作前,通过将第一显示缓冲区中的数据同步给其余显示缓冲区,可以让 显示缓存中的所有显示缓冲区都为当前显示页面的数据。Since the present disclosure bypasses the Choreographer mechanism of the Android system for drawing, before performing the hand-drawing operation, by synchronizing the data in the first display buffer to the remaining display buffers, all display buffers in the display buffer can be made current. Displays the page's data.
手绘操作对应的坐标信息可以通过调用回调函数获得,在获得手绘操作的坐标信息之后,便可执行步骤303。The coordinate information corresponding to the hand-drawing operation can be obtained by calling the callback function, and after obtaining the coordinate information of the hand-drawing operation, step 303 can be executed.
步骤303:用绘图引擎SKIA将坐标信息绘制到画布中,形成并显示对应的手绘轨迹。Step 303: Use the drawing engine SKIA to draw the coordinate information on the canvas to form and display the corresponding hand-drawn track.
用绘图引擎SKIA将坐标信息绘制到画布中,形成并显示对应的手绘轨迹,可以通过下列方式实现:Use the drawing engine SKIA to draw the coordinate information into the canvas to form and display the corresponding hand-drawn trajectory, which can be achieved in the following ways:
将第一显示缓冲区中的数据备份到临时缓冲区;在捕获到手绘操作中的按压操作时,将坐标信息设置在Path对象中,并传递到画布中进行轨迹绘制,在未捕获到按压操作时结束轨迹绘制,获得手绘轨迹。由于之前已将第一显示缓冲区映射到显示缓冲区中,因此上述手绘操作相当于在第一显示缓冲区中进行绘制,从而可以让实时显示的手绘轨迹,且该手绘轨迹可以快速跟随手绘操作。Back up the data in the first display buffer to the temporary buffer; when the pressing operation in the hand-painting operation is captured, set the coordinate information in the Path object and transfer it to the canvas for trajectory drawing. If the pressing operation is not captured When the trajectory drawing is ended, the hand-drawn trajectory is obtained. Since the first display buffer has been mapped to the display buffer before, the above hand-drawing operation is equivalent to drawing in the first display buffer, so that the hand-drawn trajectory displayed in real time can be quickly followed by the hand-drawn operation. .
请参见图5,为本公开实施例提供的在形成手绘轨迹时显示内存的多个显示缓冲区对应图像的示意图。假设在初始时所有显示缓冲区对应的图像都为空白图像,图5中编号为1~3的图像分别为显示缓存中3个显示缓冲区的数据对应的图像,箭头指向第一显示缓冲区对应的图像(下同),即图像1即为当前显示页面显示的图像,而其它两个图像当前未显示。在用户执行一次手绘操作时,在图1中形成了“一”的轨迹。Please refer to FIG. 5 , which is a schematic diagram of displaying images corresponding to multiple display buffers in the memory when forming a hand-drawn track according to an embodiment of the present disclosure. Assuming that all the images corresponding to the display buffers are blank images at the beginning, the images numbered 1 to 3 in Figure 5 are the images corresponding to the data of the three display buffers in the display buffer, and the arrows point to the first display buffer corresponding to image (the same below), that is, image 1 is the image displayed on the currently displayed page, and the other two images are not currently displayed. When the user performs a hand-drawing operation, a "one" track is formed in FIG. 1 .
在未捕获到按压操作(即完成一次手绘轨迹)之后,还需要将该手绘轨迹转换为符合系统标准的线条进行显示,可以通过下列方式实现:After the pressing operation is not captured (that is, a hand-drawn trajectory is completed), the hand-drawn trajectory needs to be converted into a line that conforms to the system standard for display, which can be achieved in the following ways:
应用层对手绘轨迹进行优化,用临时缓冲区的数据覆盖第二显示缓冲区,并通知SurfaceFlinger将优化后的手绘轨迹合成到第二显示缓冲区对应的图像中;将第二显示缓冲区切换为与当前显示页面对应的显示缓冲区,并在下一垂直同步信号到来时,将第二显示缓冲区的内容刷新到当前显示页面;其中,在显示缓存中,第二显示缓冲区为第一显示缓冲区的下一个显示缓冲区,显示缓存中最后一个显示缓冲区的下一个显示缓冲区为显示缓存中的首个显示 缓冲区。The application layer optimizes the hand-drawn track, overwrites the second display buffer with the data of the temporary buffer, and informs SurfaceFlinger to synthesize the optimized hand-drawn 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 when the next vertical synchronization signal arrives, refresh the content of the second display buffer to the current display page; wherein, in the display buffer, the second display buffer is the first display buffer The next display buffer in the display buffer is the first display buffer in the display buffer.
请参见图6,为本公开实施例提供的第二显示缓冲区中优化后的手绘轨迹的示意图。在形成图5所示的手绘轨迹后,通过上述方式,在当前显示页面中显示的便为图6中的图像2(即第二显示缓冲区对应图像)。Please refer to FIG. 6 , which is a schematic diagram of an optimized hand-drawn trajectory in the second display buffer provided by an embodiment of the present disclosure. After the hand-drawn track shown in FIG. 5 is formed, the image 2 in FIG. 6 (ie, the image corresponding to the second display buffer area) is displayed on the current display page by the above method.
在将第二显示缓冲区的内容刷新到当前显示页面之后,在没有捕获到新的手绘操作时,释放临时缓冲区,并结束显示缓存的映射。这样可以保持系统的稳定性。After the content of the second display buffer is flushed to the current display page, when no new hand-drawing operation is captured, the temporary buffer is released, and the mapping of the display buffer is ended. This keeps the system stable.
假设用户在屏幕中绘制一个“王”字,请参见图5、图7~10。图7为本公开实施例提供的在形成新的手绘轨迹时显示内存的多个显示缓冲区对应图像的示意图一,图8为本公开实施例提供的在形成新的手绘轨迹时显示内存的多个显示缓冲区对应图像的示意图二,图9为本公开实施例提供的在形成新的手绘轨迹时显示内存的多个显示缓冲区对应图像的示意图三,图10为本公开实施例提供的最终“王”字示意图。Suppose the user draws a word "王" on the screen, please refer to Figure 5 and Figures 7 to 10. FIG. 7 is a schematic diagram 1 of displaying images corresponding to multiple display buffers in memory when a new hand-drawn track is formed according to an embodiment of the present disclosure, and FIG. 8 shows a plurality of images in memory when a new hand-drawn track is formed according to an embodiment of the present disclosure. Schematic diagram 2 of images corresponding to each display buffer, FIG. 9 is a schematic diagram 3 of displaying images corresponding to multiple display buffers in the memory when a new hand-drawn track is formed according to an embodiment of the present disclosure, and FIG. 10 is a final schematic diagram provided by an embodiment of the present disclosure. Schematic diagram of the word "King".
用户执行第一次手绘操作后形成“王”字中的第一个“一”(记为手绘轨迹1),如图5所示,当手绘轨迹1完成后,应用层对手绘轨迹1进行优化,得到优化后的手绘轨迹1,之后用临时缓冲区中的数据(绘制手绘轨迹1前备份的第一显示缓冲区的数据)覆盖第二显示缓冲区中的数据,并通知SurfaceFlinger将是优化后的手绘轨迹1合成到第二显示缓冲区对应的图像中,将第二显示缓冲区切换为与当前显示页面对应的显示缓冲区,并在下一个垂直同步信号到来后,完成绘制刷新,将第二显示缓冲区中的数据刷新为屏幕上当前显示的当前显示页面。After the user performs the first hand-drawing operation, the first "one" in the word "王" is formed (referred to as hand-drawn track 1), as shown in Figure 5, when the hand-drawn track 1 is completed, the application layer optimizes the hand-drawn track 1 , get the optimized hand-drawn track 1, then overwrite the data in the second display buffer with the data in the temporary buffer (the data of the first display buffer backed up before drawing the hand-drawn track 1), and notify SurfaceFlinger that the optimized The hand-drawn track 1 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 arrival of the next vertical synchronization signal, the drawing refresh is completed, and the second display buffer is The data in the display buffer is refreshed to the current display page currently displayed on the screen.
假设此时用户又回点屏幕,在屏幕上执行新的手绘操作,形成如图7中的手绘轨迹2(即“王”字中的第二个“一”),此时在屏幕上就会同时显示优化后的手绘轨迹1以及手绘轨迹2。当手绘轨迹2完成后,应用层对手绘轨迹2进行优化,得到优化后的手绘轨迹2,之后用临时缓冲区中的数据(绘制手轨迹2前备份的第二显示缓冲区的数据,即图6中的图像2)覆盖第三显示缓冲区中的数据,并通知SurfaceFlinger将是优化后的手绘轨迹2合成到第三显示 缓冲区对应的图像中,将第三显示缓冲区切换为与当前显示页面对应的显示缓冲区,并在下一个垂直同步信号到来后,完成绘制刷新,将第三显示缓冲区中的数据刷新为屏幕上当前显示的当前显示页面。Assuming that the user clicks back on the screen at this time, and performs a new hand-drawing operation on the screen, forming a hand-drawn trajectory 2 as shown in Figure 7 (that is, the second "one" in the word "王"), then the screen will be displayed on the screen. At the same time, the optimized hand-drawn track 1 and hand-drawn track 2 are displayed. When the hand-drawn track 2 is completed, the application layer optimizes the hand-drawn track 2 to obtain the optimized hand-drawn track 2, and then uses the data in the temporary buffer (the data in the second display buffer that was backed up before drawing the hand track 2, i.e. Image 2 in 6) Overwrite the data in the third display buffer, and notify SurfaceFlinger to synthesize the optimized hand-drawn track 2 into the image corresponding to the third display buffer, and switch the third display buffer to be the same as the current display. The display buffer corresponding to the page, and after the arrival of the next vertical synchronization signal, the drawing refresh is completed, and the data in the third display buffer is refreshed to the current display page currently displayed on the screen.
接着,用户又回点屏幕,在屏幕上执行新的手绘操作,形成如图8中的手绘轨迹3(即“王”字中的“︱”),此时在屏幕上就会同时显示优化后的手绘轨迹1和优化后的手绘轨迹2,以及手绘轨迹3。当手绘轨迹3完成后,应用层对手绘轨3迹进行优化,得到优化后的手绘轨迹3,之后用临时缓冲区中的数据(绘制手轨迹3前备份的第三显示缓冲区的数据)覆盖第一显示缓冲区中的数据,并通知SurfaceFlinger将是优化后的手绘轨迹3合成到第一显示缓冲区对应的图像中,将第一显示缓冲区切换为与当前显示页面对应的显示缓冲区,并在下一个垂直同步信号到来后,完成绘制刷新,将第一显示缓冲区中的数据刷新为屏幕上当前显示的当前显示页面。Then, the user clicks back on the screen and performs a new hand-drawn operation on the screen to form the hand-drawn track 3 (ie, "︱" in the word "王") as shown in Figure 8. At this time, the optimized image will be displayed on the screen at the same time. The hand-drawn trajectory 1 and the optimized hand-drawn trajectory 2, and the hand-drawn trajectory 3. When the hand-drawn track 3 is completed, the application layer optimizes the hand-drawn track 3 to obtain the optimized hand-drawn track 3, and then overwrites it with the data in the temporary buffer (the data in the third display buffer that was backed up before drawing the hand track 3). The data in the first display buffer, and notify SurfaceFlinger to synthesize the optimized hand-drawn track 3 into the image corresponding to the first display buffer, and switch the first display buffer to the display buffer corresponding to the current display page, And after the arrival of the next vertical synchronization signal, the drawing refresh is completed, and the data in the first display buffer is refreshed to the current display page currently displayed on the screen.
最后,用户再回点屏幕,在屏幕上执行新的手绘操作,形成如图9中的手绘轨迹4(即“王”字中的第三个“一”),此时在屏幕上就会同时显示优化后的手绘轨迹1~优化后的手绘轨迹3,以及手绘轨迹4,形成“王”字。当手绘轨迹4完成后,应用层对手绘轨迹进行优化,得到优化后的手绘轨迹4,之后用临时缓冲区中的数据(绘制手轨迹4前备份的第一显示缓冲区的数据)覆盖第二显示缓冲区中的数据,并通知SurfaceFlinger将是优化后的手绘轨迹4合成到第二显示缓冲区对应的图像中,将第二显示缓冲区切换为与当前显示页面对应的显示缓冲区,并在下一个垂直同步信号到来后,完成绘制刷新,将第二显示缓冲区中的数据刷新为屏幕上当前显示的当前显示页面,如图10所示。Finally, the user clicks back on the screen and performs a new hand-drawn operation on the screen to form a hand-drawn track 4 as shown in Figure 9 (that is, the third "one" in the word "王"). Display the optimized hand-drawn track 1 to the optimized hand-drawn track 3, and the hand-drawn track 4, forming the word "king". When the hand-drawn track 4 is completed, the application layer optimizes the hand-drawn track to obtain the optimized hand-drawn track 4, and then uses the data in the temporary buffer (the data of the first display buffer backed up before drawing the hand track 4) to overwrite the second Display the data in the buffer, and notify SurfaceFlinger to synthesize the optimized hand-drawn track 4 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 in the next After a 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 displayed on the screen, as shown in FIG. 10 .
需要说明的是,为了示意图5-10中哪条轨迹是用户正在绘制的轨迹,因此在正在绘制轨迹处示意出用户的“手”,该“手”实际并非图像的组成部分。为了便于区分,用细线条示意手绘轨迹,用粗线条示意优化后的手绘轨迹。It should be noted that, in order to determine which track in the schematic diagram 5-10 is the track being drawn by the user, the user's "hand" is indicated where the track is being drawn, and the "hand" is not actually a component of the image. In order to facilitate the distinction, thin lines are used to indicate the hand-drawn trajectory, and thick lines are used to indicate the optimized hand-drawn trajectory.
上述方法不仅可以用于电子白板,也可以用于电视、手机等电子设备。The above method can be used not only for electronic whiteboards, but also for electronic devices such as televisions and mobile phones.
基于同一发明构思,本公开一实施例中提供一种基于安卓系统的笔迹显 示的装置,该装置的笔迹显示方法的具体实施方式可参见方法实施例部分的描述,重复之处不再赘述,请参见图11,该装置包括:Based on the same inventive concept, an embodiment of the present disclosure provides a device for displaying handwriting based on an Android system. For the specific implementation of the method for displaying handwriting in the device, please refer to the description of the method embodiment section, and the repeated parts will not be repeated. Referring to Figure 11, the device includes:
共享单元1101,用于在调用应用时,将与当前显示页面对应的第一显示缓冲区共享给本地层的画布,作为所述画布的图形缓冲区;其中,所述第一显示缓冲区是显示缓存中与所述当前显示页面对应的一个显示缓冲区;The sharing unit 1101 is used to share the first display buffer corresponding to the current display page to the canvas of the local layer as the graphics buffer of the canvas when the application is called; wherein, the first display buffer is the display buffer a display buffer corresponding to the currently displayed page in the cache;
获取单元1102,用于在用户执行手绘操作期间,实时获取所述手绘操作对应的坐标信息;an obtaining unit 1102, configured to obtain coordinate information corresponding to the hand-drawn operation in real time during the period when the user performs the hand-drawn operation;
绘制单元1103,用于用绘图引擎SKIA将所述坐标信息绘制到所述画布中,形成并显示对应的手绘轨迹。The drawing unit 1103 is configured to use the drawing engine SKIA to draw the coordinate information into the canvas to form and display the corresponding hand-drawn track.
一种可能的实施方式,所述共享单元1101用于:In a possible implementation manner, the sharing unit 1101 is used for:
将所述显示缓存映射到所述应用对应的虚拟内存;其中,所述显示缓存包括多个显示缓冲区,所述虚拟内存与所述显示缓存等大小;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 is the same size as the display cache;
确定所述第一显示缓冲区的第一区编号;determining the first area number of the first display buffer;
从所述虚拟内存中获取与所述第一编号对应的第一虚拟区域;Obtain a first virtual area corresponding to the first number from the virtual memory;
将所述第一虚拟区域作为所述图形缓冲区。The first virtual area is used as the graphics buffer.
一种可能的实施方式,所述共享单元1101还用于:In a possible implementation manner, the sharing unit 1101 is further used for:
获取所述显示缓存的基本信息;其中,所述基本信息包括所述显示缓存的大小;Acquire basic information of the display cache; wherein the basic information includes the size of the display cache;
根据所述基本信息,创建与所述显示缓存等大小的所述虚拟内存;According to the basic information, create the virtual memory of the same size as the display cache;
将所述显示缓存映射到所述虚拟缓存。The display cache is mapped to the virtual cache.
一种可能的实施方式,所述获取单元1102还用于:In a possible implementation manner, the obtaining unit 1102 is further configured to:
在所述用户执行所述手绘操作前,将所述第一显示缓冲区中的数据同步给其余所述显示缓冲区。Before the user performs the hand-drawing operation, the data in the first display buffer is synchronized to the remaining display buffers.
一种可能的实施方式,所述绘制单元1103用于:In a possible implementation manner, the drawing unit 1103 is used for:
将所述第一显示缓冲区中的数据备份到临时缓冲区;backing up the data in the first display buffer to the temporary buffer;
在捕获到所述手绘操作中的按压操作时,将所述坐标信息设置在Path对象中,并传递到所述画布中进行轨迹绘制,在未捕获到所述按压操作时结束 所述轨迹绘制,获得所述手绘轨迹。When a pressing operation in the hand-drawing operation is captured, the coordinate information is set in the Path object, and transferred to the canvas for trajectory drawing, and when the pressing operation is not captured, the trajectory drawing is ended, The hand-drawn trajectory is obtained.
一种可能的实施方式,所述绘制单元1103还用于:In a possible implementation manner, the drawing unit 1103 is also used for:
在未捕获到所述按压操作之后,对所述手绘轨迹进行优化;After the pressing operation is not captured, optimizing the hand-drawn trajectory;
用所述临时缓冲区的数据覆盖所述第二显示缓冲区,并通知SurfaceFlinger将优化后的手绘轨迹合成到所述第二显示缓冲区对应的图像中;Covering the second display buffer with the data of the temporary buffer, and informing SurfaceFlinger to synthesize the optimized hand-drawn trajectory into the image corresponding to the second display buffer;
将所述第二显示缓冲区切换为与所述当前显示页面对应的显示缓冲区,并在下一垂直同步信号到来时,将所述第二显示缓冲区的内容刷新到所述当前显示页面;其中,在所述显示缓存中,所述第二显示缓冲区为所述第一显示缓冲区的下一个显示缓冲区,所述显示缓存中最后一个显示缓冲区的下一个显示缓冲区为所述显示缓存中的首个显示缓冲区。Switching the second display buffer to a display buffer corresponding to the current display page, and refreshing the content of the second display buffer to the current display page when the next vertical synchronization signal arrives; wherein , in the display buffer, 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 buffer is the display buffer The first display buffer in the cache.
一种可能的实施方式,所述绘制单元1103还用于:In a possible implementation manner, the drawing unit 1103 is also used for:
将所述第二显示缓冲区的内容刷新到所述当前显示页面之后,在没有捕获到新的手绘操作时,释放所述临时缓冲区,并结束所述显示缓存的映射。After the content of the second display buffer is refreshed to the current display page, when no new hand-drawing operation is captured, the temporary buffer is released, and the mapping of the display buffer is ended.
基于同一发明构思,本公开实施例中提供了一种基于安卓系统的笔迹显示的设备,包括:至少一个处理器,以及Based on the same inventive concept, an embodiment of the present disclosure provides a device for displaying handwriting based on an Android system, including: at least one processor, and
与所述至少一个处理器连接的存储器;a memory connected to the at least one processor;
其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述至少一个处理器通过执行所述存储器存储的指令,执行如上所述的笔迹显示方法。Wherein, the memory stores instructions executable by the at least one processor, and the at least one processor executes the above-described handwriting display method by executing the instructions stored in the memory.
基于同一发明构思,本公开实施例还提一种可读存储介质,包括:Based on the same inventive concept, an embodiment of the present disclosure also provides a readable storage medium, including:
存储器,memory,
所述存储器用于存储指令,当所述指令被处理器执行时,使得包括所述可读存储介质的装置完成如上所述的笔迹显示方法。The memory is used to store instructions, and when the instructions are executed by the processor, make the apparatus including the readable storage medium complete the above-described handwriting display method.
本领域内的技术人员应明白,本公开实施例可提供为方法、系统、或计算机程序产品。因此,本公开实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本公开实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但 不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。As will be appreciated by one skilled in the art, embodiments of the present disclosure may be provided as a method, system, or computer program product. Accordingly, embodiments of the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media having computer-usable program code embodied therein, including but not limited to disk storage, CD-ROM, optical storage, and the like.
本公开实施例是参照根据本公开实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。Embodiments of the present disclosure are described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present disclosure. It will be understood that each process and/or block in the flowchart illustrations and/or block diagrams, and combinations of processes and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to the processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing device to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing device produce Means for implementing the functions specified in a flow or flow of a flowchart and/or a block or blocks of a block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, the instructions The apparatus implements the functions specified in the flow or flow of the flowcharts and/or the block or blocks of the block diagrams.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process such that The instructions provide steps for implementing the functions specified in the flow or blocks of the flowcharts and/or the block or blocks of the block diagrams.
显然,本领域的技术人员可以对本公开进行各种改动和变型而不脱离本公开的精神和范围。这样,倘若本公开的这些修改和变型属于本公开权利要求及其等同技术的范围之内,则本公开也意图包含这些改动和变型在内。It will be apparent to those skilled in the art that various modifications and variations can be made in the present disclosure without departing from the spirit and scope of the present disclosure. Thus, provided that these modifications and variations of the present disclosure fall within the scope of the claims of the present disclosure and their equivalents, the present disclosure is also intended to cover such modifications and variations.

Claims (10)

  1. 一种基于安卓系统的笔迹显示的方法,其中,包括:A method for displaying handwriting based on an Android system, comprising:
    在调用应用时,将与当前显示页面对应的第一显示缓冲区共享给本地层的画布,作为所述画布的图形缓冲区;其中,所述第一显示缓冲区是显示缓存中与所述当前显示页面对应的一个显示缓冲区;When calling the application, the first display buffer corresponding to the current display page is shared with the canvas of the local layer as the graphics buffer of the canvas; wherein, the first display buffer is the same as the current display buffer in the display buffer. A display buffer corresponding to the display page;
    在用户执行手绘操作期间,实时获取所述手绘操作对应的坐标信息;During the period when the user performs the hand-drawing operation, obtain the coordinate information corresponding to the hand-drawing operation in real time;
    用绘图引擎SKIA将所述坐标信息绘制到所述画布中,形成并显示对应的手绘轨迹。The coordinate information is drawn into the canvas by the drawing engine SKIA, and the corresponding hand-drawn track is formed and displayed.
  2. 如权利要求1所述的方法,其中,将与当前显示页面对应的第一显示缓冲区共享给本地层的画布,作为所述画布的图形缓冲区,包括:The method of claim 1, wherein sharing the first display buffer corresponding to the current display page to the canvas of the local layer as the graphics buffer of the canvas, comprising:
    将所述显示缓存映射到所述应用对应的虚拟内存;其中,所述显示缓存包括多个显示缓冲区,所述虚拟内存与所述显示缓存等大小;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 is the same size as the display cache;
    确定所述第一显示缓冲区的第一区编号;determining the first area number of the first display buffer;
    从所述虚拟内存中获取与所述第一编号对应的第一虚拟区域;Obtain a first virtual area corresponding to the first number from the virtual memory;
    将所述第一虚拟区域作为所述图形缓冲区。The first virtual area is used as the graphics buffer.
  3. 如权利要求2所述的方法,其中,将所述显示缓存映射到应用对应的虚拟内存,包括:The method of claim 2, wherein mapping the display cache to the virtual memory corresponding to the application comprises:
    获取所述显示缓存的基本信息;其中,所述基本信息包括所述显示缓存的大小;Acquire basic information of the display cache; wherein the basic information includes the size of the display cache;
    根据所述基本信息,创建与所述显示缓存等大小的所述虚拟内存;According to the basic information, create the virtual memory of the same size as the display cache;
    将所述显示缓存映射到所述虚拟缓存。The display cache is mapped to the virtual cache.
  4. 如权利要求1所述的方法,其中,在所述用户执行所述手绘操作前,还包括:The method of claim 1, wherein before the user performs the hand-drawing operation, further comprising:
    将所述第一显示缓冲区中的数据同步给其余所述显示缓冲区。Synchronizing the data in the first display buffer to the remaining display buffers.
  5. 如权利要求1-4任一项所述的方法,其中,用绘图引擎SKIA将所述坐标信息绘制到所述画布中,形成并显示对应的手绘轨迹,包括:The method according to any one of claims 1-4, wherein the coordinate information is drawn into the canvas by a drawing engine SKIA to form and display a corresponding hand-drawn track, comprising:
    将所述第一显示缓冲区中的数据备份到临时缓冲区;backing up the data in the first display buffer to the temporary buffer;
    在捕获到所述手绘操作中的按压操作时,将所述坐标信息设置在Path对象中,并传递到所述画布中进行轨迹绘制,在未捕获到所述按压操作时结束所述轨迹绘制,获得所述手绘轨迹。When a pressing operation in the hand-drawing operation is captured, the coordinate information is set in the Path object, and transferred to the canvas for trajectory drawing, and when the pressing operation is not captured, the trajectory drawing is ended, The hand-drawn trajectory is obtained.
  6. 如权利要求5所述的方法,其中,在未捕获到所述按压操作之后,还包括:The method of claim 5, wherein after the pressing operation is not captured, further comprising:
    对所述手绘轨迹进行优化;optimizing the hand-drawn trajectory;
    用所述临时缓冲区的数据覆盖所述第二显示缓冲区,并通知SurfaceFlinger将优化后的手绘轨迹合成到所述第二显示缓冲区对应的图像中;Covering the second display buffer with the data of the temporary buffer, and informing SurfaceFlinger to synthesize the optimized hand-drawn trajectory into the image corresponding to the second display buffer;
    将所述第二显示缓冲区切换为与所述当前显示页面对应的显示缓冲区,并在下一垂直同步信号到来时,将所述第二显示缓冲区的内容刷新到所述当前显示页面;其中,在所述显示缓存中,所述第二显示缓冲区为所述第一显示缓冲区的下一个显示缓冲区,所述显示缓存中最后一个显示缓冲区的下一个显示缓冲区为所述显示缓存中的首个显示缓冲区。Switching the second display buffer to a display buffer corresponding to the current display page, and refreshing the content of the second display buffer to the current display page when the next vertical synchronization signal arrives; wherein , in the display buffer, 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 buffer is the display buffer The first display buffer in the cache.
  7. 如权利要求6所述的方法,其中,将所述第二显示缓冲区的内容刷新到所述当前显示页面之后,还包括:The method of claim 6, wherein after refreshing the content of the second display buffer to the current display page, the method further comprises:
    在没有捕获到新的手绘操作时,释放所述临时缓冲区,并结束所述显示缓存的映射。When no new hand-drawing operation is captured, the temporary buffer is released, and the mapping of the display buffer is ended.
  8. 一种基于安卓系统的笔迹显示的装置,其中,包括:A device for displaying handwriting based on an Android system, comprising:
    共享单元,用于在调用应用时,将与当前显示页面对应的第一显示缓冲区共享给本地层的画布,作为所述画布的图形缓冲区;其中,所述第一显示缓冲区是显示缓存中与所述当前显示页面对应的一个显示缓冲区;The sharing unit is used to share the first display buffer corresponding to the current display page to the canvas of the local layer as the graphics buffer of the canvas when the application is called; wherein, the first display buffer is the display buffer A display buffer corresponding to the currently displayed page in the;
    获取单元,用于在用户执行手绘操作期间,实时获取所述手绘操作对应的坐标信息;an obtaining unit, configured to obtain coordinate information corresponding to the hand-drawn operation in real time during the period when the user performs the hand-drawn operation;
    绘制单元,用于用绘图引擎SKIA将所述坐标信息绘制到所述画布中,形成并显示对应的手绘轨迹。The drawing unit is used for drawing the coordinate information into the canvas by using the drawing engine SKIA to form and display the corresponding hand-drawn track.
  9. 一种基于安卓系统的笔迹显示的装置,其中,包括:A device for displaying handwriting based on an Android system, comprising:
    至少一个处理器,以及at least one processor, and
    与所述至少一个处理器连接的存储器;a memory connected to the at least one processor;
    其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述至少一个处理器通过执行所述存储器存储的指令,执行如权利要求1-7任一项所述的方法。Wherein, the memory stores instructions executable by the at least one processor, and the at least one processor executes the method according to any one of claims 1-7 by executing the instructions stored in the memory.
  10. 一种可读存储介质,其中,包括存储器,A readable storage medium comprising a memory,
    所述存储器用于存储指令,当所述指令被处理器执行时,使得包括所述可读存储介质的装置完成如权利要求1~7中任一项所述的方法。The memory is used to store instructions that, when executed by a processor, cause an apparatus including the readable storage medium to perform the method of any one of claims 1-7.
PCT/CN2020/124930 2020-10-29 2020-10-29 Handwriting displaying method and apparatus based on android system, and storage medium WO2022087981A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2020/124930 WO2022087981A1 (en) 2020-10-29 2020-10-29 Handwriting displaying method and apparatus based on android system, and storage medium
CN202080002556.8A CN115280265A (en) 2020-10-29 2020-10-29 Handwriting display method and device based on android system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/124930 WO2022087981A1 (en) 2020-10-29 2020-10-29 Handwriting displaying method and apparatus based on android system, and storage medium

Publications (1)

Publication Number Publication Date
WO2022087981A1 true WO2022087981A1 (en) 2022-05-05

Family

ID=81381736

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/124930 WO2022087981A1 (en) 2020-10-29 2020-10-29 Handwriting displaying method and apparatus based on android system, and storage medium

Country Status (2)

Country Link
CN (1) CN115280265A (en)
WO (1) WO2022087981A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116071459A (en) * 2023-03-06 2023-05-05 深圳市英唐数码科技有限公司 Ink screen-based hand drawing control method, system and readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103823605A (en) * 2014-03-03 2014-05-28 华强云投资控股有限公司 Processing method of handwriting data between electromagnetic screens and electromagnetic screen system
CN105677107A (en) * 2016-01-11 2016-06-15 福州瑞芯微电子股份有限公司 Method and system for optimizing screen handwriting following performance
US20180158219A1 (en) * 2017-05-15 2018-06-07 Luis Javier Pagan Tracing canvas
CN109858421A (en) * 2019-01-24 2019-06-07 广东第二师范学院 A kind of Android platform person's handwriting back method and device based on scalable vector graphics

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103823605A (en) * 2014-03-03 2014-05-28 华强云投资控股有限公司 Processing method of handwriting data between electromagnetic screens and electromagnetic screen system
CN105677107A (en) * 2016-01-11 2016-06-15 福州瑞芯微电子股份有限公司 Method and system for optimizing screen handwriting following performance
US20180158219A1 (en) * 2017-05-15 2018-06-07 Luis Javier Pagan Tracing canvas
CN109858421A (en) * 2019-01-24 2019-06-07 广东第二师范学院 A kind of Android platform person's handwriting back method and device based on scalable vector graphics

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116071459A (en) * 2023-03-06 2023-05-05 深圳市英唐数码科技有限公司 Ink screen-based hand drawing control method, system and readable storage medium

Also Published As

Publication number Publication date
CN115280265A (en) 2022-11-01

Similar Documents

Publication Publication Date Title
EP3111318B1 (en) Cross-platform rendering engine
US7889202B2 (en) Transparent multi-buffering in multi-GPU graphics subsystem
CN114741044B (en) Cross-operation environment display output sharing method based on heterogeneous rendering
US5574836A (en) Interactive display apparatus and method with viewer position compensation
US8878833B2 (en) Systems, methods, and apparatus for recording of graphical display
CN110703978B (en) Information display method, reader, and computer storage medium
US7475197B1 (en) Cross process memory management
CN111651079B (en) Handwriting display method, device, equipment and computer storage medium
CN110597444B (en) Handwriting display method and device, terminal device and storage medium
JP2011510407A (en) Multi-buffer support for off-screen surfaces in graphics processing systems
KR102646977B1 (en) Display method and device based on augmented reality, and storage medium
US11561637B2 (en) Method and device of drawing handwriting track, electronic apparatus, medium, and program product
US10672099B2 (en) Memory cache management for graphics processing
TW201301195A (en) Method of controlling multiple displays and systems thereof
US10319068B2 (en) Texture not backed by real mapping
CN114741081B (en) Cross-operation environment display output sharing method based on heterogeneous cache access
KR20220080007A (en) Augmented reality-based display method, device and storage medium
CN109375980B (en) Touch drawing method based on Andriod system
WO2022087981A1 (en) Handwriting displaying method and apparatus based on android system, and storage medium
CN117170883B (en) Method, device, equipment and storage medium for rendering display
US10789913B2 (en) Arbitrary block rendering and display frame reconstruction
CN116339900B (en) Multi-window fusion display method for cross-operating environment
US20140292617A1 (en) System, method, and computer program product for reducing image artifacts on multiple displays
CN114924837A (en) Data processing method, electronic device and readable storage medium
US20220391084A1 (en) Information display method, reader, computer storage medium, ink screen reading device and screen projection display system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20959144

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 21.08.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 20959144

Country of ref document: EP

Kind code of ref document: A1