Graph processing method and device, electronic equipment and storage medium

By performing Boolean operations on components of different layers in the EDA online layout design tool, the problem that existing tools cannot generate custom components is solved, achieving higher flexibility and efficiency.

CN120012667APending Publication Date: 2025-05-16SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510161610.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-13
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

Existing EDA online layout design tools cannot perform Boolean operations on components between different layers, resulting in poor flexibility in generating custom components.

Method used

Create multiple pending graphic objects on a blank canvas and set their attribute information, including layer information. Based on these layer information, multiple layers to be computed are determined and Boolean operations are performed to obtain the target graphic object. Finally, it is added to the canvas based on the attribute information of the target graphic object.

Benefits of technology

It realizes Boolean computing of components between different layers to generate customized components, improving the flexibility and efficiency of graphics processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120012667A_ABST
    Figure CN120012667A_ABST
Patent Text Reader

Abstract

The invention discloses a graphic processing method and device, electronic equipment and a storage medium, and relates to the technical field of electronic design automation, and the method comprises the steps: creating a to-be-processed graphic object containing attribute information on a blank canvas, determining a plurality of to-be-calculated graphic layers according to the graphic layer information in the attribute information of the to-be-processed graphic object, and calculating the to-be-calculated graphic layers according to the to-be-calculated graphic layers. According to the technical scheme, the to-be-operated layers are different layers, the to-be-operated graphic objects in the to-be-operated layers are subjected to Boolean operation, the target graphic object can be obtained, that is, the target component can be obtained, the technical problem that components among different layers cannot be subjected to Boolean operation to generate self-defined components in the prior art is solved, and the user experience is improved. The technical effects that Boolean operation can be carried out on the components between different layers, and the flexibility of component generation is improved are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of electronic design automation technology, and in particular to a graphics processing method, device, electronic device and storage medium. Background Art

[0002] Electronic Design Automation (EDA) is a new technology in the field of electronic system design. It combines computer technology, signal processing technology, etc., and greatly improves the efficiency and accuracy of electronic design. Its emergence not only simplifies the workflow of electronic design, but also reduces the workload for engineers.

[0003] At present, EDA online platforms have become the core tools in the field of electronic design, providing a convenient design environment for electronic design. However, when creating custom components, it is impossible to perform Boolean operations on components between different layers to generate custom components, and the flexibility is poor. Summary of the invention

[0004] The present application provides a graphics processing method, device, electronic device and storage medium to at least solve the problem in the related art that it is impossible to perform Boolean operations on components between different layers to generate customized components, resulting in poor flexibility.

[0005] The present application provides a graphics processing method, comprising:

[0006] Creating multiple graphic objects to be processed on a blank canvas, and setting attribute information of the graphic objects to be processed, the attribute information including layer information, and different graphic objects to be processed are used to represent different components;

[0007] Based on the layer information of the graphic object to be processed, determining a plurality of layers to be calculated, wherein the plurality of layers to be calculated are different layers;

[0008] Performing Boolean operations on the graphic objects to be operated in the multiple layers to be operated to obtain a target graphic object, where the target graphic object is used to represent the target component;

[0009] Get the attribute information of the target graphic object, and add the target graphic object to the canvas based on the attribute information of the target graphic object.

[0010] The present application also provides a graphics processing device, comprising:

[0011] A creation module, used for creating multiple graphic objects to be processed on a blank canvas, and setting attribute information of the graphic objects to be processed, wherein the attribute information includes layer information, and different graphic objects to be processed are used to represent different components;

[0012] A determination module, used for determining a plurality of layers to be calculated based on the layer information of the graphic object to be processed, wherein the plurality of layers to be calculated are different layers;

[0013] A first acquisition module is used to perform Boolean operations on the graphic objects to be operated in the multiple layers to be operated to obtain a target graphic object, where the target graphic object is used to represent the target component;

[0014] The second acquisition module is used to acquire the attribute information of the target graphic object, and add the target graphic object to the canvas based on the attribute information of the target graphic object.

[0015] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any one of the above-mentioned graphics processing methods when executing the computer program.

[0016] The present application also provides a computer-readable storage medium, in which a computer program is stored, wherein when the computer program is executed by a processor, the steps of any of the above-mentioned graphics processing methods are implemented.

[0017] The present application also provides a computer program product, including a computer program, which implements the steps of any of the above-mentioned graphics processing methods when executed by a processor.

[0018] Through the present application, since the attribute information of multiple graphic objects to be processed includes layer information, based on the layer information of the graphic objects to be processed, multiple layers to be operated are determined, and the multiple layers to be operated are different layers. Boolean operations are performed on the graphic objects to be operated in the multiple layers to be operated to obtain target graphic objects, which are used to represent target components, that is, customized components. Based on the attribute information of the target graphic objects, the target graphic objects are added to the canvas to realize the generation of customized components. Therefore, the technical problem that it is impossible to perform Boolean operations on components between different layers to generate customized components and the flexibility is poor in the related art can be solved, and the technical effect of realizing the generation of customized components by performing Boolean operations on components between different layers and improving the flexibility and efficiency of graphic processing can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0020] Figure 1 A flowchart of a graphics processing method provided in an embodiment of the present application;

[0021] Figure 2 A flowchart of another graphics processing method provided in an embodiment of the present application;

[0022] Figure 3 A flowchart of another graphics processing method provided in an embodiment of the present application;

[0023] Figure 4 A structural block diagram of a graphics processing device provided in an embodiment of the present application;

[0024] Figure 5 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0025] 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 ordinary technicians in this field without creative work are within the scope of protection of this application.

[0026] It should be noted that, in the description of this application, the terms "include", "comprise" or any other variant 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 includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in this application are used to distinguish similar objects, and are not used to describe a specific order or sequence.

[0027] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0028] EDA technology is an electronic system design method that integrates multidisciplinary knowledge such as database, computational mathematics, graph theory, graphics, topological logic and optimization theory. This technology uses computers as tools and the expression form of hardware description language to achieve efficient design, simulation, debugging and error correction of electronic systems. As the latest achievement of computer technology, signal processing technology and signal analysis technology, EDA technology provides strong support for electronic engineering design and greatly reduces the workload of engineers.

[0029] EDA software is an indispensable tool for designing electronic chips and circuit boards. It runs through all aspects from integrated circuit (IC) design to circuit board layout and routing, and then to verification, simulation and testing. At present, no other type of software can completely replace EDA in the field of electronic design.

[0030] EDA online platforms have become an indispensable tool in the field of electronic design. As quantum computing gradually shows great commercial potential, this trend is accelerating the development of EDA technology towards a more customized and specialized direction. In particular, in the process of developing quantum EDA online layout design tools, innovative solutions have emerged in the face of some challenges and needs.

[0031] In order to meet users' needs for a more convenient and efficient design experience, these platforms are constantly upgraded and optimized. Among them, Boolean operations between components on different layers are a key function. When users draw quantum chips, as the complexity of the design increases, users hope to be able to customize the creation and use of components to achieve more sophisticated and optimized design processing. In the process of customizing components, it is usually necessary to perform Boolean operations on components on different layers to complete the design.

[0032] However, the EDA online layout design tool of the related art cannot perform Boolean operations on components between different layers to generate customized components, but can only perform Boolean operations on components on the same layer, which has poor flexibility.

[0033] In response to the above problems, the embodiments of the present application provide a graphics processing method, device, electronic device and storage medium, the method comprising: creating multiple graphics objects to be processed on a blank canvas, and setting the attribute information of the graphics objects to be processed, the attribute information including layer information, and different graphics objects to be processed are used to represent different components; based on the layer information of the graphics objects to be processed, determining multiple layers to be operated, wherein the multiple layers to be operated are different layers; performing Boolean operations on the graphics objects to be operated in the multiple layers to be operated to obtain a target graphics object, the target graphics object is used to represent the target component; obtaining the attribute information of the target graphics object, and adding the target graphics object to the canvas based on the attribute information of the target graphics object. The method provided by the above scheme achieves the technical effect of performing Boolean operations on components between different layers to generate customized components, thereby improving the flexibility and efficiency of graphics processing.

[0034] The embodiment of the present application provides a graphics processing method, which is applied to an EDA online layout design tool, which may be a quantum EDA online layout design tool. Figure 1 A flowchart of a graphics processing method provided in an embodiment of the present application is shown in FIG. Figure 1As shown, the process includes the following steps:

[0035] Step S101, creating a plurality of graphic objects to be processed on a blank canvas, and setting attribute information of the graphic objects to be processed, wherein the attribute information includes layer information, and different graphic objects to be processed are used to represent different components.

[0036] Among them, the front-end interface of the EDA online layout design tool can be implemented using the Vue.js framework. Vue.js is a progressive JavaScript framework developed for the front end to build user interfaces.

[0037] Introduce the fabric.js library in the EDA online layout design tool, and set the canvas element in the Vue project. The canvas is a rectangular canvas that can be painted on with JavaScript to control every pixel on it. The fabric.js library is a JavaScript library that can simplify the writing of canvas programs. JavaScript is a lightweight, interpreted or just-in-time compiled programming language with function priority.

[0038] It should be noted that a fabric.Canvas instance needs to be created to manage all graphic objects on the canvas.

[0039] Initially, the canvas is a blank canvas. In response to the user's creation operation, the graphic objects to be processed that need to be Boolean operations are defined and created on the blank canvas. The graphic objects to be processed can be rectangles, circles, etc. Each graphic object to be processed is created through constructors such as fabric.Rect and fabric.Circle, and its attribute information is set. The attribute information of the graphic object to be processed includes layer information, position information, size information, color information, etc.

[0040] It can be understood that different graphic objects to be processed can be used to represent different components, which may be quantum components or components in other fields, such as electronic components, etc., wherein graphic objects to be processed with different attribute information are different graphic objects to be processed.

[0041] In actual graphic design and processing, it is often necessary to group graphic objects to simulate different layers for easy management and operation. In fabric.js, similar functions can be achieved through fabric.Group. Related graphic objects are combined into a group, and this group can be regarded as a layer.

[0042] For example, assuming that there are multiple rectangles and circles, all rectangles can be regarded as one layer, and all circles can be regarded as one layer. Different layers can be intuitively distinguished by setting different colors.

[0043] Step S102: determining a plurality of layers to be calculated based on the layer information of the graphic object to be processed, wherein the plurality of layers to be calculated are different layers.

[0044] Among them, after creating multiple graphic objects to be processed and setting their corresponding attribute information, according to the layer information in the attribute information, in response to the user's selection operation, the layer to be calculated is determined from the multiple layers. The multiple layers to be calculated are different layers, that is, the layer information of the graphic objects to be calculated in the multiple layers to be calculated is different.

[0045] It is understandable that, according to the layer information in the attribute information, in response to the user's selection operation, multiple graphic objects to be calculated located in the same layer can also be determined from multiple layers. This embodiment is described by taking the user selecting multiple different layers and performing Boolean operations on the graphic objects to be calculated in the multiple different layers.

[0046] Step S103, performing Boolean operations on the graphic objects to be operated in the multiple layers to be operated to obtain target graphic objects, where the target graphic objects are used to represent target components.

[0047] After determining a plurality of different layers to be operated, the corresponding Boolean operation algorithm function is called, and all the graphic objects in the selected plurality of different layers to be operated are passed in as parameters, and Boolean operations are performed on all the graphic objects in the plurality of different layers to be operated to obtain the target graphic object, which is a target component created by the user. Different Boolean operation types correspond to different Boolean operation algorithm functions, and the Boolean operation types include union operation, intersection operation, difference operation, and XOR operation, etc.

[0048] It can be understood that all graphic objects in the layer to be calculated are graphic objects to be calculated.

[0049] It should be noted that, based on the layer information of the graphic object to be processed, the graphic objects to be operated located in different layers can be determined from multiple graphic objects to be processed, and Boolean operations can be performed on the graphic objects to be operated to obtain the target graphic object.

[0050] Step S104, obtaining attribute information of the target graphic object, and adding the target graphic object to the canvas based on the attribute information of the target graphic object.

[0051] After obtaining the target graphic object, according to the attribute information pre-set by the user for the target graphic object, the attribute information includes layer information, the target graphic object is added to the canvas to realize the generation and display of the target graphic object.

[0052] Exemplarily, the layers to be operated are layer 0 and layer 4, and a union operation, i.e., an "or" operation, is performed on the graphic objects to be operated in layer 0 and layer 4 to obtain a target graphic object, and the target graphic object is output to layer 6 according to the attribute information set for the target graphic object.

[0053] The layers to be calculated are layer 0 and layer 4. An intersection operation, i.e., an "and" operation, is performed on the graphic objects to be calculated in layer 0 and layer 4 to obtain the target graphic object, and the target graphic object is output to layer 6 according to the attribute information set for the target graphic object.

[0054] The layers to be calculated are layer 0 and layer 4. A difference operation, i.e., a "not" operation, is performed on the graphic objects to be calculated in layer 0 and layer 4 to obtain the target graphic object, and the target graphic object is output to layer 6 according to the attribute information set for the target graphic object.

[0055] The layers to be operated are layer 0 and layer 4. An exclusive OR operation, i.e., an "xor" operation, is performed on the graphic objects to be operated in layer 0 and layer 4 to obtain the target graphic object, and the target graphic object is output to layer 6 according to the attribute information set for the target graphic object.

[0056] In the graphics processing method provided in this embodiment, since the attribute information of multiple graphics objects to be processed includes layer information, multiple layers to be operated are determined based on the layer information of the graphics objects to be processed, and the multiple layers to be operated are different layers. Boolean operations are performed on the graphics objects to be operated in the multiple layers to be operated to obtain target graphics objects, which are used to represent target components, that is, customized components. Based on the attribute information of the target graphics objects, the target graphics objects are added to the canvas to achieve the generation of customized components. Therefore, the technical problem that it is impossible to perform Boolean operations on components between different layers to generate customized components and the flexibility is poor in the related art can be solved, and the technical effect of achieving the rapid and accurate generation of customized components by performing Boolean operations on components between different layers, simplifying the operation process, and improving the flexibility and efficiency of graphics processing can be achieved.

[0057] The embodiment of the present application provides a graphics processing method, which is applied to an EDA online layout design tool. Figure 2 A flowchart of a graphics processing method provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the process includes the following steps:

[0058] Step S201: create multiple graphic objects to be processed on a blank canvas, and set attribute information of the graphic objects to be processed. The attribute information includes layer information. Different graphic objects to be processed are used to represent different components. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0059] Step S202: Based on the layer information of the graphic object to be processed, multiple layers to be calculated are determined, wherein the multiple layers to be calculated are different layers. Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.

[0060] Step S203, performing Boolean operations on the graphic objects to be operated in the multiple layers to be operated to obtain target graphic objects, where the target graphic objects are used to represent target components.

[0061] Specifically, the above step S203 includes:

[0062] Step S2031, determining the Boolean operation types of multiple layers to be operated.

[0063] Among them, Boolean operation types include union operation, intersection operation, difference operation, XOR operation, etc.

[0064] After the multiple layers to be operated are determined, in response to the user's Boolean operation type selection operation, the Boolean operation types of the multiple layers to be operated are determined.

[0065] The union operation is to combine the graphics objects to be operated in multiple layers to be operated to form a new graphics object that contains all the original graphics objects to be operated.

[0066] The intersection operation is to find out the common area where the graphics objects to be calculated in multiple layers to be calculated overlap and form a new graphics object.

[0067] The difference operation is to subtract the overlapping part of a graphic object to be operated from another graphic object to be operated, and obtain the remaining area as a new graphic object.

[0068] The XOR operation is to combine non-overlapping areas of the graphic objects to be operated in multiple layers to be operated into a new graphic object.

[0069] Step S2032: Based on the Boolean operation types of the multiple layers to be operated, Boolean operations are performed on the graphic objects to be operated in the multiple layers to be operated to obtain target graphic objects.

[0070] After the Boolean operation type is determined, a corresponding Boolean operation is performed on the graphic objects to be operated in the multiple layers to be operated according to the Boolean operation type to obtain a target graphic object.

[0071] Step S204, obtain the attribute information of the target graphic object, and add the target graphic object to the canvas based on the attribute information of the target graphic object. Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.

[0072] The graphics processing method provided in this embodiment can perform corresponding Boolean operations according to user needs by providing multiple Boolean operation types such as union operation, intersection operation, difference operation and XOR operation, thereby greatly enhancing the flexibility of graphic object processing of different layers, being able to cope with various complex design scenarios, meet complex graphics processing requirements, and realize efficient component design.

[0073] In some optional implementations, the above step S2032 includes:

[0074] Step a1, when the Boolean operation type of the multiple layers to be operated is a union operation, obtain the vertex coordinate information of the graphic object to be operated, wherein the attribute information includes the vertex coordinate information.

[0075] Among them, when the Boolean operation type of multiple layers to be calculated is a union operation, it is necessary to perform a union operation on the graphic objects to be calculated in the multiple layers to be calculated, and use canvas.getObjects() to traverse the graphic objects to be calculated in the multiple layers to be calculated on the canvas to obtain the vertex coordinate information in the attribute information of the graphic objects to be calculated, that is, the points attribute.

[0076] Step a2, determining the maximum value information of the horizontal coordinate and the maximum value information of the vertical coordinate based on the vertex coordinate information of the graphic object to be calculated.

[0077] The Math.min() and Math.max() methods are used to traverse the vertex coordinate information of the graphic object to be calculated until the maximum and minimum horizontal coordinate information and the maximum and minimum vertical coordinate information of all vertices are found.

[0078] The maximum horizontal coordinate information includes the maximum horizontal coordinate information and the minimum horizontal coordinate information of the vertex. The maximum vertical coordinate information includes the maximum vertical coordinate information and the minimum vertical coordinate information of the vertex.

[0079] Step a3: determining the union area of ​​the graphic objects to be calculated based on the maximum value information of the horizontal coordinate and the maximum value information of the vertical coordinate.

[0080] After the maximum value information of the horizontal coordinate and the maximum value information of the vertical coordinate are determined, a new graphic object boundary is defined according to the maximum value information of the horizontal coordinate and the maximum value information of the vertical coordinate, that is, the union area of ​​the graphic objects to be calculated is determined.

[0081] It is understandable that if there are overlapping parts between the graphic objects to be calculated, no special processing is required because the union operation includes all the graphic objects.

[0082] Step a4: determining a target graphic object based on the union area of ​​the graphic objects to be calculated.

[0083] After the union region of the graphic objects to be calculated is determined, a new graphic object is created, whose boundary matches the calculated union region of the graphic objects to be calculated, and the new graphic object is the target graphic object.

[0084] It should be noted that a new graphics object can be created through the fabric.Rect method or a custom shape method.

[0085] Step a5: when the Boolean operation type of the multiple layers to be operated is an intersection operation, the graphic objects to be operated are divided into at least one combination of graphic objects to be operated, each combination of graphic objects to be operated includes two graphic objects to be operated.

[0086] Among them, when the Boolean operation type of multiple layers to be calculated is a union operation, it is necessary to perform an intersection operation on the graphic objects to be calculated in the multiple layers to be calculated, and divide all the graphic objects to be calculated into at least one combination of graphic objects to be calculated.

[0087] It should be noted that there is at most one identical graphic object to be calculated between the graphic object combinations to be calculated.

[0088] Step a6: for any combination of graphic objects to be calculated, determine whether there is an intersection area between two graphic objects to be calculated in the combination of graphic objects to be calculated.

[0089] The intersectsWithObject() method of fabric.js is used to determine whether there is an intersection area between two graphics objects to be calculated in the combination of graphics objects to be calculated.

[0090] Step a7: if there is an intersection area between two graphic objects to be calculated in the combination of graphic objects to be calculated, the intersection area of ​​the two graphic objects to be calculated is obtained to determine the intersection area of ​​the combination of graphic objects to be calculated.

[0091] If two graphics objects to be calculated in the combination of graphics objects to be calculated have an intersection area, the intersection area needs to be calculated.

[0092] The method for calculating the intersection area of ​​two graphics objects to be calculated is: first obtain the points attribute value of each graphics object to be calculated, and then use the Clipper library to calculate the intersection. Specifically:

[0093] First, create a Clipper object named clipper, then map the points (vertices) attribute values ​​of the two graphics objects to be calculated, and use ClipperLib.IntPoint (X value (horizontal coordinate value) of the traversal point, Y value (vertical coordinate value) of the traversal point) to process the value of each point and output it as a new object array. Then create a ClipperLib.Paths() object named solution, and then use clipper.AddPath (output object array, ClipperLib.PolyType.ptSubject, true) to draw the paths of the points of the two graphics objects, and then use clipper.Execute (ClipperLib.ClipType.ctIntersection, solution) method to get the intersection area path information of the two graphics objects to be calculated, and finally convert the intersection area path information into Fabric polygon points through the double map traversal method to create the intersection polygon, that is, the intersection area.

[0094] That is, for a combination of graphics objects to be calculated that has an intersection area, the Clipper library is used to accurately calculate the intersection area between two graphics objects to be calculated in the combination of graphics objects to be calculated, which specifically involves converting the point coordinates of the graphics objects to be calculated into the format required by the Clipper library, calculating the intersection area path information, converting the intersection area path information into the format required by fabric.js, and determining the intersection area. The Clipper library is an open source C++ library for performing polygon clipping and offset operations.

[0095] Step a8: determining a target intersection area based on the intersection area of ​​the combination of graphic objects to be calculated.

[0096] After obtaining the intersection area of ​​all combinations of graphic objects to be calculated, if there are multiple intersections of graphic objects to be calculated, it is necessary to further use fabric.Group() to merge these intersection areas.

