Screen adaptation method and device, electronic equipment and readable storage medium

By processing image data based on the scale adjustment coefficient and adapting to terminal devices with different resolutions, it solves multiple development and testing problems and achieves efficient screen adaptation and display effect improvement.

CN118550491APending Publication Date: 2024-08-27BYD CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311248030.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-22
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

When developing the user interface of an application, it needs to be developed, designed and tested for terminal devices with different screen resolutions, resulting in high resource consumption and long time.

Method used

When the preset resolution of the target application is obtained and the resolution of the target device does not match, the image data is processed based on the proportion adjustment coefficient to adapt to the screen, including horizontal and vertical adjustment coefficients, determine the pixel adjustment strategy, and perform pixel filling to fit the screen. Match the target resolution.

Benefits of technology

It reduces the development, design and testing requirements for devices with different resolutions, shortens development time, avoids resolution distortion, improves display effects, and reduces resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550491A
    Figure CN118550491A
Patent Text Reader

Abstract

The embodiment of the invention provides a screen adaptation method and device, electronic equipment and a readable storage medium, and the method comprises the steps: obtaining image data in a target graph buffer region corresponding to a target picture layer based on a target service process under the condition that a preset resolution of a target application is not matched with a target resolution of target equipment; and processing the image data based on the proportional adjustment coefficient to obtain target image data. Thus, the target application adapted on the low resolution can be normally displayed on the target device with the high resolution, the distortion phenomenon is avoided, and the display effect of the target application on the target device is improved to a certain extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image technology, and in particular to a screen adaptation method, device, electronic device and readable storage medium. Background Art

[0002] Due to the openness of the Android system, there are terminal devices with different screen resolutions on the market, such as terminal devices with screen resolutions of 1080×1920 pixels, 720×1280 pixels, 480×800 pixels, etc.

[0003] When developing the user interface of an application, application developers need to develop user interface-adaptive applications for terminal devices with different resolutions. Accordingly, developers, designers, and testers need to develop, design, and test for terminal devices with different resolutions, which consumes a lot of resources and takes a long time. Summary of the invention

[0004] In order to overcome the problems existing in the related art, the present invention provides a screen adaptation method, device, electronic device and readable storage medium.

[0005] In a first aspect, the present invention provides a screen adaptation method, the method comprising:

[0006] When the preset resolution of the target application does not match the target resolution of the target device, based on the target service process, acquiring image data in a target graphics buffer corresponding to a target screen layer; the target screen layer is a visible screen layer selected by the target service process from at least one screen layer corresponding to the target application;

[0007] Based on the ratio adjustment coefficient, the image data is processed to obtain target image data to adapt to the screen; the ratio adjustment coefficient is determined based on the preset resolution and the target resolution.

[0008] Optionally, the method further comprises:

[0009] Obtaining a preset resolution of the target application;

[0010] Determining a target resolution corresponding to the target device based on device parameter information of the target device;

[0011] The proportional adjustment coefficient is determined based on the preset resolution and the target resolution; the proportional adjustment coefficient includes a horizontal adjustment coefficient and a vertical adjustment coefficient.

[0012] Optionally, when the preset resolution of the target application does not match the target resolution of the target device, acquiring the image data in the target graphics buffer corresponding to the target screen layer based on the target service process includes:

[0013] When the preset resolution of the target application does not match the target resolution of the target device, and the ratio difference between the preset resolution and the target resolution is smaller than a preset threshold, image data in the target graphics buffer corresponding to the target screen layer is obtained based on the target service process.

[0014] Optionally, the processing of the image data based on the scale adjustment coefficient to obtain target image data to adapt to the screen includes:

[0015] Determining a pixel adjustment strategy based on the horizontal adjustment coefficient and the vertical adjustment coefficient;

[0016] Based on the pixel adjustment strategy, the image data is pixel adjusted while maintaining the number of valid pixels corresponding to the image data and the relative position relationship to obtain the target image data.

[0017] Optionally, when the preset resolution is smaller than the target resolution, the pixel adjustment strategy includes a pixel filling strategy, and the pixel filling strategy includes a horizontal pixel filling number and a vertical pixel filling number;

[0018] The determining of the pixel adjustment strategy based on the horizontal adjustment coefficient and the vertical adjustment coefficient includes:

[0019] Determining the horizontal pixel filling quantity based on a rounding result of rounding up the horizontal adjustment coefficient;

[0020] The vertical pixel filling quantity is determined based on a rounding result of rounding up the vertical adjustment coefficient.

[0021] Optionally, the pixel adjustment based on the pixel adjustment strategy, while maintaining the number of valid pixels corresponding to the image data and the relative position relationship, is performed to obtain the target image data, including:

[0022] Determining at least one horizontal analog pixel based on the horizontal pixel filling quantity and each valid pixel corresponding to the image data;

[0023] Determine at least one vertical analog pixel based on the vertical pixel filling quantity, the at least one horizontal analog pixel, and each valid pixel corresponding to the image data;

[0024] While maintaining the number and relative position relationship of each valid pixel corresponding to the image data, the at least one horizontal analog pixel and the at least one vertical analog pixel are filled into designated positions respectively to obtain the target image data.

[0025] Optionally, the method further comprises:

[0026] In response to a start command for the target application, constructing at least one target window in a window management system of the target device;

[0027] According to the parameter information of the at least one target window, construct at least one screen layer in the target service process respectively;

[0028] In response to a vertical synchronization signal, screening the at least one picture layer to determine at least one target picture layer to be displayed;

[0029] The graphics buffer corresponding to the target picture layer is determined as the target graphics buffer.

[0030] Optionally, the method further comprises:

[0031] Render the target image data to obtain rendering data, and display the image on the target device based on the rendering data; the output image corresponding to the rendering data is adapted to the target resolution

