Image element display method and device, computer equipment and storage medium

By obtaining the actual screen resolution and preset screen resolution of the terminal, determining and scaling the image elements, the problem of poor display effects of the full-screen game interface at different resolutions is solved, and good performance on devices with different resolutions is achieved. Display effects and code suitability.

CN118535113APending Publication Date: 2024-08-23NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410572364.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-09
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

In a full-screen game interface, it is difficult for the background image or scene of the interface to adapt to devices at different resolutions, resulting in poor display effects.

Method used

By obtaining the actual screen resolution and the preset screen resolution of the terminal, the scaling ratio of the image elements is determined, and the image elements are scaled to ensure that the same display effect is obtained on devices with different resolutions.

Benefits of technology

It achieves good display effects of image elements on devices with different resolutions, avoids misalignment, improves the adaptability and compatibility of program code, reduces the need to design different versions of program code for different devices, and improves development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535113A
    Figure CN118535113A
Patent Text Reader

Abstract

The embodiment of the invention discloses an image element display method and device, computer equipment and a storage medium, and the method comprises the steps: obtaining an actual screen resolution of a terminal, and obtaining a preset screen resolution of a to-be-displayed image element of the terminal; according to the actual screen resolution and a preset screen resolution, determining a scaling ratio for the image element; performing scaling processing on the image elements according to the scaling ratio to obtain scaled image elements; and displaying the zoomed image element on the terminal. According to the embodiment of the invention, the scaling required for the image element is determined according to the actual screen resolution and the preset screen resolution, and the first scaling processing is performed on the image element based on the scaling, so that the image element can obtain the same display effect as a device with the preset screen resolution on the terminal, and the user experience is improved. In addition, different image elements are matched without dislocation, so that a better display effect can be obtained on equipment with different resolutions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a method, device, computer equipment and storage medium for displaying image elements, wherein the storage medium is a computer-readable storage medium. Background Art

[0002] In a full-screen game interface, the background image or scene of the interface, and the corresponding animation and special effects are adapted to devices with different resolutions. Usually, fixed screen resolution adaptation is used. This method fixes the game interface at a certain screen resolution and does not adjust with changes in the screen resolution of the display device, resulting in poor display effects on devices with non-target screen resolutions. Summary of the invention

[0003] The embodiments of the present application provide a method, apparatus, computer device and computer-readable storage medium for displaying image elements, which can achieve better display effects of interface background resources and visual enhancement effect resources on devices with different resolutions.

[0004] An embodiment of the present application provides a method for displaying an image element, comprising:

[0005] Acquiring an actual screen resolution of a terminal and acquiring a preset screen resolution of an image element to be displayed on the terminal;

[0006] Determining a scaling ratio for the image element according to the actual screen resolution and the preset screen resolution;

[0007] Scaling the image element according to the scaling ratio to obtain a scaled image element;

[0008] The scaled image element is displayed on the terminal.

[0009] Accordingly, an embodiment of the present application further provides an image element display device, comprising:

[0010] An acquisition unit, used to acquire an actual screen resolution of a terminal and a preset screen resolution of an image element to be displayed on the terminal;

[0011] a ratio determination unit, configured to determine a scaling ratio for the image element according to the actual screen resolution and the preset screen resolution;

[0012] A scaling processing unit, used for performing scaling processing on the image element according to the scaling ratio to obtain a scaled image element;

[0013] A display unit is used to display the scaled image element on the terminal.

[0014] Correspondingly, an embodiment of the present application also provides a computer device, including a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to execute any image element display method provided in the embodiment of the present application.

[0015] Correspondingly, an embodiment of the present application further provides a computer-readable storage medium, which is used to store a computer program, and the computer program is loaded by a processor to execute any image element display method provided in the embodiment of the present application.

[0016] The embodiments of the present application obtain the actual screen resolution of the terminal and the preset screen resolution of the image element to be displayed on the terminal; determine the scaling ratio for the image element according to the actual screen resolution and the preset screen resolution; scale the image element according to the scaling ratio to obtain the scaled image element; and display the scaled image element on the terminal.

[0017] The embodiment of the present application determines the required scaling ratio for the image elements according to the actual screen resolution and the preset screen resolution, and performs a first scaling process on the image elements based on the scaling ratio, so that the image elements can obtain the same display effect on the terminal as on the device with the preset screen resolution, and different image elements match each other without misalignment. Therefore, a better display effect can be achieved on devices with different resolutions.

[0018] In addition, by updating the original image elements based on the scaled image elements, the terminal can render a graphical user interface that matches the actual screen resolution of the terminal through the original processing logic. There is no need to design different versions of program code for different devices, which can improve the adaptability and compatibility of the program code with different terminals and improve development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0020] Figure 1 is a flow chart of the image element display method provided by an embodiment of the present application;

[0021] Figure 2 It is a display schematic diagram of the interface background resources provided in the embodiment of the present application;

[0022] Figure 3is a display schematic diagram of another interface background resource provided in an embodiment of the present application;

[0023] Figure 4 is a schematic diagram of resource adaptation under a preset screen resolution provided in an embodiment of the present application;

[0024] Figure 5 is a schematic diagram of resource error adaptation under actual screen resolution provided by an embodiment of the present application;

[0025] Figure 6 This is a schematic diagram of correct resource adaptation under the actual screen resolution provided by an embodiment of the present application;

[0026] Figure 7 is a schematic diagram of an image element display device provided in an embodiment of the present application;

[0027] Figure 8 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0028] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0029] The present application provides a method, device, computer equipment and computer readable storage medium for displaying image elements. The image element display device can be integrated in a computer equipment, which can be a server or a terminal.

[0030] The terminal may include a mobile phone, a wearable smart device, a tablet computer, a laptop computer, a personal computer (PC), and a vehicle-mounted computer.

[0031] Among them, the server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.

[0032] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.

[0033] This embodiment will be described from the perspective of an image element display device. The image element display device may be integrated into a computer device, which may be a server or a terminal.

[0034] An embodiment of the present application provides a method for displaying image elements, such as Figure 1 As shown, the specific process of the image element display method can be as follows:

[0035] 101. Acquire an actual screen resolution of a terminal, and acquire a preset screen resolution of an image element to be displayed on the terminal.

[0036] The actual screen resolution is the resolution of the display screen configured for the terminal. The resolution can be represented by the number of pixels in each row and the number of pixels in each column of the display screen. For example, 1920×1080 means that the display screen has 1920 pixels in each row and 1080 pixels in each column.

[0037] The preset screen resolution may be a screen resolution designed for image elements to be displayed, for example, user A creates an image on terminal B, then the preset screen resolution may be the screen resolution of terminal B. User A sends the image to terminal D of user C, and the screen resolution of the terminal is the actual screen resolution.

[0038] In one embodiment, the image element may be a graphical user interface of the target client, and the preset screen resolution may be a screen resolution pre-written in the code of the target client. For example, if the developer designs the program based on a screen resolution of 1280×720, the preset screen resolution may be a screen resolution of 1280×720, and the image elements of the target client may obtain an ideal display effect on a 1280×720 display screen. The target client may include applications (APP), applets, and Web applications. Applications may be installed on a terminal, and Web applications may be accessed through the terminal. The actual screen resolution of the terminal is the screen resolution of the terminal on which the target client is installed.

[0039] 102. Determine a scaling ratio for the image element according to the actual screen resolution and the preset screen resolution.

[0040] If the actual screen resolution is different from the preset screen resolution, image elements (such as visual resources such as images provided by the target client) cannot obtain ideal display effects on the terminal. For example, for a display screen with a preset screen resolution, image A can fill the entire display screen, but for a display screen with a screen resolution different from the preset screen resolution, image A cannot fill the entire display screen. Image A needs to be scaled so that image A can be better displayed on the terminal.

[0041] Among them, the image elements may include interface background resources, which may include background images and virtual background scenes, etc. The virtual background scene may be a virtual three-dimensional scene or at least a part of a virtual two-dimensional scene. The image elements may also include visual enhancement effects, and the visual enhancement effect resources may include resources for creating better visual effects (such as dynamic effects, light and shadow effects, etc.), such as motion effects and special effects. For example, dynamic effects may create the visual effect of flowing water and the light and shadow effects of mountains. The visual enhancement effect resources may include motion and special effect resources that are realized through a particle system or a virtual three-dimensional model. The image elements may also include other resources such as controls, buttons, and icons.

[0042] The scaling ratio may be used to scale the image elements so that the image elements can match the actual screen resolution of the terminal.

[0043] For example, the actual screen resolution may be expressed as the number of pixels in the width and the number of pixels in the height of the terminal screen, or may be expressed as the ratio of the number of pixels in the width to the number of pixels in the height, and the scaling ratio may be determined according to the difference between the actual screen resolution and the preset screen resolution. That is, in one embodiment, the actual screen resolution includes a first ratio of the width and the height of the terminal screen, and the preset screen resolution includes a second ratio of the preset width and the height. The step of “determining the scaling ratio for the image element according to the actual screen resolution and the preset screen resolution” includes:

[0044] If the first ratio is not less than the second ratio, determining the scaling ratio according to the ratio of the width of the terminal screen to the preset width;

[0045] If the first ratio is smaller than the second ratio, the scaling ratio is determined according to a ratio of the height of the terminal screen to the preset height.

[0046] Among them, the first ratio of the width and height of the terminal screen can be the ratio of the number of pixels in the width of the terminal screen to the number of pixels in the height, and the second ratio can be the ratio of the number of pixels in the width and height of the preset screen resolution.

[0047] Taking the background image as the interface background resource as an example, if the first ratio is less than the second ratio, it means that under the premise of keeping the background image ratio unchanged, when the background image is enlarged or reduced to the display ratio on the width of the terminal screen to achieve the ideal effect (the same as the display ratio at the preset screen resolution), the height of the background image is not enough to achieve the ideal effect on the terminal screen, so the background image needs to be enlarged. Figure 2 As shown in (1), the black box is the actual screen resolution of the terminal, the red box is the preset screen resolution, and the area filled with diagonal lines is the background image. Assuming that the background image is at the preset screen resolution, the background image can just tile the entire screen. At the preset screen resolution, the display effect of the background image is as follows: Figure 2 As shown in (1), for the terminal, the background image cannot tile the entire terminal screen, so the background image needs to be scaled. Figure 2 As can be seen from the example of (2), when the first ratio is smaller than the second ratio, the background image needs to be enlarged until the background image can fill the terminal screen in the vertical direction. Therefore, the scaling ratio can be determined based on the ratio of the height of the terminal screen to the preset height, specifically by calculating the ratio of the height in the first ratio and the height in the second ratio.

[0048] Therefore, when the first ratio is smaller than the second ratio, the scaling ratio can be obtained by calculating the ratio between the height of the terminal screen and the preset height.

[0049] If the first ratio is not less than the second ratio, it means that under the premise of keeping the ratio of the background image unchanged, when the background image is enlarged or reduced to achieve the ideal display ratio on the height of the terminal screen, the width of the background image is not enough to achieve the ideal effect on the terminal screen, so the background image needs to be enlarged. Figure 3 As shown in (1), the black box is the actual screen resolution of the terminal, the red box is the preset screen resolution, and the area filled with diagonal lines is the background image. Assuming that the background image is at the preset screen resolution, the background image can just tile the entire screen. At the preset screen resolution, the display effect of the background image is as follows: Figure 3 As shown in FIG. 1 , for a terminal, the background image cannot cover the entire terminal screen, so the background image needs to be scaled. Figure 3 As can be seen from the example of (2), when the first ratio is smaller than the second ratio, the background image needs to be enlarged until the background image can cover the entire terminal screen in the horizontal direction. Therefore, the scaling ratio can be determined based on the ratio of the width of the terminal screen to the preset width, specifically, by calculating the ratio of the width in the first ratio to the width in the second ratio.

