WO2018035686A1 - Graphical user interface gui rendering method and apparatus - Google Patents

Graphical user interface gui rendering method and apparatus Download PDF

Info

Publication number
WO2018035686A1
WO2018035686A1 PCT/CN2016/096264 CN2016096264W WO2018035686A1 WO 2018035686 A1 WO2018035686 A1 WO 2018035686A1 CN 2016096264 W CN2016096264 W CN 2016096264W WO 2018035686 A1 WO2018035686 A1 WO 2018035686A1
Authority
WO
WIPO (PCT)
Prior art keywords
gui
parameters
parsing
binary
compiler
Prior art date
Application number
PCT/CN2016/096264
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/CN2016/096264 priority Critical patent/WO2018035686A1/en
Publication of WO2018035686A1 publication Critical patent/WO2018035686A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs

Definitions

  • the present invention relates to the field of communications, and in particular to a method and apparatus for drawing a GUI of a graphical user interface.
  • the embedded graphical user interface GUI system is a key technology in embedded systems. Its performance and interface quality are directly affecting the user experience of embedded products.
  • the development of GUIs on embedded systems is not as easy and convenient as the development of applications on PC platforms. In this way, selecting a complete and suitable GUI support system for target embedded products with different hardware configurations and embedded operating systems becomes a challenging problem.
  • GUI on embedded systems there are two main ways to develop GUI on embedded systems: one is to develop an existing GUI library for a specific embedded system, such as Microsoft's WinCE, TrollTech's Qt and GNU's GTK+.
  • the approach can generally be based on a GUI library to provide a complete solution and application.
  • the general GUI library is relatively large, it needs to be tailored and personalized when it is used, and often costs extra to obtain software license.
  • the embedded graphics middleware specially designed by the developer for embedded systems. Pieces such as MiniGUI, SwellSoftware's PEG and TilconSoftware's Tilcon products.
  • the embodiment of the invention provides a method and a device for drawing a graphical user interface GUI, so as to at least solve the problem that the related art needs to parse the parameter set to draw the GUI during the compiling process, resulting in low program execution efficiency.
  • a method for drawing a GUI of a graphical user interface comprising: parsing a markup language file for drawing the GUI, and acquiring the compiler before compiling the GUI for drawing the GUI
  • the parameters of the GUI are drawn; the obtained parameters are compiled into the above-mentioned compiler; and the GUI is drawn by running the above-mentioned compiler that compiles the above parameters.
  • obtaining the parameter for drawing the GUI by parsing the markup language file for drawing the GUI includes: classifying and parsing all the markup language files for drawing the GUI according to the interface level, and obtaining a binary analysis result;
  • the above binary analysis result is cached in an analysis order; parameters for drawing the GUI are extracted from the above binary analysis result.
  • the method further includes: The result of the hexadecimal parsing is reordered according to a preset sorting rule, wherein after the above-mentioned binary parsing result is reordered according to the above-mentioned preset sorting rule, the binary parsing from the reordering is matched by matching the above-mentioned preset collation rules.
  • the structured data used to draw the GUI described above is extracted from the results.
  • drawing the GUI includes: retrieving the parameters during the running of the compiler; and transmitting the parameters to the encapsulated graphics function interface; At least one of the preset GUI libraries calls a control structure that matches the above parameters; the GUI is drawn using the above-mentioned control structure invoked.
  • drawing the GUI includes: calling, by using a packaged system function interface, an operating environment required to draw the current GUI from a plurality of preset operating environments, where The above operating environment includes at least one of the following: an operating system and hardware resources.
  • a drawing device for a GUI of a graphical user interface, comprising: an obtaining unit configured to pass a markup language for drawing the GUI before compiling a compiler for drawing the GUI
  • the file is parsed to obtain parameters for drawing the GUI; the compiling unit is configured to compile the obtained parameters into the above compiling program; and the drawing unit is configured to draw the GUI by running the above compiling program that compiles the above parameters.
  • the obtaining unit includes: a parsing module, configured to hierarchically parse all the markup language files for drawing the GUI according to the interface hierarchy to obtain a binary parsing result; and the caching module is configured to buffer the binary parsing result according to the parsing order; The extraction module is configured to extract parameters for drawing the GUI from the binary analysis result.
  • a parsing module configured to hierarchically parse all the markup language files for drawing the GUI according to the interface hierarchy to obtain a binary parsing result
  • the caching module is configured to buffer the binary parsing result according to the parsing order
  • the extraction module is configured to extract parameters for drawing the GUI from the binary analysis result.
  • the foregoing apparatus further includes: a sorting unit, configured to reorder the binary parsing result according to a preset sorting rule after buffering the binary parsing result according to the parsing order, wherein the extracting module is further configured to After the binary analysis results are reordered according to the above-mentioned preset sorting rules, the structured data for drawing the GUI is extracted from the reordered binary analysis results by matching the above-mentioned preset sorting rules.
  • a sorting unit configured to reorder the binary parsing result according to a preset sorting rule after buffering the binary parsing result according to the parsing order
  • the extracting module is further configured to After the binary analysis results are reordered according to the above-mentioned preset sorting rules, the structured data for drawing the GUI is extracted from the reordered binary analysis results by matching the above-mentioned preset sorting rules.
  • the drawing unit includes: a retrieval module configured to retrieve the parameter during the running of the compiler; the delivery module is configured to pass the parameter to the encapsulated graphic function interface; and the first calling module is configured to pass The graphics function interface invokes a control structure that matches the above parameters from at least one of a plurality of preset GUI libraries; the rendering module is configured to draw the GUI using the invoked control structure.
  • the drawing unit includes: a second calling module, configured to invoke, by using a packaged system function interface, an operating environment required to draw the current GUI from a plurality of preset operating environments, where the operating environment includes At least one of the following: operating system and hardware resources.
  • a computer storage medium is further provided, and the computer storage medium may store an execution instruction for performing the implementation of the drawing method of the GUI in the foregoing embodiment.
  • the parameters for drawing the GUI are obtained by parsing the markup language file for drawing the GUI; and the obtained parameters are compiled into the compiler; Run the compiler that compiles the parameters, draw the GU, and solve the related technology that needs to be parsed for drawing during the compilation process.
  • the parameter of the GUI causes a problem that the program execution efficiency is low, thereby achieving an effect of improving the execution efficiency of the program for drawing the GUI.
  • FIG. 1 is a flow chart of a method of drawing a graphical user interface GUI according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of a location of a GUI in an entire system according to an embodiment of the present invention
  • FIG. 3 is a flowchart of a script parsing layer parsing an XML document according to an embodiment of the present invention
  • FIG. 4 is a flow chart of a method of drawing a graphical user interface GUI in accordance with an alternative embodiment of the present invention
  • FIG. 5 is a schematic diagram of a drawing device of a graphical user interface GUI according to an embodiment of the present invention.
  • FIG. 1 is a flowchart of a method for drawing a GUI of a graphical user interface according to an embodiment of the present invention. As shown in FIG. 1 , the process includes the following steps:
  • Step S102 before compiling the compiler for drawing the GUI, obtaining parameters for drawing the GUI by parsing the markup language file for drawing the GUI;
  • Step S104 compiling the obtained parameters into the compiler
  • step S106 the GUI is drawn by running a compiler that compiles the parameters.
  • GUI In order to achieve the independence of the GUI definition from the specific programming language and development platform, all GUI parameters and resources are defined by the markup language description method. Therefore, when drawing the GUI, the markup language file used to draw the GUI needs to be parsed and parsed into an assembly language or a binary language file.
  • the GUI system architecture for drawing a GUI mainly includes: a script parsing layer, a graphics layer, and a system encapsulation interface layer.
  • the script parsing layer may parse the markup language file used to draw the GUI before compiling the compiler for drawing the GUI to obtain parameters for drawing the GUI, and compile the parsed parameters into the program. In this way, during the execution of the program, the corresponding parameters can be extracted to draw the graphical interface.
  • the technical solution provided by the present invention is to parse the markup language file to obtain the parameters for drawing the GUI before the program is compiled, so that the parameters compiled in the program can be directly extracted during the drawing process, and the program is greatly improved. Execution efficiency.
  • obtaining parameters for drawing the GUI includes:
  • the parameters described by the markup language are parsed into parameters described by the binary language.
  • the machine-recognizable binary parameters can be directly compiled into the compiler; on the other hand, all markup language files are parsed according to the interface hierarchy. It can simplify the parsing logic, improve the parsing efficiency, and prevent the correct GUI from being drawn due to leak parsing or repeated parsing.
  • the method further includes:
  • the binary parsing result is reordered according to a preset sorting rule, wherein after the binary parsing result is reordered according to a preset sorting rule, the binary parsing result from the reordering is matched by matching a preset collating rule. Extract the structured data used to draw the GUI.
  • the script parsing layer hierarchically parses all the markup language files describing the GUI according to the interface hierarchy, and the parsed data according to a preset sorting rule (such as a specific data arrangement protocol). ) After rearranging, get a binary file and cache it.
  • the structured data is extracted from the binary file by matching the aforementioned preset collation rules, and are respectively filled into some preset data structures. In this way, if a specific graphical interface needs to be drawn during the execution of the program, only the parameters corresponding to the corresponding GUI need to be retrieved from the data structure, thereby improving the loading speed of the parameters and the compilation efficiency of the program.
  • drawing the GUI includes:
  • various parameters compiled in the compiler can be retrieved, and the retrieved parameters are passed to a graphical function interface pre-packaged in the graphics layer, through which the graphical function interface can be derived from multiple At least one of the set GUI libraries calls a control structure that matches the parameters, and then directly draws the GUI using the invoked control structure.
  • the pre-packaged graphics function interface in the graphics layer is a package for various controls that make up the GUI.
  • These controls can be divided into three categories, namely Control, GDI, and Image decoding.
  • Control is the basic control that constitutes the GUI. Commonly used are Button, Label, Combobox, List, Textbox, Timer, etc.;
  • GDI is a key technology to realize multi-window system, namely the cut domain technology, which can be embedded by cutting the domain.
  • the complex platform is displayed on the platform to ensure that the drawing of one window does not affect the drawing of other windows.
  • Image decoding is the decoding of different types of images.
  • the supported image types are BMP, GIF, JEPG and PNG.
  • the GUI system architecture can only support a single type of GUI library; and the GUI system architecture designed by the present invention can be retrieved from a specific data structure during program execution. Go to the interface parameters and pass them to the packaged function interface to adapt to various GUI libraries, thus completing the corresponding GUI drawing tasks, improving the flexibility of the system, while the structure is clear, the resources are less, the performance is more efficient, and Easy to maintain.
  • the graphics layer in the GUI system architecture may be adapted to an existing GUI library, or may be a software interface provided by a chip manufacturer.
  • a simple drawing operation can directly call the software interface provided by the chip manufacturer.
  • the more complicated control drawing operation can be realized by the software interface provided by the packaged chip manufacturers.
  • drawing the GUI includes:
  • the operating environment required for drawing the current GUI is invoked from a plurality of preset operating environments through the encapsulated system function interface, where the operating environment includes at least one of the following: an operating system and hardware resources.
  • the system function interface is the encapsulation of the operating system and hardware platform at the system package interface layer. All system resources used in the GUI system architecture are obtained by calling the system function interface of the system package interface layer.
  • the system function interface of the system package interface layer includes operating system related interfaces, such as memory management, process scheduling, timer management, semaphores, file systems, etc., as well as platform display, driver and other related interfaces, such as fill, blit, surface, and so on.
  • the system package interface layer is located between the operating system and the application layer to isolate the different operating systems used by the lower layers.
  • the system function interface of the system package interface layer is called to complete the call of the relevant interface such as the operating system or the platform driver, such as the application and release of the memory, the creation and release of the semaphore, and the creation and release of the thread. Wait.
  • the GUI is adapted to a specific operating system and hardware platform, and finally the GUI is drawn and displayed.
  • the invention can realize the purpose of adapting a plurality of graphics libraries, multiple operating systems and multiple hardware platforms in the GUI drawing process, and is simpler when the GUI is drawn. More flexible, clearer structure, smaller resources, faster response, and easier maintenance.
  • GUI system architecture serves as a graphics library system, and provides a service interface for a GUI of an upper layer APP (ie, a graphics function interface of a graphics layer package). ), Provide the corresponding interface for the system package interface layer package for the lower layer operating system and hardware platform.
  • APP a graphics function interface of a graphics layer package
  • FIG. 3 is a flow chart of parsing an XML document by a script parsing layer according to an embodiment of the present invention.
  • all XML documents (such as XML1, XML2, ... XMLn) are subjected to XML parsing rules before the program is compiled.
  • Parsing and caching in order to facilitate compiling the parsing parameters into the compiler, the parsed data can be rearranged according to a preset collation to obtain a view.bin file.
  • the structured data is extracted from the view.bin file by matching the aforementioned preset collation rules, and filled into the preset data structure: string array, color array, image array , form linked list.
  • FIG. 4 is a flowchart of a method for drawing a GUI of a graphical user interface according to an alternative embodiment of the present invention.
  • displaying a GUI in an APP requires relying on a GUI system architecture.
  • the APP indexes the corresponding control parameters of the GUI to be drawn through the subscripts of the four data structures of string, color, image, and form, and then passes the control parameters to the GUI system architecture, implements the GUI drawing within the architecture, and advances through the APP.
  • the set callback notifies the APP of the event information, and finally completes the drawing of the GUI.
  • the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases, the former is A better implementation.
  • the technical solution of the present invention which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk,
  • the optical disc includes a number of instructions for causing a terminal device (which may be a cell phone, a computer, a server, or a network device, etc.) to perform the methods described in various embodiments of the present invention.
  • a drawing device of a GUI is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and has not been described again.
  • the term "module” as used below may implement a combination of software and/or hardware of a predetermined function.
  • the apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and contemplated.
  • FIG. 5 is a schematic diagram of a drawing device of a graphical user interface GUI according to an embodiment of the present invention.
  • the device includes: an obtaining unit 502, a compiling unit 504, and a drawing unit 506.
  • the obtaining unit 502 is configured to obtain parameters for drawing the GUI by parsing the markup language file for drawing the GUI before compiling the compiler for drawing the GUI;
  • the compiling unit 504 is configured to compile the acquired parameters to
  • the drawing unit 506 is set to draw the GUI by running a compiler that compiles the parameters.
  • GUI In order to achieve the independence of the GUI definition from the specific programming language and development platform, all GUI parameters and resources are defined by the markup language description method. Therefore, when drawing the GUI, the markup language file used to draw the GUI needs to be parsed and parsed into assembly language or binary language.
  • the GUI system architecture for drawing a GUI mainly includes: a script parsing layer, a graphics layer, and a system encapsulation interface layer.
  • the script parsing layer may parse the markup language file used to draw the GUI before compiling the compiler for drawing the GUI to obtain parameters for drawing the GUI, and compile the parsed parameters into the program. In this way, during the execution of the program, the corresponding parameters can be extracted to draw the graphical interface.
  • the technical solution provided by the present invention is to parse the markup language file to obtain the parameters for drawing the GUI before the program is compiled, so that the parameters compiled in the program can be directly extracted during the drawing process, and the program is greatly improved. Execution efficiency.
  • the obtaining unit includes: a parsing module configured to hierarchically parse all the markup language files for drawing the GUI according to the interface hierarchy to obtain a binary parsing result; the caching module is configured to cache the binary parsing result according to the parsing order; and the extracting module , set to extract the parameters used to draw the GUI from the binary parsing results.
  • a parsing module configured to hierarchically parse all the markup language files for drawing the GUI according to the interface hierarchy to obtain a binary parsing result
  • the caching module is configured to cache the binary parsing result according to the parsing order
  • the extracting module set to extract the parameters used to draw the GUI from the binary parsing results.
  • the parameters described by the markup language are parsed into parameters described by the binary language.
  • the machine-recognizable binary parameters can be directly compiled into the compiler; on the other hand, all markup language files are parsed according to the interface hierarchy. It can simplify the parsing logic, improve the parsing efficiency, and prevent the correct GUI from being drawn due to missing parsing or repeated parsing.
  • the apparatus further includes: a sorting unit configured to: after buffering the binary parsing result according to the parsing order, reorder the binary parsing result according to a preset collation, wherein the extracting module is further configured to follow the binary parsing result according to After the pre-set collation is reordered, the structured data for drawing the GUI is extracted from the reordered binary parsing result by matching the pre-set collation.
  • a sorting unit configured to: after buffering the binary parsing result according to the parsing order, reorder the binary parsing result according to a preset collation, wherein the extracting module is further configured to follow the binary parsing result according to After the pre-set collation is reordered, the structured data for drawing the GUI is extracted from the reordered binary parsing result by matching the pre-set collation.
  • the script parsing layer hierarchically parses all the markup language files describing the GUI according to the interface hierarchy, and the parsed data according to a preset sorting rule (such as a specific data arrangement protocol). ) After rearranging, get a binary file and cache it.
  • the structured data is extracted from the binary file by matching the aforementioned preset collation rules, and are respectively filled into some preset data structures. In this way, if a specific graphical interface needs to be drawn during the execution of the program, only the parameters corresponding to the corresponding GUI need to be retrieved from the data structure, thereby improving the loading speed of the parameters and the compilation efficiency of the program.
  • the drawing unit comprises: a retrieval module configured to retrieve parameters during the running of the compiler; a delivery module configured to pass the parameters to the encapsulated graphics function interface; the first calling module is set to pass the graphical function interface A control structure that matches the parameter is called from at least one of the plurality of preset GUI libraries; the drawing module is set to draw the GUI using the invoked control structure.
  • various parameters compiled in the compiler can be retrieved, and the retrieved parameters are passed to a graphical function interface pre-packaged in the graphics layer, through which the graphical function interface can be derived from multiple At least one of the set GUI libraries calls a control structure that matches the parameters, and then directly draws the GUI using the invoked control structure.
  • the pre-packaged graphics function interface in the graphics layer is a package for various controls that make up the GUI.
  • These controls can be divided into three categories, namely Control, GDI, and Image decoding.
  • Control is the basic control that constitutes the GUI. Commonly used are Button, Label, Combobox, List, Textbox, Timer, etc.;
  • GDI is a key technology to realize multi-window system, namely the shear domain technology, which can display complex windows on the embedded platform through the cut domain. Ensure that the drawing of one window does not affect the drawing of other windows;
  • Image decoding is the decoding of different types of pictures.
  • the supported picture types are BMP, GIF, JEPG and PNG.
  • the GUI system architecture can only support a single type of GUI library; and the GUI system architecture designed by the present invention can be retrieved from a specific data structure during program execution. Go to the interface parameters and pass them to the packaged function interface to adapt to various GUI libraries, thus completing the corresponding GUI drawing tasks, improving the flexibility of the system, while the structure is clear, the resources are less, the performance is more efficient, and Easy to maintain.
  • the graphics layer in the GUI system architecture may be adapted to an existing GUI library, or may be a software interface provided by a chip manufacturer.
  • a simple drawing operation can directly call the software interface provided by the chip manufacturer.
  • the more complicated control drawing operation can be realized by the software interface provided by the packaged chip manufacturers.
  • the drawing unit includes: a second calling module, configured to invoke, by using the encapsulated system function interface, an operating environment required to draw the current GUI from a plurality of preset operating environments, where the operating environment includes at least the following One: operating system and hardware resources.
  • a second calling module configured to invoke, by using the encapsulated system function interface, an operating environment required to draw the current GUI from a plurality of preset operating environments, where the operating environment includes at least the following One: operating system and hardware resources.
  • the system function interface is the encapsulation of the operating system and hardware platform at the system package interface layer. All system resources used in the GUI system architecture are obtained by calling the system function interface of the system package interface layer.
  • the system function interface of the system package interface layer includes operating system related interfaces, such as memory management, process scheduling, timer management, semaphores, file systems, etc., as well as platform display, driver and other related interfaces, such as fill, blit, surface, and so on.
  • the system package interface layer is located between the operating system and the application layer to isolate the different operating systems used by the lower layers.
  • the system function interface of the system package interface layer is called to complete the call of the relevant interface such as the operating system or the platform driver, such as the application and release of the memory, the creation and release of the semaphore, and the creation and release of the thread. Wait.
  • the GUI is adapted to a specific operating system and hardware platform, and finally the GUI is drawn and displayed.
  • the invention can realize the purpose of adapting a plurality of graphics libraries, multiple operating systems and multiple hardware platforms in the GUI drawing process, and is simpler when the GUI is drawn. More flexible, clearer structure, smaller resources, faster response, and easier maintenance.
  • each of the above modules may be implemented by software or hardware.
  • the foregoing may be implemented by, but not limited to, the foregoing modules are all located in the same processor; or, the modules are located in multiple In the processor.
  • Embodiments of the present invention also provide a storage medium.
  • the foregoing storage medium may be configured to store program code for performing the following steps:
  • the storage medium is further configured to store program code for performing other steps in the preferred embodiments of the above-described embodiments, and details are not described herein again.
  • the foregoing storage medium may include, but not limited to, a USB flash drive, a Read-Only Memory (ROM), a Random Access Memory (RAM), a mobile hard disk, and a magnetic memory.
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • a mobile hard disk e.g., a hard disk
  • magnetic memory e.g., a hard disk
  • the processor executes according to the stored program code in the storage medium:
  • the processor executes the program code of the other steps in the foregoing preferred embodiments in the foregoing embodiments according to the stored program code in the storage medium, and details are not described herein again.
  • modules or steps of the present invention described above can be implemented by a general-purpose computing device that can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein.
  • the steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps thereof are fabricated as a single integrated circuit module.
  • the invention is not limited to any specific combination of hardware and software.
  • the above technical solution provided by the embodiment of the present invention can be applied to the drawing process of the GUI, and before the compiler for drawing the GUI is compiled, the markup language file for drawing the GUI is parsed to obtain the GUI for drawing the GUI.
  • the parameter is compiled into the compiler; the compiler is compiled by running the compiled parameter, and the GU is solved, which solves the problem that the related technology needs to parse the parameters used to draw the GUI during the compilation process, resulting in low program execution efficiency. Further, the effect of improving the execution efficiency of the program for drawing the GUI is achieved.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

A graphical user interface GUI rendering method and apparatus, the method comprising: before compiling a compiler program used for rendering a GUI, acquiring parameters used for rendering the GUI by means of parsing markup language files used for rendering the GUI (S102); compiling the acquired parameters into the compiling program (S104); and rendering the GUI by means of running the compiling program having the compiled parameters (S106). The present method and apparatus solve the problem in the prior art of the low efficiency of program execution as a result of the need to parse the parameters for rendering the GUI during the compiling process, and thereby achieve the effect of improving the efficiency of the execution of the GUI rendering program.

Description

图形用户界面GUI的绘制方法及装置Graphic user interface GUI drawing method and device 技术领域Technical field
本发明涉及通信领域,具体而言,涉及一种图形用户界面GUI的绘制方法及装置。The present invention relates to the field of communications, and in particular to a method and apparatus for drawing a GUI of a graphical user interface.
背景技术Background technique
嵌入式图形用户界面GUI系统作为嵌入式系统中的一大关键技术,其性能的好坏、界面的美观程度,直接影响着嵌入式产品的用户体验效果。然而,由于可用设备资源和操作系统提供的底层机制有限,使得嵌入式系统上GUI的开发无法像PC平台上应用程序的开发那么容易和方便。这样一来,为具有不同硬件配置的目标嵌入式产品以及嵌入式操作系统选择完备、适合的GUI支持系统,成为颇具挑战性的难题。The embedded graphical user interface GUI system is a key technology in embedded systems. Its performance and interface quality are directly affecting the user experience of embedded products. However, due to the limited available mechanisms and available underlying mechanisms provided by the operating system, the development of GUIs on embedded systems is not as easy and convenient as the development of applications on PC platforms. In this way, selecting a complete and suitable GUI support system for target embedded products with different hardware configurations and embedded operating systems becomes a challenging problem.
目前,嵌入式系统上GUI的开发方式主要有两种:一是针对某种特定的嵌入式系统采用现有的GUI库的开发方式,如Microsoft的WinCE、TrollTech的Qt和GNU的GTK+,这种方式一般可以基于GUI库来提供完整的解决方案和应用。但是,通用的GUI库相对比较庞大,使用时一般需要对其进行裁剪和个性化定制,并且往往要支出额外的成本来获得软件授权;二是开发商针对嵌入式系统专门设计的嵌入式图形中间件,如MiniGUI、SwellSoftware的PEG和TilconSoftware的Tilcon产品等。此类方式的GUI虽然占用资源较小,容易满足嵌入式系统的实时性和个性化需求,但是该方式一般由专业公司维护,只适合功能单一的嵌入式系统,存在拓展性不够的缺点。At present, there are two main ways to develop GUI on embedded systems: one is to develop an existing GUI library for a specific embedded system, such as Microsoft's WinCE, TrollTech's Qt and GNU's GTK+. The approach can generally be based on a GUI library to provide a complete solution and application. However, the general GUI library is relatively large, it needs to be tailored and personalized when it is used, and often costs extra to obtain software license. Second, the embedded graphics middleware specially designed by the developer for embedded systems. Pieces such as MiniGUI, SwellSoftware's PEG and TilconSoftware's Tilcon products. Although the GUI of this type occupies less resources, it is easy to meet the real-time and personalized requirements of the embedded system. However, this method is generally maintained by a professional company, and is only suitable for an embedded system with a single function, and has the disadvantage of insufficient expansion.
针对上述的问题,目前尚未提出有效的解决方案。In response to the above problems, no effective solution has been proposed yet.
发明内容Summary of the invention
本发明实施例提供了一种图形用户界面GUI的绘制方法及装置,以至少解决了相关技术中需要在编译过程中解析设置为绘制GUI的参数而导致程序执行效率低的问题。The embodiment of the invention provides a method and a device for drawing a graphical user interface GUI, so as to at least solve the problem that the related art needs to parse the parameter set to draw the GUI during the compiling process, resulting in low program execution efficiency.
根据本发明的一个实施例,提供了一种图形用户界面GUI的绘制方法,包括:在编译用于绘制上述GUI的编译程序之前,通过对用于绘制上述GUI的标记语言文件进行解析,获取用于绘制上述GUI的参数;将获取的上述参数编译到上述编译程序中;通过运行编译了上述参数的上述编译程序,绘制上述GUI。According to an embodiment of the present invention, there is provided a method for drawing a GUI of a graphical user interface, comprising: parsing a markup language file for drawing the GUI, and acquiring the compiler before compiling the GUI for drawing the GUI The parameters of the GUI are drawn; the obtained parameters are compiled into the above-mentioned compiler; and the GUI is drawn by running the above-mentioned compiler that compiles the above parameters.
进一步地,通过对用于绘制上述GUI的标记语言文件进行解析,获取用于绘制上述GUI的参数包括:对用于绘制上述GUI的所有标记语言文件按照界面层次进行分级解析,得到二进制解析结果;按照解析顺序缓存上述二进制解析结果;从上述二进制解析结果中提取用于绘制上述GUI的参数。Further, obtaining the parameter for drawing the GUI by parsing the markup language file for drawing the GUI includes: classifying and parsing all the markup language files for drawing the GUI according to the interface level, and obtaining a binary analysis result; The above binary analysis result is cached in an analysis order; parameters for drawing the GUI are extracted from the above binary analysis result.
进一步地,在按照解析顺序缓存上述二进制解析结果之后,上述方法还包括:将上述二 进制解析结果按照预先设定的排序规则重新排序,其中,在将上述二进制解析结果按照上述预先设定的排序规则重新排序之后,通过匹配上述预先设定的排序规则,从重新排序的二进制解析结果中提取用于绘制上述GUI的结构化数据。Further, after the foregoing binary parsing result is cached according to the parsing order, the method further includes: The result of the hexadecimal parsing is reordered according to a preset sorting rule, wherein after the above-mentioned binary parsing result is reordered according to the above-mentioned preset sorting rule, the binary parsing from the reordering is matched by matching the above-mentioned preset collation rules. The structured data used to draw the GUI described above is extracted from the results.
进一步地,通过运行编译了上述参数的上述编译程序,绘制上述GUI包括:在上述编译程序运行过程中,检索上述参数;将上述参数传递给封装好的图形函数接口;通过上述图形函数接口从多个预先设定的GUI库中的至少之一中调用与上述参数相匹配的控件结构;使用调用的上述控件结构绘制上述GUI。Further, by running the above compiler that compiles the above parameters, drawing the GUI includes: retrieving the parameters during the running of the compiler; and transmitting the parameters to the encapsulated graphics function interface; At least one of the preset GUI libraries calls a control structure that matches the above parameters; the GUI is drawn using the above-mentioned control structure invoked.
进一步地,通过运行编译了上述参数的上述编译程序,绘制上述GUI包括:通过封装好的系统函数接口从多种预先设定的运行环境中调用绘制当前的上述GUI所需要的运行环境,其中,上述运行环境包括以下至少之一:操作系统和硬件资源。Further, by running the above compiler that compiles the above parameters, drawing the GUI includes: calling, by using a packaged system function interface, an operating environment required to draw the current GUI from a plurality of preset operating environments, where The above operating environment includes at least one of the following: an operating system and hardware resources.
根据本发明的另一实施例,提供了一种图形用户界面GUI的绘制装置,包括:获取单元,设置为在编译用于绘制上述GUI的编译程序之前,通过对用于绘制上述GUI的标记语言文件进行解析,获取用于绘制上述GUI的参数;编译单元,设置为将获取的上述参数编译到上述编译程序中;绘制单元,设置为通过运行编译了上述参数的上述编译程序,绘制上述GUI。According to another embodiment of the present invention, there is provided a drawing device for a GUI of a graphical user interface, comprising: an obtaining unit configured to pass a markup language for drawing the GUI before compiling a compiler for drawing the GUI The file is parsed to obtain parameters for drawing the GUI; the compiling unit is configured to compile the obtained parameters into the above compiling program; and the drawing unit is configured to draw the GUI by running the above compiling program that compiles the above parameters.
进一步地,上述获取单元包括:解析模块,设置为对用于绘制上述GUI的所有标记语言文件按照界面层次进行分级解析,得到二进制解析结果;缓存模块,设置为按照解析顺序缓存上述二进制解析结果;提取模块,设置为从上述二进制解析结果中提取用于绘制上述GUI的参数。Further, the obtaining unit includes: a parsing module, configured to hierarchically parse all the markup language files for drawing the GUI according to the interface hierarchy to obtain a binary parsing result; and the caching module is configured to buffer the binary parsing result according to the parsing order; The extraction module is configured to extract parameters for drawing the GUI from the binary analysis result.
进一步地,上述装置还包括:排序单元,设置为在按照解析顺序缓存上述二进制解析结果之后,将上述二进制解析结果按照预先设定的排序规则重新排序,其中,上述提取模块还设置为在将上述二进制解析结果按照上述预先设定的排序规则重新排序之后,通过匹配上述预先设定的排序规则,从重新排序的二进制解析结果中提取用于绘制上述GUI的结构化数据。Further, the foregoing apparatus further includes: a sorting unit, configured to reorder the binary parsing result according to a preset sorting rule after buffering the binary parsing result according to the parsing order, wherein the extracting module is further configured to After the binary analysis results are reordered according to the above-mentioned preset sorting rules, the structured data for drawing the GUI is extracted from the reordered binary analysis results by matching the above-mentioned preset sorting rules.
进一步地,上述绘制单元包括:检索模块,设置为在上述编译程序运行过程中,检索上述参数;传递模块,设置为将上述参数传递给封装好的图形函数接口;第一调用模块,设置为通过上述图形函数接口从多个预先设定的GUI库中的至少之一中调用与上述参数相匹配的控件结构;绘制模块,设置为使用调用的上述控件结构绘制上述GUI。Further, the drawing unit includes: a retrieval module configured to retrieve the parameter during the running of the compiler; the delivery module is configured to pass the parameter to the encapsulated graphic function interface; and the first calling module is configured to pass The graphics function interface invokes a control structure that matches the above parameters from at least one of a plurality of preset GUI libraries; the rendering module is configured to draw the GUI using the invoked control structure.
进一步地,上述绘制单元包括:第二调用模块,设置为通过封装好的系统函数接口从多种预先设定的运行环境中调用绘制当前的上述GUI所需要的运行环境,其中,上述运行环境包括以下至少之一:操作系统和硬件资源。Further, the drawing unit includes: a second calling module, configured to invoke, by using a packaged system function interface, an operating environment required to draw the current GUI from a plurality of preset operating environments, where the operating environment includes At least one of the following: operating system and hardware resources.
在本发明实施例中,还提供了一种计算机存储介质,该计算机存储介质可以存储有执行指令,该执行指令用于执行上述实施例中的GUI的绘制方法的实现。In the embodiment of the present invention, a computer storage medium is further provided, and the computer storage medium may store an execution instruction for performing the implementation of the drawing method of the GUI in the foregoing embodiment.
通过本发明实施例,采用在编译用于绘制GUI的编译程序之前,通过对用于绘制GUI的标记语言文件进行解析,获取用于绘制GUI的参数;将获取的参数编译到编译程序中;通过运行编译了参数的编译程序,绘制GU,解决了相关技术中需要在编译过程中解析用于绘制 GUI的参数而导致程序执行效率低的问题,进而达到了提高用于绘制GUI的程序的执行效率的效果。According to the embodiment of the present invention, before compiling the compiler for drawing the GUI, the parameters for drawing the GUI are obtained by parsing the markup language file for drawing the GUI; and the obtained parameters are compiled into the compiler; Run the compiler that compiles the parameters, draw the GU, and solve the related technology that needs to be parsed for drawing during the compilation process. The parameter of the GUI causes a problem that the program execution efficiency is low, thereby achieving an effect of improving the execution efficiency of the program for drawing the GUI.
附图说明DRAWINGS
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:The drawings described herein are intended to provide a further understanding of the invention, and are intended to be a part of the invention. In the drawing:
图1是根据本发明实施例的图形用户界面GUI的绘制方法的流程图;1 is a flow chart of a method of drawing a graphical user interface GUI according to an embodiment of the present invention;
图2是根据本发明实施例的GUI在整个系统中的位置的示意图;2 is a schematic diagram of a location of a GUI in an entire system according to an embodiment of the present invention;
图3是根据本发明实施例的脚本解析层解析XML文档的流程图;3 is a flowchart of a script parsing layer parsing an XML document according to an embodiment of the present invention;
图4是根据本发明可选实施例的图形用户界面GUI的绘制方法的流程图;以及4 is a flow chart of a method of drawing a graphical user interface GUI in accordance with an alternative embodiment of the present invention;
图5是根据本发明实施例的图形用户界面GUI的绘制装置的示意图。FIG. 5 is a schematic diagram of a drawing device of a graphical user interface GUI according to an embodiment of the present invention.
具体实施方式detailed description
下文中将参考附图并结合实施例来详细说明本发明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。The invention will be described in detail below with reference to the drawings in conjunction with the embodiments. It should be noted that the embodiments in the present application and the features in the embodiments may be combined with each other without conflict.
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。It is to be understood that the terms "first", "second" and the like in the specification and claims of the present invention are used to distinguish similar objects, and are not necessarily used to describe a particular order or order.
在本实施例中提供了一种图形用户界面GUI的绘制方法,图1是根据本发明实施例的图形用户界面GUI的绘制方法的流程图,如图1所示,该流程包括如下步骤:In this embodiment, a method for drawing a GUI of a graphical user interface is provided. FIG. 1 is a flowchart of a method for drawing a GUI of a graphical user interface according to an embodiment of the present invention. As shown in FIG. 1 , the process includes the following steps:
步骤S102,在编译用于绘制GUI的编译程序之前,通过对用于绘制GUI的标记语言文件进行解析,获取用于绘制GUI的参数;Step S102, before compiling the compiler for drawing the GUI, obtaining parameters for drawing the GUI by parsing the markup language file for drawing the GUI;
步骤S104,将获取的参数编译到编译程序中;Step S104, compiling the obtained parameters into the compiler;
步骤S106,通过运行编译了参数的编译程序,绘制GUI。In step S106, the GUI is drawn by running a compiler that compiles the parameters.
为了实现GUI定义与具体程序设计语言和开发平台的无关性,所有的GUI参数与资源都是通过标记语言描述方法来定义的。因此,在绘制GUI时,需要对用于绘制GUI的标记语言文件进行解析,将其解析为汇编语言或二进制语言文件。In order to achieve the independence of the GUI definition from the specific programming language and development platform, all GUI parameters and resources are defined by the markup language description method. Therefore, when drawing the GUI, the markup language file used to draw the GUI needs to be parsed and parsed into an assembly language or a binary language file.
在本发明实施例中,用于绘制GUI的GUI系统架构主要包括:脚本解析层、图形层和系统封装接口层三个部分。实施时,脚本解析层可以在编译用于绘制GUI的编译程序之前,对用于绘制GUI的标记语言文件进行解析,以获取用于绘制GUI的参数,并将解析得到的参数编译到程序中。这样,在程序执行过程中,可以提取相应的参数来绘制图形界面。In the embodiment of the present invention, the GUI system architecture for drawing a GUI mainly includes: a script parsing layer, a graphics layer, and a system encapsulation interface layer. In implementation, the script parsing layer may parse the markup language file used to draw the GUI before compiling the compiler for drawing the GUI to obtain parameters for drawing the GUI, and compile the parsed parameters into the program. In this way, during the execution of the program, the corresponding parameters can be extracted to draw the graphical interface.
由于现有技术方案是在程序执行过程中对标记语言文件进行解析以获取用于绘制GUI的 参数的,导致程序的执行效率较低。而本发明提供的技术方案则是在程序编译之前对标记语言文件进行解析以获取用于绘制GUI的参数的,这样,在绘制过程中可以直接提取编译在程序中的参数,大幅度提高了程序的执行效率。Since the prior art solution is to parse the markup language file during program execution to obtain a GUI for drawing The parameter causes the execution of the program to be inefficient. The technical solution provided by the present invention is to parse the markup language file to obtain the parameters for drawing the GUI before the program is compiled, so that the parameters compiled in the program can be directly extracted during the drawing process, and the program is greatly improved. Execution efficiency.
通过上述步骤,解决了相关技术中需要在编译过程中解析用于绘制GUI的参数而导致程序执行效率低的问题,进而达到了提高用于绘制GUI的程序的执行效率的效果。Through the above steps, the problem that the parameters for drawing the GUI need to be parsed in the compiling process and the program execution efficiency is low is solved, and the effect of improving the execution efficiency of the program for drawing the GUI is achieved.
可选地,通过对用于绘制GUI的标记语言文件进行解析,获取用于绘制GUI的参数包括:Optionally, by parsing the markup language file used to draw the GUI, obtaining parameters for drawing the GUI includes:
S2,对用于绘制GUI的所有标记语言文件按照界面层次进行分级解析,得到二进制解析结果;S2, hierarchically parsing all the markup language files used for drawing the GUI according to the interface hierarchy, and obtaining a binary analysis result;
S4,按照解析顺序缓存二进制解析结果;S4, buffering the binary parsing result according to the parsing order;
S6,从二进制解析结果中提取用于绘制GUI的参数。S6, extracting parameters for drawing the GUI from the binary analysis result.
一方面,将标记语言描述的参数解析为二进制语言描述的参数,在编译时,可以直接将机器可识别的二进制参数编译到编译程序中;另一方面,按照界面层次对所有标记语言文件进行解析,可以简化解析逻辑,提高解析效率,同时可以防止由于漏解析或重复解析而无法绘制出正确的GUI。On the one hand, the parameters described by the markup language are parsed into parameters described by the binary language. At compile time, the machine-recognizable binary parameters can be directly compiled into the compiler; on the other hand, all markup language files are parsed according to the interface hierarchy. It can simplify the parsing logic, improve the parsing efficiency, and prevent the correct GUI from being drawn due to leak parsing or repeated parsing.
可选地,在按照解析顺序缓存二进制解析结果之后,上述方法还包括:Optionally, after the binary parsing result is cached in the parsing order, the method further includes:
S8,将二进制解析结果按照预先设定的排序规则重新排序,其中,在将二进制解析结果按照预先设定的排序规则重新排序之后,通过匹配预先设定的排序规则,从重新排序的二进制解析结果中提取用于绘制GUI的结构化数据。S8, the binary parsing result is reordered according to a preset sorting rule, wherein after the binary parsing result is reordered according to a preset sorting rule, the binary parsing result from the reordering is matched by matching a preset collating rule. Extract the structured data used to draw the GUI.
也即,脚本解析层在用于绘制GUI的编译程序之前,对描述GUI的所有标记语言文件按照界面层次进行分级解析,将解析后的数据按照预先设定的排序规则(如特定的数据排列协议)进行重新排列后得到一个二进制文件,并缓存之。在加载用于绘制GUI的程序的过程中,通过匹配前述的预先设定的排序规则,从二进制文件中提取出结构化数据,分别填充到一些预先设定的数据结构中。这样,在程序在执行过程中,如果需要绘制特定的图形界面,则只需要从数据结构中检索相应的GUI所对应的参数即可,从而提高了参数的加载速度以及程序的编译效率。That is, before the compiler for drawing the GUI, the script parsing layer hierarchically parses all the markup language files describing the GUI according to the interface hierarchy, and the parsed data according to a preset sorting rule (such as a specific data arrangement protocol). ) After rearranging, get a binary file and cache it. In the process of loading the program for drawing the GUI, the structured data is extracted from the binary file by matching the aforementioned preset collation rules, and are respectively filled into some preset data structures. In this way, if a specific graphical interface needs to be drawn during the execution of the program, only the parameters corresponding to the corresponding GUI need to be retrieved from the data structure, thereby improving the loading speed of the parameters and the compilation efficiency of the program.
可选地,通过运行编译了参数的编译程序,绘制GUI包括:Optionally, by running a compiler that has compiled parameters, drawing the GUI includes:
S10,在编译程序运行过程中,检索参数;S10, retrieving parameters during the running of the compiler;
S12,将参数传递给封装好的图形函数接口;S12, passing parameters to the encapsulated graphics function interface;
S14,通过图形函数接口从多个预先设定的GUI库中的至少之一中调用与参数相匹配的控件结构;S14. Call, by using a graphics function interface, a control structure that matches a parameter from at least one of a plurality of preset GUI libraries;
S16,使用调用的控件结构绘制GUI。 S16, drawing the GUI using the called control structure.
也即,在编译程序运行过程中,可以检索编译在编译程序中的各个参数,并将检索到的参数传递给在图形层预先封装好的图形函数接口,通过这个图形函数接口可以从多个预先设定的GUI库中的至少之一中调用与参数相匹配的控件结构,进而直接使用调用的控件结构绘制GUI。That is, during the running of the compiler, various parameters compiled in the compiler can be retrieved, and the retrieved parameters are passed to a graphical function interface pre-packaged in the graphics layer, through which the graphical function interface can be derived from multiple At least one of the set GUI libraries calls a control structure that matches the parameters, and then directly draws the GUI using the invoked control structure.
其中,在图形层预先封装好的图形函数接口是对组成GUI的各种控件的封装。这些控件可以分为3大类,分别为Control、GDI、Image decoding。Control是构成GUI的基本控件,常用的主要有Button、Label、Combobox、List、Textbox、Timer等;GDI是实现多窗口系统的一项关键技术,即剪切域技术,通过剪切域可以在嵌入式平台上显示复杂的窗口,保证一个窗口的绘制不会影响到其它窗口的绘制;Image decoding是对不同类型图片的解码,支持的图片类型有BMP、GIF、JEPG和PNG。Among them, the pre-packaged graphics function interface in the graphics layer is a package for various controls that make up the GUI. These controls can be divided into three categories, namely Control, GDI, and Image decoding. Control is the basic control that constitutes the GUI. Commonly used are Button, Label, Combobox, List, Textbox, Timer, etc.; GDI is a key technology to realize multi-window system, namely the cut domain technology, which can be embedded by cutting the domain. The complex platform is displayed on the platform to ensure that the drawing of one window does not affect the drawing of other windows. Image decoding is the decoding of different types of images. The supported image types are BMP, GIF, JEPG and PNG.
由于相关技术所提供的技术方案并未封装图形函数接口,导致GUI系统架构只能支持单一类型的GUI库;而本发明设计的GUI系统架构可以在程序执行过程中,从特定的数据结构中检索到界面参数,并传递给封装好的函数接口,以适配多种GUI库,从而完成相应的GUI绘制任务,提高了系统的灵活性,同时结构清晰,占用资源更少,性能更高效,更易于维护。Since the technical solution provided by the related art does not encapsulate the graphic function interface, the GUI system architecture can only support a single type of GUI library; and the GUI system architecture designed by the present invention can be retrieved from a specific data structure during program execution. Go to the interface parameters and pass them to the packaged function interface to adapt to various GUI libraries, thus completing the corresponding GUI drawing tasks, improving the flexibility of the system, while the structure is clear, the resources are less, the performance is more efficient, and Easy to maintain.
在本发明实施例中,GUI系统架构中的图形层可以适配现有的GUI库,也可以封装芯片厂家提供的软件接口。简单的绘图操作可以直接调用芯片厂家提供的软件接口,较为复杂的控件绘制操作可以通过封装好的各芯片厂家所提供的软件接口实现。In the embodiment of the present invention, the graphics layer in the GUI system architecture may be adapted to an existing GUI library, or may be a software interface provided by a chip manufacturer. A simple drawing operation can directly call the software interface provided by the chip manufacturer. The more complicated control drawing operation can be realized by the software interface provided by the packaged chip manufacturers.
可选地,通过运行编译了参数的编译程序,绘制GUI包括:Optionally, by running a compiler that has compiled parameters, drawing the GUI includes:
S18,通过封装好的系统函数接口从多种预先设定的运行环境中调用绘制当前的GUI所需要的运行环境,其中,运行环境包括以下至少之一:操作系统和硬件资源。S18, the operating environment required for drawing the current GUI is invoked from a plurality of preset operating environments through the encapsulated system function interface, where the operating environment includes at least one of the following: an operating system and hardware resources.
系统函数接口是在系统封装接口层对操作系统和硬件平台的封装。GUI系统架构用到的所有系统资源,都是通过调用系统封装接口层的系统函数接口得到的。系统封装接口层的系统函数接口包括操作系统相关接口,如内存管理、进程调度、定时器管理、信号量、文件系统等,以及平台显示、驱动等相关接口,如fill、blit、surface等。另外,系统封装接口层位于操作系统和应用层之间,用来隔离下层使用的不同的操作系统。The system function interface is the encapsulation of the operating system and hardware platform at the system package interface layer. All system resources used in the GUI system architecture are obtained by calling the system function interface of the system package interface layer. The system function interface of the system package interface layer includes operating system related interfaces, such as memory management, process scheduling, timer management, semaphores, file systems, etc., as well as platform display, driver and other related interfaces, such as fill, blit, surface, and so on. In addition, the system package interface layer is located between the operating system and the application layer to isolate the different operating systems used by the lower layers.
实施时,在GUI绘制过程中,调用系统封装接口层的系统函数接口,完成操作系统或平台驱动等相关接口的调用,如内存的申请与释放、信号量的创建与释放、线程的创建与释放等。通过系统封装接口层的系统函数接口为GUI适配特定的操作系统和硬件平台,最终实现GUI的绘制与显示。In the implementation process, in the GUI drawing process, the system function interface of the system package interface layer is called to complete the call of the relevant interface such as the operating system or the platform driver, such as the application and release of the memory, the creation and release of the semaphore, and the creation and release of the thread. Wait. Through the system function interface of the system package interface layer, the GUI is adapted to a specific operating system and hardware platform, and finally the GUI is drawn and displayed.
本发明通过设计一种轻量级的嵌入式GUI系统架构,可以实现在GUI绘制过程适配多种图形库、多种操作系统和多种硬件平台的目的,以及达到绘制GUI时,更简单、更灵活、结构更清晰、占用资源更小且反应速度更快,更易于维护的效果。By designing a lightweight embedded GUI system architecture, the invention can realize the purpose of adapting a plurality of graphics libraries, multiple operating systems and multiple hardware platforms in the GUI drawing process, and is simpler when the GUI is drawn. More flexible, clearer structure, smaller resources, faster response, and easier maintenance.
图2是根据本发明实施例的GUI在整个系统中的位置的示意图,如图2所示,GUI系统架构作为图形库系统,为上层APP的GUI提供服务接口(即图形层封装的图形函数接口), 为下层的操作系统和硬件平台提供系统封装接口层封装的相应接口。2 is a schematic diagram of a location of a GUI in an entire system according to an embodiment of the present invention. As shown in FIG. 2, a GUI system architecture serves as a graphics library system, and provides a service interface for a GUI of an upper layer APP (ie, a graphics function interface of a graphics layer package). ), Provide the corresponding interface for the system package interface layer package for the lower layer operating system and hardware platform.
图3是根据本发明实施例的脚本解析层解析XML文档的流程图,如图3所示,在程序编译之前,对所有的XML文档(如XML1、XML2、……XMLn)按照XML解析规则进行解析并缓存,为了便于将解析参数编译到编译程序中,可以将解析后的数据按照预先设定的排序规则进行重新排列,得到view.bin文件。在加载GUI绘制程序过程中,通过匹配前述的预先设定的排序规则,从view.bin文件中提取出结构化数据,分别填充到预先设定的数据结构中:string数组、color数组、image数组、form链表。3 is a flow chart of parsing an XML document by a script parsing layer according to an embodiment of the present invention. As shown in FIG. 3, all XML documents (such as XML1, XML2, ... XMLn) are subjected to XML parsing rules before the program is compiled. Parsing and caching, in order to facilitate compiling the parsing parameters into the compiler, the parsed data can be rearranged according to a preset collation to obtain a view.bin file. In the process of loading the GUI drawing program, the structured data is extracted from the view.bin file by matching the aforementioned preset collation rules, and filled into the preset data structure: string array, color array, image array , form linked list.
图4是根据本发明可选实施例的图形用户界面GUI的绘制方法的流程图,如图4所示,显示APP中的GUI,需要依赖GUI系统架构。APP通过string、color、image、form四个数据结构的下标中索引到需要绘制的GUI的相应控件参数,然后将控件参数传递给GUI系统架构,在架构内部实现GUI的绘制,并且通过APP预先设置好的回调将事件信息通知给APP,最终完成GUI的绘制。4 is a flowchart of a method for drawing a GUI of a graphical user interface according to an alternative embodiment of the present invention. As shown in FIG. 4, displaying a GUI in an APP requires relying on a GUI system architecture. The APP indexes the corresponding control parameters of the GUI to be drawn through the subscripts of the four data structures of string, color, image, and form, and then passes the control parameters to the GUI system architecture, implements the GUI drawing within the architecture, and advances through the APP. The set callback notifies the APP of the event information, and finally completes the drawing of the GUI.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本发明各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases, the former is A better implementation. Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk, The optical disc includes a number of instructions for causing a terminal device (which may be a cell phone, a computer, a server, or a network device, etc.) to perform the methods described in various embodiments of the present invention.
在本实施例中还提供了一种图形用户界面GUI的绘制装置,该装置用于实现上述实施例及优选实施方式,已经进行过说明的不再赘述。如以下所使用的术语“模块”可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。In this embodiment, a drawing device of a GUI is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and has not been described again. The term "module" as used below may implement a combination of software and/or hardware of a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and contemplated.
图5是根据本发明实施例的图形用户界面GUI的绘制装置的示意图,如图5所示,该装置包括:获取单元502、编译单元504和绘制单元506。获取单元502,设置为在编译用于绘制GUI的编译程序之前,通过对用于绘制GUI的标记语言文件进行解析,获取用于绘制GUI的参数;编译单元504,设置为将获取的参数编译到编译程序中;绘制单元506,设置为通过运行编译了参数的编译程序,绘制GUI。FIG. 5 is a schematic diagram of a drawing device of a graphical user interface GUI according to an embodiment of the present invention. As shown in FIG. 5, the device includes: an obtaining unit 502, a compiling unit 504, and a drawing unit 506. The obtaining unit 502 is configured to obtain parameters for drawing the GUI by parsing the markup language file for drawing the GUI before compiling the compiler for drawing the GUI; the compiling unit 504 is configured to compile the acquired parameters to In the compiler, the drawing unit 506 is set to draw the GUI by running a compiler that compiles the parameters.
为了实现GUI定义与具体程序设计语言和开发平台的无关性,所有的GUI参数与资源都是通过标记语言描述方法来定义的。因此,在绘制GUI时,需要对用于绘制GUI的标记语言文件进行解析,将其解析为汇编语言或二进制语言。In order to achieve the independence of the GUI definition from the specific programming language and development platform, all GUI parameters and resources are defined by the markup language description method. Therefore, when drawing the GUI, the markup language file used to draw the GUI needs to be parsed and parsed into assembly language or binary language.
在本发明实施例中,用于绘制GUI的GUI系统架构主要包括:脚本解析层、图形层和系统封装接口层三个部分。实施时,脚本解析层可以在编译用于绘制GUI的编译程序之前,对用于绘制GUI的标记语言文件进行解析,以获取用于绘制GUI的参数,并将解析得到的参数编译到程序中。这样,在程序执行过程中,可以提取相应的参数来绘制图形界面。 In the embodiment of the present invention, the GUI system architecture for drawing a GUI mainly includes: a script parsing layer, a graphics layer, and a system encapsulation interface layer. In implementation, the script parsing layer may parse the markup language file used to draw the GUI before compiling the compiler for drawing the GUI to obtain parameters for drawing the GUI, and compile the parsed parameters into the program. In this way, during the execution of the program, the corresponding parameters can be extracted to draw the graphical interface.
由于现有技术方案是在程序执行过程中对标记语言文件进行解析,以获取用于绘制GUI的参数的,导致程序的执行效率较低。而本发明提供的技术方案则是在程序编译之前对标记语言文件进行解析以获取用于绘制GUI的参数的,这样,在绘制过程中可以直接提取编译在程序中的参数,大幅度提高了程序的执行效率。Since the prior art solution is to parse the markup language file during program execution to obtain parameters for drawing the GUI, the execution efficiency of the program is low. The technical solution provided by the present invention is to parse the markup language file to obtain the parameters for drawing the GUI before the program is compiled, so that the parameters compiled in the program can be directly extracted during the drawing process, and the program is greatly improved. Execution efficiency.
通过上述步骤,解决了相关技术中需要在编译过程中解析用于绘制GUI的参数而导致程序执行效率低的问题,进而达到了提高用于绘制GUI的程序的执行效率的效果。Through the above steps, the problem that the parameters for drawing the GUI need to be parsed in the compiling process and the program execution efficiency is low is solved, and the effect of improving the execution efficiency of the program for drawing the GUI is achieved.
可选地,获取单元包括:解析模块,设置为对用于绘制GUI的所有标记语言文件按照界面层次进行分级解析,得到二进制解析结果;缓存模块,设置为按照解析顺序缓存二进制解析结果;提取模块,设置为从二进制解析结果中提取用于绘制GUI的参数。Optionally, the obtaining unit includes: a parsing module configured to hierarchically parse all the markup language files for drawing the GUI according to the interface hierarchy to obtain a binary parsing result; the caching module is configured to cache the binary parsing result according to the parsing order; and the extracting module , set to extract the parameters used to draw the GUI from the binary parsing results.
一方面,将标记语言描述的参数解析为二进制语言描述的参数,在编译时,可以直接将机器可识别的二进制参数编译到编译程序中;另一方面,按照界面层次对所有标记语言文件进行解析,可以简化解析逻辑,提高解析效率,同时防止由于漏解析或重复解析而导致绘制出正确的GUI。On the one hand, the parameters described by the markup language are parsed into parameters described by the binary language. At compile time, the machine-recognizable binary parameters can be directly compiled into the compiler; on the other hand, all markup language files are parsed according to the interface hierarchy. It can simplify the parsing logic, improve the parsing efficiency, and prevent the correct GUI from being drawn due to missing parsing or repeated parsing.
可选地,装置还包括:排序单元,设置为在按照解析顺序缓存二进制解析结果之后,将二进制解析结果按照预先设定的排序规则重新排序,其中,提取模块还设置为在将二进制解析结果按照预先设定的排序规则重新排序之后,通过匹配预先设定的排序规则,从重新排序的二进制解析结果中提取用于绘制GUI的结构化数据。Optionally, the apparatus further includes: a sorting unit configured to: after buffering the binary parsing result according to the parsing order, reorder the binary parsing result according to a preset collation, wherein the extracting module is further configured to follow the binary parsing result according to After the pre-set collation is reordered, the structured data for drawing the GUI is extracted from the reordered binary parsing result by matching the pre-set collation.
也即,脚本解析层在用于绘制GUI的编译程序之前,对描述GUI的所有标记语言文件按照界面层次进行分级解析,将解析后的数据按照预先设定的排序规则(如特定的数据排列协议)进行重新排列后得到一个二进制文件,并缓存之。在加载用于绘制GUI的程序的过程中,通过匹配前述的预先设定的排序规则,从二进制文件中提取出结构化数据,分别填充到一些预先设定的数据结构中。这样,在程序在执行过程中,如果需要绘制特定的图形界面,则只需要从数据结构中检索相应的GUI所对应的参数即可,从而提高了参数的加载速度以及程序的编译效率。That is, before the compiler for drawing the GUI, the script parsing layer hierarchically parses all the markup language files describing the GUI according to the interface hierarchy, and the parsed data according to a preset sorting rule (such as a specific data arrangement protocol). ) After rearranging, get a binary file and cache it. In the process of loading the program for drawing the GUI, the structured data is extracted from the binary file by matching the aforementioned preset collation rules, and are respectively filled into some preset data structures. In this way, if a specific graphical interface needs to be drawn during the execution of the program, only the parameters corresponding to the corresponding GUI need to be retrieved from the data structure, thereby improving the loading speed of the parameters and the compilation efficiency of the program.
可选地,绘制单元包括:检索模块,设置为在编译程序运行过程中,检索参数;传递模块,设置为将参数传递给封装好的图形函数接口;第一调用模块,设置为通过图形函数接口从多个预先设定的GUI库中的至少之一中调用与参数相匹配的控件结构;绘制模块,设置为使用调用的控件结构绘制GUI。Optionally, the drawing unit comprises: a retrieval module configured to retrieve parameters during the running of the compiler; a delivery module configured to pass the parameters to the encapsulated graphics function interface; the first calling module is set to pass the graphical function interface A control structure that matches the parameter is called from at least one of the plurality of preset GUI libraries; the drawing module is set to draw the GUI using the invoked control structure.
也即,在编译程序运行过程中,可以检索编译在编译程序中的各个参数,并将检索到的参数传递给在图形层预先封装好的图形函数接口,通过这个图形函数接口可以从多个预先设定的GUI库中的至少之一中调用与参数相匹配的控件结构,进而直接使用调用的控件结构绘制GUI。That is, during the running of the compiler, various parameters compiled in the compiler can be retrieved, and the retrieved parameters are passed to a graphical function interface pre-packaged in the graphics layer, through which the graphical function interface can be derived from multiple At least one of the set GUI libraries calls a control structure that matches the parameters, and then directly draws the GUI using the invoked control structure.
其中,在图形层预先封装好的图形函数接口是对组成GUI的各种控件的封装。这些控件可以分为3大类,分别为Control、GDI、Image decoding。Control是构成GUI的基本控件, 常用的主要有Button、Label、Combobox、List、Textbox、Timer等;GDI是实现多窗口系统的一项关键技术,即剪切域技术,通过剪切域可以在嵌入式平台上显示复杂的窗口,保证一个窗口的绘制不会影响到其它窗口的绘制;Image decoding是对不同类型图片的解码,支持的图片类型有BMP、GIF、JEPG和PNG。Among them, the pre-packaged graphics function interface in the graphics layer is a package for various controls that make up the GUI. These controls can be divided into three categories, namely Control, GDI, and Image decoding. Control is the basic control that constitutes the GUI. Commonly used are Button, Label, Combobox, List, Textbox, Timer, etc.; GDI is a key technology to realize multi-window system, namely the shear domain technology, which can display complex windows on the embedded platform through the cut domain. Ensure that the drawing of one window does not affect the drawing of other windows; Image decoding is the decoding of different types of pictures. The supported picture types are BMP, GIF, JEPG and PNG.
由于相关技术所提供的技术方案并未封装图形函数接口,导致GUI系统架构只能支持单一类型的GUI库;而本发明设计的GUI系统架构可以在程序执行过程中,从特定的数据结构中检索到界面参数,并传递给封装好的函数接口,以适配多种GUI库,从而完成相应的GUI绘制任务,提高了系统的灵活性,同时结构清晰,占用资源更少,性能更高效,更易于维护。Since the technical solution provided by the related art does not encapsulate the graphic function interface, the GUI system architecture can only support a single type of GUI library; and the GUI system architecture designed by the present invention can be retrieved from a specific data structure during program execution. Go to the interface parameters and pass them to the packaged function interface to adapt to various GUI libraries, thus completing the corresponding GUI drawing tasks, improving the flexibility of the system, while the structure is clear, the resources are less, the performance is more efficient, and Easy to maintain.
在本发明实施例中,GUI系统架构中的图形层可以适配现有的GUI库,也可以封装芯片厂家提供的软件接口。简单的绘图操作可以直接调用芯片厂家提供的软件接口,较为复杂的控件绘制操作可以通过封装好的各芯片厂家所提供的软件接口实现。In the embodiment of the present invention, the graphics layer in the GUI system architecture may be adapted to an existing GUI library, or may be a software interface provided by a chip manufacturer. A simple drawing operation can directly call the software interface provided by the chip manufacturer. The more complicated control drawing operation can be realized by the software interface provided by the packaged chip manufacturers.
可选地,绘制单元包括:第二调用模块,设置为通过封装好的系统函数接口从多种预先设定的运行环境中调用绘制当前的GUI所需要的运行环境,其中,运行环境包括以下至少之一:操作系统和硬件资源。Optionally, the drawing unit includes: a second calling module, configured to invoke, by using the encapsulated system function interface, an operating environment required to draw the current GUI from a plurality of preset operating environments, where the operating environment includes at least the following One: operating system and hardware resources.
系统函数接口是在系统封装接口层对操作系统和硬件平台的封装。GUI系统架构用到的所有系统资源,都是通过调用系统封装接口层的系统函数接口得到的。系统封装接口层的系统函数接口包括操作系统相关接口,如内存管理、进程调度、定时器管理、信号量、文件系统等,以及平台显示、驱动等相关接口,如fill、blit、surface等。另外,系统封装接口层位于操作系统和应用层之间,用来隔离下层使用的不同的操作系统。The system function interface is the encapsulation of the operating system and hardware platform at the system package interface layer. All system resources used in the GUI system architecture are obtained by calling the system function interface of the system package interface layer. The system function interface of the system package interface layer includes operating system related interfaces, such as memory management, process scheduling, timer management, semaphores, file systems, etc., as well as platform display, driver and other related interfaces, such as fill, blit, surface, and so on. In addition, the system package interface layer is located between the operating system and the application layer to isolate the different operating systems used by the lower layers.
实施时,在GUI绘制过程中,调用系统封装接口层的系统函数接口,完成操作系统或平台驱动等相关接口的调用,如内存的申请与释放、信号量的创建与释放、线程的创建与释放等。通过系统封装接口层的系统函数接口为GUI适配特定的操作系统和硬件平台,最终实现GUI的绘制与显示。In the implementation process, in the GUI drawing process, the system function interface of the system package interface layer is called to complete the call of the relevant interface such as the operating system or the platform driver, such as the application and release of the memory, the creation and release of the semaphore, and the creation and release of the thread. Wait. Through the system function interface of the system package interface layer, the GUI is adapted to a specific operating system and hardware platform, and finally the GUI is drawn and displayed.
本发明通过设计一种轻量级的嵌入式GUI系统架构,可以实现在GUI绘制过程适配多种图形库、多种操作系统和多种硬件平台的目的,以及达到绘制GUI时,更简单、更灵活、结构更清晰、占用资源更小且反应速度更快,更易于维护的效果。By designing a lightweight embedded GUI system architecture, the invention can realize the purpose of adapting a plurality of graphics libraries, multiple operating systems and multiple hardware platforms in the GUI drawing process, and is simpler when the GUI is drawn. More flexible, clearer structure, smaller resources, faster response, and easier maintenance.
需要说明的是,上述各个模块是可以通过软件或硬件来实现的,对于后者,可以通过以下方式实现,但不限于此:上述模块均位于同一处理器中;或者,上述模块分别位于多个处理器中。It should be noted that each of the above modules may be implemented by software or hardware. For the latter, the foregoing may be implemented by, but not limited to, the foregoing modules are all located in the same processor; or, the modules are located in multiple In the processor.
本发明的实施例还提供了一种存储介质。可选地,在本实施例中,上述存储介质可以被设置为存储用于执行以下步骤的程序代码:Embodiments of the present invention also provide a storage medium. Optionally, in the embodiment, the foregoing storage medium may be configured to store program code for performing the following steps:
S20,在编译用于绘制GUI的编译程序之前,通过对用于绘制GUI的标记语言文件进行解析,获取用于绘制GUI的参数; S20. Before compiling the compiler for drawing the GUI, obtain a parameter for drawing the GUI by parsing the markup language file for drawing the GUI;
S22,将获取的参数编译到编译程序中;S22, compiling the obtained parameters into the compiler;
S24,通过运行编译了参数的编译程序,绘制GUI。S24, drawing a GUI by running a compiler that compiles parameters.
可选地,存储介质还被设置为存储用于执行上述实施例中各优选实施方式中的其他步骤的程序代码,在此不再赘述。Optionally, the storage medium is further configured to store program code for performing other steps in the preferred embodiments of the above-described embodiments, and details are not described herein again.
可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。Optionally, in this embodiment, the foregoing storage medium may include, but not limited to, a USB flash drive, a Read-Only Memory (ROM), a Random Access Memory (RAM), a mobile hard disk, and a magnetic memory. A variety of media that can store program code, such as a disc or a disc.
可选地,在本实施例中,处理器根据存储介质中已存储的程序代码执行:Optionally, in this embodiment, the processor executes according to the stored program code in the storage medium:
S26,在编译用于绘制GUI的编译程序之前,通过对用于绘制GUI的标记语言文件进行解析,获取用于绘制GUI的参数;S26. Before compiling the compiler for drawing the GUI, obtain a parameter for drawing the GUI by parsing the markup language file for drawing the GUI;
S28,将获取的参数编译到编译程序中;S28, compiling the obtained parameters into the compiler;
S30,通过运行编译了参数的编译程序,绘制GUI。S30, drawing a GUI by running a compiler that compiles parameters.
可选地,在本实施例中,处理器根据存储介质中已存储的程序代码执行上述实施例中各优选实施方式中的其他步骤的程序代码,在此不再赘述。Optionally, in this embodiment, the processor executes the program code of the other steps in the foregoing preferred embodiments in the foregoing embodiments according to the stored program code in the storage medium, and details are not described herein again.
可选地,本实施例中的具体示例可以参考上述实施例及可选实施方式中所描述的示例,本实施例在此不再赘述。For example, the specific examples in this embodiment may refer to the examples described in the foregoing embodiments and the optional embodiments, and details are not described herein again.
显然,本领域的技术人员应该明白,上述的本发明的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件和软件结合。It will be apparent to those skilled in the art that the various modules or steps of the present invention described above can be implemented by a general-purpose computing device that can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein. The steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps thereof are fabricated as a single integrated circuit module. Thus, the invention is not limited to any specific combination of hardware and software.
以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above description is only the preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes can be made to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and scope of the present invention are intended to be included within the scope of the present invention.
工业实用性Industrial applicability
本发明实施例提供的上述技术方案,可以应用于GUI的绘制过程中,采用在编译用于绘制GUI的编译程序之前,通过对用于绘制GUI的标记语言文件进行解析,获取用于绘制GUI的参数;将获取的参数编译到编译程序中;通过运行编译了参数的编译程序,绘制GU,解决了相关技术中需要在编译过程中解析用于绘制GUI的参数而导致程序执行效率低的问题,进而达到了提高用于绘制GUI的程序的执行效率的效果。 The above technical solution provided by the embodiment of the present invention can be applied to the drawing process of the GUI, and before the compiler for drawing the GUI is compiled, the markup language file for drawing the GUI is parsed to obtain the GUI for drawing the GUI. The parameter is compiled into the compiler; the compiler is compiled by running the compiled parameter, and the GU is solved, which solves the problem that the related technology needs to parse the parameters used to draw the GUI during the compilation process, resulting in low program execution efficiency. Further, the effect of improving the execution efficiency of the program for drawing the GUI is achieved.

