An electronic device screen projection method and system, an electronic device, and a readable storage medium
By acquiring the screen resolution and aspect ratio, calculating the device's independent pixels and pixels per inch, an adaptive projection interface is generated, solving the problems of projection interface distortion and layout inconsistency, ensuring that content is clearly displayed on screens of different resolutions, and improving the user experience.
Patent Information
- Application Number
- CN202111615420.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2041-12-27
AI Technical Summary
Existing screen mirroring technologies are prone to distortion or misalignment on screens with different resolutions, affecting the user experience.
By acquiring the screen's resolution and aspect ratio, matching it with a matching target reference aspect ratio, calculating device-independent pixels and pixels per inch, obtaining the appropriate device-independent pixels, and using the target rendering parameters to generate the projection interface, the content is ensured to display adaptively on screens with different resolutions.
It enables clear and complete display of content on screens with different resolutions, thus improving the user experience.
Smart Images

Figure CN116400874B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of vehicle control technology, and in particular relates to an electronic device projection method, system, electronic device, and readable storage medium. Background Technology
[0002] With the rapid development of Internet of Vehicles (IoV) and Bluetooth communication technologies, vehicle-mounted center consoles have gradually broken free from the limitations of local information and have begun to obtain target content for screen projection from IoV cloud servers or users' mobile devices, and then project that target content onto the screens of electronic devices for display.
[0003] The relevant screen mirroring methods often involve simply stretching or tiling the entire target content based on the specific resolution of the electronic device's screen.
[0004] Therefore, the screen projection interface obtained through relevant projection technologies often suffers from distortion or misaligned layout, thus affecting the user experience. Summary of the Invention
[0005] In view of this, this application provides a method, system, electronic device, and readable storage medium for projecting content onto an electronic device, in order to solve the technical problem that simply stretching or tiling the entire projected content will cause distortion of the projected interface or inconsistency in the layout ratio.
[0006] One objective of this application is to provide a method, system, electronic device, and readable storage medium for screen projection from an electronic device, the advantage of which is that the content to be projected can be clearly and completely displayed on the projection interface.
[0007] One objective of this application is to provide a method for projecting an electronic device onto a screen, the advantage of which is that it can ensure that regardless of whether a reference device independent pixel that is the same as the qualified device independent pixel of the screen can be obtained, a target reference device independent pixel that matches the qualified device independent pixel of the screen can be obtained.
[0008] One objective of this application is to provide a method for projecting an electronic device onto a screen. Its advantage is that it enables a smart terminal to obtain a number of pixels per inch corresponding to the number of pixels per inch obtained for the screen resolution, thereby obtaining a number of pixels suitable for the screen.
[0009] One objective of this application is to provide a method for projecting an electronic device screen, the advantage of which is that it can ensure that regardless of whether a reference aspect ratio that is the same as the calculated aspect ratio can be obtained, a target reference aspect ratio that matches the aspect ratio can be obtained.
[0010] One objective of this application is to provide a method for projecting an electronic device screen, which has the advantage of ensuring that the number of pixels per inch of the screen can be obtained regardless of whether the aspect ratio is less than or equal to the target reference aspect ratio or greater than the target reference aspect ratio.
[0011] One objective of this application is to provide a method for projecting an electronic device screen, which allows the method to adjust the number of pixels per inch corresponding to a specific resolution, so as to prevent the interface data from being incompletely displayed on the projected screen after rendering.
[0012] One object of this application is to provide a method for screen projection on an electronic device, wherein the electronic device includes a screen, and the method includes:
[0013] In response to establishing a screen mirroring connection, the resolution of the screen is obtained;
[0014] Based on the resolution, the aspect ratio of the screen is obtained; the aspect ratio is the ratio of the screen width to the screen height.
[0015] Based on the aspect ratio, a target reference aspect ratio that matches the aspect ratio of the screen is matched;
[0016] The number of pixels per inch is obtained based on the resolution and the device-independent pixels corresponding to the target reference aspect ratio.
[0017] Based on the resolution and the number of pixels per inch, obtain the device-specific pixels of the screen;
[0018] Based on the device-independent pixels of the screen, obtain target rendering parameters that match the device-independent pixels of the screen;
[0019] Based on the target rendering parameters, a projection interface is generated;
[0020] Send and display the projection interface on the electronic device.
[0021] Another objective of this application is to provide an electronic device projection system, including a smart terminal and an electronic device, wherein the smart terminal is communicatively connected to the electronic device; the electronic device includes a screen.
[0022] The smart terminal, in response to establishing a screen projection connection between itself and the electronic device, acquires the screen resolution, obtains the screen aspect ratio based on the resolution (the aspect ratio is the ratio of the screen width to the screen height), matches a target reference aspect ratio that matches the screen aspect ratio, acquires the number of pixels per inch (Pixels per inch) based on the resolution and the device-independent pixels corresponding to the target reference aspect ratio, acquires the appropriate device-independent pixels for the screen based on the resolution and the number of pixels per inch, acquires target rendering parameters that match the appropriate device-independent pixels for the screen, generates a screen projection interface based on the target rendering parameters, and sends the screen projection interface to the electronic device.
[0023] The electronic device receives and displays the projection interface.
[0024] Another object of this application is to provide an electronic device, including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the above-described electronic device screen projection method.
[0025] Another objective of this application is to provide a readable storage medium on which a program or instruction is stored, which, when executed by a processor, implements the above-described electronic device screen projection method.
[0026] The above description is merely an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, specific embodiments of this application are given below. Attached Figure Description
[0027] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0028] Figure 1 This is a flowchart illustrating the steps of a screen mirroring method for an electronic device provided in an embodiment of this application;
[0029] Figure 2 This is one of the flowcharts of another electronic device screen projection method provided in the embodiments of this application;
[0030] Figure 3This is the second flowchart of another method for screen projection on an electronic device provided in the embodiments of this application;
[0031] Figure 4 This is the third step in the flowchart of another electronic device screen projection method provided in the embodiments of this application;
[0032] Figure 5 This is the fourth step in the flowchart of another electronic device screen projection method provided in the embodiments of this application;
[0033] Figure 6 This is the fifth step in a flowchart of another electronic device screen projection method provided in this application embodiment;
[0034] Figure 7 This is the sixth step in the flowchart of another electronic device screen projection method provided in the embodiments of this application;
[0035] Figure 8 This is a schematic diagram of a resource file directory provided in an embodiment of this application;
[0036] Figure 9 This is another schematic diagram of a resource file directory provided in an embodiment of this application;
[0037] Figure 10 This is a schematic diagram of the layout of an electronic device's screen projection effect provided in an embodiment of this application;
[0038] Figure 11 This is a structural block diagram of an electronic device projection system provided in an embodiment of this application;
[0039] Figure 12 This is a structural block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0040] Exemplary embodiments of the present application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the scope of the present application to those skilled in the art.
[0041] In Android development, commonly used units of measurement include pixels (Pixel / px), device-independent pixels (DIP / dip / dp), and scale-independent pixels (SIP / sp), where sp is generally used for font size. Since px is the unit of measurement for pixels, commonly used phone resolutions such as 1920x1080 are all in px. On Android screen resolutions (e.g., 720x1280, 1080x1920, 2280x1080), the same control occupies the same number of pixels across all screen resolutions.
[0042] Because the physical size of a pixel varies across devices with different resolutions, the same connected car application (APP / App / app) often displays very differently when projected onto screens of different resolutions, sometimes exhibiting distortion or layout issues. This is especially true when the interface is complex, as Android's existing resource adaptation solutions are cumbersome and unsatisfactory. Furthermore, there is currently no simple and quick solution for adapting the projected page to its optimal size.
[0043] Related technologies often rely on simple layouts to project content onto screens of different resolutions. For example, the homepage of the projected screen may feature a large entry point or selectable button. When the user clicks on this entry point or button, they enter a full-screen interface. However, when encountering multiple display interfaces with different resolutions, the target content is often simply stretched or tiled. As a result, on screens with lower resolutions or significantly different aspect ratios, the content displays poorly, leading to a poor user experience.
[0044] To address the aforementioned issues, this application, based on Android principles, proposes a method, system, electronic device, and readable storage medium for screen mirroring from an electronic device. By enabling communication connections such as Wi-Fi and Bluetooth, the user opens a mobile app that enables vehicle connectivity on their mobile terminal. The app then connects and mirrors the screen onto in-vehicle devices (supported screens or third-party smart hardware supporting screen mirroring) with different resolutions. The mirrored homepage, weather, radio, voice, and navigation pages automatically adapt to the user interface (UI) design, going beyond simple stretching and filling. This solution adaptively provides excellent display quality on mainstream resolutions such as 800*480, 1920*720, 1280*720, and 1024*600, effectively solving the problem of automatic resolution adaptation after Android screen mirroring. It is simple to integrate, easy to adapt, and provides a permanent solution.
[0045] Since the target content of this application uses dp as the unit, for example, a control with dp as the size unit, the target content represents different pixels on screens with different resolutions and sizes. For example, on a screen with a lower resolution, 1dp may equal 1px, while on a screen with a higher resolution, 1dp may equal 2px. In this way, a control can be displayed with a relatively consistent size on screens with different resolutions.
[0046] In Android, dp is converted to px before rendering. The formulas for converting dp to px include: px = density * dp; density = dpi / 160; px = dp * (dpi / 160).
[0047] The dp in the above formula is calculated based on screen resolution and density, which may vary for each device. Since density is not fixed, the density will definitely be different for each device with different resolutions. This will result in different total dp values corresponding to the width / height of each device. For example, assuming a 480*800 resolution (9:15 aspect ratio) has a density of 1.5, a 1080*1920 resolution (9:16 aspect ratio) has a density of 2.6, and a 1440*2560 resolution (9:16 aspect ratio) has a density of 3.5, then their corresponding total width dp = (width in pixels) / density is 480 / 1.5 = 320 dp, 1080 / 2.6 = 415 dp, and 1440 / 3.5 = 411 dp respectively. As can be seen, when the unit is dp, even screens with the same aspect ratio or a difference between aspect ratios less than a threshold (e.g., 0.1125 (20% of an aspect ratio of 9:16)) still have different device-independent pixels.
[0048] Based on the above, when Android screens use dp as the unit of measurement, each dp represents a pixel, determined by the number of pixels per inch (Dots Per Inch, DPI / dpi) displayed on the device. Since the screen mirroring method provided in this application creates and provides the surface and the displayed interface during mirroring, the dpi can be dynamically generated based on the screen resolution using an algorithm after mirroring. In fact, each Android device also generates its dpi based on the screen density and resolution at the factory.
[0049] Figure 1 This is a flowchart illustrating the steps of a screen projection method for an electronic device according to an embodiment of this application. The electronic device includes a screen, and the method may include:
[0050] Step 101: In response to establishing a screen mirroring connection, obtain the screen resolution;
[0051] In this embodiment of the application, the screen projection connection refers to the connection established between the smart terminal and the electronic device for screen projection; the resolution can be mainstream resolutions such as 800*480, 1920*720, 1280*720, or other non-stream resolutions such as 1280*700, 1280*750; the electronic device can be a vehicle or other devices with a screen, which can be determined according to actual needs and is not limited here.
[0052] In this embodiment of the application, the smart terminal sends a screen mirroring request to the electronic device, then receives connection establishment data returned by the electronic device in response to the screen mirroring request, and then establishes a screen mirroring connection between the smart terminal and the electronic device based on the connection establishment data. When a screen mirroring command input by the user is received, a resolution acquisition request is sent to the electronic device, and the resolution returned by the electronic device in response to the resolution acquisition request is received. The screen mirroring command is used to instruct the smart terminal to mirror the screen on the screen of the electronic device.
[0053] For example, after establishing a screen mirroring connection between the smart terminal and the electronic device, in response to the established screen mirroring connection, when receiving a screen mirroring command input by the user, the device sends a resolution acquisition request to the electronic device. The electronic device acquires the screen resolution as 1920*720, and then sends the resolution 1920*720 to the smart terminal. The smart terminal receives the resolution 1920*720 returned by the electronic device in response to the resolution acquisition request.
[0054] Step 102: Obtain the aspect ratio of the screen based on the resolution.
[0055] In this embodiment of the application, the resolution of the screen of the electronic device includes the screen width and the screen height, and the aspect ratio of the screen is the ratio of the screen width to the screen height, that is, the aspect ratio of the screen = screen width : screen height.
[0056] In this embodiment of the application, after the smart terminal receives the resolution returned by the electronic device, it calculates the ratio between the screen width and the screen height included in the resolution, which is used as the aspect ratio of the screen.
[0057] For example, after the smart terminal receives the resolution of 1920*720 returned by the electronic device, since the screen resolution of the electronic device includes the screen width and screen height, the smart terminal can determine that the screen width of the electronic device is 1920px and the screen height is 720px. The ratio between the screen width and the screen height is calculated to be 1920:720 = 24:9 = 8:3, so the aspect ratio of the screen is 8:3.
[0058] Step 103: Based on aspect ratio, match a target reference aspect ratio that matches the screen's aspect ratio.
[0059] In this embodiment of the application, the smart terminal can obtain a reference aspect ratio that is the same as the calculated aspect ratio, as a target reference aspect ratio that matches the aspect ratio of the screen.
[0060] In this application embodiment, the application can cover the reference aspect ratio corresponding to mainstream market resolutions, see [link to relevant documentation]. Figure 8As shown, from top to bottom, the corresponding aspect ratios are: 1:3, 2:3, 3:3, 4:3, 16:9, and 8:3. The primary principle of adaptation is to calculate the aspect ratio based on the screen resolution, rather than the specific resolution, thus avoiding the need for methods like... Figure 9 The cumbersome and repetitive resource files shown can greatly improve the efficiency of screen mirroring adaptation and save storage space.
[0061] For example, with a resolution of 1280*720, after the smart terminal calculates the aspect ratio as 1280:720 = 16:9, based on this aspect ratio 16:9, if a reference aspect ratio 16:9 that is the same as this aspect ratio 16:9 is obtained, or a reference aspect ratio 16:9 that is in the same reference aspect ratio range (e.g., 17:10 to 15:8) is obtained, then this reference aspect ratio 16:9 is taken as the target reference aspect ratio 16:9 that matches the aspect ratio.
[0062] Step 104: Obtain the number of pixels per inch based on the resolution and the device-independent pixels corresponding to the target reference aspect ratio.
[0063] In this embodiment of the application, after the smart terminal determines the target reference aspect ratio, it queries the reference device-independent pixels corresponding to the target reference aspect ratio from the aspect ratio relationship, and uses them as the device-independent pixels corresponding to the target reference aspect ratio. Then, the resolution and the device-independent pixels corresponding to the target reference aspect ratio are input into the algorithm model with preset coefficients as parameters, and the number of pixels per inch can be calculated.
[0064] In the embodiments of this application, the aspect ratio relationship is the relationship between the reference aspect ratio and the independent pixels of the reference device. The reference aspect ratio refers to the ratio of the screen width to the screen height of the reference resolution. The specific aspect ratio can be determined according to actual needs and is not limited here.
[0065] For example, with a resolution of 1280*720, the calculated aspect ratio is 1280:720 = 16:9. After the smart terminal determines that the target reference aspect ratio is 16:9, it queries the aspect ratio relationship to find the reference device independent pixel 640dp corresponding to the target reference aspect ratio 16:9. Then, the resolution 1280*720 and the reference device independent pixel 640dp corresponding to the target reference aspect ratio 16:9 are input into the algorithm model DPI = px(dp / 160) with a preset coefficient of 160 as the parameter. The number of pixels per inch (DPI) can be calculated as DPI = 1280 / (640 / 160) = 320.
[0066] Step 105: Obtain the screen's device-specific pixels based on resolution and pixels per inch.
[0067] In this embodiment, the device-independent pixel of the screen refers to the screen width and / or screen height when the content of the interface data to be projected in the smart device is expressed in dp units.
[0068] In this embodiment of the application, after the smart terminal determines the number of pixels per inch, it inputs the resolution and the number of pixels per inch into an algorithm model with preset coefficients as parameters, and the appropriate device-independent pixels of the screen can be calculated.
[0069] For example, with a resolution of 1280*720, the calculated aspect ratio is 1280:720 = 16:9. The target reference aspect ratio that matches this aspect ratio is 16:9. The target reference aspect ratio of 16:9 corresponds to 640 dp of device-independent pixels. After the smart terminal calculates the number of pixels per inch (dpi) as 1280 / (640 / 160) = 320 pdi, the resolution of 1280*720 and the number of pixels per inch of 320 pdi are input into the algorithm model DP = px(dpi / 160) with a preset coefficient of 160 as the parameter. The appropriate device-independent pixels of the screen can then be calculated as DP = 1280 / (320 / 160) = 640.
[0070] Step 106: Obtain target rendering parameters that match the screen's device-independent pixels based on the screen's device-independent pixels.
[0071] In this embodiment, the target rendering parameter refers to the reference rendering parameter corresponding to the appropriate device-independent pixels of the screen, which is found in the device-independent pixel relationship. For example: Figure 8-9 The resource folders shown are, for example: valuse-w640dp, valuse-w960dp, valuse-sw1024dp, valuse-sw1280dp; the device-independent pixel relationship is the association between the reference device-independent pixels and the reference rendering parameters. The specific relationship can be determined according to actual needs and is not limited here.
[0072] In this embodiment of the application, after the smart terminal determines the qualified device-independent pixels of the screen, it queries the device-independent pixel relationship to find the reference rendering parameters corresponding to the qualified device-independent pixels of the screen, and uses them as the target rendering parameters that match the qualified device-independent pixels of the screen.
[0073] For example, with a resolution of 1280*720, the calculated aspect ratio is 1280:720 = 16:9. The target reference aspect ratio that matches this aspect ratio is determined to be 16:9. The target reference aspect ratio of 16:9 corresponds to 640 dp of device-independent pixels. The number of pixels per inch (PDI) is 1280 / (640 / 160) = 320 PDI. The qualified device-independent pixels (DIP) is 1280 / (320 / 160) = 640 dp. In the device-independent pixel relationship, the smart terminal queries the resource folder of the reference rendering parameter valuse-w640dp that corresponds to the qualified device-independent pixels of the screen. This resource folder is used as the target rendering parameter valuse-w640dp that matches the qualified device-independent pixels of the screen. This device-independent pixel relationship is the association between the reference device-independent pixels and the reference rendering parameters.
[0074] Step 107: Generate the projection interface based on the target rendering parameters.
[0075] In this embodiment of the application, after the smart terminal determines the target rendering parameters, the target rendering parameters can be used to render the interface data that needs to be projected, thereby obtaining the projected interface.
[0076] For example, with a resolution of 1280*720, the calculated aspect ratio is 1280:720 = 16:9. The target reference aspect ratio that matches this ratio is determined to be 16:9. The target reference aspect ratio of 16:9 corresponds to 640 dp of device-independent pixels. The number of pixels per inch (pDI) is 1280 / (640 / 160) = 320 pdi. The qualified device-independent pixels are 1280 / (320 / 160) = 640 dp. After the smart terminal determines the target rendering parameters (the resource folder values-w640dp) that match the qualified device-independent pixels of 640 dp, it can render the interface data to be projected in real time according to the determined target rendering parameters (the resource folder values-w640dp), thus obtaining the projected interface. See [link to relevant documentation]. Figure 10 The screen mirroring effect is shown in 1920*720 resolution. Also see... Figure 10As shown, 1920:720 = 24:9, 1280:720 = 16:9, and 800:480 = 15:9. It's evident that compared to the projection effect in 1920*720, since the aspect ratio of 1280*720 is 16:9, it can be understood that for screens with resolutions of 1280*720 and 1920*720, the screen height is the same (because DPI design allows for proportional stretching or scaling), but the width of the 1280*720 screen is smaller than the width of the 1920*720 screen. After automatic adjustment, the number of display areas per row compared to the 1920*720 screen... A 1280*720 screen reduces the number of display areas per row, from 6 areas per row in a 1920*720 screen to 4 areas per row in a 1280*720 screen. Similarly, an 800*480 screen has an aspect ratio of 15:9. This can be understood as two screens with the same height but a 15:9 aspect ratio: the 15:9 screen is narrower than the 16:9 screen. To achieve better adaptation, we can use an adaptive solution to reduce the width of each display area on the right side of the 15:9 screen, or adjust the spacing between the display areas per row (the projection effect in 800*480 screens shows a reduced spacing) while still maintaining 4 areas per row.
[0077] Step 108: Send and display the screen mirroring interface on the electronic device.
[0078] In this embodiment of the application, after the smart terminal obtains the projection interface, it sends the projection interface to the electronic device so that the electronic device can display the projection interface on its screen after receiving the projection interface.
[0079] For example, with a resolution of 1280*720, the calculated aspect ratio is 1280:720 = 16:9. The target reference aspect ratio that matches this aspect ratio is determined to be 16:9. The target reference aspect ratio of 16:9 corresponds to 640 dp of device-independent pixels. The number of pixels per inch is 1280 / (640 / 160) = 320 pdi. The qualified device-independent pixels is 1280 / (320 / 160) = 640 dp. The target rendering parameter that matches the qualified device-independent pixels of 640 dp is determined to be a resource folder with values-w640dp. After the smart terminal obtains the projection interface based on the resource folder with the target rendering parameter values-w640dp, it sends the projection interface to the electronic device. After receiving the projection interface, the electronic device displays the projection interface on the screen.
[0080] This application embodiment, in response to establishing a screen mirroring connection, obtains the screen resolution of the electronic device. Based on this resolution, the screen's aspect ratio is calculated. Then, based on this aspect ratio, a target reference aspect ratio is matched, thereby obtaining the device-independent pixels corresponding to the target reference aspect ratio. Based on these device-independent pixels and the resolution, the number of pixels per inch (Pixels per inch) is calculated. Furthermore, based on the Pixels per inch and the resolution, the appropriate device-independent pixels for the screen are calculated. Based on these appropriate device-independent pixels, target rendering parameters matching these appropriate device-independent pixels are obtained. Then, a screen mirroring interface is generated based on these target rendering parameters, and finally, the screen mirroring interface is sent and displayed on the screen of the electronic device. This allows the interface data to be displayed on the screen mirroring interface to adapt to the screen resolution of the electronic device, ensuring that the interface data is displayed clearly and completely on the screen mirroring interface.
[0081] Figure 2 This is one of the flowcharts of another screen projection method for electronic devices provided in this application embodiment. Step 106 may include:
[0082] Step 201: Based on the qualified device-independent pixels of the screen, obtain the target reference device-independent pixels that match the qualified device-independent pixels of the screen.
[0083] In this embodiment of the application, the smart terminal obtains a reference device independent pixel that matches the qualified device independent pixel, and then uses the obtained reference device independent pixel as the target reference device independent pixel.
[0084] For example, the smart terminal obtains a reference device independent pixel that is the same as the qualified device independent pixel, or obtains the maximum value among the reference device independent pixels that is smaller than the qualified device independent pixel, as the target reference device independent pixel.
[0085] Step 202: Based on the target reference device-independent pixels, obtain the reference rendering parameters corresponding to the target reference device-independent pixels, and use them as the target rendering parameters that match the appropriate device-independent pixels of the screen.
[0086] In this embodiment of the application, the smart terminal queries and obtains the reference rendering parameters corresponding to the target reference device-independent pixels in the device-independent pixel relationship, and uses them as the target rendering parameters that match the qualified device-independent pixels of the screen. The device-independent pixel relationship is the association between the reference device-independent pixels and the reference rendering parameters.
[0087] For example, the smart terminal obtains reference rendering parameters corresponding to the target reference device-independent pixels, and uses them as target rendering parameters to match the appropriate device-independent pixels of the screen.
[0088] This application embodiment obtains a target reference device-independent pixel that matches the screen's device-independent pixels based on the screen's device-independent pixels. Then, a reference rendering parameter corresponding to the target reference device-independent pixel can be obtained based on the target reference device-independent pixel, which serves as the target rendering parameter that matches the screen's device-independent pixels. The target rendering parameter can then be used to render the interface data, so that the data in the rendered interface data can be displayed completely and clearly on the screen where it needs to be displayed.
[0089] Figure 3 This is a second flowchart of another method for screen projection on an electronic device provided in this application embodiment. Step 201 may include:
[0090] Step 301: Based on the qualified device-independent pixels of the screen, obtain a reference device-independent pixel that is the same as the qualified device-independent pixel of the screen.
[0091] In this embodiment of the application, the smart terminal acquires reference device independent pixels that are the same as those of the qualified device independent pixels.
[0092] For example, with a resolution of 1280*720, the calculated aspect ratio is 1280:720 = 16:9. The qualified device-independent pixel count is 640dp. The target reference aspect ratio that matches this is 16:9. The device-independent pixel count corresponding to the target reference aspect ratio of 16:9 is 640dp. The number of pixels per inch (PDI) is 1280 / (640 / 160) = 320. The qualified device-independent pixel count is 1280 / (320 / 160) = 640dp. The smart terminal obtains a reference device-independent pixel count of 640dp that is identical to the qualified device-independent pixel count of 640dp.
[0093] Step 302: In response to obtaining a reference device-independent pixel that is the same as the qualified device-independent pixel of the screen, the reference device-independent pixel is used as the target reference device-independent pixel that matches the qualified device-independent pixel of the screen.
[0094] In this embodiment of the application, the smart terminal obtains a reference device independent pixel that is the same as the qualified device independent pixel, and then uses the obtained reference device independent pixel as the qualified device independent pixel.
[0095] For example, with a resolution of 1280*720, the calculated aspect ratio is 1280:720 = 16:9. The target reference aspect ratio that matches the aspect ratio is determined to be 16:9. The target reference aspect ratio of 16:9 corresponds to 640 dp of device-independent pixels. The number of pixels per inch is 1280 / (640 / 160) = 320 pdi. The qualified device-independent pixels are 1280 / (320 / 160) = 640 dp. The smart terminal obtains a reference device-independent pixel of 640 dp that is the same as the qualified device-independent pixel of 640 dp, and then uses the obtained reference device-independent pixel of 640 dp as the qualified device-independent pixel of 640 dp.
[0096] Step 303: In response to the failure to obtain a reference device independent pixel that is the same as the qualified device independent pixel of the screen, obtain a target reference device independent pixel that matches the qualified device independent pixel of the screen based on the reference device independent pixel and the qualified device independent pixel of the screen.
[0097] In this embodiment, the smart terminal acquires a reference device independent pixel that is the same as the qualified device independent pixel. Then, in response to the smart terminal not acquiring a reference device independent pixel that is the same as the qualified device independent pixel on the screen, the reference device independent pixels are sorted from largest to smallest. The qualified device independent pixels are compared with the sorted reference device independent pixels in turn. In response to the qualified device independent pixel being larger than the reference device independent pixel, the reference device independent pixel is used as the target reference device independent pixel that matches the qualified device independent pixel on the screen.
[0098] For example, with a resolution of 1280*700, the calculated aspect ratio is 1280:700 = 16:8.75. The determined target reference aspect ratio that matches this ratio is 16:9. The device-independent pixels corresponding to the target reference aspect ratio of 16:9 are 640 dp. The target reference screen height corresponding to the target reference aspect ratio is 720 px. The number of pixels per inch corresponding to the target reference screen height of 720 px is 320 dpi. The target reference device-independent pixels corresponding to the target reference screen height of 720 px = 720 / (320 / preset coefficient 160) = 360 dp. The number of pixels per inch (DPI) corresponding to the screen height of 700 px is 700 / (360 / 160). =311.1, the qualified device-independent pixel (DP) = screen height 1280 / (311.1 / 160) = 658 dp. The smart terminal acquires a reference device-independent pixel that is the same as the qualified device-independent pixel 658 dp. Then, in response to not acquiring a reference device-independent pixel that is the same as the qualified device-independent pixel 658 dp on the screen, the smart terminal sorts the reference device-independent pixels (e.g., 120 dp, 640 dp, 240 dp, 960 dp, 360 dp, 480 dp) from largest to smallest, and compares the qualified device-independent pixel 658 dp with the sorted reference device-independent pixels (e.g., 960 dp, 640 dp, 480 dp, 360 dp, 240 dp, 120 dp). In response to the fact that the qualified device-independent pixel 658dp is greater than the reference device-independent pixel 640dp, the reference device-independent pixel 640dp is used as the target reference device-independent pixel 640dp to match the qualified device-independent pixel 658dp of the screen.
[0099] This embodiment of the application obtains a reference device-independent pixel that is identical to the qualified device-independent pixel of the screen based on the qualified device-independent pixel of the screen. Then, in response to obtaining a reference device-independent pixel that is identical to the qualified device-independent pixel of the screen, the reference device-independent pixel is used as a target reference device-independent pixel that matches the qualified device-independent pixel of the screen; in response to not obtaining a reference device-independent pixel that is identical to the qualified device-independent pixel of the screen, the target reference device-independent pixel that matches the qualified device-independent pixel of the screen is obtained based on the reference device-independent pixel and the qualified device-independent pixel of the screen. In this way, it can be guaranteed that regardless of whether a reference device-independent pixel that is identical to the qualified device-independent pixel of the screen can be obtained, a target reference device-independent pixel that matches the qualified device-independent pixel of the screen can be obtained.
[0100] Figure 4 This is the third step in the flowchart of another electronic device screen projection method provided in this application embodiment. Step 105 may include:
[0101] Step 401: Obtain the appropriate device-independent pixels of the screen based on the number of pixels per inch, the screen width and / or screen height of the resolution.
[0102] In this embodiment of the application, after the smart terminal determines the number of pixels per inch, it calculates the ratio of the number of pixels per inch to a preset coefficient to obtain a first ratio; the ratio of the screen width to the first ratio, or the ratio of the screen height to the first ratio, is used as the qualified device-independent pixels of the screen.
[0103] For example, with a resolution of 1280*700, the calculated aspect ratio is 1280:700 = 16:8.75. The determined target reference aspect ratio that matches this ratio is 16:9. The device-independent pixels corresponding to the target reference aspect ratio of 16:9 are 640 dp, the target reference screen height corresponding to the target reference aspect ratio is 720 px, and the number of pixels per inch corresponding to the target reference screen height of 720 px is 320 dpi. The target reference device-independent pixels corresponding to the target reference screen height of 720px are 720 / (320 / preset coefficient 160) = 360dp. After the smart terminal determines the number of pixels per inch corresponding to the screen height of 700px as 700 / (360 / 160) = 311.1pdi, the ratio of the number of pixels per inch of 311.1pdi to the preset coefficient 160 is calculated to obtain the first ratio (311.1 / 160). The ratio of the screen width of 1280px to the first ratio (311.1 / 160) is 1280 / (311.1 / 160) = 658, which is taken as the qualified device-independent pixels of the screen. With a resolution of 1290*720, the calculated aspect ratio is 1290:720 = 16.125:9. The determined target reference aspect ratio is 16:9, corresponding to 640 dp of device-independent pixels. The target reference screen width is 720 * (16:9) = 1280 pixels, corresponding to 320 dpi. The target reference device-independent pixels are... 1280 / (320 / preset coefficient 160) = 640dp. After the smart terminal determines the number of pixels per inch corresponding to the screen width of 1290px = 1290 / (640 / 160) = 322.5pdi, then calculate the ratio of the number of pixels per inch of 322.5pdi to the preset coefficient 160 to obtain the first ratio (322.5 / 160). The ratio of the screen width of 1290px to the first ratio (322.5 / 160) of 1290 / (322.5 / 160) = 640 is taken as the qualified device-independent pixels of the screen.
[0104] This application embodiment obtains the appropriate device-independent pixels of the screen based on the screen width of the resolution and the calculated number of pixels per inch. This allows the smart terminal to recalculate the appropriate device-independent pixels corresponding to the number of pixels per inch calculated for the screen resolution, so as to obtain appropriate device-independent pixels adapted to the screen.
[0105] Figure 5 This is the third step in the flowchart of another screen projection method for electronic devices provided in this application embodiment. Step 103 may include:
[0106] Step 501: Obtain a reference aspect ratio that is the same as the aspect ratio.
[0107] In this embodiment of the application, the smart terminal obtains a reference aspect ratio that is the same as the calculated aspect ratio.
[0108] For example, when the resolution is 2560*1440, the smart terminal calculates the ratio of the screen width 2560 to the screen height 1440 included in the resolution as 2560:1440 = 16:9, and then uses this ratio of 16:9 as the aspect ratio of the screen. Then, based on this aspect ratio of 16:9, it obtains a reference aspect ratio that is the same as the calculated aspect ratio.
[0109] Step 502: In response to obtaining a reference aspect ratio that is the same as the aspect ratio, the reference aspect ratio is used as the target reference aspect ratio that matches the aspect ratio.
[0110] In this embodiment of the application, when the smart terminal obtains a reference aspect ratio that is the same as the aspect ratio, the reference aspect ratio is used as the target reference aspect ratio that matches the aspect ratio.
[0111] For example, with a resolution of 2560*1440, the calculated aspect ratio is 2560:1440 = 16:9. When the smart terminal obtains a reference aspect ratio of 16:9 that is the same as the aspect ratio of 16:9, it will use the reference aspect ratio of 16:9 as the target reference aspect ratio of 16:9 that matches the aspect ratio.
[0112] Step 503: In response to the failure to obtain a reference aspect ratio that is the same as the aspect ratio, obtain the target reference aspect ratio range based on the aspect ratio, and take the reference aspect ratio corresponding to the target reference aspect ratio range as the target reference aspect ratio that matches the aspect ratio.
[0113] In this embodiment of the application, when the smart terminal does not obtain a reference aspect ratio that is the same as the aspect ratio, it searches for the target reference aspect ratio range in the aspect ratio range relationship, obtains the reference aspect ratio corresponding to the target reference aspect ratio range, and uses it as the target reference aspect ratio that matches the aspect ratio; the aspect ratio range relationship is the association relationship between the reference aspect ratio and the reference aspect ratio range.
[0114] In this embodiment, the upper limit of the reference aspect ratio range can be an increase of a preset percentage (e.g., 20%, 15%) on the basis of the reference aspect ratio, and the lower limit can be a decrease of a preset percentage (e.g., 20%, 15%) on the basis of the reference aspect ratio. The upper and lower limits of the reference aspect ratio range can also be default values preset in the screen projection system of the smart terminal or electronic device (e.g., the upper limit of the reference aspect ratio range corresponding to a reference aspect ratio of 16:9 is 17:10, and the lower limit of the reference aspect ratio range corresponding to a reference aspect ratio of 16:9 is 15:8). The specific values can be determined according to actual needs and are not limited here.
[0115] For example, with a resolution of 1280*700, the calculated aspect ratio is 1280:700 = 16:8.75. If the smart terminal does not obtain a reference aspect ratio that is the same as 16:8.75, it searches for the target reference aspect ratio range of 16:8.75 within the aspect ratio range relationship. The target reference aspect ratio range of 16:8.75 is 17:10 to 15:8. The reference aspect ratio 16:9 corresponding to the target reference aspect ratio range of 17:10 to 15:8 is obtained as the target reference aspect ratio 16:9 that matches the aspect ratio 16:8.75.
[0116] This application embodiment obtains a reference aspect ratio that is the same as the calculated aspect ratio. Then, in response to obtaining a reference aspect ratio that matches the calculated aspect ratio, this reference aspect ratio is used as a target reference aspect ratio that matches the calculated aspect ratio. In response to not obtaining a reference aspect ratio that matches the calculated aspect ratio, the range of target reference aspect ratios within the calculated aspect ratio is obtained, and the reference aspect ratios corresponding to this range are used as the target reference aspect ratios that match the calculated aspect ratio. This ensures that a target reference aspect ratio that matches the calculated aspect ratio can be obtained regardless of whether a reference aspect ratio that matches the calculated aspect ratio can be obtained.
[0117] Figure 6 This is the fourth step in the flowchart of another screen projection method for electronic devices provided in this application embodiment. Step 104 may include:
[0118] Step 601: Obtain device-independent pixels corresponding to the target reference aspect ratio based on the target reference aspect ratio.
[0119] In this embodiment of the application, the smart terminal queries the reference device-independent pixel corresponding to the target reference aspect ratio in the aspect ratio relationship, and uses it as the device-independent pixel corresponding to the target reference aspect ratio. The aspect ratio relationship is the association relationship between the reference aspect ratio and the reference device-independent pixel.
[0120] For example, with a resolution of 1280*720, the calculated aspect ratio is 1280:720 = 16:9. The target reference aspect ratio that matches the aspect ratio is determined to be 16:9. The smart terminal queries the pre-stored aspect ratio relationship for the reference device-independent pixel 640dp that corresponds to the target reference aspect ratio of 16:9, and uses it as the device-independent pixel corresponding to the target reference aspect ratio of 16:9.
[0121] Step 602: In response to an aspect ratio less than or equal to the target reference aspect ratio, obtain the number of pixels per inch based on the screen width of the device-independent pixels and resolution.
[0122] In this embodiment, in response to an aspect ratio less than or equal to a target reference aspect ratio, the smart terminal calculates a second ratio between the device-independent pixels corresponding to the target reference aspect ratio and a preset coefficient, and uses the ratio of the screen width to the second ratio as the number of pixels per inch corresponding to the aspect ratio.
[0123] For example, with a resolution of 1280*750, the calculated aspect ratio is 1280:750 = 16:9.375. The target reference aspect ratio that matches the aspect ratio is determined to be 16:9. In response to the fact that the aspect ratio 16:9.375 is less than the target reference aspect ratio 16:9, the smart terminal calculates the second ratio (640 / 160) between the device-independent pixels 640dp corresponding to the target reference aspect ratio 16:9 and the preset coefficient 160. The ratio of the screen width 1280px to the second ratio (640 / 160) is 1280 / (640 / 160) = 320, which is taken as the number of pixels per inch corresponding to the aspect ratio.
[0124] Step 603: In response to the aspect ratio being greater than the target reference aspect ratio, obtain the target number of pixels per inch corresponding to the screen height of the resolution based on the screen width and the target reference aspect ratio, and use the target number of pixels per inch as the number of pixels per inch.
[0125] In this embodiment of the application, in response to the aspect ratio being greater than the target reference aspect ratio, the smart terminal can calculate the target number of pixels per inch corresponding to the screen height based on the screen width and the target reference aspect ratio, and then use the target number of pixels per inch as the number of pixels per inch corresponding to the aspect ratio.
[0126] For example, with a resolution of 1280*700, the calculated aspect ratio is 1280:780 = 16:8.75. The target reference aspect ratio that matches this aspect ratio is determined to be 16:9. Since the aspect ratio 16:8.75 is greater than the target reference aspect ratio 16:9, the smart terminal can calculate the target reference screen height based on the screen width of 1280px and the target reference aspect ratio 16:9. Then, the target reference screen height and the corresponding number of pixels per inch are input into an algorithm model with preset coefficients as parameters. This allows the calculation of the target device-independent pixels corresponding to the target reference screen height. Finally, the target device-independent pixels and the screen height are input into the algorithm model with preset coefficients as parameters to calculate the target number of pixels per inch corresponding to the screen height, which is then used as the number of pixels per inch corresponding to the aspect ratio.
[0127] This embodiment of the application obtains device-independent pixels corresponding to a target reference aspect ratio. Then, in response to the aspect ratio being less than or equal to the target reference aspect ratio, the number of pixels per inch (Pixels per inch) can be calculated based on the device-independent pixels and the screen width of the resolution. In response to the aspect ratio being greater than the target reference aspect ratio, the target number of pixels per inch corresponding to the screen height of the resolution is calculated based on the screen width and the target reference aspect ratio, and used as the number of pixels per inch. In this way, it can be ensured that the number of pixels per inch of the screen is calculated regardless of whether the aspect ratio is less than or equal to the target reference aspect ratio or greater than the target reference aspect ratio.
[0128] Figure 7 This is the fourth step in the flowchart of another screen projection method for electronic devices provided in this application embodiment. Step 603 may include:
[0129] Step 701: Obtain the target reference screen height based on the screen width and the target reference aspect ratio.
[0130] In this embodiment of the application, the smart terminal can calculate the ratio of the screen width to the target reference aspect ratio to obtain the target reference screen height.
[0131] For example, with a resolution of 1280*700, the calculated aspect ratio is 1280:700 = 16:8.75. The target reference aspect ratio that matches the aspect ratio is determined to be 16:9. The smart terminal can calculate the ratio of the screen width of 1280px to the target reference aspect ratio of 16:9, which is 1280 / (16:9) = 720, and thus obtain the target reference screen height as 720 (px).
[0132] Step 702: Obtain the target reference device independent pixels corresponding to the target reference screen height based on the target reference screen height and the number of pixels per inch corresponding to the target reference screen height.
[0133] In this embodiment of the application, a third ratio of the number of pixels per inch corresponding to the target reference screen height to a preset coefficient is calculated, and the ratio of the target reference screen height to the third ratio is used as the target reference device independent pixels of the target reference screen height.
[0134] For example, with a resolution of 1280*700, the calculated aspect ratio is 1280:700 = 16:8.75. The target reference aspect ratio that matches the aspect ratio is determined to be 16:9. The device-independent pixels corresponding to the target reference aspect ratio of 16:9 are 640dp. The target reference screen height corresponding to the target reference aspect ratio is 720px. The smart terminal calculates the third ratio (320 / 160) of the number of pixels per inch corresponding to the target reference screen height of 720 (px) and the preset coefficient of 160. The ratio of the target reference screen height of 720 (px) to the third ratio (320 / 160) is 720 / (320 / 160) = 360 (dp), which is taken as the target reference device-independent pixels of the target reference screen height.
[0135] Step 703: Based on the screen height of the target reference device's independent pixels and resolution, obtain the target number of pixels per inch corresponding to the screen height.
[0136] In this embodiment, a fourth ratio of the independent pixels of the target reference device to a preset coefficient is calculated, and the ratio of the screen height to the fourth ratio is used as the target number of pixels per inch corresponding to the screen height.
[0137] For example, with a resolution of 1280*700, the calculated aspect ratio is 1280:700 = 16:8.75. The target reference aspect ratio that matches the aspect ratio is determined to be 16:9. The device-independent pixels corresponding to the target reference aspect ratio of 16:9 are 640dp. The target reference screen height corresponding to the target reference aspect ratio is 720px. The corresponding number of pixels per inch corresponding to the target reference aspect ratio is 320dpi. The target reference device-independent pixels corresponding to the target reference aspect ratio are 720 / (320 / 160) = 360dp. The smart terminal calculates the fourth ratio (360 / 160) between the target reference device-independent pixels of 360dp and the preset coefficient of 160. The ratio of the screen height of 700 (px) to the fourth ratio (360 / 160) is 700 / (360 / 160) as the target number of pixels per inch corresponding to the screen height.
[0138] This embodiment of the application obtains the target reference screen height based on the screen width and the target reference aspect ratio. Then, based on this target reference screen height and the corresponding number of pixels per inch (Pixels per inch), the target reference device-specific pixels corresponding to that height are calculated. Finally, based on the target reference device-specific pixels and the screen height at that resolution, the target number of pixels per inch corresponding to that screen height is calculated. This allows the method to adjust the number of pixels per inch for a specific resolution, preventing the rendered interface data from being incompletely displayed on the projection interface.
[0139] Reference Figure 11 This application provides a structural block diagram of an electronic device projection system 800. The system includes a smart terminal 801 and an electronic device 802, with the smart terminal 801 and the electronic device 802 communicatively connected. The electronic device 802 includes a screen 8021.
[0140] In response to establishing a screen projection connection between the smart terminal 801 and the electronic device 802, the following steps are taken: First, the resolution of the screen 8021 is obtained. Based on the resolution, the aspect ratio of the screen 8021 (the ratio of the screen width to the screen height) is obtained. Then, a target reference aspect ratio that matches the aspect ratio of the screen 8021 is matched. Next, the number of pixels per inch (Pixels per inch) is obtained based on the resolution and the device-independent pixels corresponding to the target reference aspect ratio. Finally, the appropriate device-independent pixels for the screen are obtained based on the resolution and the number of pixels per inch. Based on the appropriate device-independent pixels for the screen 8021, target rendering parameters that match the appropriate device-independent pixels for the screen 8021 are obtained. Based on the target rendering parameters, a screen projection interface is generated and sent to the electronic device 802.
[0141] Electronic device 802 receives and displays the screen projection interface.
[0142] This application provides an electronic device screen projection system. In response to establishing a projection connection, a smart terminal obtains the screen resolution of the electronic device. Based on this resolution, the screen's aspect ratio is calculated. Then, a target reference aspect ratio is matched to this aspect ratio, thereby obtaining the device-independent pixels corresponding to the target reference aspect ratio. Based on the device-independent pixels and the resolution, the number of pixels per inch (Pixels per inch) is calculated. Then, based on the number of pixels per inch and the resolution, the appropriate device-independent pixels for the screen are calculated. Based on the appropriate device-independent pixels, target rendering parameters matching these appropriate device-independent pixels are obtained. Then, a projection interface is generated based on these target rendering parameters, and finally, the projection interface is sent and displayed on the screen of the electronic device. This allows the interface data to be displayed on the projection screen to adapt to the screen resolution of the electronic device, ensuring that the interface data is clearly and completely displayed on the projection interface.
[0143] Reference Figure 12 This application provides a structural block diagram of an electronic device 900. The electronic device 900 shown is merely an example and should not impose any limitations on the function and scope of use of the embodiments of the present invention.
[0144] like Figure 8 As shown, the electronic device 900 is presented in the form of a general-purpose computing device. The components of the electronic device 900 may include, but are not limited to: one or more processors 901 or processing units, a memory 902, a bus 903 connecting different system components (including the memory 902 and the processor 901), and computer instructions stored in the memory 902 and executable on the processor 901. When the computer instructions are executed by the processor 901, the above-mentioned electronic device screen projection method is implemented.
[0145] Bus 903 represents one or more of several bus architectures, including memory buses or memory controllers, peripheral buses, graphics acceleration ports, processors, or local buses using any of the various bus architectures. Examples of these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0146] Electronic device 900 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by electronic device 900, including volatile and non-volatile media, removable and non-removable media.
[0147] Memory 902 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 9021 and / or cache memory 9022. Electronic device 900 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 9023 may be used to read and write non-removable, non-volatile magnetic media (not shown in Figure 12, commonly referred to as a "hard disk drive"). Although Figure 12 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 903 via one or more data media interfaces. Memory 902 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.
[0148] A program / utility 9024 having a set (at least one) of program modules 90241 may be stored, for example, in memory 902. Such program modules 90241 include—but are not limited to—an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 90241 typically perform the functions and / or methods described in the embodiments of the present invention.
[0149] Electronic device 900 can also communicate with one or more external devices 905 (e.g., keyboard, pointing device, display 906, etc.), and with one or more devices that enable a user to interact with electronic device 900, and / or with any device that enables electronic device 900 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (904). Furthermore, electronic device 900 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 907. As shown, network adapter 907 communicates with other modules of electronic device 900 via bus 903. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 900, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0150] This application provides an electronic device that, in response to establishing a screen mirroring connection via a smart terminal, obtains the screen resolution of the electronic device. Based on this resolution, the screen's aspect ratio is calculated. Then, based on this aspect ratio, a target reference aspect ratio is matched, thereby obtaining the device-independent pixels corresponding to the target reference aspect ratio. Based on the device-independent pixels and the resolution, the number of pixels per inch (Pixels per inch) is calculated. Furthermore, based on the number of pixels per inch and the resolution, the appropriate device-independent pixels for the screen are calculated. Based on the appropriate device-independent pixels, target rendering parameters matching the appropriate device-independent pixels are obtained. Then, a screen mirroring interface is generated based on the target rendering parameters, and finally, the screen mirroring interface is sent and displayed on the screen of the electronic device. This allows the interface data to be displayed on the screen to adapt to the screen resolution of the electronic device, ensuring that the interface data is clearly and completely displayed on the screen mirroring interface.
[0151] This application provides a readable storage medium storing computer instructions, which, when executed by a processor, implement the above-described electronic device screen projection method.
[0152] This application provides a computer storage medium that, in response to establishing a screen mirroring connection via a smart terminal, obtains the screen resolution of the electronic device. Based on this resolution, the screen's aspect ratio is calculated. Then, based on this aspect ratio, a target reference aspect ratio is matched, thereby obtaining the device-independent pixels corresponding to the target reference aspect ratio. Based on the device-independent pixels and the resolution, the number of pixels per inch (Pixels per inch) is calculated. Furthermore, based on the number of pixels per inch and the resolution, the appropriate device-independent pixels for the screen are calculated. Based on the appropriate device-independent pixels, target rendering parameters matching the appropriate device-independent pixels are obtained. Then, a screen mirroring interface is generated based on the target rendering parameters, and finally, the screen mirroring interface is sent and displayed on the screen of the electronic device. This allows the interface data to be displayed on the screen to adapt to the screen resolution of the electronic device, ensuring that the interface data is clearly and completely displayed on the screen mirroring interface.
[0153] Those skilled in the art will understand that this application includes devices for performing one or more of the operations described in this application. These devices may be specifically designed and manufactured for the desired purpose, or may include known devices found in general-purpose computers. These devices have computer programs stored therein that can be selectively activated or reconfigured. Such computer programs may be stored in a storage medium of the device (e.g., a computer) or in any type of medium suitable for storing electronic instructions and respectively coupled to a bus. This computer storage medium includes, but is not limited to, any type of disk (including floppy disks, hard disks, optical disks, CD-ROMs, and magneto-optical disks), ROM (Read-Only Memory), RAM (Random Access Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory, magnetic cards, or optical cards. That is, the storage medium includes any medium by which a device (e.g., a computer) stores or transmits information in a readable form.
[0154] Those skilled in the art will understand that each block in these structural diagrams and / or block diagrams and / or flowcharts, as well as combinations of blocks in these structural diagrams and / or block diagrams and / or flowcharts, can be implemented using computer program instructions. Those skilled in the art will also understand that these computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing method for implementation, thereby enabling the processor of the computer or other programmable data processing method to execute the schemes specified in the blocks or plurality of blocks of the structural diagrams and / or block diagrams and / or flowcharts disclosed in this application.
[0155] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for projecting a screen from an electronic device, wherein the electronic device includes a screen, characterized in that, The method includes: In response to establishing a screen mirroring connection, the resolution of the screen is obtained; Based on the resolution, the aspect ratio of the screen is obtained; the aspect ratio is the ratio of the screen width to the screen height. Based on the aspect ratio, a target reference aspect ratio that matches the aspect ratio of the screen is matched; The number of pixels per inch is obtained based on the resolution and the device-independent pixels corresponding to the target reference aspect ratio. Based on the resolution and the number of pixels per inch, obtain the device-specific pixels of the screen; Based on the device-independent pixels of the screen, obtain target rendering parameters that match the device-independent pixels of the screen; Based on the target rendering parameters, a projection interface is generated; Send and display the projection interface on the electronic device; The resolution includes the screen width and the screen height.
2. The method according to claim 1, characterized in that, The step of obtaining target rendering parameters that match the device-independent pixels of the screen based on the device-independent pixels of the screen includes: Based on the qualified device-independent pixels of the screen, obtain a target reference device-independent pixel that matches the qualified device-independent pixels of the screen; Based on the target reference device-independent pixels, obtain reference rendering parameters corresponding to the target reference device-independent pixels, and use them as target rendering parameters that match the appropriate device-independent pixels of the screen.
3. The method according to claim 2, characterized in that, The step of obtaining a target reference device-independent pixel that matches the eligible device-independent pixel of the screen, based on the eligible device-independent pixels of the screen, includes: Based on the qualified device-independent pixels of the screen, obtain reference device-independent pixels that are the same as the qualified device-independent pixels of the screen; In response to obtaining a reference device independent pixel that is the same as the qualified device independent pixel of the screen, the reference device independent pixel is used as the target reference device independent pixel that matches the qualified device independent pixel of the screen; In response to the failure to obtain a reference device independent pixel that is the same as the qualified device independent pixel of the screen, a target reference device independent pixel that matches the qualified device independent pixel of the screen is obtained based on the reference device independent pixel and the qualified device independent pixel of the screen.
4. The method according to claim 1, characterized in that, The step of obtaining the device-specific pixels of the screen based on the resolution and the number of pixels per inch includes: Based on the pixels per inch, the screen width and / or screen height of the resolution, obtain the eligible device-independent pixels of the screen.
5. The method according to claim 1, characterized in that, The step of matching a target reference aspect ratio that matches the aspect ratio of the screen, based on the aspect ratio, includes: Based on the aspect ratio, obtain a reference aspect ratio that is the same as the aspect ratio. In response to obtaining a reference aspect ratio that is the same as the aspect ratio, the reference aspect ratio is used as a target reference aspect ratio that matches the aspect ratio. In response to the failure to obtain a reference aspect ratio that is the same as the aspect ratio, the target reference aspect ratio range in which the aspect ratio is located is obtained based on the aspect ratio, and the reference aspect ratio corresponding to the target reference aspect ratio range is taken as the target reference aspect ratio that matches the aspect ratio.
6. The method according to claim 1, characterized in that, The step of obtaining the number of pixels per inch based on the resolution and the device-independent pixels corresponding to the target reference aspect ratio includes: Based on the target reference aspect ratio, obtain the device-independent pixels corresponding to the target reference aspect ratio; In response to the aspect ratio being less than or equal to the target reference aspect ratio, the number of pixels per inch is obtained based on the device-independent pixels and the screen width of the resolution; In response to the aspect ratio being greater than the target reference aspect ratio, the target number of pixels per inch corresponding to the screen height of the resolution is obtained based on the screen width and the target reference aspect ratio, and the target number of pixels per inch is used as the number of pixels per inch.
7. The method according to claim 6, characterized in that, The step of obtaining the target number of pixels per inch corresponding to the screen height of the resolution based on the screen width and the target reference aspect ratio includes: The target reference screen height is obtained based on the screen width and the target reference aspect ratio. Based on the target reference screen height and the number of pixels per inch corresponding to the target reference screen height, obtain the target reference device independent pixels corresponding to the target reference screen height; Based on the independent pixels of the target reference device and the screen height of the resolution, obtain the target number of pixels per inch corresponding to the screen height.
8. A screen projection system for electronic devices, characterized in that, It includes a smart terminal and an electronic device, wherein the smart terminal is communicatively connected to the electronic device; the electronic device includes a screen; The smart terminal, in response to establishing a screen projection connection between the smart terminal and the electronic device, obtains the resolution of the screen, and obtains the aspect ratio of the screen based on the resolution, wherein the aspect ratio is the ratio of the screen width to the screen height. Based on the aspect ratio, a target reference aspect ratio that matches the aspect ratio of the screen is matched; the number of pixels per inch is obtained based on the resolution and the device-independent pixels corresponding to the target reference aspect ratio; the appropriate device-independent pixels of the screen are obtained based on the resolution and the number of pixels per inch; target rendering parameters that match the appropriate device-independent pixels of the screen are obtained based on the appropriate device-independent pixels of the screen; a projection interface is generated based on the target rendering parameters, and the projection interface is sent to the electronic device. The electronic device receives and displays the projection interface; The resolution includes the screen width and the screen height.
9. An electronic device, characterized in that, It includes a processor, a memory, and computer instructions stored in the memory and executable on the processor, wherein the computer instructions, when executed by the processor, implement the electronic device projection method as described in any one of claims 1-7.
10. A readable storage medium, characterized in that, The readable storage medium stores computer instructions, which, when executed by a processor, implement the electronic device screen projection method as described in any one of claims 1-7.
Citation Information
Patent Citations
Screen projection method and device and storage medium
CN112114765A
Front-end screen projection method adaptive to different large screen resolutions
CN113253959A