[0097] That is, after obtaining the intersection areas of all combinations of graphic objects to be calculated, fabric.Group() is used to obtain the overlapping parts of these intersection areas, and the overlapping parts of these intersection areas are determined as the target intersection areas.

[0098] Step a9: determining the target graphic object based on the target intersection area.

[0099] After the target intersection area is determined, a new graphic object is created to represent the target intersection area, and the new graphic object is the target graphic object.

[0100] It should be noted that if the target intersection area is empty, that is, the graphic objects to be calculated do not intersect at all, an empty result or a clear error message is returned.

[0101] The graphics processing method provided in this embodiment reduces unnecessary repeated calculations by directly determining the union area based on vertex coordinate information, quickly locates the graphics range through the maximum value information, and improves the calculation speed. By dividing the graphics objects to be calculated into combinations of graphics objects to be calculated, determining whether there is an intersection area one by one, and only performing detailed calculations on the combinations of graphics objects to be calculated that have an intersection area, the overall calculation amount is effectively reduced and the algorithm efficiency is improved.

[0102] By optimizing the algorithms of graphic objectification, union operation and intersection operation, the speed and accuracy of union operation and intersection operation between graphic objects of different layers are significantly improved.

[0103] In some optional implementations, the above step S2032 includes:

[0104] Step b1, when the Boolean operation type of multiple layers to be operated is a difference operation, determine the main graphic object from the graphic objects to be operated.

[0105] Among them, when the Boolean operation type of multiple layers to be operated is a difference operation, it is necessary to perform a difference operation on the graphic objects to be operated in the multiple layers to be operated. First, a main graphic object needs to be selected from the graphic objects to be operated.

[0106] Generally, the main graphic object is determined according to the creation time of the graphic object. For example, the graphic object to be calculated with the earliest creation time can be determined as the main graphic object, and the graphic object to be calculated with the latest creation time can also be determined as the main graphic object.

[0107] Step b2: determine the intersection area between the main graphic object and other graphic objects to be calculated.

[0108] The intersection area between the main graphic object and any of the other graphic objects to be calculated is calculated by using the methods of the above-mentioned steps a6 and a7 to determine the intersection area between the main graphic object and the other graphic objects to be calculated.

[0109] It is understandable that if the intersection area between the main graphic object and any of the other graphic objects to be calculated is empty, an empty result or a clear error message should be returned.

[0110] Step b3: remove the intersection area between the main graphic object and other graphic objects to be calculated from the main graphic object to obtain the target graphic object.

[0111] After obtaining the intersection area between the main graphic object and other graphic objects to be calculated, the intersection area between the main graphic object and other graphic objects to be calculated is removed from the main graphic object to obtain a target graphic object, which represents the result of the difference operation.

[0112] It is understandable that this process may require multiple iterations, especially when there are multiple graphic objects to be calculated.

[0113] The graphics processing method provided in this embodiment ensures that the result of the difference operation is more accurate, reduces unnecessary repeated calculations, and improves the operation speed by clearly distinguishing the main graphic object from other graphic objects to be calculated and accurately determining the intersection area between them. By optimizing the difference operation algorithm, the speed and accuracy of the difference operation between graphic objects to be calculated on different layers are significantly improved.

[0114] In some optional implementations, the above step S2032 includes:

[0115] Step c1, when the Boolean operation type of the multiple layers to be operated is an exclusive OR operation, obtain the union area of ​​the graphic objects to be operated and the intersection area of ​​the graphic objects to be operated.

[0116] Among them, when the Boolean operation type of multiple layers to be calculated is an XOR operation, it is necessary to perform an XOR operation on the graphic objects to be calculated in the multiple layers to be calculated. First, the union area of ​​the graphic objects to be calculated is determined using the methods of steps a1, a2, and a3, and then the intersection area of ​​the graphic objects to be calculated is determined using the methods of steps a5, a6, a7, and a8.

[0117] It should be noted that the XOR operation can be regarded as the union area minus the intersection area.

[0118] Step c2: removing the intersection area of ​​the graphic objects to be calculated from the union area of ​​the graphic objects to be calculated to obtain the target graphic object.

[0119] Among them, after obtaining the union area of ​​the graphic objects to be calculated and the intersection area of ​​the graphic objects to be calculated, the intersection area of ​​the graphic objects to be calculated is removed from the union area of ​​the graphic objects to be calculated, an XOR result is obtained, and a new graphic object is created to represent the XOR result. The new graphic object is the target graphic object.

[0120] The graphics processing method provided in this embodiment decomposes the XOR operation into two steps, first calculating the union area and the intersection area of ​​the graphic objects to be operated, and then removing the intersection area from the union area to obtain the XOR operation result, thereby simplifying the operation logic, reducing unnecessary repeated calculations, and improving the overall operation efficiency. By optimizing the XOR operation algorithm, the speed and accuracy of the XOR operation between the graphic objects to be operated on different layers are significantly improved.

[0121] In some optional implementations, the graphics processing method further includes:

[0122] Step d1, in response to the user's dragging operation, moving the target graphic object to a target position.

[0123] Step d2: In response to the user's zooming operation, the target graphic object is zoomed to a target ratio.

[0124] Step d3, in response to the user's rotation operation, rotating the target graphic object to a target angle.

[0125] After adding the target graphic object to the canvas, the target graphic object can also be edited or interactively operated.

[0126] By utilizing the interactive functions of fabric.js, users can drag, scale, rotate, and perform other operations on target graphic objects.

[0127] Step d4, in response to the user's attribute information modification operation, obtain the modified attribute information, and make corresponding modifications to the target graphic object based on the modified attribute information.

[0128] This embodiment also provides a dynamic adjustment interface for the attribute information of the target graphic object, such as color, border, transparency adjustment, etc., so that the user can modify the appearance of the target graphic object in real time.

[0129] The graphics processing method provided in this embodiment realizes dynamic adjustment and editing of target graphic objects by combining the interactive function of fabric.js, improves the user experience, and makes the design process more streamlined and efficient.

[0130] In some optional implementations, before performing Boolean operations on the graphic objects to be operated in the multiple layers to be operated, the graphic processing method further includes:

[0131] Step e1, performing validity check on the graphics object to be operated.

[0132] Before performing Boolean operations on the graphic objects to be operated, it is necessary to check the validity of all the graphic objects to be operated to ensure that they are all valid fabric objects and their attributes (such as position and size) have been correctly set.

[0133] The validity check of the graphic object to be calculated includes boundary condition check. The boundary condition check is used to detect whether the graphic object to be calculated is an empty graphic object. If the graphic object to be calculated is an empty graphic object, an empty result or a clear error message is returned to determine that the graphic object to be calculated has not passed the validity check and is not a valid graphic object.

[0134] It is understandable that performing intersection or difference operations on empty graphics objects should return empty results or clear error messages.

[0135] Step e2: when the graphic object to be calculated is a valid graphic object, a Boolean operation is performed on the graphic objects to be calculated in the multiple layers to be calculated.

[0136] It should be noted that for complex Boolean operations, especially those involving multiple different graphic objects, an error handling mechanism is used to capture and report any potential geometric errors or calculation problems.

[0137] The graphics processing method provided in this embodiment performs validity check on the graphics objects to be operated before Boolean operation to ensure that all graphics objects to be operated are valid fabric objects and their properties (such as position, size, etc.) are correctly set. This avoids operation failure or abnormal results caused by invalid or erroneous graphics objects and improves the reliability of the operation.

[0138] In some optional implementations, the graphics processing method further includes:

[0139] Step f1, in the process of performing Boolean operations on the graphic objects to be operated in the multiple layers to be operated, detecting the running status of the Boolean operations in real time.

[0140] Step f2: when it is detected that the running state of the Boolean operation is an abnormal state, capturing abnormal information.

[0141] Step f3, recording the exception information, so as to perform exception handling based on the exception information.

[0142] The exception information includes the exception type, the location where the exception occurred, possible causes of the exception, etc.

[0143] The graphics processing method provided in this embodiment detects the running status of Boolean operations in real time during the process of performing Boolean operations on the graphic objects to be operated in multiple layers to be operated, and captures abnormal information in time and performs abnormal processing when the running status of the Boolean operation is abnormal, thereby enhancing the reliability of graphics processing and improving user experience.

[0144] The embodiment of the present application provides a graphics processing method. Figure 3 A flowchart of a graphics processing method provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, the process includes the following steps:

[0145] Step S301, start Boolean operation on component graphics of different layers.

[0146] Here, the Boolean operation is started on the graphics of components on different layers, that is, the Boolean operation is started on the graphic objects corresponding to the components on different layers.

[0147] Step S302: Before the Boolean operation, the boundary conditions and exception handling of the component graphics to be subjected to the Boolean operation are checked. If there is any error information, it should be captured in time and returned to the user for understanding.

[0148] The detection of component graphic boundary conditions may be to determine whether the boundary of the graphic object corresponding to the component to be subjected to Boolean operation indicates that it is an empty graphic object. The detection of exception handling may be to detect whether an empty result or a clear error message is normally returned when the graphic object corresponding to the component to be subjected to Boolean operation is an empty graphic object.

[0149] Step S303, creating a custom component that meets the requirements by selecting different Boolean operation methods to perform union, difference, intersection, and XOR operations on component graphics between different layers.

[0150] In response to different Boolean operation methods selected by the user, corresponding Boolean operations are performed on the graphic objects corresponding to the components between different layers to obtain target graphic objects corresponding to the custom components that meet the requirements.

[0151] Step S304, after the Boolean operation is completed, the newly generated component graphic is interactively and dynamically adjusted so that it has all the necessary properties of the component.

[0152] It is understandable that after the Boolean operation is completed and the newly generated component graphics are obtained, the newly generated component graphics can be interactively and dynamically adjusted.

[0153] Interaction and dynamic adjustment can be operations such as moving, scaling, rotating, and adding attribute information.

[0154] Step S305, completing the Boolean operation of component graphics between different layers.

[0155] At this point, the Boolean operation of component graphics between different layers is completed.

[0156] The graphics processing method provided in this embodiment can greatly improve the efficiency and accuracy of component design by implementing the function of Boolean operation of components between different layers in the EDA online layout design tool. And through a variety of different Boolean operation methods, commonly used custom components between different layers can be quickly created and used, which not only reduces the workload of designers, but also improves the reliability and maintainability of the design.

[0157] In order to make the above-mentioned graphic processing method clearer, the creation of component air bridge is described as an example.

[0158] First, three rectangular graphic objects are created, wherein one rectangular graphic object and the other two rectangular graphic objects belong to different virtual layers respectively.

[0159] Call the union operation algorithm to calculate the boundary intersection points of the three rectangular graphic objects and determine the boundary of the union area.

[0160] According to the boundary of the union area, a new rectangle graphics object is created, the boundary of the new rectangle graphics object matches the boundary of the union area, and the new rectangle graphics object is added to the canvas.

[0161] Allow users to perform interactive operations such as dragging, scaling, etc. on the new rectangular graphic object.

[0162] It can be understood that the new rectangular graphic object is used to represent the component air bridge. The creation of the component air bridge is achieved through the above steps.

[0163] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.

[0164] The embodiment of the present application also provides a graphics processing device, such as Figure 4 As shown, including:

[0165] The creation module 401 is used to create multiple graphic objects to be processed on a blank canvas and set attribute information of the graphic objects to be processed. The attribute information includes layer information. Different graphic objects to be processed are used to represent different components.

[0166] The determination module 402 is used to determine a plurality of layers to be calculated based on the layer information of the graphic object to be processed, wherein the plurality of layers to be calculated are different layers.

[0167] The first acquisition module 403 is used to perform Boolean operations on the graphic objects to be operated in the multiple layers to be operated to obtain target graphic objects, where the target graphic objects are used to represent target components.

[0168] The second acquisition module 404 is used to acquire the attribute information of the target graphic object, and add the target graphic object to the canvas based on the attribute information of the target graphic object.

[0169] In some optional implementations, the first acquisition module 403 includes:

[0170] The first determining unit is used to determine the Boolean operation type of multiple layers to be operated.

[0171] The first acquisition unit is used to perform Boolean operation on the graphic objects to be operated in the multiple layers to be operated based on the Boolean operation types of the multiple layers to be operated, so as to obtain the target graphic object.

[0172] In some optional implementations, the first acquiring unit includes:

[0173] The second acquisition unit is used to acquire vertex coordinate information of the graphic object to be operated when the Boolean operation type of the multiple layers to be operated is a union operation, wherein the attribute information includes the vertex coordinate information.

[0174] The second determining unit is used to determine the maximum value information of the horizontal coordinate and the maximum value information of the vertical coordinate based on the vertex coordinate information of the graphic object to be calculated.

[0175] The third determining unit is used to determine the union area of ​​the graphic objects to be calculated based on the maximum value information of the horizontal coordinate and the maximum value information of the vertical coordinate.

[0176] The fourth determining unit is used to determine the target graphic object based on the union area of ​​the graphic objects to be calculated.

[0177] The first division unit is used to divide the graphic objects to be operated into at least one combination of graphic objects to be operated when the Boolean operation type of the multiple layers to be operated is an intersection operation, and each combination of graphic objects to be operated includes two graphic objects to be operated.

[0178] The first judgment unit is used to judge, for any combination of graphic objects to be calculated, whether there is an intersection area between two graphic objects to be calculated in the combination of graphic objects to be calculated.

[0179] The third acquisition unit is configured to acquire the intersection area of ​​the two graphic objects to be calculated if there is an intersection area between the two graphic objects to be calculated in the combination of graphic objects to be calculated, so as to determine the intersection area of ​​the combination of graphic objects to be calculated.

[0180] The fifth determining unit is used to determine a target intersection area based on the intersection area of ​​the combination of graphic objects to be calculated.

[0181] The sixth determining unit is used to determine the target graphic object based on the target intersection area.

[0182] In some optional implementations, the first acquiring unit includes:

[0183] The seventh determining unit is used to determine the main graphic object from the graphic objects to be operated when the Boolean operation type of the multiple layers to be operated is a difference operation.

[0184] The eighth determining unit is used to determine the intersection area between the main graphic object and other graphic objects to be calculated.

[0185] The fourth acquisition unit is used to remove the intersection area between the main graphic object and other graphic objects to be calculated from the main graphic object to obtain the target graphic object.

[0186] In some optional implementations, the first acquiring unit includes:

[0187] The fifth acquisition unit is used to acquire the union area of ​​the graphic objects to be calculated and the intersection area of ​​the graphic objects to be calculated when the Boolean operation type of the multiple layers to be calculated is an exclusive OR operation.

[0188] The sixth acquisition unit is used to remove the intersection area of ​​the graphic objects to be calculated from the union area of ​​the graphic objects to be calculated to obtain the target graphic object.

[0189] In some optional implementations, the graphics processing device further includes:

[0190] The moving module is used to move the target graphic object to a target position in response to a user's dragging operation.

[0191] The scaling module is used to scale the target graphic object to a target ratio in response to a user's scaling operation.

[0192] The rotation module is used to rotate the target graphic object to a target angle in response to a rotation operation of the user.

[0193] The modification module is used to obtain the modified attribute information in response to the user's attribute information modification operation, and to make corresponding modifications to the target graphic object based on the modified attribute information.

[0194] In some optional implementations, the graphics processing device further includes:

[0195] The detection module is used to perform validity detection on the graphics object to be calculated.

[0196] The operation module is used to perform Boolean operation on the graphic objects to be operated in multiple layers to be operated when the graphic objects to be operated are valid graphic objects.

[0197] For the description of the features in the embodiment corresponding to the graphics processing device, reference can be made to the relevant description of the embodiment corresponding to the graphics processing method, which will not be repeated here.

[0198] The embodiment of the present application also provides an electronic device, see Figure 5 , Figure 5 is a schematic diagram of the structure of an electronic device provided by an optional embodiment of the present invention, such as Figure 5 As shown, the electronic device includes a processor 501 and a memory 502, wherein the memory 502 stores a computer program, and the processor 501 is configured to run the computer program to execute the steps in any of the above-mentioned graphics processing method embodiments.

[0199] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned graphics processing method embodiments when running.

[0200] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0201] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above-mentioned graphics processing method embodiments are implemented.

[0202] An embodiment of the present application also provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above-mentioned graphics processing method embodiments are implemented.

[0203] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0204] The above is a detailed introduction to a graphics processing method, device, electronic device and storage medium provided by the present application. Specific examples are used herein 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 and core idea of ​​the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.

Claims

1. A graphics processing method, characterized in that: The method comprises: Creating a plurality of graphic objects to be processed on a blank canvas, and setting attribute information of the graphic objects to be processed, wherein the attribute information includes layer information, and different graphic objects to be processed are used to represent different components; Based on the layer information of the graphic object to be processed, determining a plurality of layers to be calculated, wherein the plurality of layers to be calculated are different layers; Performing Boolean operations on the graphic objects to be operated in the plurality of layers to be operated to obtain a target graphic object, wherein the target graphic object is used to represent a target component; Acquire the attribute information of the target graphic object, and add the target graphic object to the canvas based on the attribute information of the target graphic object.

2. The method according to claim 1, characterized in that The step of performing Boolean operations on the graphic objects to be operated in the plurality of layers to be operated to obtain a target graphic object comprises: Determining the Boolean operation types of the plurality of layers to be operated; Based on the Boolean operation types of the multiple layers to be operated, Boolean operations are performed on the graphic objects to be operated in the multiple layers to be operated to obtain target graphic objects.

3. The method according to claim 2, characterized in that The step of performing Boolean operations on the graphic objects to be operated in the plurality of layers to be operated based on the Boolean operation types of the plurality of layers to be operated to obtain a target graphic object includes: When the Boolean operation type of the plurality of layers to be operated is a union operation, obtaining vertex coordinate information of the graphic object to be operated, wherein the attribute information includes the vertex coordinate information; Determine the maximum value information of the horizontal coordinate and the maximum value information of the vertical coordinate based on the vertex coordinate information of the graphic object to be calculated; Determine the union area of ​​the to-be-calculated graphic objects based on the abscissa maximum value information and the ordinate maximum value information; Determining the target graphic object based on the union area of ​​the graphic objects to be calculated; In the case where the Boolean operation type of the plurality of layers to be operated is an intersection operation, the graphic objects to be operated are divided into at least one combination of graphic objects to be operated, each combination of graphic objects to be operated includes two graphic objects to be operated; For any combination of graphic objects to be calculated, determining whether two graphic objects to be calculated in the combination of graphic objects to be calculated have an intersection area; If there is an intersection area between two graphic objects to be calculated in the combination of graphic objects to be calculated, obtaining the intersection area of ​​the two graphic objects to be calculated to determine the intersection area of ​​the combination of graphic objects to be calculated; Determine a target intersection area based on the intersection area of ​​the combination of graphic objects to be calculated; Based on the target intersection area, a target graphic object is determined.

4. The method according to claim 2, characterized in that: The step of performing Boolean operations on the graphic objects to be operated in the plurality of layers to be operated based on the Boolean operation types of the plurality of layers to be operated to obtain a target graphic object includes: In the case where the Boolean operation type of the plurality of layers to be operated is a difference operation, determining a main graphic object from the graphic objects to be operated; Determine the intersection area between the main graphic object and other graphic objects to be calculated; The intersection area between the main graphic object and other graphic objects to be calculated is removed from the main graphic object to obtain the target graphic object.

5. The method according to claim 2, characterized in that: The step of performing Boolean operations on the graphic objects to be operated in the plurality of layers to be operated based on the Boolean operation types of the plurality of layers to be operated to obtain a target graphic object includes: When the Boolean operation type of the plurality of layers to be calculated is an exclusive OR operation, obtaining a union area of ​​the graphic objects to be calculated and an intersection area of ​​the graphic objects to be calculated; The intersection area of ​​the graphic objects to be calculated is removed from the union area of ​​the graphic objects to be calculated to obtain a target graphic object.

6. The method according to claim 1, characterized in that The method further comprises: In response to a drag operation by a user, moving the target graphic object to a target position; In response to a user's zooming operation, zooming the target graphic object to a target scale; In response to a rotation operation by a user, rotating the target graphic object to a target angle; In response to the user's attribute information modification operation, the modified attribute information is obtained, and based on the modified attribute information, the target graphic object is modified accordingly.

7. The method according to claim 1, characterized in that Before performing Boolean operations on the graphic objects to be operated in the plurality of layers to be operated, the method further comprises: Performing validity detection on the graphic object to be calculated; In the case that the graphic object to be calculated is a valid graphic object, a Boolean operation is performed on the graphic objects to be calculated in the plurality of layers to be calculated.

8. A graphics processing device, characterized in that: The device comprises: A creation module, used for creating a plurality of graphic objects to be processed on a blank canvas, and setting attribute information of the graphic objects to be processed, wherein the attribute information includes layer information, and different graphic objects to be processed are used to represent different components; A determination module, configured to determine a plurality of layers to be calculated based on the layer information of the graphic object to be processed, wherein the plurality of layers to be calculated are different layers; A first acquisition module is used to perform Boolean operations on the graphic objects to be operated in the plurality of layers to be operated to obtain a target graphic object, wherein the target graphic object is used to represent a target component; The second acquisition module is used to acquire the attribute information of the target graphic object, and add the target graphic object to the canvas based on the attribute information of the target graphic object.

9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the graphics processing method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the graphics processing method according to any one of claims 1 to 7.

Citation Information

Cited By

  • RDL information push-down method for chip back-end design

    CN121936409A