Claims (10)

  1. 一种图形用户界面GUI的绘制方法,包括:A method for drawing a GUI of a graphical user interface, comprising:
    在编译用于绘制所述GUI的编译程序之前,通过对用于绘制所述GUI的标记语言文件进行解析,获取用于绘制所述GUI的参数;Obtaining parameters for drawing the GUI by parsing a markup language file for drawing the GUI before compiling a compiler for drawing the GUI;
    将获取的所述参数编译到所述编译程序中;Compiling the obtained parameters into the compiler;
    通过运行编译了所述参数的所述编译程序,绘制所述GUI。The GUI is drawn by running the compiler that compiled the parameters.
  2. 根据权利要求1所述的方法,其中,通过对用于绘制所述GUI的标记语言文件进行解析,获取用于绘制所述GUI的参数包括:The method of claim 1, wherein the obtaining parameters for drawing the GUI by parsing a markup language file for drawing the GUI comprises:
    对用于绘制所述GUI的所有标记语言文件按照界面层次进行分级解析,得到二进制解析结果;All the markup language files used to draw the GUI are hierarchically parsed according to the interface hierarchy, and a binary analysis result is obtained;
    按照解析顺序缓存所述二进制解析结果;Caching the binary parsing result in parsing order;
    从所述二进制解析结果中提取用于绘制所述GUI的参数。Parameters for drawing the GUI are extracted from the binary analysis result.
  3. 根据权利要求2所述的方法,其中,在按照解析顺序缓存所述二进制解析结果之后,所述方法还包括:The method of claim 2, wherein after the binary parsing result is cached in an analytical order, the method further comprises:
    将所述二进制解析结果按照预先设定的排序规则重新排序,Reordering the binary parsing results according to a preset collation.
    其中,在将所述二进制解析结果按照所述预先设定的排序规则重新排序之后,通过匹配所述预先设定的排序规则,从重新排序的二进制解析结果中提取用于绘制所述GUI的结构化数据。After the re-sorting the binary parsing result according to the preset collation rule, extracting the structure for drawing the GUI from the reordered binary parsing result by matching the preset collation rule Data.
  4. 根据权利要求1所述的方法,其中,通过运行编译了所述参数的所述编译程序,绘制所述GUI包括:The method of claim 1 wherein drawing the GUI by running the compiler that compiled the parameters comprises:
    在所述编译程序运行过程中,检索所述参数;Retrieving the parameters during execution of the compiler;
    将所述参数传递给封装好的图形函数接口;Passing the parameters to the encapsulated graphics function interface;
    通过所述图形函数接口从多个预先设定的GUI库中的至少之一中调用与所述参数相匹配的控件结构;Calling, by the graphics function interface, a control structure that matches the parameter from at least one of a plurality of preset GUI libraries;
    使用调用的所述控件结构绘制所述GUI。The GUI is drawn using the called control structure.
  5. 根据权利要求1所述的方法,其中,通过运行编译了所述参数的所述编译程序,绘制所述GUI包括:The method of claim 1 wherein drawing the GUI by running the compiler that compiled the parameters comprises:
    通过封装好的系统函数接口从多种预先设定的运行环境中调用绘制当前的所述GUI所需要的运行环境,其中,所述运行环境包括以下至少之一:操作系统和硬件资源。 The operating environment required to draw the current GUI is invoked from a plurality of pre-set operating environments through a packaged system function interface, wherein the operating environment includes at least one of the following: an operating system and hardware resources.
  6. 一种图形用户界面GUI的绘制装置,包括:A drawing device for a GUI of a graphical user interface, comprising:
    获取单元,设置为在编译用于绘制所述GUI的编译程序之前,通过对用于绘制所述GUI的标记语言文件进行解析,获取用于绘制所述GUI的参数;An obtaining unit, configured to obtain a parameter for drawing the GUI by parsing a markup language file for drawing the GUI before compiling a compiler for drawing the GUI;
    编译单元,设置为将获取的所述参数编译到所述编译程序中;a compiling unit configured to compile the obtained parameters into the compiler;
    绘制单元,设置为通过运行编译了所述参数的所述编译程序,绘制所述GUI。A drawing unit is arranged to draw the GUI by running the compiler that compiled the parameters.
  7. 根据权利要求6所述的装置,其中,所述获取单元包括:The apparatus of claim 6, wherein the obtaining unit comprises:
    解析模块,设置为对用于绘制所述GUI的所有标记语言文件按照界面层次进行分级解析,得到二进制解析结果;The parsing module is configured to perform hierarchical analysis on all the markup language files used to draw the GUI according to the interface hierarchy, to obtain a binary parsing result;
    缓存模块,设置为按照解析顺序缓存所述二进制解析结果;a cache module, configured to cache the binary parsing result in a parsing order;
    提取模块,设置为从所述二进制解析结果中提取用于绘制所述GUI的参数。An extraction module is configured to extract parameters for rendering the GUI from the binary analysis results.
  8. 根据权利要求7所述的装置,其中,所述装置还包括:The apparatus of claim 7 wherein said apparatus further comprises:
    排序单元,设置为在按照解析顺序缓存所述二进制解析结果之后,将所述二进制解析结果按照预先设定的排序规则重新排序,a sorting unit, configured to reorder the binary parsing results according to a preset collation after buffering the binary parsing results in a parsing order,
    其中,所述提取模块还设置为在将所述二进制解析结果按照所述预先设定的排序规则重新排序之后,通过匹配所述预先设定的排序规则,从重新排序的二进制解析结果中提取用于绘制所述GUI的结构化数据。The extracting module is further configured to: after reordering the binary parsing result according to the preset sorting rule, extracting from the reordered binary parsing result by matching the preset collating rule The structured data of the GUI is drawn.
  9. 根据权利要求6所述的装置,其中,所述绘制单元包括:The apparatus of claim 6, wherein the drawing unit comprises:
    检索模块,设置为在所述编译程序运行过程中,检索所述参数;Retrieving a module, configured to retrieve the parameter during execution of the compiler;
    传递模块,设置为将所述参数传递给封装好的图形函数接口;a delivery module configured to pass the parameter to the encapsulated graphics function interface;
    第一调用模块,设置为通过所述图形函数接口从多个预先设定的GUI库中的至少之一中调用与所述参数相匹配的控件结构;a first calling module, configured to invoke, by the graphics function interface, a control structure that matches the parameter from at least one of a plurality of preset GUI libraries;
    绘制模块,设置为使用调用的所述控件结构绘制所述GUI。A drawing module is arranged to draw the GUI using the called control structure.
  10. 根据权利要求6所述的装置,其中,所述绘制单元包括:The apparatus of claim 6, wherein the drawing unit comprises:
    第二调用模块,设置为通过封装好的系统函数接口从多种预先设定的运行环境中调用绘制当前的所述GUI所需要的运行环境,其中,所述运行环境包括以下至少之一:操作系统和硬件资源。 a second calling module, configured to invoke, by using a packaged system function interface, a running environment required to draw the current GUI from a plurality of preset operating environments, wherein the operating environment includes at least one of the following: System and hardware resources.
PCT/CN2016/096264 2016-08-22 2016-08-22 Graphical user interface gui rendering method and apparatus WO2018035686A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2016/096264 WO2018035686A1 (en) 2016-08-22 2016-08-22 Graphical user interface gui rendering method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2016/096264 WO2018035686A1 (en) 2016-08-22 2016-08-22 Graphical user interface gui rendering method and apparatus

Publications (1)

Publication Number Publication Date
WO2018035686A1 true WO2018035686A1 (en) 2018-03-01

Family

ID=61245993

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/096264 WO2018035686A1 (en) 2016-08-22 2016-08-22 Graphical user interface gui rendering method and apparatus

Country Status (1)

Country Link
WO (1) WO2018035686A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111722845A (en) * 2020-06-04 2020-09-29 深圳中科优瑞医疗科技有限公司 Embedded GUI framework using STM32 single chip microcomputer as main control
CN112214255A (en) * 2020-09-29 2021-01-12 上海上讯信息技术股份有限公司 Method and equipment for calling executable program with parameters
WO2023136776A3 (en) * 2022-01-11 2023-08-24 Lemon Inc. Graphical user interface generator using markup language

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101202665A (en) * 2007-12-06 2008-06-18 中兴通讯股份有限公司 Method for generating graphical user interface
CN101963905A (en) * 2010-09-17 2011-02-02 中山大学 Method and system for applying extensive makeup language (XML) to development of graphical user interface (GUI) of set top box
CN104317587A (en) * 2014-10-22 2015-01-28 中国人民解放军国防科学技术大学 Automatic android mobile device oriented application generation method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101202665A (en) * 2007-12-06 2008-06-18 中兴通讯股份有限公司 Method for generating graphical user interface
CN101963905A (en) * 2010-09-17 2011-02-02 中山大学 Method and system for applying extensive makeup language (XML) to development of graphical user interface (GUI) of set top box
CN104317587A (en) * 2014-10-22 2015-01-28 中国人民解放军国防科学技术大学 Automatic android mobile device oriented application generation method

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111722845A (en) * 2020-06-04 2020-09-29 深圳中科优瑞医疗科技有限公司 Embedded GUI framework using STM32 single chip microcomputer as main control
CN112214255A (en) * 2020-09-29 2021-01-12 上海上讯信息技术股份有限公司 Method and equipment for calling executable program with parameters
WO2023136776A3 (en) * 2022-01-11 2023-08-24 Lemon Inc. Graphical user interface generator using markup language
US11829734B2 (en) 2022-01-11 2023-11-28 Lemon Inc. Graphical user interface generator using markup language

