CN102799581B - A kind of system and method realizing cross-platform graphic library - Google Patents

A kind of system and method realizing cross-platform graphic library Download PDF

Info

Publication number
CN102799581B
CN102799581B CN201110133570.4A CN201110133570A CN102799581B CN 102799581 B CN102799581 B CN 102799581B CN 201110133570 A CN201110133570 A CN 201110133570A CN 102799581 B CN102799581 B CN 102799581B
Authority
CN
China
Prior art keywords
platform
library
function
api function
cross
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201110133570.4A
Other languages
Chinese (zh)
Other versions
CN102799581A (en
Inventor
蒋昌俊
陈闳中
闫春钢
方钰
张栋良
陈凯
白星振
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tongji University
Original Assignee
Tongji University
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 Tongji University filed Critical Tongji University
Priority to CN201110133570.4A priority Critical patent/CN102799581B/en
Publication of CN102799581A publication Critical patent/CN102799581A/en
Application granted granted Critical
Publication of CN102799581B publication Critical patent/CN102799581B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention discloses a kind of system and method realizing cross-platform graphic library, for areas of information technology, not to be suitable for the deficiency of embedded system development for cross-platform graphic library in prior art, a kind of new cross-platform graphic library is proposed, complete set is provided and unified development interface for using the developer of this shape library, and be applicable to for different system platforms, make shape library can call primary pattern library function based on this platform.Described system comprises: platform independent stratum, is used for as user provides development interface api function; Platform relevant layers, is used for docking with the described api function of described platform independent stratum, and carries out alternately with the ecosystem pattern library function of particular platform.The shape library system very light weight of the embodiment of the present invention, is applicable to embedded device application; Expand conveniently simultaneously, be easy to add new system platform.

Description

A kind of system and method realizing cross-platform graphic library
Technical field
The present invention relates to a kind of areas of information technology, particularly relate to a kind of system and method realizing cross-platform graphic library.
Background technology
When developing cross-platform application program with programming language tools, often running into application program needs for code for this platform write by different platforms, and graphical user interface (being called for short GUI) code is write in the most outstanding representative.If GUI demand is once change, the correlative code of all platforms all needs to make corresponding amendment.So not only take time and effort, easily make mistakes again, the management of code also can be affected, and from then on can reduce development efficiency simultaneously.A kind of method solving this problem uses cross-platform shape library interface to develop cross-platform application program, cross-platform graphic library provides unified DLL (dynamic link library) to developer, simultaneously in specific implementation, carries out different realizations according to the difference of operating system.
For C++, having a lot at present take C++ as the cross-platform graphic library of development language, and wherein typical representative has Qt and wxWidget.Qt is cross-platform C++ class storehouse, can use on the Mainstream Platforms such as Windows, Linux.Qt, except comprising shape library, additionally provides cross-platform base library, as array, storehouse or thread etc.WxWidget is also the figure class libraries for different platform design, and the design and use style of wxWidget is similar to MFC, and different is that wxWidget may operate in different system platforms.No matter be Qt or wxWidget, its complexity is high is not suitable for the embedded device applying to resource-constrained.Trixul is also the cross-platform graphic library of writing with C++, and C++ code and JavaScript code merge by the JavaScript engine technique that Trixul have employed Mozilla, simplify the complicacy of graphic designs.Weak point Trixul needs the support of JS engine can realize alternately, this common applications design in not necessarily.
Summary of the invention
The object of the invention is the deficiency not being suitable for embedded system development for cross-platform graphic library in prior art, a kind of new cross-platform graphic library is proposed, complete set is provided and unified development interface for using the developer of this shape library, and be applicable to for different system platforms, make shape library can call primary pattern library function based on this platform.
In order to reach foregoing invention object, the present invention proposes a kind of system realizing cross-platform graphic library, described system is realized by following technical scheme:
Realize a system for cross-platform graphic library, described system comprises:
Platform independent stratum, is used for as user provides development interface api function;
Platform relevant layers, is used for docking with the described api function of described platform independent stratum, and carries out alternately with the ecosystem pattern library function of particular platform.
Further preferably, described platform relevant layers specifically comprises:
Api function realizes module, is used for docking to the corresponding api function of described platform independent stratum, realizes the calling function of api function;
Platform communication module, is used for carrying out alternately with the ecosystem pattern library function of described particular platform, receives the signal and event that are fed back by ecosystem shape library control, calls provide interface for user realizes api function.
In order to realize aforementioned invention object, the embodiment of the present invention additionally provides a kind of method realizing cross-platform graphic library, said method comprising the steps of:
When the api function that user carries out graphical development calls, platform independent stratum provides a corresponding api function calling interface;
Platform relevant layers is docked with platform independent stratum according to described api function, and carries out alternately with the ecosystem pattern library function of particular platform.
Further preferably, described platform relevant layers is docked with platform independent stratum according to described api function, and carries out specifically comprising alternately with the ecosystem pattern library function of particular platform:
Platform relevant layers is docked to the corresponding api function of described platform independent stratum, realizes the calling function of api function;
The ecosystem pattern library function of platform relevant layers and described particular platform carries out alternately, receives the signal and event that are fed back by ecosystem shape library control, calls provide interface for user realizes api function.
Compared with prior art, the system architecture of the cross-platform graphic library of embodiment of the present invention proposition is divided into platform independent stratum and platform relevant layers two large divisions.Code in platform independent stratum is mainly development interface that user provides: these interfaces be complete, independently, during exploitation cross-platform program, developer should call api function corresponding in this layer; The code of platform relevant layers is mainly used in carrying out alternately with the ecosystem pattern library function of particular platform.Module in this layer is connected to module corresponding to platform independent stratum on the one hand, achieves the concrete function that these modules should realize; On the other hand, the shape library of particular platform ecosystem of the model calling in this layer, is used as the passage that platform independent stratum provides information feed back, makes the shape library control of particular platform can send event response to cross-platform graphic library control.Therefore, the shape library system very light weight of the embodiment of the present invention, is applicable to embedded device application; Expand conveniently simultaneously, be easy to add new system platform.
Accompanying drawing explanation
By the description carried out its exemplary embodiment below in conjunction with accompanying drawing, the above-mentioned feature and advantage of the present invention will become apparent and easy understand.
Fig. 1 is the system composition schematic diagram that the embodiment of the present invention 1 one kinds realizes cross-platform graphic library;
Fig. 2 is the another kind of a kind of system composition schematic diagram realizing cross-platform graphic library of the embodiment of the present invention 2;
Fig. 3 is the primary structure figure that the embodiment of the present invention 3 cross-platform graphic library realizes a cross-platform button control;
Fig. 4 is the initialization figure that the embodiment of the present invention 3 cross-platform graphic library realizes a cross-platform button control;
Fig. 5 is the calling sequence figure of platform independent stratum to platform relevant layers that the embodiment of the present invention 4 cross-platform graphic library realizes a cross-platform button control;
Fig. 6 is the event call-back sequence chart that the embodiment of the present invention 5 cross-platform graphic library realizes a cross-platform button control.
Embodiment
Below in conjunction with accompanying drawing, the present invention is described in further detail.
As shown in Figure 1, for the embodiment of the present invention 1 one kinds realizes the system composition schematic diagram of cross-platform graphic library.A kind of cross-platform graphic library that realizes, described system comprises:
Platform independent stratum, is used for as user provides development interface api function;
Platform relevant layers, is used for docking with the described api function of described platform independent stratum, and carries out alternately with the ecosystem pattern library function of particular platform.
Further preferably, described platform relevant layers specifically comprises:
Api function realizes module, is used for docking to the corresponding api function of described platform independent stratum, realizes the calling function of api function;
Platform communication module, is used for carrying out alternately with the ecosystem pattern library function of described particular platform, receives the signal and event that are fed back by ecosystem shape library control, calls provide interface for user realizes api function.
The embodiment of the present invention is to realize Button control, and the Button in platform independent stratum is available to the cross-platform button control that user uses.Widget and Control in this layer is also cross-platform control, lists here just in order to Button and their logical relation in shape library are described.By Buttonlmpl interface, the realization (as above WindowsButtonlmpl and GtkButtonlmpl of figure) of the button control of particular platform can be carried out for different platform in platform relevant layers; On reception event response, Button realizes ButtonEventObserver interface, for receiving the signal and event that are fed back by ecosystem shape library control, for user's realization event readjustment provides interface.
When user's initialization Button control, the specific assembly of cross-platform graphic library request completes the establishment of Button control.This assembly according to residing particular platform, can create the Buttonlmpl object instance on this platform.
If user calls the relevant function (user on windows platform might as well be established to call the SetText method of Button control) of Button, so this calls finally meeting performed by the specific GUI of platform.Detailed process is: Button calls the SetText method in Buttonlmpl, and because C++ inherits and polymorphic characteristic, this calls and can be called by the special object of platform relevant layers, is WindowsButtonlmpl::SetText here.Request forward can be given the ecosystem shape library control (WinForm::Button) contained by self by WindowsButtonlmpl further, calls the SetText method of this control.Through above-mentioned steps, can implementation platform independent stratum calling to platform relevant layers.Figure below is that this sequence chart called represents.
In the process problem of signal, complete signal from platform relevant layers to the loopback of platform independent stratum mainly through CallbackHelper and supplementary structure.When initialization control, the CallbackHelper of particular platform can associate with ecosystem control, thus realizes catching the signal that ecosystem control sends.When system ecosystem control sends signal (WinForm::Button sends ButtonPressed signal), the CallbackHelper object of particular platform will capture this signal, and call the OnButtonPressed function of self.OnButtonPressed will call the HandleCommand method of the WindowsButtonlmpl object that CallbackHelper points to.In HandleCommand, WindowsButtonlmpl will call the NotifyButtonPressed method of ButtonEventSubject, and the method finally have invoked the ButtonPressed of ButtonEventObserver.Because Button achieves ButtonEventObserver, the therefore signal message that will receive from WinForm of Button, thus achieve message from particular platform to the transmission of independent platform.In this way, user just can at the event response of platform independent stratum design control, and not need specifically to realize for different platform.Figure below is that the sequence chart of event call-back represents.
The system realizing cross-platform graphic library of the embodiment of the present invention is divided into platform independent stratum and platform relevant layers two large divisions.Code in platform independent stratum is mainly development interface that user provides: these interfaces be complete, independently, during exploitation cross-platform program, developer should call api function corresponding in this layer; The code of platform relevant layers is mainly used in carrying out alternately with the ecosystem pattern library function of particular platform.Module in this layer is connected to module corresponding to platform independent stratum on the one hand, achieves the concrete function that these modules should realize; On the other hand, the shape library of particular platform ecosystem of the model calling in this layer, is used as the passage that platform independent stratum provides information feed back, makes the shape library control of particular platform can send event response to cross-platform graphic library control.Therefore, the shape library system very light weight of the embodiment of the present invention, is applicable to embedded device application; Expand conveniently simultaneously, be easy to add new system platform.Described design structuring is good, and simultaneously in platform extended problem, this embodiment has good extensibility.Only need the module of adding platform relevant layers, just can realize specific shape library control in new system platform.Belong to the part in general frame due to the module of newly adding, therefore can reduce the development effort of developer.
As shown in Figure 4, the embodiment of the present invention 4 is a kind of method realizing cross-platform graphic library of the present invention, said method comprising the steps of:
When the api function that user carries out graphical development calls, platform independent stratum provides a corresponding api function calling interface;
Platform relevant layers is docked with platform independent stratum according to described api function, and carries out alternately with the ecosystem pattern library function of particular platform.
Further preferably, described platform relevant layers is docked with platform independent stratum according to described api function, and carries out specifically comprising alternately with the ecosystem pattern library function of particular platform:
Platform relevant layers is docked to the corresponding api function of described platform independent stratum, realizes the calling function of api function;
The ecosystem pattern library function of platform relevant layers and described particular platform carries out alternately, receives the signal and event that are fed back by ecosystem shape library control, calls provide interface for user realizes api function.
The embodiment of the present invention is to realize Button control, and the Button in platform independent stratum is available to the cross-platform button control that user uses.Widget and Control in this layer is also cross-platform control, lists here just in order to Button and their logical relation in shape library are described.By Buttonlmpl interface, the realization (as above WindowsButtonlmpl and GtkButtonlmpl of figure) of the button control of particular platform can be carried out for different platform in platform relevant layers; On reception event response, Button realizes ButtonEventObserver interface, for receiving the signal and event that are fed back by ecosystem shape library control, for user's realization event readjustment provides interface.
When user's initialization Button control, the specific assembly of cross-platform graphic library request completes the establishment of Button control.This assembly according to residing particular platform, can create the Buttonlmpl object instance on this platform.
If user calls the relevant function (user on windows platform might as well be established to call the SetText method of Button control) of Button, so this calls finally meeting performed by the specific GUI of platform.Detailed process is: Button calls the SetText method in Buttonlmpl, and because C++ inherits and polymorphic characteristic, this calls and can be called by the special object of platform relevant layers, is WindowsButtonlmpl::SetText here.Request forward can be given the ecosystem shape library control (WinForm::Button) contained by self by WindowsButtonlmpl further, calls the SetText method of this control.Through above-mentioned steps, can implementation platform independent stratum calling to platform relevant layers.Figure below is that this sequence chart called represents.
In the process problem of signal, complete signal from platform relevant layers to the loopback of platform independent stratum mainly through CallbackHelper and supplementary structure.When initialization control, the CallbackHelper of particular platform can associate with ecosystem control, thus realizes catching the signal that ecosystem control sends.When system ecosystem control sends signal (WinForm::Button sends ButtonPressed signal), the CallbackHelper object of particular platform will capture this signal, and call the OnButtonPressed function of self.OnButtonPressed will call the HandleCommand method of the WindowsButtonlmpl object that CallbackHelper points to.In HandleCommand, WindowsButtonlmpl will call the NotifyButtonPressed method of ButtonEventSubject, and the method finally have invoked the ButtonPressed of ButtonEventObserver.Because Button achieves ButtonEventObserver, the therefore signal message that will receive from WinForm of Button, thus achieve message from particular platform to the transmission of independent platform.In this way, user just can at the event response of platform independent stratum design control, and not need specifically to realize for different platform.Figure below is that the sequence chart of event call-back represents.
The method realizing cross-platform graphic library of the embodiment of the present invention, realizes being completed respectively by platform independent stratum and platform relevant layers by calling of graphical api function.Code in platform independent stratum is mainly development interface that user provides: these interfaces be complete, independently, during exploitation cross-platform program, developer should call api function corresponding in this layer; The code of platform relevant layers is mainly used in carrying out alternately with the ecosystem pattern library function of particular platform.Module in this layer is connected to module corresponding to platform independent stratum on the one hand, achieves the concrete function that these modules should realize; On the other hand, the shape library of particular platform ecosystem of the model calling in this layer, is used as the passage that platform independent stratum provides information feed back, makes the shape library control of particular platform can send event response to cross-platform graphic library control.Therefore, the shape library system very light weight of the embodiment of the present invention, is applicable to embedded device application; Expand conveniently simultaneously, be easy to add new system platform.Described design structuring is good, and simultaneously in platform extended problem, this embodiment has good extensibility.Only need the module of adding platform relevant layers, just can realize specific shape library control in new system platform.Belong to the part in general frame due to the module of newly adding, therefore can reduce the development effort of developer.
It should be noted that; above content is in conjunction with concrete embodiment further description made for the present invention; can not assert that the specific embodiment of the present invention is only limitted to this; under above-mentioned guidance of the present invention; those skilled in the art can carry out various improvement and distortion on the basis of above-described embodiment, and these improve or distortion drops in protection scope of the present invention.

Claims (2)

1. realize a system for cross-platform graphic library, it is characterized in that, described system comprises:
Platform independent stratum, is used for as user provides development interface api function;
Platform relevant layers, is used for docking with the described api function of described platform independent stratum, and carries out alternately with the ecosystem pattern library function of particular platform,
Described platform relevant layers specifically comprises:
Api function realizes module, is used for docking to the corresponding api function of described platform independent stratum, realizes the calling function of api function;
Platform communication module, is used for carrying out alternately with the ecosystem pattern library function of described particular platform, receives the signal and event that are fed back by ecosystem shape library control, calls provide interface for user realizes api function.
2. realize a method for cross-platform graphic library, it is characterized in that, described method comprises:
When the api function that user carries out graphical development calls, platform independent stratum provides a corresponding api function calling interface;
Platform relevant layers is docked with platform independent stratum according to described api function, and carries out alternately with the ecosystem pattern library function of particular platform,
Described platform relevant layers is docked with platform independent stratum according to described api function, and carries out specifically comprising alternately with the ecosystem pattern library function of particular platform:
Platform relevant layers is docked to the corresponding api function of described platform independent stratum, realizes the calling function of api function;
The ecosystem pattern library function of platform relevant layers and described particular platform carries out alternately, receives the signal and event that are fed back by ecosystem shape library control, calls provide interface for user realizes api function.
CN201110133570.4A 2011-05-23 2011-05-23 A kind of system and method realizing cross-platform graphic library Active CN102799581B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110133570.4A CN102799581B (en) 2011-05-23 2011-05-23 A kind of system and method realizing cross-platform graphic library

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110133570.4A CN102799581B (en) 2011-05-23 2011-05-23 A kind of system and method realizing cross-platform graphic library

Publications (2)

Publication Number Publication Date
CN102799581A CN102799581A (en) 2012-11-28
CN102799581B true CN102799581B (en) 2016-02-17

Family

ID=47198693

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110133570.4A Active CN102799581B (en) 2011-05-23 2011-05-23 A kind of system and method realizing cross-platform graphic library

Country Status (1)

Country Link
CN (1) CN102799581B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104317895A (en) * 2014-10-23 2015-01-28 百度在线网络技术(北京)有限公司 Browser and information displaying method thereof
CN106959848A (en) * 2017-02-21 2017-07-18 成都景中教育软件有限公司 A kind of open interface implementation method based on dynamic geometry
CN107402749B (en) * 2017-04-14 2020-07-07 阿里巴巴集团控股有限公司 Method and device for realizing picture loading library
CN111752550B (en) * 2020-06-28 2022-07-12 吉林大学 Embedded real-time Linux and AUTOSAR OS cross-platform development implementation system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101078989A (en) * 2007-07-31 2007-11-28 阮俊杰 Visio file cross-platform network browser implementation method and software
CN101115078A (en) * 2007-07-19 2008-01-30 中兴通讯股份有限公司 System for developing mobile communications terminal equipment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101115078A (en) * 2007-07-19 2008-01-30 中兴通讯股份有限公司 System for developing mobile communications terminal equipment
CN101078989A (en) * 2007-07-31 2007-11-28 阮俊杰 Visio file cross-platform network browser implementation method and software

Also Published As

Publication number Publication date
CN102799581A (en) 2012-11-28

Similar Documents

Publication Publication Date Title
CN102662664B (en) Interface animation realization method and system
CN101971143B (en) Automatic connections between application components
CN102799581B (en) A kind of system and method realizing cross-platform graphic library
US9940224B2 (en) Automatic remote execution of an application
CN101247292B (en) Test equipment and method based on universal test meter API
CN103530160A (en) Page loading method and device
CN101645020A (en) Virtual operating system creation method
CN102810184A (en) Method and device for dynamically executing workflow and enterprise system
CN103176802B (en) Realize the method that the user interface UI of system separates with widget library by control pond
CN104267957A (en) Mobile application unified service framework system
CN105867944A (en) Web front-end terminal operating layer and implementing method thereof
CN104199714A (en) Method for achieving mobile terminal GIS platform on android system and apple system
CN103092583A (en) Method and device for dynamically generating setting item list views
CN101789944B (en) Development system of communication protocol stack of multifunctional energy meter
CN106502770A (en) A kind of HMI state transfer methods based on finite state machine
CN102200909A (en) Mobile terminal uniform interface method and system
CN102999371B (en) Interface Development method and system based on Lua script
CN104834715A (en) Website generating method and system based on components and container
WO2019080665A1 (en) View display method, apparatus and device, and storage medium
CN103902325A (en) Method and device for achieving window synchronization
CN104216839A (en) Information interaction method, device and terminal
CN107025040A (en) Display and setting method, system and graphic user interface based on OLED screen curtain
CN105786484A (en) Application fusion method and device
CN114356430B (en) DAG dependent configuration tool based on airflow scheduling system
CN103150162B (en) Improve the method for embedded software code degree of share

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant