CN107450897B - Cross-platform migration method and device for graphic engine - Google Patents

Cross-platform migration method and device for graphic engine Download PDF

Info

Publication number
CN107450897B
CN107450897B CN201610383503.0A CN201610383503A CN107450897B CN 107450897 B CN107450897 B CN 107450897B CN 201610383503 A CN201610383503 A CN 201610383503A CN 107450897 B CN107450897 B CN 107450897B
Authority
CN
China
Prior art keywords
operating system
system platform
module
platform
interface
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
CN201610383503.0A
Other languages
Chinese (zh)
Other versions
CN107450897A (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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding Ltd
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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201610383503.0A priority Critical patent/CN107450897B/en
Publication of CN107450897A publication Critical patent/CN107450897A/en
Application granted granted Critical
Publication of CN107450897B publication Critical patent/CN107450897B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/76Adapting program code to run in a different environment; Porting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The application provides a cross-platform transplanting method and a device of a graphic engine, wherein the cross-platform transplanting method of the graphic engine comprises the following steps: extracting functional modules related to the operating system platform from a graphic engine applicable to the first operating system platform; converting the functional module related to the operating system platform into a functional module matched with a second operating system platform; and operating the converted graphic engine in the second operating system platform so that the second operating system platform is displayed through the converted graphic engine control interface. The cross-platform transplanting method of the graphic engine realizes the transplanting of the graphic engine from one platform to another platform and the cross-platform operation of the graphic engine, facilitates the control of graphic interface display and reduces the workload of graphic engine development.

Description

Cross-platform migration method and device for graphic engine
Technical Field
The present application relates to the field of image technologies, and in particular, to a method and an apparatus for cross-platform migration of a graphics engine.
Background
The DALi (Dynamic Animation Library) engine is a UI (User Interface) graphic engine of a Tizen (Tizen) platform, and is responsible for Interface layout, controls, special effects, and the like. The DALi engine is largely divided into four modules (as shown in FIG. 1, which is derived from the DALi official PDF): the core module, the adaptor adaptation module, the toolkit toolset, demo demonstration module. The core module mainly realizes the functions of mathematical model calculation, graphic drawing, animation rendering, core element definition and the like, and consists of a plurality of bottom-layer and core modules. The adapter module is mainly used for processing events, adapting local windows, analyzing picture resources and the like, and is a module related to a specific platform. The Toolkit module is a module for implementing some controls such as buttons, picture views, sliders, and the like. The Demo module is mainly a few demonstration small examples based on engine implementation and is used for reference development of developers.
At present, the DALi engine is mainly used in a Tizen platform and an ubuntu platform, but cannot be applied to an Android (Android) platform which is widely used at present in a cross-platform mode.
Disclosure of Invention
The present application aims to address the above technical problem, at least to some extent.
Therefore, a first objective of the present application is to provide a cross-platform migration method for a graphics engine, which realizes cross-platform migration operation of the graphics engine, and facilitates control of graphical interface display.
A second objective of the present application is to provide a graphics engine cross-platform migration apparatus.
To achieve the above object, according to a first aspect of the present application, a method for cross-platform migration of a graphics engine is provided, including the following steps: extracting functional modules related to the operating system platform from a graphic engine applicable to the first operating system platform; converting the functional module related to the operating system platform into a functional module matched with a second operating system platform; and operating the converted graphic engine in the second operating system platform so that the second operating system platform is displayed through the converted graphic engine control interface.
According to the cross-platform transplanting method of the graphic engine, the functional module related to the operating system platform is extracted from the graphic engine applicable to the first operating system platform, the functional module is converted into the functional module matched with the second operating system platform, and the converted graphic engine runs in the second operating system platform, so that the second operating system platform is displayed through the converted graphic engine control interface, transplanting of the graphic engine from one platform to another platform and cross-platform running of the graphic engine are achieved, the display of the graphic interface is convenient to control, and the workload of graphic engine development is reduced.
The embodiment of the second aspect of the present application provides a cross-platform migration apparatus for a graphics engine, including: an extraction module for extracting functional modules associated with the operating system platform from a graphics engine adapted for use with the first operating system platform; the conversion module is used for converting the functional module related to the operating system platform into a functional module matched with a second operating system platform; and the running module is used for running the converted graphic engine in the second operating system platform so as to enable the second operating system platform to be displayed through the converted graphic engine control interface.
The cross-platform transplantation device of the graphic engine extracts the functional module related to the operating system platform from the graphic engine applicable to the first operating system platform, converts the functional module into the functional module matched with the second operating system platform, and runs the converted graphic engine in the second operating system platform, so that the second operating system platform is displayed through the converted graphic engine control interface, transplantation of the graphic engine from one platform to another platform and cross-platform running of the graphic engine are realized, the display of the graphic interface is convenient, and the workload of graphic engine development is reduced.
Additional aspects and advantages of the present application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the present application.
Drawings
The above and/or additional aspects and advantages of the present application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a schematic diagram of a DALi engine;
FIG. 2 is a flow diagram of a method for cross-platform migration of a graphics engine according to one embodiment of the present application;
FIG. 3 is a flowchart of a cross-platform migration method of a graphics engine according to another embodiment of the present application
FIG. 4 is a diagram illustrating the linkage between an OpenGL ES interface and a local window according to an embodiment of the present application;
FIG. 5 is a flow diagram of a method for cross-platform migration of a graphics engine according to another embodiment of the present application;
FIG. 6 is a flow diagram of a method for cross-platform migration of a graphics engine according to another embodiment of the present application;
FIG. 7 is a first schematic diagram illustrating a cross-platform migration apparatus of a graphics engine according to an embodiment of the present application;
FIG. 8 is a first schematic diagram of a cross-platform migration apparatus of a graphics engine according to an embodiment of the present application;
FIG. 9 is a first schematic diagram of a cross-platform migration apparatus of a graphics engine according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present application.
A cross-platform migration method and apparatus of a graphics engine according to an embodiment of the present application is described below with reference to the accompanying drawings.
FIG. 2 is a flow diagram of a method for cross-platform migration of a graphics engine according to one embodiment of the present application.
As shown in fig. 2, a method for cross-platform migration of a graphics engine according to an embodiment of the present application includes:
s201, extracting functional modules related to the operating system platform from the graphic engine applicable to the first operating system platform.
The graphic engine is responsible for the layout of the interface, the drawing of the control, the special effect and the like. Generally, since the development languages of the operating system platforms are different, the corresponding graphic engines can be developed for the different operating system platforms. In one embodiment of the present invention, the graphics engine may be a Dynamic Animation Library (DALi) engine, which is a UI graphics image engine for a Tizen (an operating system for cell phones and other devices, developed by two Linux alliances LiMo Foundation and Linux Foundation, with Mobile Intel and Samsung electronics, to integrate resource advantages). The functional module can be an adapter module, the first operating system platform can be a Taize platform, and the second operating system platform can be an android platform.
In an embodiment of the present application, cross-platform migration of a graphics engine is also intended to be a migration of a graphics engine adapted to a first operating system platform to a second operating system platform to enable the second operating system platform to be exposed based on the graphics engine control interface. Taking the dynamic animation library engine as an example, a scheme for applying the dynamic animation library engine to the Android platform from the Tien platform is described.
It should be understood that implementations for cross-platform porting of other graphics engines, or applying a dynamic animation library engine to other operating system platforms, are not necessarily described.
As shown in fig. 1, the dynamic animation library engine mainly includes four modules: a Core module 11, an adapter module 12, a toolset Toolkit module 13, and a Demo module 14 (not shown in the figure). The Core module 11 is mainly used for mathematical model calculation, graphic drawing, animation rendering, Core element definition, and the like in the image processing process, and is a bottom-layer and Core module. The Adaptor module 12 is mainly used for event processing, local window adaptation, picture resource analysis, and the like, and is a module related to a specific operating system platform. Toolkit module 13 is an implementation module for buttons, picture views, sliders, and other controls. The Demo module 14 is primarily a few demonstration instantiations of the graphics engine implementation for developer reference development.
Therefore, it can be seen that the functional module related to the operating system platform in the dynamic animation library engine is an adapter module. Therefore, when the dynamic animation library engine is transplanted from the Tizen platform to the Android platform, the Adaptor module can be converted into a functional module matched with the Android local display part.
S202, converting the functional module related to the operating system platform into a functional module matched with a second operating system platform.
In the embodiment of the present application, before the conversion, the function files in the function module related to the operating system platform are applicable to the first operating system platform, and therefore, the function files in the function module related to the operating system platform need to be replaced by the function files applicable to the second operating system platform, and then the cross-compilation is performed again by using the compilation tool of the second operating system platform to generate the function module adapted to the second operating system platform.
Still taking the dynamic animation library engine as an example for explanation, the Adaptor module related to the operating system platform mainly includes three sub-modules, namely a picture resource analysis sub-module, an event processing sub-module and a local window adaptation sub-module. Therefore, when performing conversion, the main focus is on the three sub-modules. Specifically, as shown in fig. 3, in one embodiment of the present application, S202 may include the following steps:
s301, converting the picture analysis tool based on the first operating system platform in the picture resource analysis sub-module into a picture analysis tool based on the second operating system platform.
In an embodiment of the application, the parsing rule file in the picture parsing tool based on the first operating system platform may be replaced with the parsing rule file based on the second operating system platform, and then the picture parsing tool after replacing the parsing rule file is cross-compiled by using the compiling tool of the second operating system platform, so as to generate the picture parsing tool based on the second operating system platform.
The picture resource is used for texture mapping of a bottom layer OpenGL (Open Graphics Library) of a dynamic animation Library engine, wherein the Open Graphics Library defines a professional graphical program interface with a cross-programming language and cross-platform programming interface specification. For example, the format of the picture resources is generally stored in a compressed format such as jpg, png, jpeg, gif, etc., and these compressed format picture resources need to be parsed into a bitmap format in an uncompressed format for being provided to the underlying OpenGL. However, the dynamic animation library engine picture resource analysis based on the Tizen platform is realized by an analysis tool based on an ubuntu (wubang, a Linux operating system based on desktop applications) platform. Therefore, the ubuntu platform-based picture parsing tool needs to be replaced with the Android platform-based picture parsing tool.
Specifically, the method includes the steps of firstly determining picture analysis tools of various format open sources of the linux platform, replacing makefile files of various tool source codes with mk files of the Android platform, and then performing cross compilation by using an NDK compilation tool of the Android platform to obtain the picture analysis tools which can be used by a native layer of the Android platform. There are many NDK (natural Development Kit) compiling tools of the Android platform, and one of them may be selected for illustration in the present application, for example, the picture parsing tool may be:
libjpeg-turbo-android,libpng-android,platform_external_giflib.
correspondingly, the library on which the picture analysis tool depends is as follows:
android-libdrm,Boost-for-Android-Prebuilt,curl-android-ios,nodejs-android。
s302, packaging and mapping the event processing submodule according to the system architecture standard of the second operating system platform so as to map an event processing model in the event processing submodule to the second operating system platform.
The event response and processing of the dynamic animation library engine are both used in a standard linux event processing model, which cannot be directly used on the Android platform, so that the event processing model of the dynamic animation library engine needs to be mapped and converted into an event processing model of the Android platform. The Android platform is also based on a linux kernel, the event response and processing of the Android platform are also based on a linux event response mechanism, and only the upper Java layer of the Android platform encapsulates and maps an event processing model through a Java virtual machine. Therefore, in the embodiment of the application, the event processing submodule can be packaged and mapped through a Java virtual machine, so that an event processing model in the event processing submodule is mapped to an Android platform. That is, the mapping conversion can be performed on the linux event processing model according to the system architecture standard of the Android platform, that is, the linux event processing model can be mapped to the Android platform. The mapping rule used during mapping conversion is the same as the rule used during the packaging and mapping processing of the event processing model by the upper Java layer of the Android platform through the Java virtual machine.
S303, configuring an EGL (embedded graphics library) interface of the local window adaptation sub-module so as to enable the EGL interface to adapt to the second operating system platform.
The switching of the graphic engine among different platforms mainly aims to correspond the rendering and drawing contents to a specific hardware platform so as to normally display the rendering and drawing contents. The dynamic animation library engine is implemented by using an OpenGL ES interface in a portion responsible for graphics rendering, and the OpenGL ES (OpenGL for Embedded Systems, an open graphics library of an Embedded system, which is a subset of an OpenGL three-dimensional graphics application program interface) is a cross-platform interface, that is, an interface unrelated to a platform. The Android platform also supports the OpenGL ES interface. Specifically, as shown in fig. 4, when rendering and drawing content corresponds to a specific hardware platform, what is responsible for linking an OpenGL ES interface and a local window (local EGL canvas or screen cache) is an EGL (embedded graphics library) interface, so that only the configuration of the EGL interface corresponding to the Android platform needs to be adapted in the migration process of the graphics engine. This is also a key part of the migration of the dynamic animation library engine.
Specifically, as shown in fig. 5, in an embodiment of the present application, S303 may include the following steps:
s501, an EGL canvas of the second operating system platform is created in the EGL interface, so that the second operating system platform can perform local window and canvas operations through the EGL canvas when a control interface is displayed.
For example, the dynamic animation library engine is transplanted to the Android platform, that is, an EGL Surface (EGL canvas) of the Android platform is created.
Specifically, for example, the display protocol files ecore-wl-render-surface.h/ecore-wl-render-surface.cpp and ecore-X-render-surface.h/ecore-X-render-surface.h in the original animation library engine may be first replaced with the Android-render-surface.h/Android-render-surface.cpp of the Android platform, where wl represents the display of wayland (a display protocol under linux platform) and X represents X11 (a display protocol under X Windows system). Therefore, through the replacement, the display protocol file which is suitable for the Tizen platform in the original dynamic animation library engine can be replaced by the display protocol file which is suitable for the Android platform.
And then, the Android platform local window and surface operation is realized through the following operations. Specifically, a native window of the Android platform can be created through SurfaceCreated (): anattivewindow. The created local window ANativeWindow is obtained through GetWindow (). The mPosition structure (location structure) of the dynamic animation library engine is populated by CreateWindow ().
The coordinate xy at the upper left corner in the structure is assigned with (0, 0) respectively, and the width and the height (w, h) are obtained by using ANativeWindow _ getWidth (mWindow) and ANativeWindow _ getHeight (mWindow).
Further, the mWindow parameter of egl.createsecourfacewindow (mWindow, mColorDepth) in the function CreateEglSurface (eglnface & eglIf) used to create the EGL canvas in the dynamic animation library engine may be populated with the native window ANativeWindow of the Android platform. Thus, the association of the EGL canvas with the local window in the dynamic animation library engine is realized. In the subsequent interface control process, the Android platform can call the dynamic animation library engine and map the operation on the canvas in the dynamic animation library engine to the corresponding operation on the local window.
S502, defining the attribute and the interface of the EGL interface according to the second operating system platform.
Specifically, for example, the dynamic animation library engine is transplanted to the Android platform, EGL interface configuration files EGL-implementation-android.cpp based on the Android platform can be created, and the EGL-implementation-wl.cpp (corresponding to the wayland display protocol) and EGL-implementation-x.cpp (corresponding to the x11 display protocol) of the existing configuration files in the dynamic animation library engine can be replaced by the EGL interface configuration files EGL-implementation-android.cpp.
The EGL interface configuration file based on the Android platform can realize the EGL initialization and configuration operation of the Android platform. In the file, the original wayland-egl.h in the dynamic animation library engine is replaced by an Android platform EGL interface definition file EGL/egl.h to define the EGL interface of the dynamic animation library engine, so that the defined EGL interface of the dynamic animation library engine is suitable for the Android platform.
When defining the attribute of the EGL interface, the original mEglNativeDisplay member in the dynamic animation library engine can be assigned as the Android platform ANativeWindow handle, so that the display window in the dynamic animation library engine is associated with the local window of the Android platform.
After the display window in the dynamic animation library engine is associated with the local window of the Android platform, the attribute data in the dynamic animation library engine can be accessed and acquired through the Android platform. The attribute data may include information such as the size of the display screen, the attribute data of the window (e.g., supported window width and height, color depth, etc.), and the number and type of the buffers.
Then, the interfaces of the EGL in the Android platform, such as InitializeGles (), CreateContext (), MakeContextCurrent (), SwapBuffers () and the like, can be filled with the acquired attribute data of the dynamic animation library engine. Therefore, the attribute data of the dynamic animation library engine can be input to the Android platform through the interface of the EGL in the Android platform, and the dynamic animation library engine and the Android platform are linked. .
And the EGL interface is an interface responsible for Android platform display, so that after the attributes and the interface of the EGL interface are defined according to the second operating system platform, the dynamic animation library engine is linked with the Android platform, and graphics can be drawn in the Android platform through the dynamic animation library engine.
S503, an engine call interface function is constructed in the EGL interface, so that the second operating system platform can obtain the display information of the second operating system platform through the engine call interface function when a control interface is displayed.
Specifically, for example, the dynamic animation library engine is transplanted to the Android platform, a display-connection-import-Android-cpp based on the Android platform is created, and the display-connection-import-x.cpp (corresponding to the x11 display protocol) or display-connection-import-wl.cpp (corresponding to the wayland display protocol) file, which is the screen display file in the dynamic animation library engine, is replaced with the display-connection-import-android.cpp.
Then, a GetDpi () interface for acquiring screen information is implemented, the dynamic animation library engine acquires the screen information through ecore _ wl _ dpi _ get () and ecore _ x _ dpi _ get (), screen material property information dm is acquired through DisplayMetrics dm of java layer instead of DisplayMetrics () in the Android platform, and after acquiring the screen material property, wide xdpi and high ydpi of the screen can be acquired through getWindowManager ().getdefaultdisplay ().getmetrics (dm). That is, acquiring the width and height of the screen requires two steps: the first step is to acquire the material property dm of the screen, and the second step is to acquire the width and height supported by the screen according to the material property dm of the screen.
S203, the converted graphic engine is operated in the second operating system platform, so that the second operating system platform is displayed through the converted graphic engine control interface.
According to the cross-platform transplanting method of the graphic engine, the functional module related to the operating system platform is extracted from the graphic engine applicable to the first operating system platform, the functional module is converted into the functional module matched with the second operating system platform, and the converted graphic engine runs in the second operating system platform, so that the second operating system platform is displayed through the converted graphic engine control interface, transplanting of the graphic engine from one platform to another platform and cross-platform running of the graphic engine are achieved, the display of the graphic interface is convenient to control, and the workload of graphic engine development is reduced.
In one embodiment of the application, the function module further includes an example demonstration sub-module, which converts the function module related to the operating system platform into a function module adapted to a second operating system platform, and further includes:
s601, constructing an example demonstration function.
In embodiments of the application, a presentation may be made for one of the presentation examples in the example library to enable the transformed graphics engine to adapt to the second operating system platform. As exemplified by demo: taking mesh-morph-example as an example, the demonstration function of the example can be tested and constructed: demo _ main () and replace the main () function originally in the dynamic animation library engine with it to achieve the same function.
Then, an initialization operation is performed through android _ main (), and during the initialization process, the structure of struct android _ app _ state can be filled, specifically, state- > userData ═ engine, state- > onapplcmd ═ engine _ handle _ cmd, and state- > onputevent ═ engine _ handle _ input, respectively.
S602, setting a calling interface of the exemplary demonstration function.
For example, the interface that calls demo _ main () may be: android _ init (& demo _ main), wherein shutdownrequest is implemented in this interface, init _ function is implemented in this interface, so as to define that no prompt message is displayed when the example demonstration is closed, and a standard interface is defined as a system example demonstration function demo _ main.
S603, configuring the calling interface based on the interface standard of the second operating system platform so as to enable the second operating system platform to successfully call the example demonstration function.
In an embodiment of the present invention, the example demonstration may be executed through a standard JNI Interface (Java Native Interface) and an upper layer Java activity, so that the local window adaptation submodule may be capable of adapting to demo.
Therefore, the local window adaptation submodule in the converted graphic engine can adapt to demo, and demo demonstration can be conveniently carried out on the second operating system platform.
Corresponding to the method for transplanting the graphics engine across platforms provided by the above embodiments, the present application also provides a device for transplanting the graphics engine across platforms.
Fig. 7 is a first schematic structural diagram of a cross-platform migration apparatus of a graphics engine according to an embodiment of the present application.
As shown in fig. 7, a cross-platform migration apparatus of a graphics engine according to an embodiment of the present application includes: an extraction module 10, a conversion module 20 and an execution module 30.
In particular, extraction module 10 is configured to extract functional modules associated with a first operating system platform from a graphics engine adapted for use with the first operating system platform.
The graphic engine is responsible for the layout of the interface, the drawing of the control, the special effect and the like. Generally, since the development languages of the operating system platforms are different, the corresponding graphic engines can be developed for the different operating system platforms. In one embodiment of the present invention, the graphics engine may be a Dynamic Animation Library (DALi) engine, which is a UI graphics image engine for a Tizen (an operating system for cell phones and other devices, developed by two Linux alliances LiMo Foundation and Linux Foundation, with Mobile Intel and Samsung electronics, to integrate resource advantages). The functional module can be an adapter module, the first operating system platform can be a Taize platform, and the second operating system platform can be an android platform.
In an embodiment of the present application, cross-platform migration of a graphics engine is also intended to be a migration of a graphics engine adapted to a first operating system platform to a second operating system platform to enable the second operating system platform to be exposed based on the graphics engine control interface. Taking the dynamic animation library engine as an example, a scheme for applying the dynamic animation library engine to the Android platform from the Tien platform is described.
It should be understood that implementations for cross-platform porting of other graphics engines, or applying a dynamic animation library engine to other operating system platforms, are not necessarily described.
As shown in fig. 1, the dynamic animation library engine mainly includes four modules: a Core module 11, an adapter module 12, a toolset Toolkit module 13, and a Demo module 14 (not shown in the figure). The Core module 11 is mainly used for mathematical model calculation, graphic drawing, animation rendering, Core element definition, and the like in the image processing process, and is a bottom-layer and Core module. The Adaptor module 12 is mainly used for event processing, local window adaptation, picture resource analysis, and the like, and is a module related to a specific operating system platform. Toolkit module 13 is an implementation module for buttons, picture views, sliders, and other controls. The Demo module 14 is primarily a few demonstration instantiations of the graphics engine implementation for developer reference development.
Therefore, it can be seen that the functional module related to the operating system platform in the dynamic animation library engine is an adapter module. Therefore, when the dynamic animation library engine is transplanted from the Tizen platform to the Android platform, the Adaptor module can be converted into a functional module matched with the Android local display part.
The conversion module 20 is used for converting the functional module related to the operating system platform into a functional module adapted to the second operating system platform.
In the embodiment of the present application, before the conversion, the function files in the function module related to the operating system platform are applicable to the first operating system platform, and therefore, the function files in the function module related to the operating system platform need to be replaced by the function files applicable to the second operating system platform, and then the cross-compilation is performed again by using the compilation tool of the second operating system platform to generate the function module adapted to the second operating system platform.
Still taking the dynamic animation library engine as an example for explanation, the Adaptor module related to the operating system platform mainly includes three sub-modules, namely a picture resource analysis sub-module, an event processing sub-module and a local window adaptation sub-module. Therefore, when performing conversion, the main focus is on the three sub-modules. Specifically, as shown in fig. 8, the conversion module 20 may include: a conversion unit 21, a mapping unit 22 and a first configuration unit 23.
The conversion unit 21 is configured to convert a picture parsing tool based on the first operating system platform in the picture resource parsing sub-module into a picture parsing tool based on the second operating system platform.
In one embodiment of the present application, the conversion unit 21 may be configured to: replacing the parsing rule file in the picture parsing tool based on the first operating system platform with a parsing rule file based on the second operating system platform; and performing cross compilation on the picture analysis tool after replacing the analysis rule file by using the compilation tool of the second operating system platform to generate a picture analysis tool based on the second operating system platform, and replacing the picture analysis tool based on the first operating system platform.
The picture resource is used for the bottom layer OpenGL texture mapping of the dynamic animation library engine. For example, the format of the picture resources is generally stored in a compressed format such as jpg, png, jpeg, gif, etc., and these compressed format picture resources need to be parsed into a bitmap format in an uncompressed format for being provided to the underlying OpenGL. However, the dynamic animation library engine picture resource analysis based on the Tizen platform is realized by an analysis tool based on an ubuntu (wubang, a Linux operating system based on desktop applications) platform. Therefore, the ubuntu platform-based picture parsing tool needs to be replaced with the Android platform-based picture parsing tool.
Specifically, the conversion unit 21 may first determine the picture analysis tools of each format open source of the linux platform, replace the makefile of each tool source code with the Android platform mk file, and then perform cross-compilation by using the NDK compilation tool of the Android platform to obtain the picture analysis tools that can be used by the native layer of the Android platform. There are many NDK compiling tools for the Android platform, and one of them may be selected for illustration in the present application, for example, the picture parsing tool may be:
libjpeg-turbo-android,libpng-android,platform_external_giflib.
correspondingly, the library on which the picture analysis tool depends is as follows:
android-libdrm,Boost-for-Android-Prebuilt,curl-android-ios,nodejs-android。
the mapping unit 22 is configured to encapsulate and map the event processing submodule according to the system architecture standard of the second operating system platform, so as to map an event processing model in the event processing submodule to the second operating system platform.
The event response and processing of the dynamic animation library engine are both used in a standard linux event processing model, which cannot be directly used on the Android platform, so that the event processing model of the dynamic animation library engine needs to be mapped and converted into an event processing model of the Android platform. The Android platform is also based on a linux kernel, the event response and processing of the Android platform are also based on a linux event response mechanism, and only the upper Java layer of the Android platform encapsulates and maps an event processing model through a Java virtual machine. Therefore, in an embodiment of the present application, the mapping unit 22 may be configured to encapsulate and map the event processing submodule through a Java virtual machine, so as to map an event processing model in the event processing submodule to an Android platform. That is, the mapping conversion can be performed on the linux event processing model according to the system architecture standard of the Android platform, that is, the linux event processing model can be mapped to the Android platform. The mapping rule used during mapping conversion is the same as the rule used during the packaging and mapping processing of the event processing model by the upper Java layer of the Android platform through the Java virtual machine.
The first configuration unit 23 is configured to configure an embedded graphics library EGL interface of the local window adaptation sub-module, so that the EGL interface adapts to the second operating system platform.
The switching of the graphic engine among different platforms mainly aims to correspond the rendering and drawing contents to a specific hardware platform so as to normally display the rendering and drawing contents. The dynamic animation library engine is implemented by using an OpenGL ES interface in the part responsible for graphics rendering, and the OpenGL ES is a cross-platform interface, namely a platform-independent interface. The Android platform also supports the OpenGL ES interface. Specifically, as shown in fig. 4, when rendering and drawing content corresponds to a specific hardware platform, an EGL (embedded graphics library) interface is responsible for linking an OpenGL ES interface and a local window, so that only the configuration of the EGL interface corresponding to the Android platform needs to be adapted in the migration process of the graphics engine. This is also a key part of the migration of the dynamic animation library engine.
Specifically, the first configuration unit 23 can be used to execute the steps shown in fig. 5, and please refer to the embodiment shown in fig. 5 for a detailed description.
In another embodiment of the present application, as shown in fig. 9, the conversion module 20 may further include a construction unit 24, a setting unit 25, and a second configuration unit 26.
Wherein the construction unit 24 is adapted to construct an example demonstration function.
In an embodiment of the present application, the building unit 24 may demonstrate for one of the demonstration examples in the example library to enable the transformed graphics engine to adapt to the second operating system platform. As exemplified by demo: taking mesh-morph-example as an example, the demonstration function of the example can be tested and constructed: demo _ main () and replace the main () function originally in the dynamic animation library engine with it to achieve the same function.
Then, an initialization operation is performed through android _ main (), and during the initialization process, the structure of struct android _ app _ state can be filled, specifically, state- > userData ═ engine, state- > onapplcmd ═ engine _ handle _ cmd, and state- > onputevent ═ engine _ handle _ input, respectively.
The setting unit 25 is used to set the call interface of the example demonstration function.
For example, the interface that calls demo _ main () may be: android _ init (& demo _ main), wherein shutdownrequest is implemented in this interface, init _ function is implemented in this interface, so as to define that no prompt message is displayed when the example demonstration is closed, and a standard interface is defined as a system example demonstration function demo _ main.
The second configuration unit 26 is configured to configure the calling interface based on the interface standard of the second operating system platform, so that the example demonstration function can be successfully called at the second operating system platform.
In an embodiment of the present invention, the second configuration unit 26 may execute the example demonstration through a standard JNI Interface (Java Native Interface) and an upper Java event Java activity, so that the local window adaptation submodule can adapt the demo.
Therefore, the local window adaptation submodule in the converted graphic engine can adapt to demo, and demo demonstration can be conveniently carried out on the second operating system platform.
The running module 30 is configured to run the converted graphics engine in the second operating system platform, so that the second operating system platform is displayed through the converted graphics engine control interface.
The cross-platform transplantation device of the graphic engine extracts the functional module related to the operating system platform from the graphic engine applicable to the first operating system platform, converts the functional module into the functional module matched with the second operating system platform, and runs the converted graphic engine in the second operating system platform, so that the second operating system platform is displayed through the converted graphic engine control interface, transplantation of the graphic engine from one platform to another platform and cross-platform running of the graphic engine are realized, the display of the graphic interface is convenient, and the workload of graphic engine development is reduced.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and the scope of the preferred embodiments of the present application includes other implementations in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present application.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present application may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, reference to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
While embodiments of the present application have been shown and described, it will be understood by those of ordinary skill in the art that: various changes, modifications, substitutions and alterations can be made to the embodiments without departing from the principles and spirit of the application, the scope of which is defined by the claims and their equivalents.

Claims (14)

1. A cross-platform migration method of a graphic engine is characterized by comprising the following steps:
extracting functional modules related to an operating system platform from a graphic engine applicable to a first operating system platform, wherein the graphic engine is a dynamic animation library engine which comprises a core module, an adapter module, a tool set module and a demonstration module;
converting the functional module related to the operating system platform into a functional module adapted to a second operating system platform, wherein the functional files in the functional module related to the operating system platform are replaced by the functional files suitable for the second operating system platform, and the cross compiling is performed again by using a compiling tool of the second operating system platform to generate the functional module adapted to the second operating system platform; and
and operating the converted graphic engine in the second operating system platform so that the second operating system platform is displayed through the converted graphic engine control interface.
2. The method of claim 1, wherein the functional module is an adapter module, the first operating system platform is a tazey platform, and the second operating system platform is an android platform.
3. The method of claim 1, wherein the function modules comprise a picture resource parsing sub-module, an event processing sub-module, and a local window adaptation sub-module, and wherein converting the function module associated with the operating system platform into a function module adapted to a second operating system platform comprises:
converting a picture analysis tool based on the first operating system platform in the picture resource analysis sub-module into a picture analysis tool based on the second operating system platform;
packaging and mapping the event processing submodule according to a system architecture standard of the second operating system platform so as to map an event processing model in the event processing submodule to the second operating system platform;
and configuring an embedded graphic library interface of the local window adaptation sub-module so that the embedded graphic library interface is adapted to the second operating system platform.
4. The method of claim 3, wherein the converting the picture parsing tool based on the first operating system platform in the picture resource parsing sub-module to the picture parsing tool based on the second operating system platform comprises:
replacing the parsing rule file in the picture parsing tool based on the first operating system platform with a parsing rule file based on the second operating system platform;
and performing cross compilation on the picture analysis tool after replacing the analysis rule file by using the compilation tool of the second operating system platform to generate a picture analysis tool based on the second operating system platform, and replacing the picture analysis tool based on the first operating system platform.
5. The method of claim 3, wherein said encapsulating and mapping said event processing submodule according to a system architecture standard of said second operating system platform comprises:
and packaging and mapping the event processing submodule through a Java virtual machine.
6. The method of claim 3, wherein said configuring the embedded graphics library interface of the local window adaptation sub-module to adapt the embedded graphics library interface to the second operating system platform comprises:
creating an embedded graphic library canvas of the second operating system platform in the embedded graphic library interface so that the second operating system platform performs local window and canvas operations through the embedded graphic library canvas when a control interface is displayed;
defining the attribute and the interface of the embedded graphic library interface according to the second operating system platform;
and constructing an engine calling interface function in the embedded graphic library interface so that the second operating system platform can obtain the display information of the second operating system platform through the engine calling interface function when a control interface is displayed.
7. The method of claim 3, wherein the functional modules further comprise an example demonstration sub-module that transforms the functional module associated with the operating system platform into a functional module that is compatible with a second operating system platform, further comprising:
constructing an example demonstration function;
setting a calling interface of the example demonstration function;
and configuring the calling interface based on the interface standard of the second operating system platform so that the example demonstration function can be successfully called at the second operating system platform.
8. A graphics engine cross-platform migration apparatus, comprising:
the system comprises an extraction module, a demonstration module and a display module, wherein the extraction module is used for extracting a functional module related to an operating system platform from a graphic engine suitable for a first operating system platform, the graphic engine is a dynamic animation library engine, and the dynamic animation library engine comprises a core module, an adapter module, a tool set module and the demonstration module;
the conversion module is used for converting the functional module related to the operating system platform into a functional module adaptive to a second operating system platform, wherein the functional files in the functional module related to the operating system platform are replaced by the functional files suitable for the second operating system platform, and the cross compiling is carried out again by using a compiling tool of the second operating system platform so as to generate the functional module adaptive to the second operating system platform;
and the running module is used for running the converted graphic engine in the second operating system platform so as to enable the second operating system platform to be displayed through the converted graphic engine control interface.
9. The apparatus of claim 8, wherein the functional module is an adapter module, the first operating system platform is a tazey platform, and the second operating system platform is an android platform.
10. The apparatus of claim 8, wherein the functional modules comprise a picture resource parsing sub-module, an event processing sub-module, and a local window adaptation sub-module, and the conversion module comprises:
the conversion unit is used for converting the picture analysis tool based on the first operating system platform in the picture resource analysis sub-module into a picture analysis tool based on the second operating system platform;
the mapping unit is used for packaging and mapping the event processing submodule according to the system architecture standard of the second operating system platform so as to map an event processing model in the event processing submodule to the second operating system platform;
and the first configuration unit is used for configuring the embedded graphic library interface of the local window adaptation submodule so as to enable the embedded graphic library interface to adapt to the second operating system platform.
11. The apparatus of claim 10, wherein the conversion unit is to:
replacing the parsing rule file in the picture parsing tool based on the first operating system platform with a parsing rule file based on the second operating system platform;
and performing cross compilation on the picture analysis tool after replacing the analysis rule file by using the compilation tool of the second operating system platform to generate a picture analysis tool based on the second operating system platform, and replacing the picture analysis tool based on the first operating system platform.
12. The apparatus of claim 10, wherein the mapping unit is to:
and packaging and mapping the event processing submodule through a Java virtual machine.
13. The apparatus of claim 10, wherein the first configuration unit is to:
creating an embedded graphic library canvas of the second operating system platform in the embedded graphic library interface so that the second operating system platform performs local window and canvas operations through the embedded graphic library canvas when a control interface is displayed;
defining the attribute and the interface of the embedded graphic library interface according to the second operating system platform;
and constructing an engine calling interface function in the embedded graphic library interface so that the second operating system platform can obtain the display information of the second operating system platform through the engine calling interface function when a control interface is displayed.
14. The apparatus of claim 10, wherein the function module further comprises an example demonstration sub-module, the conversion module further comprising:
the construction unit is used for constructing an example demonstration function;
the setting unit is used for setting a calling interface of the example demonstration function;
and the second configuration unit is used for configuring the calling interface based on the interface standard of the second operating system platform so as to enable the second operating system platform to successfully call the example demonstration function.
CN201610383503.0A 2016-06-01 2016-06-01 Cross-platform migration method and device for graphic engine Active CN107450897B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610383503.0A CN107450897B (en) 2016-06-01 2016-06-01 Cross-platform migration method and device for graphic engine

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610383503.0A CN107450897B (en) 2016-06-01 2016-06-01 Cross-platform migration method and device for graphic engine

Publications (2)

Publication Number Publication Date
CN107450897A CN107450897A (en) 2017-12-08
CN107450897B true CN107450897B (en) 2021-03-02

Family

ID=60485246

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610383503.0A Active CN107450897B (en) 2016-06-01 2016-06-01 Cross-platform migration method and device for graphic engine

Country Status (1)

Country Link
CN (1) CN107450897B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109445846A (en) * 2018-10-30 2019-03-08 中国船舶重工集团公司第七0七研究所 A kind of NDK adaptation layer transplantation method
CN110554873B (en) * 2019-08-20 2023-06-30 上海沣沅星科技有限公司 System, computer device and storage medium for realizing man-machine interaction interface
CN110853121B (en) * 2019-10-25 2023-02-10 稿定(厦门)科技有限公司 Cross-platform data processing method and device based on AE
CN113504914B (en) * 2021-09-09 2021-12-07 北京鲸鲮信息系统技术有限公司 Operating system construction compiling method and device, electronic equipment and storage medium
CN113822962B (en) * 2021-11-19 2022-03-18 北京鲸鲮信息系统技术有限公司 Window information processing method and device, electronic equipment and storage medium
CN113918366B (en) * 2021-12-14 2022-04-19 北京鲸鲮信息系统技术有限公司 Information processing method, information processing device, electronic equipment and storage medium
CN116107665B (en) * 2023-04-10 2023-10-27 北京渲光科技有限公司 Project configuration method, device, terminal and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101630251A (en) * 2009-08-05 2010-01-20 中国船舶重工集团公司第七○九研究所 Graphical interfaces development method and system of cross-desktop and embedded system
CN102306099A (en) * 2011-08-23 2012-01-04 上海网达软件有限公司 Cross-platform graphic display method and graphic display system on handheld terminal equipment
CN104166552A (en) * 2014-08-15 2014-11-26 成都天奥信息科技有限公司 Transplantable memory bitmap graphics library application method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101630251A (en) * 2009-08-05 2010-01-20 中国船舶重工集团公司第七○九研究所 Graphical interfaces development method and system of cross-desktop and embedded system
CN102306099A (en) * 2011-08-23 2012-01-04 上海网达软件有限公司 Cross-platform graphic display method and graphic display system on handheld terminal equipment
CN104166552A (en) * 2014-08-15 2014-11-26 成都天奥信息科技有限公司 Transplantable memory bitmap graphics library application method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
移植Android图形引擎Skia到MIPS平台经验总结(一);Audio_Wang;《https://blog.csdn.net/wanggp_2007/article/details/6163551》;20110125;全文 *
移植Android图形引擎Skia到MIPS平台经验总结(二);Audio_Wang;《https://blog.csdn.net/wanggp_2007/article/details/6163561》;20110125;全文 *

Also Published As

Publication number Publication date
CN107450897A (en) 2017-12-08

Similar Documents

Publication Publication Date Title
CN107450897B (en) Cross-platform migration method and device for graphic engine
CN107832108B (en) Rendering method and device of 3D canvas webpage elements and electronic equipment
CN109918607B (en) Page construction method and device, medium and computing equipment
RU2321892C2 (en) Markup language and object model for vector graphics
RU2324229C2 (en) Visual and three-dimensional graphic interfaces
US20140082511A1 (en) Method and system for emulating desktop software applications in a mobile communication network
CN107393013B (en) Virtual roaming file generation and display method, device, medium, equipment and system
CN104216691A (en) Application creating method and device
CN108876887B (en) Rendering method and device
CN111408138B (en) Rendering method and device based on game engine and electronic equipment
KR100975457B1 (en) Gui application development support device, gui application program generating method, and recording medium
CN101421761A (en) Visual and scene graph interfaces
US9836441B2 (en) Platform abstraction of graphics
KR101618381B1 (en) Shader-based extensions for a declarative presentation framework
CN111740948A (en) Data packet issuing method, dynamic updating method, device, equipment and medium
CN115495069B (en) Model-driven coal industry software process implementation method, device and equipment
CN113419710A (en) Development method and device of small program, electronic equipment and medium
KR101552914B1 (en) Web server application framework web application processing method using the framework and computer readable medium processing the method
EP4006662A1 (en) System and method supporting graphical programming based on neuron blocks, and storage medium
US8203567B2 (en) Graphics processing method and apparatus implementing window system
CN102253841B (en) Small-scale graphical user interface system
US20220027172A1 (en) Assigning computing resources to execution of evaluators for image animation
CN110930499B (en) 3D data processing method and device
Jolma Geoinformatica: a modeling platform built on FOSS
EP3834080B1 (en) Static reconcilliation of application view hierarchies

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant