Picture rendering method and device, electronic equipment and storage medium

By matching and cropping the rendering texture in size, the problem of screen element deformation by RTT technology when the size of the UI window changes is solved, improving the rendering effect and user experience.

CN119068103APending Publication Date: 2024-12-03GUANGZHOU HUYA INFORMATION TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411153532.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

When the size of the UI window changes, existing RTT technology can easily lead to stretching or compressing of screen elements, affecting the display effect and reducing the user experience.

Method used

By post-processing the original rendered texture, the size of the target rendered texture is updated according to the current size of the user interface window, and the matching between the two is judged. If it does not match, crop it to ensure that the size of the target rendered texture is consistent with the user interface window. This avoids deformation of the picture elements.

Benefits of technology

Improves the flexibility and display effect of picture rendering, improves the user experience, and ensures that the picture does not deform when the size of the UI window changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119068103A_ABST
    Figure CN119068103A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, and provides a picture rendering method and device, electronic equipment and a storage medium. The method comprises the steps of updating the size of a corresponding target rendering texture according to the current size of a user interface window in the process of post-processing an original rendering texture obtained based on picture content rendering, and judging whether the size of the original rendering texture is matched with the size of the target rendering texture; if the sizes of the target rendering texture and the original rendering texture are not matched, cutting based on the original rendering texture to obtain an undetermined rendering texture matched with the size of the target rendering texture, and copying the image data of the undetermined rendering texture to the target rendering texture; and displaying the image data of the target rendering texture through the user interface component to display a rendered picture. Therefore, deformation of the picture elements is avoided, the flexibility of picture rendering is improved, and the display effect of the picture and the user experience are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] RTT (Render to Texture) is a technology that renders screen content such as scenes, characters, special effects, etc. onto a texture. Currently, RTT technology is usually used to render screen content onto a texture, and the content of this texture is displayed through a UI (User Interface) component to display the screen. However, this method requires that the aspect ratio of the UI window be consistent with the aspect ratio of the texture used. However, as the gameplay of the game increases, sometimes the UI window that displays the game screen will change. Then, when the size of the UI window changes, it is easy for the displayed screen elements to be stretched or compressed, etc., thereby affecting the display effect of the screen, resulting in poor flexibility in screen rendering and reduced user experience. Summary of the invention

[0003] In view of this, an object of the present invention is to provide a picture rendering method, device, electronic device and storage medium.

[0004] In order to achieve the above object, the technical solution adopted by the present invention is as follows:

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

[0006] In a process of post-processing an original rendering texture obtained by rendering based on the screen content, updating a size of a corresponding target rendering texture according to a current size of the user interface window, and determining whether the size of the original rendering texture matches the size of the target rendering texture;

[0007] If the sizes of the two do not match, cropping is performed based on the original rendering texture to obtain a pending rendering texture that matches the size of the target rendering texture, and image data of the pending rendering texture is copied to the target rendering texture;

[0008] The image data of the target rendering texture is displayed through a user interface component to display a rendered picture.

[0009] In an optional implementation, after the step of determining whether the size of the original rendering texture matches the size of the target rendering texture, the screen rendering method further includes:

[0010] If the sizes of the two match, the image data of the original rendering texture is copied to the target rendering texture.

[0011] In an optional implementation, the step of updating the size of the corresponding target rendering texture according to the current size of the user interface window includes:

[0012] When the current size of the user interface window is different from the size of the corresponding target rendering texture, the target rendering texture is released, and a rendering texture is regenerated based on the current size of the user interface window as the target rendering texture.

[0013] In an optional implementation, the step of determining whether the size of the original rendering texture matches the size of the target rendering texture includes:

[0014] Compare the aspect ratio of the original rendering texture with the aspect ratio of the target rendering texture;

[0015] If the ratio of width to height of the two images is the same, the sizes of the two images are determined to match;

[0016] When the aspect ratios of the two are different, it is determined that the sizes of the two do not match.

[0017] In an optional implementation, the step of performing clipping based on the original rendering texture to obtain a pending rendering texture that matches the size of the target rendering texture includes:

[0018] Copying the image data of the original render texture to a temporary render texture of the same size;

[0019] According to the size of the temporary rendering texture and the size of the target rendering texture, the size and position of the clipping rectangle are obtained;

[0020] The temporary rendering texture is clipped according to the size and position of the clipping rectangle to obtain the pending rendering texture.