Similar Documents

Publication Publication Date Title
CN110020307B (en) Drawing method and device for client end view
WO2018228211A1 (en) Application conversion method, apparatus and device
CN111090437B (en) Application deployment method and device and computer readable storage medium
US7681114B2 (en) Method of authoring, deploying and using interactive, data-driven two or more dimensional content
EP2141651B1 (en) Framework to integrate and abstract processing of multiple hardware domains, data types and format
US20190102201A1 (en) Component invoking method and apparatus, and component data processing method and apparatus
US10061575B2 (en) Managed execution environment for software application interfacing
US9710950B2 (en) Extensible sprite sheet generation mechanism for declarative data formats and animation sequence formats
US9841953B2 (en) Pluggable components for runtime-image generation
US10380329B2 (en) Method and apparatus for preventing application from being deciphered
WO2018035686A1 (en) Graphical user interface gui rendering method and apparatus
US11068243B2 (en) Application stack builder based on node features
CN106469045A (en) The method for drafting of graphic user interface GUI and device
CN105683957A (en) Style sheet speculative preloading
CN102693238B (en) Widget application process, system and multimedia terminal
US10514940B2 (en) Virtual application package reconstruction
US9760381B2 (en) Configurable toolbar
CN110020370B (en) Method and device for realizing animation in client application and framework of animation script
US20210165643A1 (en) User Interface Resource File Optimization
CN103631645A (en) Digital family middleware system based on digital medical treatment
Cinar Android quick APIs reference
US20130191442A1 (en) Provision of a download script
US11281477B2 (en) Assigning computing resources to execution of evaluators for image animation
US20140313215A1 (en) Scene-isolated internet application
CN107077484B (en) Generating a web browser view of an application

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: 16913710

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16913710

Country of ref document: EP

Kind code of ref document: A1