[0032] In a second aspect, the present invention provides a screen adaptation device, the device comprising:

[0033] A first acquisition module is used to acquire, based on a target service process, image data in a target graphics buffer corresponding to a target screen layer when a preset resolution of the target application does not match a target resolution of the target device; the target screen layer is a visible screen layer selected by the target service process from at least one screen layer corresponding to the target application;

[0034] The first processing module is used to process the image data based on a ratio adjustment coefficient to obtain target image data to adapt to the screen; the ratio adjustment coefficient is determined based on the preset resolution and the target resolution.

[0035] In a third aspect, the present invention provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the screen adaptation method described in any one of the first aspects when executing the program.

[0036] In a fourth aspect, the present invention provides a readable storage medium. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can perform the steps in the screen adaptation method in any one of the embodiments of the first aspect above.

[0037] In the embodiment of the present invention, by acquiring the image data in the target graphics buffer and processing the image data based on the scale adjustment coefficient, in this way, when the preset resolution of the target application does not match the target resolution of the target device, the underlying image data can be processed based on the scale adjustment coefficient starting from the underlying image data of the system, and the processing method is more flexible. Furthermore, through the method of the embodiment of the present invention, developers, designers, and testers do not need to perform multiple development, design, and testing for terminal devices with different resolutions, which reduces resource investment to a certain extent and shortens the time spent on development, design, and testing. At the same time, compared with the screen adaptation method that consumes more resources, in which the parameters of the interface to be displayed that has been rendered on the screen of the target device are adjusted in sequence during resolution adaptation, and the size, hierarchy, visibility and other factors between all the interfaces to be displayed displayed on the screen need to be considered during the adjustment, the embodiment of the present invention can directly process the image data in the target graphic buffer corresponding to the target screen layer based on the preset resolution and the proportional adjustment coefficient determined by the target resolution before displaying the target image (interface to be displayed) corresponding to the target application, so that the target image data can be adapted to the screen. In this way, there is no need to adjust the size of the interface to be displayed based on the resolution ratio to adapt to the target device. Instead, by processing the image data of the bottom layer of the system before rendering to generate the target image, the target application adapted at a low resolution can be displayed normally on the target device with a high resolution, avoiding distortion, and improving the display effect of the target application on the target device to a certain extent. In addition, since the hierarchical relationship and the number of target screen layers have been determined, the image data corresponding to the target screen layer is processed, and the number of image data corresponding to the target screen layer that needs to be processed is small, which reduces resource consumption to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0039] Figure 1 is a flowchart of the steps of a screen adaptation method provided by an embodiment of the present invention;

[0040] Figure 2is a schematic diagram of a window corresponding to a target picture layer provided by an embodiment of the present invention;

[0041] Figure 3 is a flowchart of specific steps of a screen adaptation method provided by an embodiment of the present invention;

[0042] Figure 4 is a structural diagram of a screen adaptation device provided by an embodiment of the present invention;

[0043] Figure 5 It is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0044] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0045] Figure 1 is a flowchart of a screen adaptation method provided by an embodiment of the present invention. Figure 1 As shown, the method may include:

[0046] Step 101: When a preset resolution of a target application does not match a target resolution of a target device, image data in a target graphics buffer corresponding to a target screen layer is obtained based on a target service process; the target screen layer is a visible screen layer selected by the target service process from at least one screen layer corresponding to the target application.

[0047] In an embodiment of the present invention, the target device is configured with a target application, the target device may be deployed with an Android system, and the target application is installed on the target device and runs on the target device. Generally speaking, the target application can adapt to devices with at least one resolution. If the resolution of the target device where the target application runs is not fully adaptable to the target application, the screen display of the target application will be distorted. Exemplarily, when the resolution of the target application is lower than the system resolution of the target device, the font displayed on the screen in the target application may be too small. In the case where the preset resolution of the target application does not match the target resolution of the target device, it is necessary to adjust and adapt the screen displayed by the target application.

[0048] A target service process is deployed in the framework layer of the Android system corresponding to the target device, which is used to uniformly manage the display devices of the Android system and process the screen display of all applications (including the target application). When the target application that needs to display the interface is started, it communicates with the target service process, sends the user interface (UI) data of the target application to the target service process, and the target service process renders the user interface data of the target application and outputs it to the screen. Among them, the target service process can be the SurfaceFlinger system process of the Android system framework. In the case where the window screen corresponding to the target application needs to be displayed when the target application is started, the target application establishes a connection with the target service process for communication when it is started, and sends the image data of the target application to the target service process at the same time, and the target service process writes the image data into the image buffer. Specifically, a picture layer (layer) will be constructed in the target service process for each target window, and an image buffer will be applied to the target service process for each picture layer. The image buffer serves as the carrier and processor of the image data corresponding to the user interface (UI). The image buffer can be Surface, which can be GraphicBuffer in the Android system. When there are multiple screen layers, the target service process needs to screen and determine the visible screen layer to be displayed as the target screen layer according to the size, color, transparency and other parameters of the multiple screen layers. It can be understood that the hierarchical relationship and number of the screened target screen layers have been determined.

[0049] When the preset resolution of the target application does not match the target resolution of the target device, the image data in the target graphics buffer corresponding to the target screen layer is obtained based on the target service process. The image data in the target graphics buffer may be a set of binary data.

[0050] Step 102: Process the image data based on a scale adjustment coefficient to obtain target image data to adapt to the screen; the scale adjustment coefficient is determined based on the preset resolution and the target resolution.

[0051] In an embodiment of the present invention, a proportional adjustment coefficient is determined based on a preset resolution of a target application and a target resolution of a target device. The proportional adjustment coefficient may characterize the difference between the preset resolution and the target resolution. Based on the proportional adjustment coefficient, the image data is processed so that the processed image data is adapted to the target resolution to obtain target image data. The image data may be binary data composed of a plurality of data segments, each of which may be used to characterize a pixel data. Exemplarily, the data segments in the image data may be copied and filled to adjust the size of the target picture layer, thereby making the output image adapted to the target resolution.

[0052] In summary, in the embodiment of the present invention, by acquiring the image data in the target graphics buffer and processing the image data based on the scale adjustment coefficient, when the preset resolution of the target application does not match the target resolution of the target device, the underlying image data can be processed based on the scale adjustment coefficient starting from the underlying image data of the system, and the processing method is more flexible. Furthermore, through the method of the embodiment of the present invention, developers, designers, and testers do not need to perform multiple development, design, and testing for terminal devices with different resolutions, which reduces resource investment to a certain extent and shortens the time spent on development, design, and testing. At the same time, compared with the screen adaptation method that consumes more resources, in which the parameters of the to-be-displayed interface that has been rendered on the screen of the target device are adjusted in sequence during resolution adaptation, and the size, hierarchy, visibility and other factors between all the to-be-displayed interfaces displayed on the screen need to be considered during the adjustment, the embodiment of the present invention can directly process the image data in the target graphic buffer corresponding to the target screen layer based on the preset resolution and the proportional adjustment coefficient determined by the target resolution before displaying the target image (to-be-displayed interface) corresponding to the target application, so that the target image data can be adapted to the screen. In this way, there is no need to adjust the size of the to-be-displayed interface based on the resolution ratio to adapt to the target device. By processing the image data of the bottom layer of the system before rendering and generating the target image, the target application adapted at a low resolution can be displayed normally on the target device with a high resolution, avoiding distortion, and improving the display effect of the target application on the target device to a certain extent. In addition, since the hierarchical relationship and the number of the target screen layers have been determined, the image data corresponding to the target screen layers are processed, and the number of image data corresponding to the target screen layers that need to be processed is small, which reduces resource consumption to a certain extent.

[0053] Optionally, the embodiment of the present invention may include the following steps:

[0054] Step 201: Obtain a preset resolution of the target application.

[0055] In the embodiment of the present invention, the preset resolution of the target application is determined based on the resolution information supported by the target application. Exemplarily, the preset resolution may be sent by the target application to the target device when the target application is started.

[0056] Step 202: Determine a target resolution corresponding to the target device based on the device parameter information of the target device.

[0057] In the embodiment of the present invention, after the target device has installed the target application, when the target application is started, the target device can call the preset code to obtain the device parameter information of the target device, wherein the device parameter information may include but is not limited to: the target resolution corresponding to the target device.

[0058] Step 203: Determine the proportional adjustment coefficient based on the preset resolution and the target resolution; the proportional adjustment coefficient includes a horizontal adjustment coefficient and a vertical adjustment coefficient.

[0059] In an embodiment of the present invention, a proportional adjustment coefficient can be calculated based on the ratio of the target resolution to the preset resolution. The preset resolution and the target resolution are usually expressed in the form of "horizontal pixel number × vertical pixel number". Therefore, the ratio of the horizontal pixel number of the target resolution to the preset resolution can be calculated to obtain the horizontal adjustment coefficient, and the ratio of the vertical pixel number of the target resolution to the preset resolution can be calculated to obtain the vertical adjustment coefficient. In other words, the proportional adjustment coefficient may include a horizontal adjustment coefficient and a vertical adjustment coefficient. For example, assuming that the preset resolution of the target application is 1920×1080 and the target resolution of the target device is 2560×1440, the ratio of the horizontal pixel number is: 2560 / 1920=1.3333, and the ratio of the vertical pixel number is: 1440 / 1080=1.3333, that is, the horizontal adjustment coefficient is 1.3333, and the vertical adjustment coefficient is 1.3333.

[0060] In the embodiment of the present invention, the scale adjustment coefficient is calculated based on the preset resolution and the target resolution, so that the scale adjustment coefficient required for reference in the image data processing process can be quickly obtained, thereby improving the screen adaptation efficiency.

[0061] Optionally, step 101 may include the following steps:

[0062] Step 1011: When the preset resolution of the target application does not match the target resolution of the target device, and the ratio difference between the preset resolution and the target resolution is less than a preset threshold, based on the target service process, obtain image data in the target graphics buffer corresponding to the target screen layer.

[0063] In the embodiment of the present invention, when the ratio of the application resolution to the device resolution is too different, the screen stretching or deformation and the like may occur during the adaptation process, affecting the user experience. Therefore, in order to ensure the screen presentation effect of the target application, it is possible to determine whether the ratio difference between the preset resolution of the target application and the target resolution of the target device matches, and at the same time, determine whether the ratio difference between the preset resolution of the target application and the target resolution of the target device is less than a preset threshold. Different resolutions have corresponding ratio sizes, such as 1920×1080, 2560×1440, 2340×1080 corresponding to 16:9 ratio size, 2160×1080 corresponding to 18:9 ratio size, and 800×480 corresponding to 5:3 ratio size. Among them, the preset threshold can be set according to the user's display requirements, and the embodiment of the present invention does not limit this. For example, assuming that the preset threshold is 2 / 9, if the preset resolution of the target application is 800×480 and the target resolution corresponding to the target device is 1920×1080, the ratio difference between the preset resolution and the target resolution is 16 / 9-5 / 3=1 / 9, which is less than the preset threshold 2 / 9, then it can be determined that the preset resolution of the target application does not match the target resolution of the target device, and the ratio difference between the preset resolution and the target resolution is less than the preset threshold. Correspondingly, if the preset resolution of the target application is 1920×1080 and the target resolution corresponding to the target device is 2560×1440, then the ratio difference between the preset resolution and the target resolution is 0, which also satisfies the fact that the preset resolution of the target application does not match the target resolution of the target device, and the ratio difference between the preset resolution and the target resolution is less than the preset threshold.

[0064] In the embodiment of the present invention, by further comparing the ratio difference between the preset resolution and the target resolution with a preset threshold, the screen display effect of the target application can be ensured and the display effect of the screen adaptation can be improved.

[0065] Optionally, step 102 may include the following steps:

[0066] Step 301: Determine a pixel adjustment strategy based on the horizontal adjustment coefficient and the vertical adjustment coefficient.

[0067] In the embodiment of the present invention, the horizontal pixel adjustment amount can be determined based on the horizontal adjustment coefficient, and the vertical pixel adjustment amount can be determined based on the vertical adjustment coefficient. The horizontal pixel adjustment amount is used to represent the number of pixels that need to be adjusted when adjusting the horizontal pixels corresponding to the image data, and correspondingly, the vertical pixel adjustment amount is used to represent the number of pixels that need to be adjusted when adjusting the vertical pixels corresponding to the image data.

[0068] For example, assuming that the preset resolution of the target application is 1920×1080, and the target resolution of the target device is 2560×1440, the ratio of the horizontal pixel number is: 2560 / 1920=1.3333, and the ratio of the vertical pixel number is: 1440 / 1080=1.3333, that is, the horizontal adjustment coefficient is 1.3333, and the vertical adjustment coefficient is 1.3333.

[0069] Optionally, when the preset resolution is smaller than the target resolution, the pixel adjustment strategy includes a pixel filling strategy, and the pixel filling strategy includes a horizontal pixel filling number and a vertical pixel filling number.

[0070] In the embodiment of the present invention, when the preset resolution is smaller than the target resolution, the horizontal adjustment coefficient and the vertical adjustment coefficient are not smaller than 1; when the preset resolution is larger than the target resolution, the horizontal adjustment coefficient and the vertical adjustment coefficient are larger than 1.

[0071] Accordingly, step 301 may include the following steps:

[0072] Step 3011: Determine the horizontal pixel filling quantity based on the rounding result of the horizontal adjustment coefficient.

[0073] In an embodiment of the present invention, when the preset resolution is less than the target resolution, the horizontal adjustment coefficient and the vertical adjustment coefficient are not less than 1. And because the number of pixels should be an integer when performing pixel filling, the horizontal adjustment coefficient can be rounded up to obtain a rounding result. The rounding result is used to characterize the number of pixels that need to be presented for each horizontal effective pixel corresponding to the target image data if the target resolution is to be adapted. Among them, the horizontal effective pixel can refer to a plurality of horizontal pixels determined based on the "row" in the pixel dot matrix corresponding to the image, that is, a row of pixels can include multiple horizontal effective pixels. Based on the rounding result, the number of horizontal pixel fillings is determined. For example: since the rounding result can characterize the number of pixels of each horizontal effective pixel that needs to be presented in order to adapt to the screen, the value of the rounding result is subtracted by one, except for the existing horizontal effective pixels corresponding to the image data, and the number of horizontal pixel fillings that need to be filled can be obtained. It can be understood that the number of horizontal pixel fillings is not less than 1.

[0074] Step 3012: Determine the vertical pixel filling quantity based on the rounding result of the vertical adjustment coefficient.

[0075] In an embodiment of the present invention, when the preset resolution is less than the target resolution, the horizontal adjustment coefficient and the vertical adjustment coefficient are not less than 1. And because the number of pixels should be an integer when performing pixel filling, the vertical adjustment coefficient can be rounded up to obtain a rounded result. The rounded result is used to characterize the number of pixels that need to be presented for each vertical effective pixel corresponding to the target image data if the target resolution is to be adapted. Among them, the vertical effective pixel may refer to a plurality of horizontal pixels determined based on the "column" as the reference in the pixel matrix corresponding to the image, that is, a column of pixels may include a plurality of vertical effective pixels. It can be understood that for any pixel corresponding to the image data, it can be called a horizontal effective pixel or a vertical effective pixel depending on the reference (i.e., row or column).

[0076] Based on the rounding result, the number of vertical pixel filling is determined. For example, since the rounding result can represent the number of pixels of each vertical effective pixel that needs to be presented in order to adapt to the screen, the number of vertical pixel fillings that need to be filled can be obtained by subtracting one from the value of the rounding result, except for the existing vertical effective pixels corresponding to the image data. It can be understood that the number of vertical pixel fillings is not less than 1.

[0077] Step 302: Based on the pixel adjustment strategy, the image data is pixel adjusted while maintaining the number of valid pixels corresponding to the image data and the relative position relationship to obtain the target image data.

[0078] In the embodiment of the present invention, based on the pixel adjustment strategy, the pixel composition corresponding to the image data is adjusted while ensuring that the number of each valid pixel corresponding to the image data and the relative position relationship remain unchanged to obtain the target image data. It can be understood that since the image data is composed of multiple data segments, and one data segment is used to represent one pixel, therefore, adjusting the composition of the data segments in the image data is equivalent to adjusting the pixel composition corresponding to the image data.

[0079] Accordingly, step 302 may include the following steps:

[0080] Step 3021: Determine at least one horizontal analog pixel based on the horizontal pixel filling quantity and each valid pixel corresponding to the image data.

[0081] In an embodiment of the present invention, at least one horizontal analog pixel is determined based on the horizontal pixel filling number and the horizontal effective pixels corresponding to the image data. Exemplarily, for each horizontal effective pixel corresponding to the image data, the number of horizontal analog pixels corresponding to each horizontal effective pixel in the horizontal direction can be determined according to the horizontal pixel filling number. Therefore, the total number of horizontal analog pixels is an integer multiple of the total number of horizontal effective pixels corresponding to the image data. It can be understood that since at least one horizontal analog pixel is determined based on the horizontal pixel filling number and the horizontal effective pixels corresponding to the image data, that is, after determining at least one horizontal analog pixel, at least one horizontal analog pixel and the existing horizontal effective pixels corresponding to the image data together constitute the horizontal effective pixels corresponding to the target image data that needs to be presented in order to adapt to the screen.

[0082] Exemplarily, when the number of horizontal pixel filling is 1, a corresponding horizontal analog pixel is determined for each horizontal effective pixel. Accordingly, the total number of horizontal analog pixels is the same as the total number of horizontal effective pixels.

[0083] Step 3022: Determine at least one vertical analog pixel based on the vertical pixel filling quantity, the at least one horizontal analog pixel, and each valid pixel corresponding to the image data.

[0084] In the embodiment of the present invention, at least one vertical analog pixel is determined based on the vertical pixel filling number, at least one horizontal analog pixel, and the horizontal effective pixels corresponding to the image data. That is, for the horizontal effective pixels corresponding to the image data and at least one horizontal analog pixel, the vertical analog pixel number corresponding to the horizontal effective pixels corresponding to the image data and the vertical analog pixel number corresponding to the at least one horizontal analog pixel are determined according to the vertical pixel filling number. One horizontal effective pixel corresponds to at least one vertical analog pixel, and one horizontal analog pixel corresponds to at least one vertical analog pixel. Therefore, the total number of vertical analog pixels is an integer multiple of the total number of horizontal effective pixels corresponding to the image data and at least one horizontal analog pixel.

[0085] Exemplarily, when the number of vertical pixel filling is 1, a corresponding vertical analog pixel is determined for at least one horizontal analog pixel and a horizontal effective pixel corresponding to the image data. That is, each horizontal effective pixel corresponding to the image data corresponds to one vertical analog pixel, and each horizontal analog pixel also corresponds to one vertical analog pixel. Accordingly, when the number of vertical pixel filling is 2, each horizontal effective pixel corresponding to the image data corresponds to two vertical analog pixels (two vertical analog pixels are filled to the vertical adjacent positions of the horizontal effective pixels), and each horizontal analog pixel also corresponds to two vertical analog pixels (two vertical analog pixels are filled to the vertical adjacent positions of the horizontal analog pixels).

[0086] Step 3023: While maintaining the number of valid pixels corresponding to the image data and their relative positional relationship, fill the at least one horizontal analog pixel and the at least one vertical analog pixel into the specified positions of the image data respectively to obtain the target image data.

[0087] In an embodiment of the present invention, while ensuring that the number of valid pixels corresponding to the image data and the relative positional relationship remain unchanged, at least one horizontal analog pixel and at least one vertical analog pixel are respectively filled into the designated positions to obtain target image data. The designated positions may be the horizontal or vertical adjacent positions of the pixels corresponding to the horizontal analog pixels or vertical analog pixels. That is to say, after determining at least one horizontal analog pixel based on each horizontal valid pixel and the number of horizontal pixel fillings, the at least one horizontal analog pixel is directly filled into the horizontal adjacent position of the horizontal valid pixel; correspondingly, after determining at least one vertical analog pixel, the at least one vertical analog pixel is directly filled into the vertical adjacent position of each horizontal valid pixel and at least one horizontal analog pixel. Exemplarily, the horizontal adjacent position may be the right adjacent position of the pixel, and correspondingly, the vertical adjacent position may be the lower adjacent position of the pixel.

[0088] Exemplarily, assume that the image data corresponds to a total of 4 pixels, arranged in a "field" shape, that is, the pixel matrix corresponding to the image data includes two rows and two columns of pixels. Among them, the horizontally valid pixels in the first row of pixels are pixel a and pixel b respectively, and the horizontally valid pixels in the second row of pixels are pixel c and pixel d respectively. When the horizontal pixel filling quantity is 1, for each horizontally valid pixel, at the horizontal adjacent positions of each horizontally valid pixel, a horizontal analog pixel is filled. That is, pixel a' is filled at the horizontal adjacent position of pixel a, pixel b' is filled at the horizontal adjacent position of pixel b, pixel c' is filled at the horizontal adjacent position of pixel c, and pixel d' is filled at the horizontal adjacent position of pixel d. Therefore, the obtained first row of pixels are pixel a, pixel a', pixel b, and pixel b' respectively, and the second row of pixels are pixel c, pixel c', pixel d, and pixel d' respectively. When the vertical pixel filling quantity is 1, for each horizontally valid pixel and the determined at least one horizontal analog pixel, based on the vertical pixel filling quantity, at least one vertical analog pixel is determined, and at least one vertical analog pixel is filled at the vertical adjacent positions of the horizontally valid pixel and the determined at least one horizontal analog pixel. That is, for pixel a, pixel a', pixel b, and pixel b' in the first row of pixels, at least one vertical analog pixel is filled at their respective vertical adjacent positions; for pixel c, pixel c', pixel d, and pixel d' in the second row of pixels, at least one vertical analog pixel is filled at their respective vertical adjacent positions. It can be understood that the target image data obtained after filling based on at least one horizontal analog pixel and at least one vertical analog pixel contains 16 pixels (that is, a pixel matrix of four rows and four columns).

[0089] In a possible implementation, since the image data is a set of binary data composed of multiple data segments, one data segment corresponds to one pixel, and the number of byte bits of the data segment is determined by the color format of the target screen layer. For example, when the color format of the target screen layer is RGB565, that is, the number of byte bits of the data segment corresponding to one pixel is 5+6+5=16 bits, then in the actual application scenario, each data segment in the image data can be copied and filled to the position where each data segment is located to obtain the target image data. Specifically, the color format of the target screen layer can be obtained, and the target number of bits of binary data corresponding to one pixel can be determined based on the color format; based on the target service process, the image data in the target graphics buffer corresponding to the target screen layer is obtained, and based on the target number of bits, the image data is divided into multiple data segments, each data segment includes the target number of bytes, and each data segment corresponds to one pixel. After determining the proportional adjustment coefficient, based on the proportional adjustment coefficient, each data segment in the image data is copied, and each data segment is filled to the target position in the image data to obtain the target image data. Exemplarily, assuming that the color format of the target picture layer is RGB565 and the image data is binary data composed of 48 bytes, the image data is divided into three data segments, namely data segment 1, data segment 2 and data segment 3. Assuming that it is determined that each data segment needs to be copied once based on the scale adjustment coefficient, data segment 1 is copied to obtain data segment 4, data segment 2 is copied to obtain data segment 5, and data segment 3 is copied to obtain data segment 6. After filling data segment 4, data segment 5 and data segment 6 into data segment 1, data segment 2 and data segment 3 respectively, the target image data is obtained. Then the target image data is composed of: data segment 1, data segment 4, data segment 2, data segment 5, data segment 3, and data segment 6.

[0090] In the embodiment of the present invention, based on the number of horizontal pixel filling, the number of vertical pixel filling and each valid pixel corresponding to the image data, at least one horizontal analog pixel and at least one vertical analog pixel that need to be filled can be determined. By filling the pixels, the target application adapted at a low resolution can be displayed normally on a target device with a high resolution, avoiding distortion, and improving the display effect of the target application on the target device to a certain extent.

[0091] Optionally, the embodiment of the present invention may further include the following steps:

[0092] Step 401: In response to a start command for the target application, construct at least one target window in a window management system of the target device.

[0093] In an embodiment of the present invention, when a user is using a target device, if the target application is not running (not running in the background or in the foreground), the user starts the target application through the icon of the target application on the desktop of the target device. The target device first creates and starts the process of the target application for the target application. After the process of the target application has been started, the target application's Activity (e.g., Activity1) is loaded through the process. Correspondingly, when the Activity is started, a window will be correspondingly constructed in the window management system of the Android system. The Activity is used to carry the layout information of the target application, including various controls, such as Button, TextView, etc. The control size can be an absolute parameter or a non-absolute parameter, such as match_parent, match_content, etc. Exemplarily, each control, i.e., the measure, layout, and draw methods of View can be called according to the size of the window to construct a RenderNode, and finally a series of RenderNodes are formed.

[0094] Step 402: construct at least one screen layer in the target service process according to the parameter information of the at least one target window.

[0095] In an embodiment of the present invention, after constructing at least one window, the window management system of the target device returns the graphics buffer corresponding to the window to the target application, and the target application can draw image data to the graphics buffer through the system interface. According to the parameter information of at least one target window, at least one screen layer is constructed in the target service process. The screen layer is the basic operation unit for the target service process to process.

[0096] Step 403: In response to the vertical synchronization signal, filter the at least one picture layer to determine at least one target picture layer to be displayed.

[0097] In an embodiment of the present invention, in response to a vertical synchronization signal, at least one screen layer is traversed, and at least one screen layer is screened according to parameters such as screen layer size, transparency, and z-order, to determine at least one target screen layer to be displayed. Exemplarily, when a vertical synchronization signal arrives, the target service process traverses its screen layer list to find a new graphics buffer. The visible area is calculated according to parameters such as screen layer size, transparency, and z-order, and at least one target screen layer to be displayed is determined. Figure 2 As shown, Figure 2 The target service process has 6 screen layers, but after calculating the visible area based on the size, transparency, and z-order parameters of the screen layer, it can be determined Figure 2The picture layer 1 corresponding to window 1, the picture layer 2 corresponding to window 2, the picture layer 3 corresponding to window 3, and the picture layer 4 corresponding to window 4 are visible picture layers, and are determined as target picture layers.

[0098] Step 404: Determine the graphics buffer corresponding to the target picture layer as the target graphics buffer.

[0099] In the embodiment of the present invention, at least one target screen layer that needs to be displayed is determined by the target service process. Through pre-screening, the number of screen layers that need to be processed is reduced to a certain extent. Correspondingly, the amount of image data corresponding to the target screen layer that needs to be processed is small, which reduces resource consumption to a certain extent.

[0100] Optionally, the embodiment of the present invention may include the following steps:

[0101] Step 501: Render the target image data to obtain rendering data, and display an image on the target device based on the rendering data; an output image corresponding to the rendering data is adapted to the target resolution.

[0102] In an embodiment of the present invention, after obtaining the processed target image data, the target image data is rendered to obtain rendering data. An image is displayed on a target device based on the rendering data, and an output image corresponding to the rendering data is displayed on an output screen of the target device, and the output image is adapted to the target resolution of the target device. Exemplarily, the image data can be rendered by a graphics processing unit (GPU), and the GPU is responsible for rendering the image data to obtain rendering data. The rendering data is sent to the output screen of the target device, and the output screen is responsible for reading the rendering data and presenting the rendering data on the screen. It can be understood that the method for rendering the target image data can refer to the prior art and will not be repeated here.

[0103] In an embodiment of the present invention, by rendering the target image data to obtain rendering data, and displaying the image on the target device based on the rendering data, the target image after the target image data is rendered can be adapted to the target resolution, that is, the target application adapted at a low resolution can be displayed normally on a target device with a high resolution, avoiding distortion, thereby improving the display effect of the target application on the target device to a certain extent.

[0104] For example, Figure 3 A flowchart of the specific steps of a screen adaptation method is shown. Figure 3As shown, in response to a start command for a target application, at least one target window is constructed in the window management system of the target device, and at least one screen layer is respectively constructed in the target service process. In response to a vertical synchronization signal, at least one screen layer is screened to determine at least one target screen layer that needs to be displayed. It is determined whether the preset resolution of the target application matches the target resolution of the target device. If the preset resolution of the target application does not match the target resolution of the target device, it is determined whether the ratio difference between the preset resolution and the target resolution is less than a preset threshold. If it is less than the preset threshold, the image data in the target graphics buffer is obtained; the ratio adjustment coefficient is determined based on the preset resolution and the target resolution, and the image data is processed to obtain the target image data; the target image data is rendered to display the image.

[0105] Figure 4 is a structural schematic diagram of a screen adaptation device provided by an embodiment of the present invention, such as Figure 4 As shown, the device may specifically include:

[0106] A first acquisition module 601 is used to acquire, based on a target service process, image data in a target graphics buffer corresponding to a target screen layer when a preset resolution of a target application does not match a target resolution of a target device; the target screen layer is a visible screen layer selected by the target service process from at least one screen layer corresponding to the target application;

[0107] The first processing module 602 is used to process the image data based on a scale adjustment coefficient to obtain target image data to adapt to the screen; the scale adjustment coefficient is determined based on the preset resolution and the target resolution.

[0108] The screen adaptation device in the embodiment of the present invention obtains the image data in the target graphics buffer and processes the image data based on the scale adjustment coefficient. In this way, when the preset resolution of the target application does not match the target resolution of the target device, the underlying image data can be processed based on the scale adjustment coefficient starting from the underlying image data of the system, and the processing method is more flexible. Furthermore, through the method of the embodiment of the present invention, developers, designers, and testers do not need to carry out multiple development, design, and testing for terminal devices with different resolutions, which reduces resource investment to a certain extent and shortens the time spent on development, design, and testing. At the same time, compared with the screen adaptation method that consumes more resources, in which the parameters of the to-be-displayed interface that has been rendered on the target device screen are adjusted in sequence during resolution adaptation, and the size, hierarchy, visibility and other factors between all the to-be-displayed interfaces displayed on the screen need to be considered during the adjustment, the embodiment of the present invention can directly process the image data in the target graphic buffer corresponding to the target screen layer based on the preset resolution and the proportional adjustment coefficient determined by the target resolution before displaying the target image (to-be-displayed interface) corresponding to the target application, so that the target image data can be adapted to the screen. In this way, there is no need to adjust the size of the to-be-displayed interface based on the resolution ratio to adapt to the target device. By processing the image data of the bottom layer of the system before rendering to generate the target image, the target application adapted at a low resolution can be displayed normally on a target device with a high resolution, avoiding distortion, and improving the display effect of the target application on the target device to a certain extent. In addition, since the hierarchical relationship and the number of target screen layers have been determined, the image data corresponding to the target screen layer is processed, and the number of image data corresponding to the target screen layer that needs to be processed is small, which reduces resource consumption to a certain extent.

[0109] Optionally, the device may further include:

[0110] A second acquisition module is used to acquire the preset resolution of the target application;

[0111] A first determination module, configured to determine a target resolution corresponding to the target device based on device parameter information of the target device;

[0112] The second determination module is used to determine the proportional adjustment coefficient based on the preset resolution and the target resolution; the proportional adjustment coefficient includes a horizontal adjustment coefficient and a vertical adjustment coefficient.

[0113] Optionally, the first acquisition module 601 may include:

[0114] The first acquisition submodule is used to acquire image data in a target graphics buffer corresponding to a target screen layer based on a target service process when a preset resolution of a target application does not match a target resolution of a target device and a ratio difference between the preset resolution and the target resolution is less than a preset threshold.

[0115] Optionally, the first processing module 602 may include:

[0116] A first determination submodule, configured to determine a pixel adjustment strategy based on the horizontal adjustment coefficient and the vertical adjustment coefficient;

[0117] The first adjustment module is used to perform pixel adjustment on the image data based on the pixel adjustment strategy while maintaining the number and relative position relationship of each valid pixel corresponding to the image data to obtain the target image data.

[0118] Optionally, when the preset resolution is less than the target resolution, the pixel adjustment strategy includes a pixel filling strategy, and the pixel filling strategy includes a horizontal pixel filling number and a vertical pixel filling number; the first determining submodule may include:

[0119] A second determination submodule, configured to determine the horizontal pixel filling quantity based on a rounding result of rounding up the horizontal adjustment coefficient;

[0120] The third determination submodule is used to determine the vertical pixel filling quantity based on a rounding result of rounding up the vertical adjustment coefficient.

[0121] Optionally, the first adjustment module may include:

[0122] A fourth determination submodule, configured to determine at least one horizontal analog pixel based on the horizontal pixel filling quantity and each valid pixel corresponding to the image data;

[0123] a fifth determination submodule, configured to determine at least one longitudinal analog pixel based on the longitudinal pixel filling quantity, the at least one transverse analog pixel, and each valid pixel corresponding to the image data;

[0124] The first filling module is used to fill the at least one horizontal analog pixel and the at least one vertical analog pixel to the specified positions respectively while maintaining the number and relative position relationship of each valid pixel corresponding to the image data to obtain the target image data.

[0125] Optionally, the device may further include:

[0126] A first construction module, configured to construct at least one target window in a window management system of the target device in response to a start command for the target application;

[0127] A second construction module, configured to construct at least one screen layer in the target service process according to the parameter information of the at least one target window;

[0128] A third determining module, configured to screen the at least one picture layer in response to a vertical synchronization signal, and determine at least one target picture layer to be displayed;

[0129] The fourth determining module is used to determine the graphics buffer corresponding to the target picture layer as the target graphics buffer.

[0130] Optionally, the device may further include:

[0131] The first rendering module is used to render the target image data to obtain rendering data, and display the image on the target device based on the rendering data; the output image corresponding to the rendering data is adapted to the target resolution.

[0132] The present invention also provides an electronic device, see Figure 5 , including: a processor 701, a memory 702, and a computer program 7021 stored in the memory and executable on the processor, wherein the processor implements the screen adaptation method of the aforementioned embodiment when executing the program.

[0133] The present invention also provides a readable storage medium. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the screen adaptation method of the aforementioned embodiment.

[0134] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0135] The algorithm and display provided herein are not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious that the structure required for constructing such systems. In addition, the present invention is not directed to any specific programming language either. It should be understood that various programming languages ​​can be utilized to realize the content of the present invention described herein, and the description of the above specific languages ​​is for disclosing the best mode of the present invention.

[0136] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0137] Similarly, it should be understood that in order to streamline the present invention and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, the various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the following intention: that the claimed invention requires more features than the features explicitly recited in each claim. More specifically, as reflected in the claims below, inventive aspects lie in less than all the features of the individual embodiments disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present invention.

[0138] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0139] The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in the sorting device according to the present invention. The present invention may also be implemented as a device or apparatus program for executing part or all of the methods described herein. Such a program for implementing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0140] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc., does not indicate any order. These words may be interpreted as names.

[0141] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0142] It should be noted that all actions of acquiring signals, information or data in this application are carried out in compliance with the relevant data protection laws and policies of the country where they are located and with the authorization given by the owner of the corresponding device.

[0143] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

[0144] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A screen adaptation method, characterized in that: The method comprises: When the preset resolution of the target application does not match the target resolution of the target device, based on the target service process, acquiring image data in a target graphics buffer corresponding to a target screen layer; the target screen layer is a visible screen layer selected by the target service process from at least one screen layer corresponding to the target application; Based on the ratio adjustment coefficient, the image data is processed to obtain target image data to adapt to the screen; the ratio adjustment coefficient is determined based on the preset resolution and the target resolution.

2. The method according to claim 1, characterized in that The method further comprises: Obtaining a preset resolution of the target application; Determining a target resolution corresponding to the target device based on device parameter information of the target device; The proportional adjustment coefficient is determined based on the preset resolution and the target resolution; the proportional adjustment coefficient includes a horizontal adjustment coefficient and a vertical adjustment coefficient.

3. The method according to claim 1, characterized in that The method of acquiring image data in a target graphics buffer corresponding to a target screen layer based on a target service process when a preset resolution of a target application does not match a target resolution of a target device includes: When the preset resolution of the target application does not match the target resolution of the target device, and the ratio difference between the preset resolution and the target resolution is smaller than a preset threshold, image data in the target graphics buffer corresponding to the target screen layer is obtained based on the target service process.

4. The method according to claim 3, characterized in that The step of processing the image data based on the scale adjustment coefficient to obtain target image data includes: Determining a pixel adjustment strategy based on the horizontal adjustment coefficient and the vertical adjustment coefficient; Based on the pixel adjustment strategy, the image data is pixel adjusted while maintaining the number of valid pixels corresponding to the image data and the relative position relationship to obtain the target image data.

5. The method according to claim 4, characterized in that In the case where the preset resolution is less than the target resolution, the pixel adjustment strategy includes a pixel filling strategy, and the pixel filling strategy includes a horizontal pixel filling number and a vertical pixel filling number; The determining of the pixel adjustment strategy based on the horizontal adjustment coefficient and the vertical adjustment coefficient includes: Determining the horizontal pixel filling quantity based on a rounding result of rounding up the horizontal adjustment coefficient; The vertical pixel filling quantity is determined based on a rounding result of rounding up the vertical adjustment coefficient.

6. The method according to claim 5, characterized in that The pixel adjustment strategy is based on the pixel adjustment strategy, and the pixel adjustment is performed while maintaining the number of valid pixels corresponding to the image data and the relative position relationship to obtain the target image data, including: Determining at least one horizontal analog pixel based on the horizontal pixel filling quantity and each valid pixel corresponding to the image data; Determine at least one vertical analog pixel based on the vertical pixel filling quantity, the at least one horizontal analog pixel, and each valid pixel corresponding to the image data; While maintaining the number and relative position relationship of each valid pixel corresponding to the image data, the at least one horizontal analog pixel and the at least one vertical analog pixel are filled into designated positions respectively to obtain the target image data.

7. The method according to claim 5, characterized in that The method further comprises: In response to a start command for the target application, constructing at least one target window in a window management system of the target device; According to the parameter information of the at least one target window, construct at least one screen layer in the target service process respectively; In response to a vertical synchronization signal, screening the at least one picture layer to determine at least one target picture layer to be displayed; The graphics buffer corresponding to the target picture layer is determined as the target graphics buffer.

8. The method according to claim 1, characterized in that The method further comprises: The target image data is rendered to obtain rendering data, and an image is displayed on the target device based on the rendering data; an output image corresponding to the rendering data is adapted to the target resolution.

9. A screen adaptation device, characterized in that: The device comprises: A first acquisition module is used to acquire, based on a target service process, image data in a target graphics buffer corresponding to a target screen layer when a preset resolution of a target application does not match a target resolution of a target device; the target screen layer is a visible screen layer selected by the target service process from at least one screen layer corresponding to the target application; The first processing module is used to process the image data based on a ratio adjustment coefficient to obtain target image data to adapt to the screen; the ratio adjustment coefficient is determined based on the preset resolution and the target resolution.

10. An electronic device, characterized in that: The method comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the screen adaptation method as described in any one of claims 1 to 8.

11. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps of the screen adaptation method according to any one of claims 1 to 8 are implemented.