[0021] In an optional implementation, the step of obtaining the size and position of the clipping rectangle according to the size of the temporary rendering texture and the size of the target rendering texture includes:

[0022] Determining the width and height of the cropping rectangle according to the aspect ratio of the temporary rendering texture and the aspect ratio of the target rendering texture;

[0023] The position of the cropping rectangle in the temporary rendering texture is determined according to the width and height of the cropping rectangle and the width and height of the temporary rendering texture.

[0024] In a second aspect, the present invention provides a picture rendering device, the picture rendering device comprising:

[0025] An updating module, configured to update the size of a corresponding target rendering texture according to a current size of the user interface window during post-processing of an original rendering texture obtained by rendering based on the screen content, and determine whether the size of the original rendering texture matches the size of the target rendering texture;

[0026] a copy module, configured to, if the sizes of the two do not match, perform cropping based on the original rendering texture to obtain a pending rendering texture that matches the size of the target rendering texture, and copy image data of the pending rendering texture to the target rendering texture;

[0027] The display module is used to display the image data of the target rendering texture through a user interface component to display a rendered picture.

[0028] In an optional implementation, the copy module is further configured to: copy the image data of the original rendering texture to the target rendering texture if the sizes of the two textures match.

[0029] In a third aspect, the present invention provides an electronic device, including a processor and a memory, wherein the memory stores a computer program, and when the processor executes the computer program, the screen rendering method described in any one of the aforementioned embodiments is implemented.

[0030] In a fourth aspect, the present invention provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the screen rendering method described in any one of the aforementioned embodiments is implemented.

[0031] The present invention provides a method, device, electronic device and storage medium for rendering a picture, the method comprising: in the process of post-processing the original rendering texture obtained by rendering based on the picture content, updating the size of the corresponding target rendering texture according to the current size of the user interface window, and judging whether the size of the original rendering texture matches the size of the target rendering texture; if the sizes of the two do not match, cutting based on the original rendering texture to obtain a pending rendering texture matching the size of the target rendering texture, and copying the image data of the pending rendering texture to the target rendering texture; displaying the image data of the target rendering texture through the user interface component to display the rendered picture. This avoids the deformation of the picture elements, improves the flexibility of the picture rendering, and enhances the display effect and user experience of the picture.

[0032] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0034] Figure 1 A block diagram of an electronic device provided by an embodiment of the present invention is shown;

[0035] Figure 2 One of the flowchart diagrams of the picture rendering method provided by an embodiment of the present invention is shown;

[0036] Figure 3 The second flowchart of the image rendering method provided by the embodiment of the present invention is shown;

[0037] Figure 4 A functional module diagram of a picture rendering device provided by an embodiment of the present invention is shown.

[0038] Icons: 100 - electronic device; 110 - bus; 120 - processor; 130 - memory; 150 - I / O module; 170 - communication module; 300 - screen rendering device; 310 - update module; 330 - copy module; 350 - display module. DETAILED DESCRIPTION

[0039] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0040] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.

[0041] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0042] Please refer to Figure 1 , is a block diagram of an electronic device provided by an embodiment of the present invention. The electronic device 100 includes a bus 110 , a processor 120 , a memory 130 , an I / O module 150 and a communication module 170 .

[0043] The bus 110 is a circuit that connects the above elements to each other and transmits signals between the above elements.

[0044] The processor 120 can receive commands from the above-mentioned other elements (such as the memory 130, the I / O module 150, the communication module 170, etc.) through the bus 110, can interpret the received commands, and can perform calculations or data processing according to the interpreted commands. The processor 120 can be a graphics processing unit (GPU), a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0045] The memory 130 may store commands or data received from the processor 120 or other components (e.g., the I / O module 150, the communication module 170, etc.) or commands or data generated by the processor 120 or other components. The memory 130 may be a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc.

[0046] The I / O module 150 may receive commands or data input from a user via input-output means (e.g., a sensor, a keyboard, a touch screen, etc.), and may transmit the received commands or data to the processor 120 or the memory 130 via the bus 110. It is also used to display various information (e.g., multimedia data, text data) received, stored, and processed from the above elements, and may display videos, images, data, etc. to the user.

[0047] The communication module 170 may be used to communicate signals or data with other devices.

[0048] It should be understood that Figure 1 The structure shown is only a schematic diagram of the structure of the electronic device 100. The electronic device 100 may also include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown. Figure 1 Each component shown in the figure can be implemented by hardware, software or a combination thereof.

[0049] It can be understood that the electronic device is installed with a development engine such as Unity and a user interface component, namely a UI component, and the electronic device implements the screen rendering method provided by the embodiment of the present invention through the development engine and the user interface component.

[0050] The above-mentioned electronic device 100 will be used as an execution subject to execute each step in each method provided in the embodiment of the present invention and achieve corresponding technical effects.

[0051] See also Figure 2 , is a flow chart of a screen rendering method provided by an embodiment of the present invention.

[0052] Step S202 , in the process of post-processing the original rendering texture obtained by rendering based on the screen content, updating the size of the corresponding target rendering texture according to the current size of the user interface window, and determining whether the size of the original rendering texture matches the size of the target rendering texture.

[0053] In this embodiment, the screen content can be rendered first to obtain an original rendering texture, and then the original rendering texture can be post-processed using a post-processing function, i.e., OnRenderImage, in a development engine such as Unity to obtain a rendering texture, i.e., a target rendering texture, for displaying the screen content.

[0054] It is understandable that since the size of the user interface window will change, during the post-processing of the original rendering texture, the size of the corresponding target rendering texture will be updated according to the current size of the user interface window, and it will be determined whether the size of the original rendering texture matches the size of the target rendering texture, so as to decide whether to process the size of the original rendering texture based on the determination result.

[0055] Step S204: if the sizes of the two do not match, cropping is performed based on the original rendering texture to obtain a pending rendering texture that matches the size of the target rendering texture, and the image data of the pending rendering texture is copied to the target rendering texture.

[0056] In this embodiment, if the judgment result is that the sizes of the two do not match, it means that if the target rendering texture is obtained according to the size of the original rendering texture, the elements in the displayed picture will be deformed. Therefore, in the case that the sizes of the two do not match, the original rendering texture will be cropped to obtain a pending rendering texture that matches the size of the target rendering texture, and the image data of the pending rendering texture will be copied to the target rendering texture.

[0057] It can be understood that when the size of the original rendering texture does not match the size of the target rendering texture, the embodiment of the present invention selects part of the image data from the original rendering texture and copies it to the target rendering texture to ensure normal display of the picture by displaying part of the picture content.

[0058] Step S206: displaying the image data of the target rendering texture through the user interface component to display the rendered picture.

[0059] In this embodiment, after the image data of the target rendering texture is obtained, the image data of the target rendering texture can be displayed through a user interface component to display a rendered picture.

[0060] It can be understood that, in the embodiment of the present invention, when the size of the original rendering texture does not match the size of the user interface window, that is, the size of the target rendering texture, the original rendering texture is cropped to obtain a rendering texture with matching size, and the image is displayed based on the rendering texture. This avoids the deformation of the image elements, improves the flexibility of image rendering, and enhances the image display effect and user experience.

[0061] It can be seen that based on the above steps, in the process of post-processing the original rendering texture obtained by rendering based on the screen content, the size of the corresponding target rendering texture is updated according to the current size of the user interface window, and it is determined whether the size of the original rendering texture matches the size of the target rendering texture; if the sizes of the two do not match, the original rendering texture is cropped to obtain a pending rendering texture that matches the size of the target rendering texture, and the image data of the pending rendering texture is copied to the target rendering texture; the image data of the target rendering texture is displayed through the user interface component to display the rendered screen. This avoids the deformation of screen elements, improves the flexibility of screen rendering, and enhances the display effect and user experience of the screen.

[0062] Optionally, after step S202, the embodiment of the present invention further provides a possible implementation method, see Figure 3 .

[0063] Step S208: If the sizes of the two textures match, the image data of the original rendering texture is copied to the target rendering texture.

[0064] In this embodiment, if the judgment result is that the sizes of the two are matched, it means that if the target rendering texture is obtained according to the size of the original rendering texture, the elements in the displayed picture will not be deformed. Then, the texture copy function in the development engine such as Unity, namely Graphics.Blit, is used to copy the image data of the original rendering texture to the target rendering texture, and the image data of the target rendering texture is displayed through the user interface component to display the rendered picture.

[0065] Optionally, for the process of updating the size of the corresponding target rendering texture according to the current size of the user interface window in step S202, an embodiment of the present invention provides a possible implementation manner.

[0066] Step S202-1: when the current size of the user interface window is different from the size of the corresponding target rendering texture, the target rendering texture is released, and a rendering texture is regenerated based on the current size of the user interface window as the target rendering texture.

[0067] In this embodiment, the current size of the user interface window, i.e., the current width and the current height, is obtained, and the current width of the user interface window is compared with the width of the target rendering texture currently corresponding to it, and the current height of the user interface window is compared with the height of the target rendering texture currently corresponding to it.

[0068] If the width and height of the two are the same, it means that the size of the user interface window and its current corresponding target rendering texture are consistent, so there is no need to update the size of the target rendering texture. If the width or height of the two is different, it means that the size of the user interface window has changed, resulting in inconsistency with the size of the target rendering texture that it currently corresponds to, then you can use a preset texture update function such as UpdateRTT to release its current corresponding target rendering texture, and use a preset texture size update function such as UpdateRTTSize to regenerate a rendering texture of the same size as the target rendering texture based on the current size of the user interface window.

[0069] It can be understood that, in the embodiment of the present invention, when the size of the user interface window is inconsistent with that of the target rendering texture currently corresponding to it, the target rendering texture is recycled to release the corresponding memory, and a rendering texture is regenerated as a new target rendering texture, thereby avoiding affecting the efficiency of screen rendering due to the historical target rendering texture of the user interface window occupying memory.

[0070] Optionally, for the process of determining whether the size of the original rendering texture matches the size of the target rendering texture in step S202, an embodiment of the present invention provides a possible implementation manner.

[0071] Step S202-3, comparing the aspect ratio of the original rendering texture with the aspect ratio of the target rendering texture.

[0072] Step S202-5A, when the aspect ratios of the two are the same, determine that the sizes of the two are matched.

[0073] Step S202-5B: when the aspect ratios of the two images are different, it is determined that the sizes of the two images do not match.

[0074] In this embodiment, the aspect ratio can be calculated according to the size of the original rendering texture, that is, the width and height, and the aspect ratio can be calculated according to the size of the target rendering texture, that is, the width and height. Then, the aspect ratio of the original rendering texture is compared with the aspect ratio of the target rendering texture to determine whether the sizes of the two match, and a Boolean value can also be used to mark the comparison result.

[0075] If the Boolean value is true, that is, True, indicating that the aspect ratio of the two is the same, then the sizes of the two are determined to match, and the image data of the original rendering texture can be directly copied to the target rendering texture, and the image data of the target rendering texture can be displayed through the user interface component, so that the displayed picture contains all the picture content represented by the original rendering texture.

[0076] If the Boolean value is false, that is, False, it means that the aspect ratios of the two are different, and it is determined that the sizes of the two do not match. Then, the original rendering texture is cropped to obtain a pending rendering texture that matches the size of the target rendering texture, and the image data of the pending rendering texture is copied to the target rendering texture. The image data of the target rendering texture is displayed through the user interface component, so that the displayed picture contains part of the picture content represented by the original rendering texture, thereby avoiding deformation of the picture elements and improving the display effect of the picture.

[0077] Optionally, for the process of performing cropping based on the original rendering texture in step S204 to obtain a pending rendering texture that matches the size of the target rendering texture, an embodiment of the present invention provides a possible implementation manner.

[0078] Step S204 - 1 , copying the image data of the original rendering texture to a temporary rendering texture of the same size.

[0079] Step S204 - 3 , obtaining the size and position of the clipping rectangle according to the size of the temporary rendering texture and the size of the target rendering texture.

[0080] Step S204 - 5 , cropping the temporary rendering texture according to the size and position of the cropping rectangle to obtain a pending rendering texture.

[0081] In this embodiment, when the size of the original rendering texture does not match the size of the target rendering texture, in order to retain the complete image data of the original rendering texture, the texture copy function in the development engine such as Unity, namely Graphics.Blit, can be used to copy the image data of the original rendering texture to a rendering texture of the same size, thereby obtaining a temporary rendering texture.

[0082] Then, a preset cropping rectangle acquisition function such as AdjustRect can be used to obtain the size and position of the cropping rectangle according to the size of the temporary rendering texture and the size of the target rendering texture, and the temporary rendering texture is cropped according to the size and position of the cropping rectangle to obtain the pending rendering texture. Optionally, a local texture copy function in a development engine such as Unity, namely Graphics.CopyTexture, can be used to crop the temporary rendering texture according to the cropping rectangle to obtain the pending rendering texture, and copy the pending rendering texture to the target rendering texture. It can be understood that the cropping rectangle is used to represent the image data to be retained in the original rendering texture, that is, to represent the area where the pending rendering texture is located.

[0083] Optionally, for step S204-3, an embodiment of the present invention provides a possible implementation method.

[0084] Step S204-3-1, determining the width and height of the cropping rectangle according to the aspect ratio of the temporary rendering texture and the aspect ratio of the target rendering texture.

[0085] Step S204-3-3, determining the position of the cropping rectangle in the temporary rendering texture according to the width and height of the cropping rectangle and the width and height of the temporary rendering texture.

[0086] In this embodiment, the aspect ratio of the temporary rendering texture can be compared with the aspect ratio of the target rendering texture to determine the size of the cropping rectangle, i.e., the width and height. For example, if the aspect ratio of the temporary rendering texture is greater than the aspect ratio of the target rendering texture, it means that the temporary rendering texture is wider than the target rendering texture, then the height of the temporary rendering texture can be multiplied by the aspect ratio of the target rendering texture to obtain the corresponding width as the width of the cropping rectangle, and the height of the temporary rendering texture can be used as the height of the cropping rectangle.

[0087] If the aspect ratio of the temporary render texture is smaller than that of the target render texture, it means that the temporary render texture is taller than the target render texture. Then the width of the temporary render texture can be divided by the aspect ratio of the target render texture to obtain the corresponding height as the height of the cropping rectangle, and the width of the temporary render texture can be used as the width of the cropping rectangle.

[0088] Optionally, in order to further improve the display effect of the picture, the width and height of the cropping rectangle can be adaptively determined according to preset conditions. For example, the preset condition is that the aspect ratio of the cropping rectangle is equal to the aspect ratio of the target rendering texture, and the difference between the first ratio (i.e., the ratio of the width difference between the temporary rendering texture and the cropping rectangle to the width of the temporary rendering texture) and the second ratio (i.e., the ratio of the height difference between the temporary rendering texture and the cropping rectangle to the height of the temporary rendering texture) is the smallest, thereby obtaining the width and height of the cropping rectangle.

[0089] Then, a coordinate system is established with the point at the lower left corner of the temporary rendering texture as the origin, and half of the difference in width between the temporary rendering texture and the cropping rectangle is used as the horizontal coordinate, and half of the difference in height between the temporary rendering texture and the cropping rectangle is used as the vertical coordinate. The position of the point at the lower left corner of the cropping rectangle in the coordinate system is obtained, that is, the position of the cropping rectangle in the temporary rendering texture is obtained.

[0090] In order to execute the corresponding steps in the above embodiments and various possible methods, the implementation method of the picture rendering device is given below. Figure 4 , is a functional module diagram of a screen rendering device provided in an embodiment of the present invention. It should be noted that the basic principle and technical effects of the screen rendering device 300 provided in this embodiment are the same as those of the above embodiment. For the sake of brief description, for matters not mentioned in this embodiment, reference may be made to the corresponding contents in the above embodiment. The screen rendering device 300 includes:

[0091] An updating module 310 is used to update the size of the corresponding target rendering texture according to the current size of the user interface window during post-processing of the original rendering texture obtained by rendering based on the screen content, and determine whether the size of the original rendering texture matches the size of the target rendering texture;

[0092] A copy module 330 is used for, if the sizes of the two do not match, cropping based on the original rendering texture to obtain a pending rendering texture that matches the size of the target rendering texture, and copying the image data of the pending rendering texture to the target rendering texture;

[0093] The display module 350 is used to display the image data of the target rendering texture through a user interface component to display a rendered image.

[0094] Optionally, the copy module 330 is further configured to copy the image data of the original rendering texture to the target rendering texture if the sizes of the two textures match.

[0095] Optionally, the update module 310 is further used to: when the current size of the user interface window is different from the size of the corresponding target rendering texture, release the target rendering texture, and regenerate a rendering texture as the target rendering texture based on the current size of the user interface window.

[0096] Optionally, the update module 310 is further used to: compare the aspect ratio of the original rendering texture with the aspect ratio of the target rendering texture; if the aspect ratios of the two are the same, determine that the sizes of the two match; if the aspect ratios of the two are different, determine that the sizes of the two do not match.

[0097] Optionally, the copy module 330 is further used to: copy the image data of the original rendering texture to a temporary rendering texture of the same size; obtain the size and position of the cropping rectangle according to the size of the temporary rendering texture and the size of the target rendering texture; and crop the temporary rendering texture according to the size and position of the cropping rectangle to obtain the pending rendering texture.

[0098] Optionally, the copy module 330 is further used to: determine the width and height of the cropping rectangle according to the aspect ratio of the temporary rendering texture and the aspect ratio of the target rendering texture; determine the position of the cropping rectangle in the temporary rendering texture according to the width and height of the cropping rectangle and the width and height of the temporary rendering texture.

[0099] An embodiment of the present invention further provides an electronic device, including a processor and a memory, wherein the memory stores a computer program, and when the processor executes the computer program, the image rendering method disclosed in the embodiment of the present invention is implemented.

[0100] The embodiment of the present invention further provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the image rendering method disclosed in the embodiment of the present invention is implemented.

[0101] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0102] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0103] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0104] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A picture rendering method, characterized in that: The picture rendering method comprises: In a process of post-processing an original rendering texture obtained by rendering based on the screen content, updating a size of a corresponding target rendering texture according to a current size of the user interface window, and determining whether the size of the original rendering texture matches the size of the target rendering texture; If the sizes of the two do not match, cropping is performed based on the original rendering texture to obtain a pending rendering texture that matches the size of the target rendering texture, and image data of the pending rendering texture is copied to the target rendering texture; The image data of the target rendering texture is displayed through a user interface component to display a rendered picture.

2. The image rendering method according to claim 1, characterized in that: After the step of determining whether the size of the original rendering texture matches the size of the target rendering texture, the picture rendering method further includes: If the sizes of the two match, the image data of the original rendering texture is copied to the target rendering texture.

3. The image rendering method according to claim 1, characterized in that: The step of updating the size of the corresponding target rendering texture according to the current size of the user interface window includes: When the current size of the user interface window is different from the size of the corresponding target rendering texture, the target rendering texture is released, and a rendering texture is regenerated based on the current size of the user interface window as the target rendering texture.

4. The image rendering method according to claim 1, characterized in that: The step of determining whether the size of the original rendering texture matches the size of the target rendering texture comprises: Compare the aspect ratio of the original rendering texture with the aspect ratio of the target rendering texture; If the ratio of width to height of the two images is the same, the sizes of the two images are determined to match; When the aspect ratios of the two are different, it is determined that the sizes of the two do not match.

5. The image rendering method according to any one of claims 1 to 4, characterized in that: The step of performing clipping based on the original rendering texture to obtain a pending rendering texture that matches the size of the target rendering texture comprises: Copying the image data of the original render texture to a temporary render texture of the same size; According to the size of the temporary rendering texture and the size of the target rendering texture, the size and position of the clipping rectangle are obtained; The temporary rendering texture is clipped according to the size and position of the clipping rectangle to obtain the pending rendering texture.

6. The image rendering method according to claim 5, characterized in that: The step of obtaining the size and position of the clipping rectangle according to the size of the temporary rendering texture and the size of the target rendering texture comprises: Determining the width and height of the cropping rectangle according to the aspect ratio of the temporary rendering texture and the aspect ratio of the target rendering texture; The position of the cropping rectangle in the temporary rendering texture is determined according to the width and height of the cropping rectangle and the width and height of the temporary rendering texture.

7. A picture rendering device, characterized in that: The picture rendering device comprises: An updating module, configured to update the size of a corresponding target rendering texture according to a current size of the user interface window during post-processing of an original rendering texture obtained by rendering based on the screen content, and determine whether the size of the original rendering texture matches the size of the target rendering texture; a copy module, configured to, if the sizes of the two do not match, perform cropping based on the original rendering texture to obtain a pending rendering texture that matches the size of the target rendering texture, and copy image data of the pending rendering texture to the target rendering texture; The display module is used to display the image data of the target rendering texture through a user interface component to display a rendered picture.

8. The image rendering device according to claim 7, characterized in that: The copy module is further configured to copy the image data of the original rendering texture to the target rendering texture if the sizes of the two textures match.

9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program, and when the processor executes the computer program, the image rendering method according to any one of claims 1 to 6 is implemented.

10. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the processor, the image rendering method according to any one of claims 1 to 6 is implemented.

Citation Information

Cited By

  • Personalized replacing, cutting and deformation rendering method and system for design file

    CN121392102A