Graph rendering method and device, electronic equipment, chip and storage medium
By generating the maximum inscribed rectangle and using the color data of the bounding rectangle for rendering, the problem of high GPU computational load during rounded rectangle rendering is solved, thus improving GPU rendering efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING X RING TECHNOLOGY CO LTD
- Filing Date
- 2024-07-12
- Publication Date
- 2026-06-05
Smart Images

Figure CN118864618B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of graphics processing technology, and in particular to a graphics rendering method, apparatus, electronic device, chip, and storage medium. Background Technology
[0002] For drawing right-angled rectangles, the graphics processing unit (GPU) can directly calculate the color of each pixel in the output rectangle within the fragment shader of the rendering pipeline. However, for rounded rectangles, the fragment shader needs to calculate whether the position coordinates of each pixel in the right-angled rectangle are outside the rounded rectangle, based on the position information of the corresponding right-angled rectangle and the corner radius of the rounded rectangle. Pixels with coordinates outside the rounded corners are then set to transparent, thus achieving the outline effect of the rounded rectangle. Since each pixel in the fragment shader involves position coordinate calculations, this significantly increases the computational load on the GPU, leading to a performance decrease. Summary of the Invention
[0003] This disclosure aims to at least partially address one of the technical problems in the related art.
[0004] The first aspect of this disclosure provides a graphics rendering method, including:
[0005] If the graphic to be rendered is a preset shape, generate the maximum inscribed rectangle corresponding to the graphic to be rendered;
[0006] Obtain the first color data corresponding to the smallest bounding rectangle of the graphic to be rendered;
[0007] Based on the first color data, determine the second color data corresponding to the largest inscribed rectangle;
[0008] The largest inscribed rectangle is rendered based on the second color data.
[0009] A second aspect of this disclosure provides a graphics rendering apparatus, comprising:
[0010] The generation module is used to generate the maximum inscribed rectangle corresponding to the graphic to be rendered when the graphic to be rendered is a preset shape.
[0011] The acquisition module is used to acquire the first color data corresponding to the minimum bounding rectangle of the graphic to be rendered;
[0012] The determining module is used to determine the second color data corresponding to the largest inscribed rectangle based on the first color data;
[0013] The rendering module is used to render the maximum inscribed rectangle based on the second color data.
[0014] A third aspect of this disclosure provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, it implements the graphics rendering method as proposed in the first aspect of this disclosure.
[0015] A fourth aspect of this disclosure provides a chip including processing circuitry configured to perform the graphics rendering method proposed in the first aspect.
[0016] A fifth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the graphics rendering method as proposed in the first aspect of this disclosure.
[0017] The graphics rendering method, apparatus, electronic device, chip, and storage medium disclosed herein have the following beneficial effects:
[0018] In this embodiment, when the graphic to be rendered has a preset shape, the maximum inscribed rectangle corresponding to the graphic is generated, the first color data corresponding to the minimum bounding rectangle of the graphic to be rendered is obtained, and the second color data corresponding to the maximum inscribed rectangle is determined based on the first color data. Finally, the maximum inscribed rectangle is rendered based on the second color data. Thus, the maximum inscribed rectangle of the graphic to be rendered is determined, and the maximum inscribed rectangle is rendered directly based on the second color data, without needing to calculate whether the pixels inside the maximum inscribed rectangle are located inside the image to be rendered. This reduces the computational load on the GPU when rendering the graphic, lowers the GPU load, and improves the GPU's rendering efficiency.
[0019] Additional aspects and advantages of this disclosure will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this disclosure. Attached Figure Description
[0020] The above and / or additional aspects and advantages of this disclosure will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, in which:
[0021] Figure 1 This is a schematic flowchart of a graphics rendering method provided in an embodiment of the present disclosure;
[0022] Figure 2 A schematic flowchart illustrating a graphics rendering method provided in another embodiment of this disclosure;
[0023] Figure 3 This is a schematic diagram of a graphic rendering provided in an embodiment of the present disclosure;
[0024] Figure 4 A schematic diagram of the structure of a graphics rendering apparatus provided in another embodiment of the present disclosure;
[0025] Figure 5 A block diagram of an exemplary electronic device suitable for implementing embodiments of the present disclosure is shown;
[0026] Figure 6 This is a schematic diagram of the structure of a chip proposed in an embodiment of this disclosure. Detailed Implementation
[0027] Embodiments of this disclosure are described in detail below. Examples of these embodiments are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this disclosure, and should not be construed as limiting this disclosure.
[0028] The following description, with reference to the accompanying drawings, outlines a graphics rendering method, apparatus, electronic device, chip, and storage medium according to embodiments of the present disclosure.
[0029] This disclosure illustrates an example where the graphics rendering method is configured in a graphics rendering apparatus, which can be applied to any electronic device to enable the electronic device to perform graphics rendering functions.
[0030] Figure 1 This is a schematic flowchart of a graphics rendering method provided in an embodiment of the present disclosure.
[0031] like Figure 1 As shown, the graphics rendering method may include the following steps:
[0032] Step 101: If the graphic to be rendered is a preset shape, generate the maximum inscribed rectangle corresponding to the graphic to be rendered.
[0033] The graphic to be rendered can be a graphic whose shape and color have been determined and is waiting to be rendered.
[0034] In some embodiments, it can be determined whether the graphic to be rendered is a preset shape after the rendering thread starts traversing the rendering operation commands and drawing a graphic to be rendered, and after the surface compositor determines the color information of the large rendering graphic.
[0035] The preset shape is not a right-angled rectangle. For example, it can be a rounded rectangle, a pentagon, an ellipse, etc. This disclosure does not limit this.
[0036] In some embodiments, the maximum inscribed rectangle of the graphic to be rendered can be drawn on a third layer above the first layer containing the graphic to be rendered. That is, the third layer containing the maximum inscribed rectangle is displayed above the first layer containing the graphic to be rendered.
[0037] In this embodiment of the disclosure, if the maximum inscribed rectangle of the graphic to be rendered is drawn on the third layer above the first layer where the graphic to be rendered is located, it is necessary to ensure that the transparency attribute of the first layer where the graphic to be rendered is opaque, so as to avoid the problem of some transparent pixels having abnormal appearance when rendering the maximum inscribed rectangle.
[0038] Step 102: Obtain the first color data corresponding to the smallest bounding rectangle of the graphic to be rendered.
[0039] In some embodiments, if the graphic to be rendered is a rounded rectangle, the CPU determines the position, color data, and corner radius information of the outer rectangle of the rounded rectangle, and sends the position and corner radius information of the outer rectangle to the GPU. Therefore, the first color data corresponding to the smallest outer rectangle can be obtained.
[0040] In some embodiments, the first color data corresponding to the minimum bounding rectangle may include the color data corresponding to each pixel in the minimum bounding rectangle. The color data corresponding to each pixel may be the values of the red component, the green component, and the blue component.
[0041] The color data corresponding to each pixel in the minimum bounding rectangle may be the same or different, and this disclosure does not impose any restrictions on this.
[0042] Step 103: Determine the second color data corresponding to the largest inscribed rectangle based on the first color data.
[0043] The second color data may include the color data corresponding to each pixel in the largest inscribed rectangle.
[0044] In some embodiments, if any third pixel in the largest inscribed rectangle coincides with any fourth pixel in the smallest bounding rectangle, the first color data corresponding to any fourth pixel is determined as the second color data corresponding to any third pixel. Thus, the color information of the largest inscribed rectangle of the rounded rectangle can be preserved, ensuring that the appearance of the newly generated largest inscribed rectangle is consistent with that area of the rounded rectangle.
[0045] Step 104: Render the largest inscribed rectangle based on the second color data.
[0046] In this embodiment of the disclosure, after determining the second color data corresponding to the largest inscribed rectangle, the largest inscribed rectangle area in the rounded rectangle can be rendered directly based on the second color data. There is no need to determine whether the pixels in the largest inscribed rectangle area are located inside the rounded rectangle, thereby reducing the amount of computation of the GPU when rendering the preset shape graphics, reducing the GPU load, and improving the rendering efficiency of the GPU.
[0047] In some embodiments, if the maximum inscribed rectangle of the graphic to be rendered is drawn on a third layer above the first layer where the graphic to be rendered is located, after determining the second color data, the first color data of the area in the first layer that is the same as the position of the maximum inscribed rectangle can be deleted, and the second color data can be stored. Thus, the maximum inscribed rectangle of the third layer can be rendered based on the second color data. When rendering the first layer, it is not necessary to render the area corresponding to the maximum inscribed rectangle. Only the other pixels outside the maximum inscribed rectangle need to be rendered, thereby reducing the amount of computation of the GPU when rendering the graphic to be rendered, reducing the GPU load, and improving the rendering efficiency of the GPU.
[0048] In some embodiments, it is also necessary to render other pixels in the graphic to be rendered, excluding the largest inscribed rectangle, to complete the rendering effect of the graphic. Specifically, the regions outside the largest inscribed rectangle within the smallest bounding rectangle are determined to obtain the first pixel located inside the graphic to be rendered and the second pixel located outside the graphic. Based on the first color data, the third color data corresponding to the first pixel is determined. Based on the third color data, the first pixel is rendered, and the second pixel is set to transparent. Thus, the GPU only needs to determine the relationship between the other pixels in the smallest bounding rectangle (excluding the largest inscribed rectangle) and the graphic to be rendered, reducing the overall computational load on the GPU when rendering the graphic, lowering the GPU load, and improving the GPU's rendering efficiency.
[0049] Since the first color data contains the color data corresponding to each pixel in the smallest bounding rectangle, the third color data corresponding to the first pixel can be determined based on the first color data.
[0050] In this embodiment, when the graphic to be rendered has a preset shape, the maximum inscribed rectangle corresponding to the graphic is generated, the first color data corresponding to the minimum bounding rectangle of the graphic to be rendered is obtained, and the second color data corresponding to the maximum inscribed rectangle is determined based on the first color data. Finally, the maximum inscribed rectangle is rendered based on the second color data. Thus, the maximum inscribed rectangle of the graphic to be rendered is determined, and the maximum inscribed rectangle is rendered directly based on the second color data, without needing to calculate whether the pixels inside the maximum inscribed rectangle are located inside the image to be rendered. This reduces the computational load on the GPU when rendering the graphic, lowers the GPU load, and improves the GPU's rendering efficiency.
[0051] Figure 2 This is a flowchart illustrating a graphics rendering method provided in an embodiment of the present disclosure, as shown below. Figure 2 As shown, the graphics rendering method may include the following steps:
[0052] Step 201: Given that the graphic to be rendered is a preset shape, there is a second layer below the first layer where the graphic to be rendered is located, and the transparency attribute of the first layer is opaque, generate the maximum inscribed rectangle corresponding to the graphic to be rendered.
[0053] In this context, a second layer exists below the first layer containing the graphic to be rendered, indicating that a background exists beneath the graphic.
[0054] In some embodiments, the maximum inscribed rectangle of the graphic to be rendered is drawn on a third layer above the first layer.
[0055] In this embodiment, the maximum inscribed rectangle of the graphic to be rendered in the third layer completely covers the corresponding areas of the maximum inscribed rectangle of the graphic to be rendered in the first layer and the corresponding areas of the maximum inscribed rectangle of the background in the second layer. If the transparency attribute of the second layer is transparent, the graphic to be rendered in the first layer needs to be blended with the background in the second layer. If the maximum inscribed rectangle is used for complete coverage, it will cause the rendered graphic to have an abnormal appearance. Therefore, this method needs to be used when the transparency attribute of the first layer is opaque.
[0056] Step 202: Obtain the first color data corresponding to the smallest bounding rectangle of the graphic to be rendered.
[0057] Step 203: Determine the second color data corresponding to the largest inscribed rectangle based on the first color data.
[0058] The specific implementation of steps 202 and 203 can be found in the detailed descriptions of other embodiments in this disclosure, and will not be repeated here.
[0059] Step 204: Delete the first color data in the first layer corresponding to the area of the largest inscribed rectangle, and the fourth color data in the second layer corresponding to the area of the largest inscribed rectangle.
[0060] Figure 3 This is a schematic diagram of a graphic rendering provided in an embodiment of the present disclosure, such as... Figure 3 As shown, the graphic to be rendered is a rounded rectangle. The first layer containing the graphic is the layer above the second layer containing the background, and the third layer containing the largest inscribed rectangle is the layer above the first layer. Therefore, the CPU first determines the fourth color data corresponding to each pixel in the second layer containing the background and sends this data to the GPU for storage. Then, the CPU determines the first color data corresponding to each pixel in the smallest bounding rectangle of the first layer containing the graphic and sends this data to the GPU for storage. Finally, the CPU determines the second color data of the largest inscribed rectangle in the third layer and sends it to the GPU. After this, the GPU can delete the stored first color data of the area corresponding to the largest inscribed rectangle in the first layer and the fourth color data of the largest inscribed rectangle in the second layer. Thus, during rendering, the GPU only needs to render the area of the largest inscribed rectangle in the third layer, without needing to process the areas of the largest inscribed rectangles in the first and second layers, thereby further reducing the GPU load and improving GPU performance.
[0061] It should be noted that in this embodiment of the disclosure, a forward pixel culling (FPK) technique is used to remove the first color data in the first layer corresponding to the area of the largest inscribed rectangle, and the fourth color data in the second layer corresponding to the area of the largest inscribed rectangle, based on the second color data.
[0062] FPK is a hidden face removal method in GPUs. For opaque objects, when rendering in reverse order, hidden pixels can be removed to avoid them entering the fragment shader for redundant calculations, thereby improving GPU performance.
[0063] The principle behind FPK (First In, First Out) features is that a 2x2 pixel quadrilateral is not immediately sent to the fragment shader for processing. Instead, it is stored in a 128-bit First In, First Out (FIFO) queue. When a quad at the same position is added later, the cached quad is removed, thus ensuring that occluded pixel quads do not enter the fragment shader for redundant calculations, improving GPU performance. Therefore, in this embodiment, based on the second color data, the first color data in the region corresponding to the largest inscribed rectangle in the first layer and the fourth color data in the region corresponding to the largest inscribed rectangle in the second layer are removed. This avoids redundant calculations in the fragment shader for the color data below the largest inscribed rectangle, thereby improving GPU performance.
[0064] Step 205: Store the second color data.
[0065] In this embodiment of the disclosure, after deleting the first color data and the fourth color data corresponding to the largest inscribed rectangular area, the second color data can be stored in the corresponding storage location.
[0066] In some embodiments, based on the second color data, the first color data of the region corresponding to the maximum inscribed rectangle in the first layer and the fourth color data of the region corresponding to the maximum inscribed rectangle in the second layer stored in the first-in-first-out (FIFO) queue can be removed, and then the second color data can be stored in the storage location of the corresponding pixel. Thus, during GPU rendering, the fragment shader can read the second color data from the FIFO queue and render the maximum inscribed rectangle.
[0067] For example, if the position of any pixel in the largest inscribed rectangle is in the i-th row and j-th column, and the storage location corresponding to the i-th row and j-th column pixel in FIFO already stores the first color data and the fourth color data of the i-th row and j-th column pixel, then the first color data and the fourth color data in the storage location corresponding to the i-th row and j-th column pixel are deleted, and the second color data corresponding to the i-th row and j-th column pixel is stored in that storage location.
[0068] It should be noted that the second color data can be determined by the CPU when generating the maximum inscribed rectangle. The rendering of the maximum inscribed rectangle is handled by the CPU and the GPU. Therefore, the second color data needs to be stored so that the GPU can read the color data from the storage location for rendering.
[0069] Step 206: Render the largest inscribed rectangle based on the second color data.
[0070] In this embodiment of the present disclosure, during the rendering process, the GPU first renders the largest inscribed rectangle in the third layer based on the second color data. Then, it determines whether other pixels in the first layer, excluding the largest inscribed rectangle area, are located inside the graphic to be rendered. Based on the first color data corresponding to the first pixel located inside the graphic to be rendered, the first pixel located inside the graphic to be rendered is rendered, and the second pixel located outside the graphic to be rendered is set to transparent. Finally, based on the fourth color data corresponding to the pixels in other areas of the first layer excluding the graphic to be rendered, the other areas in the first layer excluding the graphic to be rendered are rendered to obtain the final rendering result.
[0071] In this embodiment, when a second layer exists below the first layer containing the graphic to be rendered, and the first layer is opaque, the maximum inscribed rectangle corresponding to the graphic to be rendered is generated. First color data corresponding to the minimum bounding rectangle of the graphic to be rendered is obtained. Based on the first color data, second color data corresponding to the maximum inscribed rectangle is determined. The first color data in the first layer corresponding to the region of the maximum inscribed rectangle, and the fourth color data in the second layer corresponding to the region of the maximum inscribed rectangle, are deleted from the stored data. The second color data is then stored. Finally, the maximum inscribed rectangle is rendered based on the second color data. Therefore, by removing the first color data in the first layer corresponding to the region of the maximum inscribed rectangle, and the fourth color data in the second layer corresponding to the region of the maximum inscribed rectangle, based on the minimum bounding rectangle, it is not only unnecessary to calculate whether the pixels in the maximum inscribed rectangle are inside the graphic to be rendered, but also avoids redundant calculations in the fragment shader for the color data of the layer below the maximum inscribed rectangle. This further reduces the complexity of the GPU and improves its performance.
[0072] To implement the above embodiments, this disclosure also proposes a graphics rendering apparatus.
[0073] Figure 4 This is a schematic diagram of the structure of the graphics rendering apparatus provided in the embodiments of this disclosure.
[0074] like Figure 4 As shown, the graphics rendering device 400 may include:
[0075] The generation module 401 is used to generate the maximum inscribed rectangle corresponding to the graphic to be rendered when the graphic to be rendered is a preset shape.
[0076] The acquisition module 402 is used to acquire the first color data corresponding to each first pixel in the minimum bounding rectangle of the graphic to be rendered;
[0077] The determining module 403 is used to determine the second color data corresponding to each second pixel in the largest inscribed rectangle based on the first color data;
[0078] Rendering module 404 is used to render the largest inscribed rectangle based on the second color data.
[0079] In some embodiments, a processing module is further included for:
[0080] Determine the region within the smallest bounding rectangle, excluding the largest inscribed rectangle;
[0081] Identify the first pixel point located inside the graphic to be rendered and the second pixel point located outside the graphic to be rendered in other regions;
[0082] Based on the first color data, determine the third color data corresponding to the first pixel;
[0083] The first pixel is rendered based on the third color data;
[0084] Set the second pixel to transparent.
[0085] In some embodiments, the generation module 401 is configured to:
[0086] If there is a second layer below the first layer containing the graphic to be rendered, and the first layer is opaque, generate the largest inscribed rectangle corresponding to the graphic to be rendered.
[0087] In some embodiments, the generation module 401 is configured to:
[0088] Draw the largest inscribed rectangle of the graphic to be rendered on the third layer, above the first layer containing the graphic to be rendered.
[0089] In some embodiments, a storage module is further included for:
[0090] Delete the first color data in the first layer corresponding to the area of the largest inscribed rectangle, and the fourth color data in the second layer corresponding to the area of the largest inscribed rectangle;
[0091] Store the second color data.
[0092] In some embodiments, the determining module 403 is configured to:
[0093] If any third pixel in the largest inscribed rectangle coincides with any fourth pixel in the smallest bounding rectangle, the first color data corresponding to any fourth pixel is determined as the second color data corresponding to any third pixel.
[0094] The functions and specific implementation principles of the modules described in this embodiment can be found in the above method embodiments, and will not be repeated here.
[0095] The graphics rendering apparatus of this disclosure first generates the maximum inscribed rectangle corresponding to the graphic to be rendered, assuming the graphic to be rendered has a preset shape. It then obtains first color data corresponding to the minimum bounding rectangle of the graphic to be rendered, determines second color data corresponding to the maximum inscribed rectangle based on the first color data, and finally renders the maximum inscribed rectangle based on the second color data. Thus, by determining the maximum inscribed rectangle of the graphic to be rendered and directly rendering it based on the second color data, it eliminates the need to calculate whether the pixels inside the maximum inscribed rectangle are located inside the image to be rendered. This reduces the computational load on the GPU when rendering the graphic, lowers the GPU load, and improves the GPU's rendering efficiency.
[0096] To implement the above embodiments, this disclosure also proposes an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the graphics rendering method proposed in the foregoing embodiments of this disclosure.
[0097] Figure 5 A block diagram of an exemplary electronic device suitable for implementing embodiments of the present disclosure is shown. Figure 5 The electronic device 12 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.
[0098] like Figure 5 As shown, the electronic device 12 is represented in the form of a general-purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, system memory 28, and bus 18 connecting different system components (including system memory 28 and processing unit 16).
[0099] Bus 18 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. Examples of these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0100] Electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by electronic device 12, including volatile and non-volatile media, removable and non-removable media.
[0101] Memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and / or cache memory 32. Electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media (… Figure 5 Not shown; usually referred to as a "hard drive"). Although Figure 5 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disc drive for reading and writing to a removable non-volatile optical disc (e.g., a compact optical disc read-only memory (CD-ROM), a digital video disc read-only memory (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of this disclosure.
[0102] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of this disclosure.
[0103] Electronic device 12 can also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), and with one or more devices that enable a user to interact with electronic device 12, and / or with any device that enables electronic device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 22. Furthermore, electronic device 12 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 20. As shown, network adapter 20 communicates with other modules of electronic device 12 via bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0104] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the methods mentioned in the foregoing embodiments.
[0105] To implement the above embodiments, this disclosure also proposes a chip, including: the chip includes processing circuitry configured to perform the graphics rendering method as provided in the foregoing embodiments.
[0106] Figure 6 This is a schematic diagram of the chip structure proposed in an embodiment of this disclosure. See also... Figure 6 The diagram shown is a schematic representation of the structure of chip 600, but it is not limited to this.
[0107] Chip 600 includes processing circuitry 601, which is configured to perform any of the above methods.
[0108] In some embodiments, chip 600 further includes one or more interface circuits 602. Optionally, the interface circuit 602 is connected to memory 603, and the interface circuit 602 can be used to receive signals from memory 603 or other devices, and the interface circuit 602 can be used to send signals to memory 603 or other devices. For example, the interface circuit 602 can read instructions stored in memory 603 and send the instructions to processing circuit 601.
[0109] In some embodiments, the interface circuit 602 performs at least one of the communication steps such as sending and / or receiving in the above method, and the processing circuit 601 performs other steps.
[0110] In some embodiments, the terms interface circuit, interface, transceiver pin, transceiver, etc., can be used interchangeably.
[0111] In some embodiments, chip 600 further includes one or more memories 603 for storing instructions. Optionally, all or part of the memories 603 may be located outside of chip 600.
[0112] To implement the above embodiments, this disclosure also proposes a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the graphics rendering method proposed in the foregoing embodiments of this disclosure.
[0113] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in this disclosure all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0114] It should be noted that personal information collected from users should be used for legitimate and reasonable purposes and should not be shared or sold outside of these legitimate uses. Furthermore, such collection / sharing should only be conducted after receiving the user's informed consent, including but not limited to notifying the user to read the user agreement / user notice and sign an agreement / authorization that includes authorization of relevant user information before the user uses the function. In addition, any necessary steps must be taken to protect and safeguard access to such personal information data and ensure that others with access to personal information data comply with their privacy policies and procedures.
[0115] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this disclosure. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0116] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this disclosure, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0117] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of preferred embodiments of this disclosure includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which embodiments of this disclosure pertain.
[0118] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.
[0119] It should be understood that various parts of this disclosure can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0120] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
[0121] Furthermore, the functional units in the various embodiments of this disclosure can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0122] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of the present disclosure have been shown and described above, it is to be understood that the above embodiments are exemplary and should not be construed as limiting the present disclosure. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present disclosure.
Claims
1. A graphics rendering method, characterized in that, The method includes: If the graphic to be rendered is a preset shape, generate the largest inscribed rectangle corresponding to the graphic to be rendered. The preset shape includes at least one of rounded rectangle, pentagon, and ellipse. Obtain the first color data corresponding to the smallest bounding rectangle of the graphic to be rendered; Based on the first color data, determine the second color data corresponding to the largest inscribed rectangle; The largest inscribed rectangle is rendered based on the second color data.
2. The method according to claim 1, characterized in that, The method further includes: Determine the regions within the minimum bounding rectangle that are not included in the maximum inscribed rectangle; Determine the first pixel point located inside the graphic to be rendered and the second pixel point located outside the graphic to be rendered in the other regions; Based on the first color data, determine the third color data corresponding to the first pixel; Based on the third color data, the first pixel is rendered; Set the second pixel to transparent.
3. The method according to claim 1, characterized in that, The process of generating the maximum inscribed rectangle corresponding to the graphic to be rendered includes: If a second layer exists below the first layer containing the graphic to be rendered, and the first layer is opaque, then the maximum inscribed rectangle corresponding to the graphic to be rendered is generated.
4. The method according to claim 1 or 3, characterized in that, The process of generating the maximum inscribed rectangle corresponding to the graphic to be rendered includes: Draw the largest inscribed rectangle of the graphic to be rendered on the third layer above the first layer.
5. The method according to claim 3, characterized in that, After determining the second color data corresponding to the largest inscribed rectangle based on the first color data, the method further includes: Delete the first color data in the first layer corresponding to the area of the largest inscribed rectangle, and the fourth color data in the second layer corresponding to the area of the largest inscribed rectangle; The second color data is stored.
6. The method according to claim 1, characterized in that, The step of determining the second color data corresponding to the largest inscribed rectangle based on the first color data includes: If any third pixel in the largest inscribed rectangle coincides with any fourth pixel in the smallest bounding rectangle, the first color data corresponding to the fourth pixel is determined as the second color data corresponding to the third pixel.
7. A graphics rendering apparatus, characterized in that, The device includes: The generation module is used to generate the largest inscribed rectangle corresponding to the graphic to be rendered when the graphic to be rendered is a preset shape. The preset shape includes at least one of rounded rectangle, pentagon, and ellipse. The acquisition module is used to acquire the first color data corresponding to the minimum bounding rectangle of the graphic to be rendered; The determining module is used to determine the second color data corresponding to the largest inscribed rectangle based on the first color data; The rendering module is used to render the maximum inscribed rectangle based on the second color data.
8. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, it implements the graphics rendering method as described in any one of claims 1-6.
9. A chip, characterized in that, The chip includes processing circuitry configured to perform the graphics rendering method as described in any one of claims 1-6.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the graphics rendering method as described in any one of claims 1-6.