[0050] Therefore, when the first ratio is not less than the second ratio, the ratio of the width of the terminal screen to the preset width is calculated to obtain the scaling ratio.

[0051] 103. Scaling the image element according to the scaling ratio to obtain the scaled image element.

[0052] After determining the scaling ratio, the image element can be scaled based on the scaling ratio, and the scaling process may include enlarging or reducing the size of the image element and / or adjusting the position of the image element. If the scaling ratio is greater than 1, it means that the interface background resource needs to be enlarged, and if the ratio is less than 1, it means that the interface background resource needs to be reduced.

[0053] The image element may include an interface background resource on a graphical user interface provided by the target client. The display size of the interface background resource may be scaled so that the interface background resource has a better display effect on the terminal. That is, in one embodiment, the image element includes the interface background resource in the graphical user interface to be displayed on the terminal. The step of “scaling the image element according to the scaling ratio to obtain the scaled image element” includes:

[0054] A first scaling process is performed on the display size information of the interface background resource according to the scaling ratio to obtain a scaled interface background resource.

[0055] The display size information can be used to control the display size of the interface background resource on the terminal. By scaling the display size information, the interface background resource can be controlled on the terminal to obtain the same display effect as on the screen with a preset screen resolution.

[0056] For example, the first scaling process may be to multiply the display size information of the interface background resource by the scaling ratio to obtain the scaled display size information, and perform scaling processing on the interface background resource based on the scaled display size information to obtain the scaled interface background resource.

[0057] The image element may also include visual enhancement effect resources, which are used to create visual effects, such as scenes and objects in the interface background resources to create dynamic effects. The visual enhancement effect resources are usually displayed only in a partial area of ​​the screen, so for the scaling of the visual enhancement effect, in addition to adjusting the display size information, it is also necessary to adjust the display position to obtain a better display effect. That is, in one embodiment, the image element includes the visual enhancement effect resource in the graphical user interface, and the step of "scaling the image element according to the scaling ratio to obtain the scaled image element" may include:

[0058] According to the above-mentioned scaling ratio, the display position information of the above-mentioned visual enhancement effect resource is adjusted to obtain adjusted display position information;

[0059] According to the above scaling ratio, scaling the display size information of at least part of the visual enhancement effect resource of the above interface background resource is performed to obtain scaled size information;

[0060] Based on the adjusted display position information and the scaled size information, the scaled visual enhancement effect resource is obtained.

[0061] The display position information may indicate the display position of the visual enhancement effect resource, and the display size information may be used to indicate the size of the visual enhancement effect image element displayed on the graphical user interface.

[0062] For example, display position information can be used to determine the display position of the visual enhancement effect resource on the terminal screen, and the display position information can be identified by coordinates; display size information can also be used to determine the display size of the visual enhancement effect resource, and the display size information can include numerical form (for example, it can include length and width).

[0063] For visual enhancement effect resources, you can scale them by layer. Visual enhancement effect resources can be used to create visual effects for scenes and / or objects in interface background resources. Therefore, visual enhancement effect resources need to match interface background resources. When interface background resources are scaled, visual enhancement effect resources also need to be scaled. After determining the scaling ratio, you can scale visual enhancement effect resources based on the scaling ratio. If the scaling ratio is greater than 1, it means that the visual enhancement effect resource needs to be enlarged. If the ratio is less than 1, it means that the visual enhancement effect resource needs to be reduced.

[0064] In one embodiment, the interface background resources and the visual enhancement effect resources can be set to belong to different layers of the graphical user interface. One layer contains at least one visual enhancement effect resource. The positions of the visual enhancement effect resource and the layer can be relative. The position of the visual enhancement effect resource is determined with reference to the layer. For example, the position of a visual enhancement effect resource can be 3mm away from the left side of the layer. The position of the visual enhancement effect resource can be changed by adjusting the size of the layer. The second scaling processing of the visual enhancement effect resource can include scaling the size of the layer where the visual enhancement effect resource is located to adjust the display position of the visual enhancement effect resource on the graphical user interface, as well as scaling the size of the visual enhancement effect resource.

[0065] Scaling the size of a layer may be performed by multiplying the original size of the layer by the scaling ratio to obtain the scaled size, and updating the original size of the layer based on the scaled size to scale the layer. Scaling the layer may achieve scaling for visual enhancement effects.

[0066] In one embodiment, the visual enhancement effect resources may not be displayed through a layer, and the coordinates of the visual enhancement effect resources may be adjusted, as well as the size of the visual enhancement effect resources, to achieve scaling of the visual enhancement effect resources. Specifically, the coordinates of each visual enhancement effect resource relative to the center of the graphical user interface are calculated with the interface center of the graphical user interface as the origin, and then the coordinates are multiplied by the scaling ratio to obtain the adjusted display position information; and the display size information of the visual enhancement effect resource is multiplied by the scaling ratio to obtain the scaled display size information; based on the adjusted display position information and the scaled display size information, the visual enhancement effect resources are adjusted to obtain the scaled visual enhancement effect resources.

[0067] Visual enhancement effect resources can be targeted at interface background resources to enhance the visual effects of interface background resources, such as creating dynamic effects or luminous effects. After the interface background resources are scaled, the position and size of objects in the interface background resources displayed on the graphical user interface will change. By adjusting the position and size of the visual enhancement effect resources according to the scaling ratio, the visual enhancement effect resources can be matched with the scaled interface background resources. For example, Figure 4 As shown in the figure, there are visual enhancement effect resources used to create light and shadow effects for the mountains of the interface background resources. Under the preset screen resolution, the adaptation effect of the screen, interface background resources, and visual enhancement effect resources is as follows: Figure 4 As shown in the figure, the red border represents the screen, the black border represents the interface background resource, and the blue border represents the visual enhancement effect resource. After scaling, the size and position of the mountain range of the interface background resource have changed compared to the original interface background resource. If the visual enhancement effect resource is not adapted, the following will appear: Figure 5 The misalignment shown, Figure 5 The display effect of the terminal when the actual screen resolution is different from the preset screen resolution and the visual enhancement effect resource is not adapted; by scaling the position and size of the visual enhancement effect resource, the visual enhancement effect resource can match the size and position of the mountain range of the scaled interface background resource, such as Figure 6 The visual enhancement effect resources shown can be matched with the interface background resources without misalignment.

[0068] The visual enhancement effect resource may also be a graphic element on a graphical user interface, such as a control, a button, and an icon. The display position of the graphic element on the graphical user interface is usually relative. The graphic element can be operated by the user or convey certain information. A control that is too small cannot be operated, and a control that is too large has poor aesthetics and blocks the display of other elements. Therefore, the display size may not necessarily change with the size of the terminal screen. That is, in one embodiment, the visual enhancement effect resource includes a visual enhancement effect resource corresponding to the graphic element in the graphical user interface. The step of "adjusting the display position information of the visual enhancement effect resource configured by the interface background resource according to the scaling ratio to obtain the adjusted display position information" includes:

[0069] Determining display position information of the graphic element on the terminal according to the anchor point and reference position information corresponding to the graphic element;

[0070] According to the display position information of the graphic element on the terminal, the display position information of the visual enhancement effect resource corresponding to the graphic element is adjusted to obtain the adjusted display position information. Among them, the anchor point can be understood as the origin of the plane coordinate system where the graphic element is located. During screen scaling or deformation, the control moves relatively with reference to its anchor point. The reference position information indicates the relative position of the graphic element and the anchor point. Regardless of how the screen size changes, the display position information of the graphic element can be determined based on the anchor point and the reference position. Through the display position information of the graphic element, the display position information of the visual enhancement effect resource of the graphic element can be adjusted so that the visual enhancement effect resource can match the graphic element.

[0071] Optionally, the display size of the visual enhancement effect resource matching the image element may be scaled according to the scaling ratio of the image element.

[0072] In one embodiment, the interface background resources of the graphical user interface, the visual enhancement effect resources for the interface background resources, and the visual enhancement effect resources for the graphic elements on the graphical user interface can be scaled respectively, and the graphical user interface is rendered on the terminal based on the scaled interface background resources, the scaled visual enhancement effects, and the graphic elements. The display effect of the graphical user interface on the terminal is the same as the display effect on a device with a preset screen resolution.

[0073] After the interface background resource is scaled, some areas cannot be displayed on the terminal screen, and the visual enhancement effect resources corresponding to these areas cannot be displayed either. The visual enhancement effect resources that cannot be displayed on the terminal screen can be deleted to reduce the visual enhancement effect resources that need to be processed and improve the processing speed. That is, in one embodiment, the step of "scaling the display size information of at least part of the visual enhancement effect resources of the above-mentioned interface background resources according to the above-mentioned scaling ratio to obtain the scaled size information" may include:

[0074] Determine, according to the actual screen resolution and the background resource of the zoomed interface, a target background area to be displayed on the terminal in the background resource of the zoomed interface;

[0075] Determine, according to the scaled display position information of the visual enhancement effect resource, a first visual enhancement effect resource located within the target background area and a second visual enhancement effect resource located outside the target background area;

[0076] Deleting or intercepting the second visual enhancement effect resource;

[0077] The display size information of the first visual enhancement effect resource and the second visual enhancement effect resource after being intercepted is scaled to obtain scaled size information.

[0078] like Figure 2 (2) and Figure 3 As shown in (2), the interface background resources are enlarged to cover the entire screen of the terminal. Some areas cannot be displayed on the screen. The visual enhancement effect resources in these areas can be deleted.

[0079] If the first ratio is smaller than the second ratio, the width of the scaled interface background resource exceeds the terminal width while keeping the image ratio unchanged. Therefore, when the first ratio is smaller than the second ratio, the first ratio can be used as the ratio of the width and height of the target background area, and the height of the scaled interface background resource can be used to determine the height of the target background area. According to the ratio of the width and height of the target background area and the height, the width of the target background area is determined, and then the part of the interface background resource that needs to be cropped is determined and cropped to obtain the target background area. For example, the two sides of the interface background resource can be cropped, and the target background area obtained can be the middle area of ​​the interface background resource; the target background area can also be the left part or the right part of the interface background resource.

[0080] Optionally, a virtual display frame can also be determined based on the first ratio and the height of the image, where the ratio of the width to the height of the virtual display frame is equal to the first ratio, and the height is equal to the height of the image. Based on the virtual display frame, the target background area can be determined from the scaled interface background resources. For example, the center position of the virtual display frame can be made coincident with the center position of the scaled interface background resources, and the target background area is determined by the area overlapping with the virtual display frame. The upper left corner of the virtual display frame can also be made coincident with the upper left corner of the scaled interface background resources, and the target background area is determined by the area overlapping with the virtual display frame.

[0081] If the first ratio is not less than the second ratio, under the premise of keeping the image ratio unchanged, the height of the interface background resource after scaling exceeds the height of the terminal screen. Therefore, when the first ratio is not less than the second ratio, the width of the target background area can be determined based on the first ratio and the width of the interface background resource after scaling, wherein the ratio of the width and height of the target background area is equal to the first ratio, and the width is equal to the width of the interface background resource after scaling. According to the width of the target background area, the part of the scaled interface background resource that needs to be cropped is determined and cropped to obtain the target background area.

[0082] The strategy for determining the target background area from the interface background resources after scaling can be pre-set. For example, the target background area can be the middle area of ​​the interface background resources after scaling. When determining the length and width of the target background area, the target background area can be determined from the interface background area after scaling.

[0083] After determining the target background area, the first visual enhancement effect resource to be displayed within the target background area and the second visual enhancement effect resource to be displayed outside the target background area can be determined based on the scaled display position information of the visual enhancement effect resource.

[0084] Usually, the area corresponding to a large number of visual enhancement effect resources is usually a key design area and a more important area in the background resources of the zoomed interface. Therefore, the target background area can also be determined according to the number of visual enhancement effect resources. That is, in one embodiment, the step of "determining the target background area to be displayed on the terminal in the background resources of the zoomed interface according to the actual screen resolution and the image resolution of the background resources of the zoomed interface" includes:

[0085] Determine, according to the actual screen resolution, the area size information of the target background area to be displayed on the terminal in the scaled interface background resource;

[0086] Traversing the scaled interface background resources based on the region size information to determine at least two candidate background regions and the number of visual enhancement effect resources contained in each candidate background region;

[0087] Determine the target background area with the largest number of resources from the above candidate background areas.

[0088] For example, the ratio of the width and height of the target background area can be determined based on the actual screen resolution. If the first ratio is not less than the second ratio, the width of the scaled interface background resource is used as the width of the target background area, and then the height of the target background area is determined based on the first ratio to obtain the area size information of the target background area. If the first ratio is less than the second ratio, the height of the target background area can be determined based on the first ratio and the height of the scaled interface background resource, and then the width of the target background area is determined based on the first ratio to obtain the area size information of the target background area.

[0089] The scaled interface background resources are traversed according to the area size information to obtain at least two candidate background areas, and the number of visual enhancement effect resources contained in each candidate background area can be determined according to the scaled display position information of the visual enhancement effect resources, and the candidate background area with the largest number of visual enhancement effect resources is taken as the target background area.

[0090] Determining whether the visual enhancement effect resource is displayed on the candidate background area can be determined based on the center position of the visual enhancement effect resource. If the center of the visual enhancement effect resource is located on the candidate background area, it is considered that the candidate background area contains the visual enhancement effect resource. Otherwise, it does not contain the visual enhancement effect resource. Optionally, it is also possible to determine whether the candidate background area contains the visual enhancement effect resource based on the display proportion of the visual enhancement effect resource in the candidate background area. That is, in one embodiment, the visual enhancement effect resource corresponds to a resource center and a resource bounding box. The above-mentioned zoomed display position information includes the position information of the resource center and the position information of the resource bounding box. The above-mentioned determination of the first visual enhancement effect resource located within the above-mentioned target background area and the second visual enhancement effect resource located outside the above-mentioned target background area based on the zoomed display position information of the above-mentioned visual enhancement effect resource includes:

[0091] If it is determined based on the location information of the resource center that the resource center of the visual enhancement effect resource is located within the target background area, the visual enhancement effect resource is determined as the first visual enhancement effect resource;

[0092] If it is determined based on the location information of the resource center that the resource center of the above-mentioned visual enhancement effect resource is located outside the above-mentioned target background area, and based on the location information of the above-mentioned resource bounding box, it is determined that the area of ​​the overlapping area between the above-mentioned resource bounding box and the above-mentioned target background area meets the preset conditions, then the above-mentioned visual enhancement effect resource is determined as the second visual enhancement effect resource.

[0093] The resource center may be the center of the visual enhancement effect resource, the resource bounding box may be the minimum bounding box of the visual enhancement effect resource, and the resource is displayed in the resource bounding box.

[0094] After determining the target background area, it is possible to determine whether the resource center of the visual enhancement effect resource is located in the target background area based on the location information of the resource center of the visual enhancement effect resource. If so, the visual enhancement effect resource is used as the first visual enhancement effect resource. If the resource center is not in the target background area, the visual enhancement effect resource is used as the second visual enhancement effect resource. Optionally, if the resource center is not in the target background area, the area of ​​the overlapping area between the target background area and the resource bounding box can be calculated. If the area is greater than a preset area threshold, the visual enhancement effect resource is used as the first visual enhancement effect resource. If the area is less than the preset area threshold, the visual enhancement effect resource can be used as the second visual enhancement effect resource.

[0095] 104. Display the scaled image element on the terminal.

[0096] For example, after obtaining the scaled image element, the scaled image element can be rendered on the screen of the terminal. Optionally, the image element can include an interface background resource and a visual enhancement effect resource, and the scaled interface background resource can replace the original interface background resource, and the scaled visual enhancement effect resource can replace the original visual enhancement effect resource, and then based on the scaled interface background resource and the scaled visual enhancement effect resource, a graphical user interface is displayed on the terminal, and the graphical user interface uses the scaled interface background resource as the background, and creates a visual effect through the scaled visual enhancement effect resource.

[0097] It can be understood that after updating the original interface background resources based on the scaled interface background resources, and updating the original visual enhancement effect resources based on the scaled visual enhancement effect resources, the terminal can render a graphical user interface that matches the actual screen resolution of the terminal through the original processing logic. There is no need to design different versions of program code for different devices, which can improve the adaptability and compatibility of the program code with different terminals, and improve development efficiency.

[0098] Before displaying the image element, the image element may be intercepted or deleted to reduce the amount of data required for rendering. That is, in one embodiment, there are multiple graphic elements, and the step of "displaying the scaled image element on the terminal" includes:

[0099] Determine, among the scaled image elements, a first image element located within the terminal screen and a second image element located outside the terminal screen;

[0100] Delete or intercept the second element;

[0101] The first image element is displayed, and the second image element after the interception process is displayed.

[0102] For example, the image elements completely outside the terminal screen, the image elements partially outside the terminal screen, and the image elements completely inside the terminal screen can be determined based on the display position information and display size information of the scaled image elements. The image elements completely outside the terminal screen are deleted, and for the image elements partially outside the terminal screen, the portion inside the terminal screen is intercepted.

[0103] Then the first image element is displayed, and the second image element after the interception process is displayed.

[0104] The interface background resources need to be intercepted and processed. The specific process can be referred to the above related description, which will not be repeated here.

[0105] As can be seen from the above, the embodiment of the present application obtains the actual screen resolution of the terminal and the preset screen resolution of the image element to be displayed on the terminal; determines the scaling ratio for the image element according to the actual screen resolution and the preset screen resolution; performs scaling processing on the image element according to the scaling ratio to obtain the scaled image element; and displays the scaled image element on the terminal. .

[0106] The embodiment of the present application determines the required scaling ratio for the image elements according to the actual screen resolution and the preset screen resolution, and performs a first scaling process on the image elements based on the scaling ratio, so that the image elements can obtain the same display effect on the terminal as on the device with the preset screen resolution, and different image elements match each other without misalignment. Therefore, a better display effect can be achieved on devices with different resolutions.

[0107] In addition, it is understandable that by updating the original image elements based on the scaled image elements, the terminal can render a graphical user interface that matches the actual screen resolution of the terminal through the original processing logic. There is no need to design different versions of program code for different devices, which can improve the adaptability and compatibility of the program code with different terminals and improve development efficiency.

[0108] In order to better implement the image element display method provided in the embodiment of the present application, an image element display device is also provided in one embodiment. The meanings of the terms are the same as those in the above-mentioned image element display method, and the specific implementation details can refer to the description in the method embodiment.

[0109] The image element display device can be integrated into a computer device, such as Figure 7As shown, the image element display device may include: an acquisition unit 301, a ratio determination unit 302, a scaling processing unit 303 and a display unit 304, as follows:

[0110] (1) An acquisition unit 301 is used to acquire an actual screen resolution of a terminal and to acquire a preset screen resolution of an image element to be displayed on the terminal.

[0111] (2) A ratio determination unit 302, configured to determine a scaling ratio for the image element according to the actual screen resolution and the preset screen resolution.

[0112] In one embodiment, the actual screen resolution may include a first ratio of the width and height of the terminal screen, the preset screen resolution may include a second ratio of the preset width and height, and the ratio determination unit 302 may include:

[0113] A first zoom ratio determination subunit, configured to determine the zoom ratio according to a ratio of a width of the terminal screen to the preset width if the first ratio is not less than the second ratio;

[0114] The second zoom ratio determining subunit is used to determine the zoom ratio according to the ratio of the height of the terminal screen to the preset height if the first ratio is smaller than the second ratio.

[0115] (3) A scaling processing unit 303, configured to perform scaling processing on the image element according to the scaling ratio to obtain a scaled image element.

[0116] In one embodiment, the image element may include an interface background resource in a graphical user interface to be displayed on the terminal, and the scaling processing unit 303 may be used to:

[0117] A first scaling process is performed on the display size information of the interface background resource according to the scaling ratio to obtain the scaled interface background resource.

[0118] In one embodiment, the image element may include a visual enhancement effect resource in the graphical user interface, and the scaling processing unit 303 may include:

[0119] A position adjustment subunit, configured to perform position adjustment processing on the display position information of the visual enhancement effect resource according to the zoom ratio to obtain adjusted display position information;

[0120] A size scaling subunit, configured to scale the display size information of at least part of the visual enhancement effect resources of the interface background resources according to the scaling ratio to obtain scaled size information;

[0121] The updating subunit is used to obtain the above-mentioned scaled visual enhancement effect resource based on the above-mentioned adjusted display position information and the above-mentioned scaled size information.

[0122] In one embodiment, the visual enhancement effect resource may include a visual enhancement effect resource corresponding to a graphic element in the graphical user interface, and the position adjustment subunit may include:

[0123] A relative position determination module, used to determine the display position information of the graphic element on the terminal according to the anchor point and reference position information corresponding to the graphic element;

[0124] The display position adjustment module is used to adjust the display position information of the visual enhancement effect resource corresponding to the above-mentioned graphic element according to the display position information of the above-mentioned graphic element on the above-mentioned terminal, so as to obtain the adjusted display position information.

[0125] In one embodiment, the scaling processing unit 303 may include:

[0126] A region determination subunit, used to determine a target background region to be displayed on the terminal in the scaled interface background resource according to the actual screen resolution and the image resolution of the scaled interface background resource;

[0127] a resource determination subunit, configured to determine, according to the scaled display position information of the visual enhancement effect resource, a first visual enhancement effect resource located within the target background area and a second visual enhancement effect resource located outside the target background area;

[0128] The resource processing subunit is used to delete the second visual enhancement effect resource and scale the first visual enhancement effect resource according to the scaling ratio to obtain the scaled size information.

[0129] In one embodiment, the visual enhancement effect resource corresponds to a resource center and a resource bounding box, the zoomed display position information may include the position information of the resource center and the position information of the resource bounding box, and the resource determination subunit may include:

[0130] A first resource determination module, configured to determine the visual enhancement effect resource as a first visual enhancement effect resource if it is determined based on the location information of the resource center that the resource center of the visual enhancement effect resource is located within the target background area;

[0131] The second resource determination module is used to determine the above-mentioned visual enhancement effect resource as the second visual enhancement effect resource if the resource center of the above-mentioned visual enhancement effect resource is determined to be located outside the above-mentioned target background area based on the location information of the resource center, and the area of ​​the overlapping area between the above-mentioned resource bounding box and the above-mentioned target background area meets the preset conditions.

[0132] (4) A display unit 304, configured to display the scaled image element on the terminal.

[0133] In one embodiment, there are multiple graphic elements, and the display unit 304 may include:

[0134] an element determination subunit, configured to determine, among the scaled image elements, a first image element located within the terminal screen and a second image element located outside the terminal screen;

[0135] A processing subunit, used for deleting or intercepting the second image element;

[0136] The element display subunit is used to display the first image element and the second image element after the interception process.

[0137] In one embodiment, there are multiple graphic elements, and the processing subunit may include:

[0138] A size determination module, used to determine the area size information of the target background area to be displayed on the terminal in the scaled interface background resource according to the actual screen resolution;

[0139] A traversal module, used to traverse the scaled interface background resources based on the region size information to determine at least two candidate background regions and the number of visual enhancement effect resources contained in each candidate background region;

[0140] The region interception module is used to determine the target background region with the largest number of resources from the candidate background regions, and to intercept the interface background resources based on the target background region.

[0141] As can be seen from the above, the image element display device of the embodiment of the present application obtains the actual screen resolution of the terminal and the preset screen resolution of the image element to be displayed by the terminal through the acquisition unit 301; the ratio determination unit 302 determines the scaling ratio for the image element according to the actual screen resolution and the preset screen resolution; the scaling processing unit 303 performs scaling processing on the image element according to the scaling ratio to obtain the scaled image element; and the display unit 304 displays the scaled image element on the terminal. .

[0142] The embodiment of the present application determines the required scaling ratio for the image element based on the actual screen resolution and the preset screen resolution, and performs a first scaling process on the image element based on the scaling ratio, so that the image element can obtain the same display effect on the terminal as on the device with the preset screen resolution, and the different image elements match each other without misalignment, so that a better display effect can be obtained on devices with different resolutions. In addition, it can be understood that by updating the original image element based on the scaled image element, the terminal can render a graphical user interface that matches the actual screen resolution of the terminal through the original processing logic, without the need to design different versions of program code for different devices, which can improve the adaptability and compatibility of the program code with different terminals, and improve development efficiency.

[0143] Accordingly, the embodiment of the present application also provides a computer device, which may be a terminal. Figure 8 As shown, Figure 8 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. The computer device 500 includes a processor 501 having one or more processing cores, a memory 502 having one or more computer-readable storage media, and a computer program stored in the memory 502 and executable on the processor. The processor 501 is electrically connected to the memory 502. It will be understood by those skilled in the art that the computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0144] The processor 501 is the control center of the computer device 500. It uses various interfaces and lines to connect the various parts of the entire computer device 500, executes various functions of the computer device 500 and processes data by running or loading software programs and / or modules stored in the memory 502, and calling data stored in the memory 502, thereby monitoring the computer device 500 as a whole.

[0145] In the embodiment of the present application, the processor 501 in the computer device 500 will load instructions corresponding to the processes of one or more application programs into the memory 502 according to the following steps, and the processor 501 will run the application programs stored in the memory 502 to implement various functions:

[0146] Obtaining the actual screen resolution of the terminal and obtaining the preset screen resolution of the image element to be displayed on the terminal;

[0147] Determine the scaling ratio for the image element according to the actual screen resolution and the preset screen resolution;

[0148] Scaling the image element according to the scaling ratio to obtain the scaled image element;

[0149] The scaled image element is displayed on the terminal.

[0150] From the above, it can be seen that the embodiment of the present application determines the required scaling ratio for the image element according to the actual screen resolution and the preset screen resolution, and performs a first scaling process on the image element based on the scaling ratio, so that the image element can obtain the same display effect on the terminal as on the device with the preset screen resolution, and different image elements match each other without misalignment. Therefore, a better display effect can be achieved on devices with different resolutions.

[0151] In addition, it is understandable that by updating the original image elements based on the scaled image elements, the terminal can render a graphical user interface that matches the actual screen resolution of the terminal through the original processing logic. There is no need to design different versions of program code for different devices, which can improve the adaptability and compatibility of the program code with different terminals and improve development efficiency.

[0152] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0153] Optional, such as Figure 8 As shown, the computer device 500 further includes: a touch screen 503, a radio frequency circuit 504, an audio circuit 505, an input unit 506, and a power supply 507. The processor 501 is electrically connected to the touch screen 503, the radio frequency circuit 504, the audio circuit 505, the input unit 506, and the power supply 507, respectively. Those skilled in the art can understand that Figure 8 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0154] The touch display screen 503 can be used to display a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. The touch display screen 503 may include a display panel and a touch panel. Among them, the display panel may be used to display information input by the user or information provided to the user and various graphical user interfaces of computer equipment, and these graphical user interfaces may be composed of graphics, text, icons, videos and any combination thereof. Optionally, the display panel may be configured in the form of a liquid crystal display (LCD, Liquid Crystal Display), an organic light emitting diode (OLED, Organic Light-Emitting Diode) and the like. The touch panel may be used to collect the user's touch operation on or near it (such as the user using any suitable object or attachment such as a finger, a stylus, etc. on the touch panel or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel may include two parts, a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 501, and can receive the command sent by the processor 501 and execute it. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 501 to determine the type of touch event, and then the processor 501 provides a corresponding visual output on the display panel according to the type of touch event. In an embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 503 to realize the input and output functions. However, in some embodiments, the touch panel and the touch panel can be used as two independent components to realize the input and output functions. That is, the touch display screen 503 can also be used as a part of the input unit 506 to realize the input function.

[0155] The radio frequency circuit 504 may be used to send and receive radio frequency signals, so as to establish wireless communication with a network device or other computer devices through wireless communication, and to send and receive signals between the network device or other computer devices.

[0156] The audio circuit 505 can be used to provide an audio interface between the user and the computer device through a speaker and a microphone. The audio circuit 505 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 505 and converted into audio data, and then the audio data is output to the processor 501 for processing, and then sent to another computer device through the radio frequency circuit 504, or the audio data is output to the memory 502 for further processing. The audio circuit 505 may also include an earphone jack to provide communication between an external headset and the computer device.

[0157] The input unit 506 may be used to receive input numbers, character information or user feature information (such as fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0158] The power supply 507 is used to supply power to various components of the computer device 500. Optionally, the power supply 507 can be logically connected to the processor 501 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 507 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0159] although Figure 8 Not shown, the computer device 500 may also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.

[0160] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0161] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0162] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of computer programs are stored, and the computer program can be loaded by a processor to execute the steps in any one of the image element display methods provided in the embodiments of the present application. For example, the computer program can execute the following steps:

[0163] Obtaining the actual screen resolution of the terminal and obtaining the preset screen resolution of the image element to be displayed on the terminal;

[0164] Determine the scaling ratio for the image element according to the actual screen resolution and the preset screen resolution;

[0165] Scaling the image element according to the scaling ratio to obtain the scaled image element;

[0166] The scaled image element is displayed on the terminal.

[0167] From the above, it can be seen that the embodiment of the present application determines the required scaling ratio for the image element according to the actual screen resolution and the preset screen resolution, and performs a first scaling process on the image element based on the scaling ratio, so that the image element can obtain the same display effect on the terminal as on the device with the preset screen resolution, and different image elements match each other without misalignment. Therefore, a better display effect can be achieved on devices with different resolutions.

[0168] In addition, it is understandable that by updating the original image elements based on the scaled image elements, the terminal can render a graphical user interface that matches the actual screen resolution of the terminal through the original processing logic. There is no need to design different versions of program code for different devices, which can improve the adaptability and compatibility of the program code with different terminals and improve development efficiency.

[0169] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0170] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0171] The above is a detailed introduction to an image element display method, device, computer equipment and computer storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for displaying an image element, characterized in that: include: Acquiring an actual screen resolution of a terminal and acquiring a preset screen resolution of an image element to be displayed on the terminal; Determining a scaling ratio for the image element according to the actual screen resolution and the preset screen resolution; Scaling the image element according to the scaling ratio to obtain a scaled image element; The scaled image element is displayed on the terminal.

2. The method according to claim 1, characterized in that The image element includes an interface background resource in a graphical user interface to be displayed on the terminal, and the scaling process is performed on the image element according to the scaling ratio to obtain the scaled image element, including: A first scaling process is performed on the display size information of the interface background resource according to the scaling ratio to obtain a scaled interface background resource.

3. The method according to claim 2, characterized in that The image element includes a visual enhancement effect resource in the graphical user interface, and the scaling process is performed on the image element according to the scaling ratio to obtain the scaled image element, including: According to the scaling ratio, position adjustment processing is performed on the display position information of the visual enhancement effect resource to obtain adjusted display position information; According to the scaling ratio, scaling the display size information of at least part of the visual enhancement effect resources of the interface background resources to obtain scaled size information; Based on the adjusted display position information and the scaled size information, a scaled visual enhancement effect resource is obtained.

4. The method according to claim 3, characterized in that The visual enhancement effect resource includes a visual enhancement effect resource corresponding to a graphic element in the graphical user interface, and the display position information of the visual enhancement effect resource is adjusted according to the scaling ratio to obtain the adjusted display position information, including: Determining display position information of the graphic element on the terminal according to the anchor point and reference position information corresponding to the graphic element; According to the display position information of the graphic element on the terminal, the display position information of the visual enhancement effect resource corresponding to the graphic element is adjusted to obtain the adjusted display position information.

5. The method according to claim 1, characterized in that The actual screen resolution includes a first ratio of a width to a height of the terminal screen, the preset screen resolution includes a second ratio of a preset width to a height, and determining the scaling ratio for the image element according to the actual screen resolution and the preset screen resolution includes: If the first ratio is not less than the second ratio, determining the scaling ratio according to the ratio of the width of the terminal screen to the preset width; If the first ratio is smaller than the second ratio, the scaling ratio is determined according to a ratio of the height of the terminal screen to the preset height.

6. The method according to claim 1, characterized in that There are a plurality of graphic elements, and displaying the scaled graphic elements on the terminal includes: Determine, among the scaled image elements, a first image element located within the terminal screen and a second image element located outside the terminal screen; Deleting or intercepting the second image element; The first image element is displayed, and the second image element after the interception process is displayed.

7. The method according to claim 6, characterized in that The image element includes an interface background resource and a visual enhancement effect resource, and the deleting or intercepting the second element includes: Determining, according to the actual screen resolution, area size information of a target background area to be displayed on the terminal in the scaled interface background resource; Traversing the scaled interface background resources based on the region size information to determine at least two candidate background regions and the number of visual enhancement effect resources contained in each candidate background region; A target background area with the largest number of resources is determined from the candidate background areas, and the interface background resources are intercepted based on the target background area.

8. An image element display device, characterized in that: include: An acquisition unit, used to acquire an actual screen resolution of a terminal and a preset screen resolution of an image element to be displayed on the terminal; a ratio determination unit, configured to determine a scaling ratio for the image element according to the actual screen resolution and the preset screen resolution; A scaling processing unit, used for performing scaling processing on the image element according to the scaling ratio to obtain a scaled image element; A display unit is used to display the scaled image element on the terminal.

9. A computer device, characterized in that: It comprises a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to execute the image element display method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and the computer program is loaded by a processor to execute the image element display method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Image display method, device and equipment

    CN119762352A

  • Graphic view self-adaptive zooming method, system and equipment based on distance stepping

    CN122195567A