The display method of Android 2D application image, device and a kind of helmetTechnical field
The present invention relates to field of computer technology, particularly to the method, device and a kind of helmet that show that Android 2D applies without distortions.
Background technology
In recent years, VR (VirtualReality, virtual reality) technology and AR (AugmentedReality, augmented reality) technology development, consider the extensive use of Android system and increasing income property, more and more urgent based on the integral type VR equipment of Android platform and the demand of AR equipment.But being required for providing picture to the left eye of user and right eye at VR equipment and AR equipment, this makes existing major part Android application, and especially 2D application cannot be applied directly in VR system and AR system simultaneously.This results in when VR system and AR system there is no unified standard, and the content on relevant device lacks.If simply the screen of the display device of display Android 2D application being divided into left screen and right screen, and when the image of 2D application to be shown is plotted on left screen and right screen respectively, the problem that there will be again image fault.
Summary of the invention
In view of the above problems, it is proposed that the present invention in case provide a kind of overcome the problems referred to above or solve the problems referred to above at least in part show method, device and the one helmet that Android 2D applies without distortions.
According to one aspect of the present invention, it is provided that a kind of method showing Android 2D application image, including:
The screen width of this Android 2D application image to be shown is revised as the half of the width of screen of display device own;
Obtain the Android 2D application to be shown undistorted image based on amended screen width;
Call the SurfaceFlinger module being responsible for display synthesis in Android system, set up grid in the left screen of display device and right screen respectively;
Use OpenGL that the texture of the undistorted image of described Android 2D application to be shown is plotted on described left screen and the respective grid of right screen respectively and is displayed.
Alternatively, the half of the width of screen that the described screen width by this Android 2D application image to be shown is revised as display device own includes:
Calling the window management service WindowManagerService of Android system, the screen size of the DisplayContent apoplexy due to endogenous wind revising Display object corresponding to this 2D to be shown display device applied is screen height * (screen width/2).
Alternatively, the undistorted image of the Android application that described acquisition is to be shown includes:
Amended screen size is returned to Android 2D application to be shown by the window management service WindowManagerService calling Android system, and obtains the undistorted image that this Android 2D application obtains based on amended screen size self adaptation.
According to another aspect of the present invention, it is provided that a kind of device showing Android 2D application image, including:
Screen size amendment unit, for being revised as the half of the width of screen own by the screen width of this Android 2D application image to be shown;
Undistorted image acquiring unit, for obtaining the Android 2D application to be shown undistorted image based on amended screen width;
Grid sets up unit, for calling the SurfaceFlinger module being responsible for display synthesis in Android system, sets up grid in the left screen of display device and right screen respectively;
Draw display unit, for using OpenGL that the texture of the undistorted image of described Android 2D application to be shown is plotted on described left screen and the respective grid of right screen respectively and is displayed.
Alternatively, described screen size amendment unit, window management for calling Android system services WindowManagerService, and the screen size of the DisplayContent apoplexy due to endogenous wind revising Display object corresponding to this 2D to be shown display device applied is screen height * (screen width/2).
Alternatively, described undistorted image acquiring unit, window management for calling Android system services WindowManagerService and amended screen size returns to Android 2D application to be shown, and obtains the undistorted image that this Android 2D application obtains based on amended screen size self adaptation.
According to another aspect of the present invention, it is provided that a kind of helmet, it is characterised in that described helmet includes the device of the display Android 2D application image as described in above-mentioned any one.
From the above, technical scheme, the screen width of this Android 2D application image to be shown is revised as the half of the width of screen of display device own, then the Android 2D application to be shown undistorted image based on amended screen width is obtained further, afterwards again through calling the SurfaceFlinger module being responsible for display synthesis in Android system, grid is set up respectively in the left screen of display device and right screen, it is then used by OpenGL the texture of the undistorted image of described Android 2D application to be shown is plotted on described left screen and the respective grid of right screen respectively and is displayed.Due in prior art, when the image of Android 2D application to be shown is on the screen being plotted to display device, what generate is the image of corresponding whole screen size, and need during actual displayed to be respectively displayed on left screen and the right screen of screen, therefore it is accomplished by image is zoomed in and out, thus producing distortion;And the Android 2D being to be shown obtained in the technical program applies the image based on amended screen width, therefore it is made without convergent-divergent thus not producing distortion, solve the problem utilizing prior art to there will be image fault when the Android 2D image rendering applied to VR equipment or AR equipment etc. is had the display device of multiple screen, can so that user watches the picture of more high-quality, picture for Android 2D application, especially the display effect of word promotes clearly, and the virtual reality all-in-one applying this technical scheme can be applied by the compatible existing Android 2D of magnanimity, when using this kind of VR equipment or AR equipment, user can experience more rich content with more joyful mood, and the cost of this technical scheme is low, method is simple, be suitable to practicality.
Described above is only the general introduction of technical solution of the present invention, in order to better understand the technological means of the present invention, and can be practiced according to the content of description, and in order to above and other objects of the present invention, feature and advantage can be become apparent, below especially exemplified by the specific embodiment of the present invention.
Accompanying drawing explanation
By reading hereafter detailed description of the preferred embodiment, various other advantage and benefit those of ordinary skill in the art be will be clear from understanding.Accompanying drawing is only for illustrating the purpose of preferred implementation, and is not considered as limitation of the present invention.And in whole accompanying drawing, it is denoted by the same reference numerals identical parts.In the accompanying drawings:
Fig. 1 illustrates the flow chart of a kind of according to an embodiment of the invention method showing Android 2D application image;
Fig. 2 illustrates the schematic diagram of a kind of according to an embodiment of the invention method showing Android 2D application image;
Fig. 3 illustrates the structural representation of a kind of according to an embodiment of the invention device showing Android 2D application image;
Fig. 4 illustrates the structural representation of a kind of according to an embodiment of the invention helmet.
Detailed description of the invention
It is more fully described the exemplary embodiment of the disclosure below with reference to accompanying drawings.Although accompanying drawing showing the exemplary embodiment of the disclosure, it being understood, however, that may be realized in various forms the disclosure and should do not limited by embodiments set forth here.On the contrary, it is provided that these embodiments are able to be best understood from the disclosure, and complete for the scope of the present disclosure can be conveyed to those skilled in the art.
Fig. 1 illustrates the flow chart of a kind of according to an embodiment of the invention method showing Android 2D application image, as it is shown in figure 1, the method includes:
Step S110, is revised as the half of the width of screen of display device own by the screen width of this Android 2D application image to be shown.
Step S120, obtains the Android 2D application to be shown undistorted image based on amended screen width.
Step S130, calls the SurfaceFlinger module being responsible for display synthesis in Android system, sets up grid in the left screen of display device and right screen respectively.
Step S140, uses OpenGL that the texture of the undistorted image of Android 2D application to be shown is plotted on left screen and the respective grid of right screen respectively and is displayed.
In Android system, by time on texture rendering to screen, it is necessary to whole screen is set up grid, for instance lower-left coordinate is (-1 ,-1), top-left coordinates is (1,1), and centre coordinate is (0,0).When the present embodiment being applied in VR system or AR system, it is necessary to utilizing screen respectively left eye and right eye to provide display, therefore screen into left screen and right screen, in left screen and right screen, the image of display should be independent.In being embodied as, can consider when carrying out the drafting of left screen, the centrage that datum line on the right side of screen grid moves to screen sets up new grid, thus the image of the left screen drawn out be distortionless, be suitable to the image of left screen, right screen can be drawn similarly.Specifically, it is possible to use OpenGL (OpenGraphicsLibrary, open graphic library) carries out the drafting of the texture of undistorted image.
Visible, method shown in Fig. 1, the screen width of this Android 2D application image to be shown is revised as the half of the width of screen of display device own, then the Android 2D application to be shown undistorted image based on amended screen width is obtained further, afterwards again through calling the SurfaceFlinger module being responsible for display synthesis in Android system, grid is set up respectively in the left screen of display device and right screen, it is then used by OpenGL the texture of the undistorted image of described Android 2D application to be shown is plotted on described left screen and the respective grid of right screen respectively and is displayed.This technical scheme solves the problem utilizing prior art to there will be image fault when the Android 2D image rendering applied to VR equipment or AR equipment etc. is had the display device of multiple screen, can so that user watches the picture of more high-quality, picture for Android 2D application, especially the display effect of word promotes clearly, and the virtual reality all-in-one applying this technical scheme can be applied by the compatible existing Android 2D of magnanimity, when using this kind of VR equipment or AR equipment, user can experience more rich content with more joyful mood, and the cost of this technical scheme is low, method is simple, be suitable to practicality.
In one embodiment of the invention, in method shown in Fig. 1, the half of the width of screen that the screen width of this Android 2D application image to be shown is revised as display device own includes: calling the window management service WindowManagerService of Android system, the screen size of the DisplayContent apoplexy due to endogenous wind revising Display object corresponding to this 2D to be shown display device applied is screen height * (screen width/2).
In Android system, it can be display device one independent Display object of distribution of each this system of application, window management service WindowManagerService can be then the newly-built DisplayContent class of this Display object, and this apoplexy due to endogenous wind just contains the information such as the window relevant with corresponding Display object.Such as, at this apoplexy due to endogenous wind, mInitialDisplayWidth, mInitialDisplayHeight, mInitialDisplayDensity correspondence saves the width of screen, height and density.So in the present embodiment, it is possible to the value of mInitialDisplayWidth is revised as 1/2nd of former display device screen width, for instance, former screen size is 800*480, then amended screen size is 400*480.
In one embodiment of the invention, in said method, the undistorted image obtaining Android application to be shown includes: amended screen size is returned to Android 2D application to be shown by the window management service WindowManagerService calling Android system, and obtains the undistorted image that this Android 2D application obtains based on amended screen size self adaptation.
If the application in Android system needs to display on the display device, generally requiring the screen size by obtaining display device, accordingly generate the image adapted with this screen size, this method is called the Android application self adaptation to screen.
In prior art, if 2D application needs to be applied directly in the scene of VR system and AR system.When the image of 2D application to be shown is plotted on left screen and right screen respectively, it is former screen size owing to being supplied to the screen size of 2D application, arise that the problem in following sight: such as, former screen size is 800*480, owing to this screen needs to be divided into left screen and right screen, respectively the left eye of user and right eye provide independent image, and therefore, practical application needs the screen size of display to be 400*480.And owing to 2D application is according to the screen size got, the image that self adaptation obtains is the screen adapting to 800*480 size, when being more completely shown on the screen of 400*480, it is necessary for image down, namely at least to narrow down to 400*240 (i.e. screen width and highly all become self adaptation is raw obtains 1/2nd of image).The problem that thus can produce image fault, and all leave black surround up and down at screen.And window management owing to calling Android system services WindowManagerService amended screen size returns to Android 2D application to be shown in the present embodiment, namely 2D application is the screen adapting to 400*480 size according to the image that amended screen size obtains, therefore 2D application can display in whole left screen and whole right screen, not only it is absent from image fault, and the utilization rate of screen is also higher.
Fig. 2 illustrates the schematic diagram of a kind of according to an embodiment of the invention method showing Android 2D application image.As shown in Figure 2, the 2D application of Android application layer interacts by servicing WindowManagerService with the window management of Android ccf layer, obtain the amended screen size of the DisplayContent apoplexy due to endogenous wind of Display object corresponding to this 2D to be shown display device applied, the image that will obtain according to this amended screen size self adaptation again, service WindowManagerService by window management, call SurfaceFlinger module further by the 2D image rendering applied to the left screen and right screen of display device.
Fig. 3 illustrates the structural representation of a kind of according to an embodiment of the invention device showing Android 2D application image, as it is shown on figure 3, show that the Android 2D device 300 applied includes without distortions:
Screen size amendment unit 310, for being revised as the half of the width of screen own by the screen width of this Android 2D application image to be shown.
Undistorted image acquiring unit 320, for obtaining the Android 2D application to be shown undistorted image based on amended screen width.
Grid sets up unit 330, for calling the SurfaceFlinger module being responsible for display synthesis in Android system, sets up grid in the left screen of display device and right screen respectively.
Draw display unit 340, for using OpenGL that the texture of the undistorted image of Android 2D application to be shown is plotted on left screen and the respective grid of right screen respectively and is displayed.
Visible, device shown in Fig. 3, the screen width of this Android 2D application image to be shown is revised as the half of the width of screen of display device own, then the Android 2D application to be shown undistorted image based on amended screen width is obtained further, afterwards again through calling the SurfaceFlinger module being responsible for display synthesis in Android system, grid is set up respectively in the left screen of display device and right screen, it is then used by OpenGL the texture of the undistorted image of described Android 2D application to be shown is plotted on described left screen and the respective grid of right screen respectively and is displayed.This technical scheme solves the problem utilizing prior art to there will be image fault when the Android 2D image rendering applied to VR equipment or AR equipment etc. is had the display device of multiple screen, can so that user watches the picture of more high-quality, picture for Android 2D application, especially the display effect of word promotes clearly, and the virtual reality all-in-one applying this technical scheme can be applied by the compatible existing Android 2D of magnanimity, when using this kind of VR equipment or AR equipment, user can experience more rich content with more joyful mood, and the cost of this technical scheme is low, method is simple, be suitable to practicality.
In one embodiment of the invention, in device shown in Fig. 3, screen size amendment unit 310, window management for calling Android system services WindowManagerService, and the screen size of the DisplayContent apoplexy due to endogenous wind revising Display object corresponding to this 2D to be shown display device applied is screen height * (screen width/2).
In one embodiment of the invention, in said apparatus, undistorted image acquiring unit 320, window management for calling Android system services WindowManagerService and amended screen size returns to Android 2D application to be shown, and obtains the undistorted image that this Android 2D application obtains based on amended screen size self adaptation.
It should be noted that the detailed description of the invention of above-mentioned each device embodiment is identical with the detailed description of the invention in aforementioned corresponding method embodiment, do not repeat them here.
Fig. 4 illustrates the structural representation of a kind of according to an embodiment of the invention helmet, and as shown in Figure 4, helmet 400 includes showing the Android 2D device 300 applied without distortions in above-mentioned any embodiment.This helmet can allow user experience the picture of more high-quality, joyful use mood in the virtual reality all-in-one of compatible 2D, greatly enriches content.
In sum, technical scheme, the screen width of this Android 2D application image to be shown is revised as the half of the width of screen of display device own, then the Android 2D application to be shown undistorted image based on amended screen width is obtained further, afterwards again through calling the SurfaceFlinger module being responsible for display synthesis in Android system, grid is set up respectively in the left screen of display device and right screen, it is then used by OpenGL the texture of the undistorted image of described Android 2D application to be shown is plotted on described left screen and the respective grid of right screen respectively and is displayed.This technical scheme solves the problem utilizing prior art to there will be image fault when the Android 2D image rendering applied to VR equipment or AR equipment etc. is had the display device of multiple screen, can so that user watches the picture of more high-quality, picture for Android 2D application, especially the display effect of word promotes clearly, and the virtual reality all-in-one applying this technical scheme can be applied by the compatible existing Android 2D of magnanimity, when using this kind of VR equipment or AR equipment, user can experience more rich content with more joyful mood, and the cost of this technical scheme is low, method is simple, be suitable to practicality.
The foregoing is only presently preferred embodiments of the present invention, be not intended to limit protection scope of the present invention.All make within the spirit and principles in the present invention any amendment, equivalent replacement, improvement etc., be all contained in protection scope of the present invention.