Window self-adaption method and system during change of resolution and pixel density of display
By monitoring events and calculating the scaling ratio, adaptively adjusting the size and position of the split-screen window, the stretching, blurring or jagged feeling problems arise during the adaptation of split-screen windows in high-definition screen systems, and the clear display of images and interface elements in high-definition screen systems is achieved.
Patent Information
- Application Number
- CN202311780613.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-22
- Publication Date
- 2025-06-24
AI Technical Summary
In high-definition screen systems, when the split-screen windows corresponding to the application are adapted to the screen, they may cause conventional-size images or interface elements to appear stretched, enlarged, blurred, or jagged when displayed.
By listening to events in split-screen windows, such as new creation, mobile, system resolution or display DPI changes, obtain the resolution and DPI of the current monitor, calculate the scaling ratio, and adaptively adjust the size and position of the split-screen window according to the scaling ratio, and automatically adjust the layout.
It effectively solves the stretching, blur or jagged feeling problems that occur during split-screen window adaptation in high-definition screen systems, ensuring that the image and interface elements are presented clearly and delicately on high-density screens.
Smart Images

Figure CN120201245A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of window adaptation, and particularly to a window adaptation method and system when the pixel density of the display resolution changes. Background Art
[0002] A high-definition screen system generally refers to a display screen system with high resolution and high pixel density (PPI or DPI, the number of pixels per inch). The characteristics of a high-definition screen system are that it can display more pixels, making images and texts clearer and more delicate. A high-definition screen system usually includes a high-resolution liquid crystal display (LCD) or an organic light-emitting diode (OLED) screen.
[0003] The main characteristics of a high-definition screen system include:
[0004] (1) High resolution: A high-definition screen has more pixels, such as 1080p (Full HD), 2K, 4K or higher resolution. Such a resolution can present more details and is very useful for graphic design, video editing and other tasks that require high-precision display.
[0005] (2) High pixel density (PPI or DPI): PPI or DPI represents the number of pixels per inch. A high-definition screen usually has a higher PPI or DPI, making images and texts sharper and avoiding the jagged feeling on traditional screens.
[0006] (3) Color accuracy: A high-definition screen usually has higher color accuracy and can display a wider range of colors, which is suitable for graphic design, video editing and professional visual art tasks.
[0007] While a high-definition screen system provides a better visual experience, it also brings some challenges, such as the adaptation of application programs to split-screen windows. Therefore, when developing and designing application programs, the characteristics of high-definition screens need to be considered to ensure a good user experience on these systems.
[0008] For the adaptation of application programs to split-screen windows, in a high-definition screen system, the default adaptation may cause regular-sized images or interface elements to appear stretched, enlarged, blurred or jagged when displayed. This is usually related to resolution and scaling. A high-definition screen usually has a higher pixel density (PPI or DPI), so more pixels are compressed into the same physical size. If the resolution (number of pixels) of an image or interface element is not sufficient to adapt to a high-density screen, the system may stretch the image to fill the screen, resulting in distortion. And the operating system may apply a scaling factor to ensure that the elements are presented in an appropriate size on a high-density screen. If the scaling is not properly handled, it may cause the image to be stretched, showing blurring or jaggedness. Summary of the Invention
[0009] In view of the above problems, the purpose of the present invention is to provide a window adaptation method and system when the pixel density of the display resolution changes, so as to adaptively adjust the split screen window when the pixel density of the display resolution changes, and solve the problem that in a high-definition screen system, when the split screen window corresponding to an application program is performing screen adaptation, the default adaptation may cause problems such as stretching, blurring or jaggedness when displaying regular-sized images or interface elements.
[0010] The above object of the present invention is achieved by the following technical solutions:
[0011] A window adaptation method when the pixel density of the display resolution changes, including the following steps:
[0012] S1: When an event including creating a new split screen window, moving the split screen window, changing the system resolution or the display DPI is monitored, obtain the resolution and the display DPI of the current monitor where the split screen window is located;
[0013] S2: Calculate the scaling ratio of the current monitor according to the display DPI of the current monitor;
[0014] S3: Adaptively adjust the size and position of the split screen window according to the scaling ratio and the original information of the split screen window, and automatically adjust the layout of the split screen window.
[0015] Further, in step S1, when an event including creating the new split screen window, moving the split screen window, changing the system resolution or the display DPI is monitored, obtaining the resolution and the display DPI of the monitor where the split screen window is located is specifically:
[0016] When an event of creating the new split screen window is monitored, create the split screen window through the creation interface of the split screen window, and at the same time obtain the resolution and the display DPI of the current monitor where the split screen window is located;
[0017] When an event of moving the split screen window is monitored, obtain the current monitor of the currently moving split screen window according to a preset rule, and obtain the resolution and the display DPI of the current monitor;
[0018] When an event of changing the system resolution or the display DPI is monitored, traverse each split screen window, obtain the current monitor of each split screen window according to the preset rule, and obtain the resolution and the display DPI of the current monitor.
[0019] Further, when an event of moving the split-screen window and an event of the system changing the resolution or the monitor DPI are monitored, the preset rules are specifically as follows:
[0020] When the split-screen window is completely within the range of a certain monitor, obtain the monitor as the current monitor of the split-screen window;
[0021] When the split-screen window spans dual monitors, if the area ratio of one of the monitors is greater than 3 / 4, take the monitor with the area ratio greater than 3 / 4 as the current monitor of the split-screen window; otherwise, take the default monitor when the split-screen window is created as the current monitor;
[0022] When the split-screen window spans more than 3 monitors, obtain the monitor with the largest area ratio of the split-screen window as the current monitor.
[0023] Further, in step S2, calculate the scaling ratio of the current monitor according to the monitor DPI of the current monitor, specifically as follows:
[0024] The scaling ratio = the monitor DPI of the current monitor * 100 / the default monitor DPI of the current monitor without scaling.
[0025] Further, in step S3, adapt the window size and position of the split-screen window according to the scaling ratio and the original information of the split-screen window, specifically as follows:
[0026] When an event of creating the split-screen window or moving the split-screen window is monitored, obtain the original window size information including the width and height in the original information of the split-screen window, calculate the new window size information according to the scaling ratio and the original window size information, and the split-screen window is displayed on the monitor with the new window size information;
[0027] When an event of the system changing the resolution or the monitor DPI is monitored, obtain the original window size information including the width and height in the original information of the split-screen window, calculate the new window size information according to the scaling ratio and the original window size information, and calculate the relative position of the split-screen window on the current monitor according to the resolution, the monitor DPI, and the scaling ratio before adjustment, and adapt the display of the split-screen window on the monitor with the new window size information and the relative position.
[0028] Further, when calculating the new window size information according to the scaling ratio and the original window size information, it further includes:
[0029] Determine whether the display DPI of the current display before adaptive adjustment is in a scaled state. If it is in a scaled state, perform reverse calculation according to the calculation formula of the scaling ratio to obtain the original window size information including width and height of the split screen window in the non-scaled state;
[0030] Calculate the new window size information based on the original window size information including width and height in the non-scaled state and the scaling ratio.
[0031] Further, in step S3, automatically adjust the layout of the split screen window, specifically:
[0032] Before scaling, count the positions, widths, heights and distribution ratios of each sub-window in the split screen window, and reset the positions, widths, heights and distribution ratios of each sub-window according to the scaling ratio;
[0033] Adjust other UI information including font size, line thickness and pictures in the split screen window according to the scaling ratio.
[0034] A window adaptive system for a display resolution pixel density change, which is used to execute the window adaptive method when the display resolution pixel density changes as described above, includes:
[0035] An event listening module, which is used to obtain the resolution and the display DPI of the current display where the split screen window is located when an event including creating a new split screen window, moving the split screen window, changing the system resolution or the display DPI is monitored;
[0036] A scaling ratio calculation module, which is used to calculate the scaling ratio of the current display according to the display DPI of the current display;
[0037] An adaptive adjustment module, which is used to perform window size and position adaptation on the split screen window according to the scaling ratio and the original information of the split screen window, and automatically adjust the layout of the split screen window.
[0038] A computer device includes a memory and one or more processors. When computer code stored in the memory is executed by the one or more processors, the one or more processors execute the method as described above.
[0039] A computer-readable storage medium stores computer code, and when the computer code is executed, the method as described above is executed.
[0040] Compared with the prior art, the beneficial effects of the present invention are:
[0041] By providing a method for window adaptation when the pixel density of the display resolution changes, including: S1: When an event including creating a split-screen window, moving the split-screen window, changing the system resolution or the display DPI is monitored, obtain the resolution and the display DPI of the current display where the split-screen window is located; S2: Calculate the scaling ratio of the current display according to the display DPI of the current display; S3: According to the scaling ratio and the original information of the split-screen window, perform window size and position adaptation on the split-screen window, and automatically adjust the layout of the split-screen window. The above technical solution adaptively adjusts the split-screen window when the pixel density of the display resolution changes, and solves the problem that in a high-definition screen system, when the split-screen window corresponding to an application program is performing screen adaptation, the default adaptation may cause regular-sized images or interface elements to appear stretched, enlarged, blurred or jagged when displayed. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 It is the overall flowchart of the method for window adaptation when the pixel density of the display resolution of the present invention changes;
[0043] Figure 2 It is the detailed flowchart of the method for window adaptation when the pixel density of the display resolution of the present invention changes;
[0044] Figure 3 It is the comparison diagram of the effects before and after adopting the method for window adaptation when the pixel density of the display resolution of the present invention changes;
[0045] Figure 4 It is the overall structure diagram of the system for window adaptation when the pixel density of the display resolution of the present invention changes. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0046] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Apparently, the described embodiments are some but not all of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0047] Those skilled in the art of the present technology can understand that unless specifically stated otherwise, the singular forms "a", "an", "the" and "said" used herein may also include the plural forms. It should be further understood that the term "including" used in the specification of the present invention means the presence of the described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or their groups.
[0048] First Embodiment
[0049] As Figure 1 and 2 shown, this embodiment provides a method for window adaptation when the pixel density of the display resolution changes, including the following steps:
[0050] S1: When an event including creating a split-screen window, moving the split-screen window, changing the system resolution or the display DPI is monitored, obtain the resolution and the display DPI of the current monitor where the split-screen window is located.
[0051] Specifically, in this embodiment, when it is necessary to adaptively adjust the split-screen window according to the change of the pixel density of the display resolution, it is first necessary to obtain the resolution of the current monitor and the display DPI according to the type of the specific operation event monitored.
[0052] (1) When an event of creating the split-screen window is monitored, create the split-screen window through the creation interface of the split-screen window, and at the same time obtain the resolution and the display DPI of the current monitor where the split-screen window is located.
[0053] For example, in this embodiment, the split-screen window is created through the CreateWindow interface. According to the size of the created split-screen window, the MontiorFromWindow interface is called to obtain the current monitor where the split-screen window is located, and then the GetMonitorInfo interface is used to obtain the logical pixel information (resolution) of the current monitor and the GetDpiForMontior interface is used to obtain the display DPI information.
[0054] The calls of the MontiorFromWindow interface, the GetMonitorInfo interface and the GetDpiForMontior interface are as follows:
[0055] / / Obtain the monitor to which the dialog box handle belongs
[0056] HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
[0057] / / Obtain the display resolution
[0058] GetMonitorInfo(hMonitor, &monitorinfo);
[0059] / / Obtain the display DPI
[0060] GetDpiForMonitor(hMonitor, MDT_EFFECTIVE_DPI, &dpiX, &dpiY);
[0061] (2) When an event of moving the split screen window is monitored, obtain the current monitor of the split screen window being moved currently according to a preset rule, and obtain the resolution and the monitor DPI of the current monitor.
[0062] For example, in this embodiment, monitor the window move WM_MOVE message event triggered when moving the split screen window, obtain the current position of the split screen window in the message event, and then obtain the resolution and the monitor DPI of the current monitor where it is located.
[0063] (3) When an event of the system changing the resolution or the monitor DPI is monitored, traverse each split screen window, obtain the current monitor of each split screen window according to the preset rule, and obtain the resolution and the monitor DPI of the current monitor.
[0064] For example, in this embodiment, when changing the resolution or the monitor DPI in the system settings, the system will send a change event to the split screen windows of all programs on the current desktop. Monitor this change event in the program. After this change event is triggered, obtain the resolution and the monitor DPI of the current monitor where the split screen window is located.
[0065] Meanwhile, further, when an event of moving the split screen window and an event of the system changing the resolution or the monitor DPI are monitored, it is necessary to judge the current monitor corresponding to the split screen window according to a preset rule, which specifically includes the following situations:
[0066] (1) When the split screen window is completely within the range of a certain monitor, obtain this monitor as the current monitor of the split screen window.
[0067] (2) When the split screen window straddles two monitors, if the area ratio of one of the monitors is greater than 3 / 4, take the monitor with the area ratio greater than 3 / 4 as the current monitor of the split screen window;
[0068] Otherwise, take the default monitor when creating the split screen window as the current monitor, that is, when the area ratios of the split screen window in the two monitors are 1 / 2 respectively, or approaching 1 / 2, take the default monitor when creating the split screen window as the current monitor.
[0069] (3) When the split screen window straddles more than 3 monitors, obtain the monitor with the largest area ratio of the split screen window as the current monitor.
[0070] S2: Calculate the scaling ratio of the current display according to the display DPI of the current display.
[0071] Specifically, the scaling ratio = the display DPI of the current display * 100 / the default display DPI of the current display without scaling. In this embodiment, the default display DPI of the current display without scaling is 96, that is, in this embodiment, the formula is: scaling ratio = the display DPI of the current display * 100 / 96.
[0072] S3: Adapt the window size and position of the split screen window according to the scaling ratio and the original information of the split screen window, and automatically adjust the layout of the split screen window.
[0073] In this embodiment, adapting the window size and position of the split screen window according to the scaling ratio and the original information of the split screen window is specifically as follows:
[0074] (1) When an event of creating the split screen window or moving the split screen window is monitored, obtain the original window size information including width and height in the original information of the split screen window, calculate the new window size information according to the scaling ratio and the original window size information, and the split screen window is displayed on the display with the new window size information.
[0075] (2) When an event of changing the system resolution or the display DPI is monitored, obtain the original window size information including width and height in the original information of the split screen window, calculate the new window size information according to the scaling ratio and the original window size information, and calculate the relative position of the split screen window in the current display according to the resolution, the display DPI and the scaling ratio before adjustment, and adapt the display of the split screen window on the display with the new window size information and the relative position.
[0076] For example, in this embodiment, the width and height (pixel values) and the relative position (coordinates of the upper left corner of the window on the corresponding display) of the split screen window are obtained through the GetWindowRect interface, and the current display information is obtained through GetMonitorInfo. Multiply the width, height and relative position of the split screen window statistically before by the scaling ratio to obtain the scaled width, height and position. (Note: For modern operating systems such as WIN10 / 11, this step will be completed by the system; but for other operating systems such as WIN7, the program needs to implement it by itself).
[0077] Further, when calculating the new window size information according to the scaling ratio and the original window size information, it further includes:
[0078] Determine whether the display DPI of the current display before adaptation is in a scaled state. If it is in a scaled state, perform reverse calculation according to the calculation formula of the scaling ratio to obtain the original window size information including width and height of the split-screen window in the non-scaled state; calculate the new window size information based on the original window size information including width and height in the non-scaled state and the scaling ratio. For example: Suppose the width of the split-screen window before adaptation is 150 and the scaling ratio of the display DPI before adaptation is 150%. The width of the split-screen window without scaling = 150 / 1.5.
[0079] Further, in step S3, automatically adjust the layout of the split-screen window, specifically:
[0080] Before scaling, count the positions, widths, heights, and distribution ratios of each sub-window in the split-screen window. In this embodiment, the positions and widths and heights of the sub-windows are obtained through the GetClientRect function, and the distribution ratio is calculated as the occupancy ratio of the sub-window area in the split-screen window. Each sub-window resets its position, width, height, and distribution ratio according to the previously counted data multiplied by the scaling ratio.
[0081] Other UI information including font size, line thickness, and pictures in the split-screen window is multiplied by the scaling ratio to adapt to the display.
[0082] The front and back effects after adjustment by the window adaptation method when the pixel density of the display resolution changes in the above embodiment are as Figure 3 shown.
[0083] Second Embodiment
[0084] As Figure 4 shown, this embodiment provides a window adaptation system when the pixel density of the display resolution changes for executing the window adaptation method when the pixel density of the display resolution changes in the first embodiment, including:
[0085] Event listening module 1, used to obtain the resolution and the display DPI of the current display where the split-screen window is located when an event including creating a new split-screen window, moving the split-screen window, changing the system resolution or the display DPI is monitored;
[0086] Scaling ratio calculation module 2, used to calculate the scaling ratio of the current display according to the display DPI of the current display;
[0087] Adaptive adjustment module 3, used to perform window size and position adaptation on the split-screen window according to the scaling ratio and the original information of the split-screen window, and automatically adjust the layout of the split-screen window.
[0088] A computer-readable storage medium stores computer code, and when the computer code is executed, the above method is executed. Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing relevant hardware through a program, and this program can be stored in a computer-readable storage medium. The storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc.
[0089] The above are only the preferred embodiments of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions falling within the concept of the present invention belong to the protection scope of the present invention. It should be noted that for those of ordinary skill in the art in this technical field, several improvements and refinements made without departing from the principle of the present invention should also be regarded as within the protection scope of the present invention.
[0090] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as within the scope described in this specification.
[0091] It should be noted that the above embodiments can be freely combined as needed. The above are only the preferred embodiments of the present invention. It should be pointed out that for those of ordinary skill in the art in this technical field, several improvements and refinements can be made without departing from the principle of the present invention, and these improvements and refinements should also be regarded as within the protection scope of the present invention.
Claims
1. A window adaptation method when the pixel density of the display resolution changes, characterized in that It includes the following steps: S1: When an event including creating a new split-screen window, moving the split-screen window, changing the system resolution or the monitor DPI is monitored, obtain the resolution and the monitor DPI of the current monitor where the split-screen window is located; S2: Calculate the scaling ratio of the current monitor according to the monitor DPI of the current monitor; S3: According to the scaling ratio and the original information of the split-screen window, perform window size and position adaptation on the split-screen window, and automatically adjust the layout of the split-screen window.
2. The window adaptation method when the pixel density of the display resolution changes according to claim 1, characterized in that In step S1, when an event including creating the new split-screen window, moving the split-screen window, changing the system resolution or the monitor DPI is monitored, obtain the resolution and the monitor DPI of the monitor where the split-screen window is located. Specifically: When the event of creating the new split-screen window is monitored, create the split-screen window through the creation interface of the split-screen window, and at the same time obtain the resolution and the monitor DPI of the current monitor where the split-screen window is located; When the event of moving the split-screen window is monitored, obtain the current monitor of the currently moving split-screen window according to a preset rule, and obtain the resolution and the monitor DPI of the current monitor; When the event of changing the system resolution or the monitor DPI is monitored, traverse each split-screen window, obtain the current monitor of each split-screen window according to the preset rule, and obtain the resolution and the monitor DPI of the current monitor.
3. The window self-adaptive method when the pixel density of the display resolution changes according to claim 2, wherein, When the event of moving the split-screen window and the event of changing the system resolution or the monitor DPI are monitored, the preset rule is specifically: When the split-screen window is completely within the range of a certain monitor, obtain the monitor as the current monitor of the split-screen window; When the split-screen window spans dual monitors, if the area ratio of one of the monitors is greater than 3 / 4, use the monitor with the area ratio greater than 3 / 4 as the current monitor of the split-screen window, otherwise use the default monitor when creating the split-screen window as the current monitor; When the split-screen window spans more than 3 monitors, obtain the monitor with the largest area ratio of the split-screen window as the current monitor.
4. The window adaptation method when the pixel density of the display resolution changes according to claim 1, characterized in that, In step S2, calculate the scaling ratio of the current monitor according to the monitor DPI of the current monitor. Specifically: The scaling ratio = the monitor DPI of the current monitor * 100 / the default monitor DPI of the current monitor without scaling.
5. The window adaptation method when the pixel density of the display resolution changes according to claim 1, characterized in that In step S3, according to the scaling ratio and the original information of the split-screen window, perform window size and position adaptation on the split-screen window. Specifically: When an event of creating the split screen window or moving the split screen window is monitored, obtain the original window size information including width and height in the original information of the split screen window, calculate the new window size information according to the scaling ratio and the original window size information, and the split screen window is displayed on the display with the new window size information; When an event of a change in the system resolution or the display DPI is monitored, obtain the original window size information including width and height in the original information of the split screen window, calculate the new window size information according to the scaling ratio and the original window size information, and calculate the relative position of the split screen window on the current display according to the resolution, the display DPI and the scaling ratio before adjustment, and adaptively display the split screen window on the display with the new window size information and the relative position.
6. The window adaptation method when the pixel density of the display resolution changes according to claim 5, characterized in that, When calculating the new window size information according to the scaling ratio and the original window size information, it further includes: Judge whether the display DPI of the current display before adaptation is in a scaled state. If it is in a scaled state, perform reverse calculation according to the calculation formula of the scaling ratio to obtain the original window size information including width and height of the split screen window in a non-scaled state; Calculate the new window size information with the original window size information including width and height in a non-scaled state and the scaling ratio.
7. The window adaptation method when the pixel density of the display resolution changes according to claim 1, characterized in that In step S3, automatically adjust the layout of the split screen window, specifically: Before scaling, count the positions, widths, heights and distribution ratios of the sub-windows in the split screen window, and reset the positions, widths, heights and distribution ratios of each sub-window according to the scaling ratio; Adjust other UI information including font size, line thickness and pictures in the split screen window according to the scaling ratio.
8. A window adaptation system for performing the window adaptation method when the display resolution pixel density changes as described in any one of claims 1-7, characterized in that, It includes: An event monitoring module, configured to obtain the resolution and the display DPI of the current display where the split screen window is located when an event including creating a split screen window, moving the split screen window, a change in system resolution or display DPI is monitored; A scaling ratio calculation module, configured to calculate the scaling ratio of the current display according to the display DPI of the current display; An adaptive adjustment module, configured to adaptively adjust the window size and position of the split screen window according to the scaling ratio and the original information of the split screen window, and automatically adjust the layout of the split screen window.
9. A computer device, including a memory and one or more processors, where computer code is stored in the memory, and when the computer code is executed by the one or more processors, the one or more processors execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, where computer code is stored in the computer-readable storage medium, and when the computer code is executed, the method according to any one of claims 1 to 7 is executed.