Method, device, electronic device and storage medium for generating superellipse

The method simplifies the generation of superellipses by using anchor points and coordinates to determine SVG path element parameters, allowing for automatic creation and adaptation to device screens, addressing the complexity of existing methods.

CN112562035BActive Publication Date: 2025-03-25BAIDU (CHINA) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011332490.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-24
Publication Date
2025-03-25
Estimated Expiration
2040-11-24

AI Technical Summary

Technical Problem

Current methods for generating superellipses in image processing software, such as Photoshop or Adobe Illustrator, require users to learn the software's usage methods, making the process difficult and complex.

Method used

A method that involves obtaining the anchor points and coordinates of a design graph to generate a superellipse by determining the d attribute parameters of SVG path elements and using these to create the superellipse, allowing for automatic and simplified generation.

Benefits of technology

Enables users to quickly and easily generate superellipses by inputting design graphs, reducing the complexity and difficulty of the process, and adapting to different device screens for optimal visual experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112562035B_ABST
    Figure CN112562035B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, electronic device and storage medium for generating a superellipse, and relates to the field of image processing technology. The specific implementation scheme is: obtaining the position and first coordinate of the anchor point of the superellipse in the design drawing; according to the position of the anchor point, determining the corresponding first coordinate as the parameter value of the d attribute in the path element of the scalable vector graphics, and obtaining the first path string; according to the path element and the first path string, generating the superellipse. The method, device, electronic device and storage medium for generating a superellipse of the present application can automatically and quickly generate a superellipse, and the implementation is simple.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology in the field of computer technology, and in particular to a method, device, electronic device and storage medium for generating a super ellipse. Background Art

[0002] At present, the super ellipse is mainly obtained by using the expansion effect in image processing software, such as PS (Photoshop) or AI (Adobe Illustrator). However, the generation method of the super ellipse in the related art requires the user to learn how to use the image processing software, which is difficult to implement. Summary of the invention

[0003] Provided are a method, device, electronic device and storage medium for generating a super ellipse.

[0004] According to a first aspect, a method for generating a superellipse is provided, comprising: obtaining a position and a first coordinate of an anchor point of the superellipse in a design drawing; according to the position of the anchor point, determining the corresponding first coordinate as a parameter value of a d attribute in a path element of a scalable vector graphic to obtain a first path character string; and generating the superellipse according to the path element and the first path character string.

[0005] According to the second aspect, a device for generating a super ellipse is provided, comprising: a first acquisition module, used to obtain the position and first coordinates of the anchor point of the super ellipse in the design drawing; a first determination module, used to determine the corresponding first coordinate as the parameter value of the d attribute in the path element of the scalable vector graphics according to the position of the anchor point, and obtain a first path character string; a first generation module, used to generate the super ellipse according to the path element and the first path character string.

[0006] According to the third aspect, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for generating a super ellipse described in the first aspect of the present application.

[0007] According to a fourth aspect, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method for generating a superellipse as described in the first aspect of the present application.

[0008] According to a fifth aspect of the present application, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the method for generating a super ellipse according to the first aspect of the present application.

[0009] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.

[0011] Figure 1 is a flow chart of a method for generating a superellipse according to the first embodiment of the present application;

[0012] Figure 2 is a schematic diagram of a superellipse design according to the present application;

[0013] Figure 3 is a flow chart of a method for generating a superellipse according to the second embodiment of the present application;

[0014] Figure 4 is a flow chart of a method for generating a superellipse according to the third embodiment of the present application;

[0015] Figure 5 is a block diagram of a device for generating a superellipse according to a first embodiment of the present application;

[0016] Figure 6 It is a block diagram of an electronic device used to implement the method for generating a super ellipse according to an embodiment of the present application. DETAILED DESCRIPTION

[0017] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0018] Image processing is a technique that uses computers to analyze images to achieve the desired results. It is also called image processing. Image processing generally refers to digital image processing. A digital image is a large two-dimensional array obtained by shooting with industrial cameras, video cameras, scanners and other equipment. The elements of the array are called pixels, and their values ​​are called grayscale values. Image processing technology generally includes three parts: image compression, enhancement and restoration, matching, description and recognition.

[0019] Figure 11 is a flow chart of the method for generating a superellipse according to the first embodiment of the present application. The execution subject of the method for generating a superellipse in the embodiment of the present application may be a hardware device with data information processing capabilities and / or the necessary software required to drive the hardware device to work. Optionally, the execution subject may include a workstation, a server, a computer, a user terminal and other devices. Among them, the user terminal includes but is not limited to a mobile phone, a computer, an intelligent voice interaction device, a smart home appliance, a vehicle-mounted terminal, etc.

[0020] like Figure 1 As shown, the method for generating a superellipse in the first embodiment of the present application may specifically include:

[0021] S101, obtaining the position and first coordinate of the anchor point of the superellipse in the design drawing.

[0022] In an embodiment of the present application, a design drawing of a superellipse designed by a designer is obtained, and the design drawing may be marked with anchor points at various positions of the superellipse and the first coordinates of each anchor point in the design drawing. The position of the anchor point is the directional position information of the anchor point in the superellipse. The design drawing may also be marked with the proportion of each anchor point to the corresponding side and the width of the superellipse (i.e., the first superellipse width), and the first coordinates of each anchor point are calculated based on the proportion of each anchor point to the corresponding side and the width of the superellipse.

[0023] Figure 2 is a schematic diagram of the super ellipse design diagram, such as Figure 2 As shown in the figure, the anchor points of the inner and outer circles of the super ellipse are marked in the design diagram (corresponding to Figure 2 The dots in the circle) and the first coordinates of each anchor point in the design drawing, for example, the 12 anchor points in the outer circle are anchor point 1 (0, 25), anchor point 2 (0, 5.5), anchor point 3 (5.5, 0), anchor point 4 (25, 0), anchor point 5 (44.5, 0), anchor point 6 (50, 5.5), anchor point 7 (50, 25), anchor point 8 (50, 44.5), anchor point 9 (50, 44.5), anchor point 10 (25, 50), anchor point 11 (5.5, 50) and anchor point 12 (0, 44.5) in clockwise direction. The proportion of each anchor point to the corresponding side is 5.5 / 25=0.22. The width of the first superellipse is 50=50 / 100rem=0.5rem. rem is a relative length unit, which refers to the size relative to the calculated value of the font size font-size of the root element html, which can be simply understood as a percentage of the screen width.

[0024] It should be noted that in the embodiment of the present application, the method for generating the outer circle of the super ellipse is described by taking the outer circle anchor point as an example. The method for generating the inner circle is similar to the method for generating the outer circle, and will not be repeated in this application.

[0025] It should be noted that before obtaining the position and first coordinate of the anchor point of the super ellipse in the design drawing, it is also necessary to determine whether the current device is a mobile device. If the current device is a non-mobile device, there is no need to consider adapting to the screen of the current device, that is, there is no need to adapt the first coordinate of the anchor point of the super ellipse in the design drawing. According to the first coordinate of the anchor point of the super ellipse in the design drawing, the path element in scalable vector graphics (svg) can be used to quickly generate the super ellipse.

[0026] S102: According to the position of the anchor point, determine the corresponding first coordinate as the parameter value of the d attribute in the path element of the scalable vector graphics to obtain a first path character string.

[0027] In the embodiment of the present application, the path element of svg provides a d attribute, which is consistent with the third-order Bessel function, so it is necessary to calculate the anchor point coordinates of the third-order Bessel function. The d attribute provides three parameters, namely M, C and S.

[0028] M represents the starting point. Assuming that the starting point is anchor point 1 (0, 25), the position of the starting point is expressed as (0, width0 / 2), which is the value of M below, where width0 is the width of the first super ellipse 50 in the design drawing.

[0029] The C attribute specifies a Bezier curve with three values. The first two are the anchor points of the Bezier curve, and the last value is the end point of the Bezier curve. The first and second values ​​of the C attribute below correspond to the coordinates of anchor point 2 (0, 5.5) and anchor point 3 (5.5, 0), respectively. The corresponding positions are expressed as (0, width0 / 2*0.22) and (width0 / 2*0.22, 0). The last value corresponds to the end point coordinate, that is, anchor point 4 (25, 0), and the corresponding position is expressed as (width0 / 2, 0).

[0030] The S attribute is the smooth curvature. In the above steps, we only get a small section of the path string of the superellipse. We hope to extend it and draw a complete superellipse, so we need to use the S attribute. The starting point of the S attribute defaults to the anchor point of the C attribute path symmetry, that is, the symmetric point anchor point 5 (44.5, 0) of anchor point 3 (5.5, 0) will be automatically completed, so you only need to fill in the next anchor point coordinates and the end point. Therefore, the first value of the first line of the S attribute is anchor point 6 (50, 5.5), and the corresponding position is expressed as (width0, width0 / 2*0.22). The end point of this curve is anchor point 7 (50, 25), and the corresponding position is expressed as (width0, width0 / 2).

[0031] Completing the above steps completes the path string of the superellipse outline from anchor point 1 (0, 25) to anchor point 7 (50, 25). The second line of the S attribute also uses the same calculation method. The starting point defaults to the symmetrical point of the last control point of the previous segment, that is, anchor point 8 (50, 44.5) symmetrical to anchor point 6 (50, 5.5), and then draws the next control point and the end point to complete the third segment of the curve. Similarly, the fourth segment of the curve can be completed using the above method to obtain the complete superellipse path string, that is, the first path string dValue.

[0032] The generation process of the first path string dValue is as follows:

[0033] const halfwidth=Math.floor(width0 / 2);

[0034] const dot1=0.22*halfwidth;

[0035] const dot2 = width0 - dot1;

[0036] this.dValue=

[0037] M 0,{halfwidth}

[0038] C 0,{dot1}{dot1},0{halfwidth},0

[0039] S{width0},{dot1}{width0},{halfwidth}

[0040] {dot2},{width0}{halfwidth},{width0}

[0041] 0,{dot2}0,{halfwidth}

[0042] S103: Generate a super ellipse according to the path element and the first path character string.

[0043] In an embodiment of the present application, the first path character string obtained in step S102 is input into the path element of svg to generate a super ellipse.

[0044] Optionally, the fill attribute of svg can be used to obtain a background image, and the background image can be filled into the super ellipse generated above to obtain a super ellipse avatar or icon.

[0045] In summary, according to the method for generating a super ellipse in an embodiment of the present application, the position and the first coordinate of the anchor point of the super ellipse in the design drawing are obtained, and according to the position of the anchor point, the corresponding first coordinate is determined as the parameter value of the d attribute in the path element of the scalable vector graphics, and the first path string is obtained. According to the path element and the first path string, a super ellipse is generated. The user only needs to input the design drawing to automatically and quickly generate the super ellipse, which is simple to implement.

[0046] Based on the above embodiments, Figure 3 As shown, the method for generating a superellipse in the embodiment of the present application may further include:

[0047] S301, identifying the current device as a mobile device, obtaining the first screen width of the screen in the design drawing, the position of the anchor point, the first super ellipse width of the super ellipse, and the proportion of the position of the anchor point to the corresponding side.

[0048] It should be noted that the screen sizes of mobile devices are different. Using a unified px unit for drawing will result in a visual effect that is too large or too small. Ideally, the design drawing can be enlarged a little on a large screen and slightly reduced on a small screen. Therefore, in order to better adapt to different screen sizes, the page layout is done in rem, which can enlarge or reduce the design draft to better adapt to the screen size and bring the best visual experience to users. The basic unit of Rem is the font size of the current page, that is, the font size is the unit.

[0049] If the current device is a non-mobile device, it is necessary to consider adapting to the screen of the current device, that is, the first coordinate of the anchor point of the superellipse in the design drawing needs to be adapted to obtain the second coordinate of the anchor point that adapts to the screen of the current device. According to the second coordinate after the adaptation transformation, the superellipse can be quickly generated using the path element in svg.

[0050] In the embodiment of the present application, the design drawing may be marked with the first screen width of the screen, the position of the anchor point, the first superellipse width of the superellipse, and the proportion of the position of the anchor point to the corresponding side. The proportion of the position of the anchor point to the corresponding side can also be calculated based on the first coordinate of the anchor point of the superellipse marked in the design drawing.

[0051] S302: Calculate the second coordinates of the anchor point in the screen of the current device according to the first screen width, the first super ellipse width and the ratio.

[0052] In an embodiment of the present application, the second super ellipse width width of the super ellipse in the screen of the current device can be calculated based on the first screen width and the first super ellipse width, and the second coordinate can be calculated based on the second super ellipse width width and the ratio.

[0053] Among them, according to the first screen width and the first super ellipse width, the second super ellipse width of the super ellipse in the screen of the current device is calculated, which may specifically include: obtaining the second screen width of the screen of the current device; calculating the font size font-size on the screen of the current device according to the first screen width and the second screen width; calculating the second super ellipse width width = width0*font-size according to the font size font-size and the first super ellipse width width0.

[0054] Specifically, Figure 2 Take the design drawing in as an example, the width of the first superellipse width0 = 0.5rem, then the width of the second superellipse width = width0*font-size. The first coordinate (0, 25) of anchor point 1 corresponds to the second coordinate (0, width / 2), the first coordinate (0, 5.5) of anchor point 2 corresponds to the second coordinate (0, width / 2*0.22), the first coordinate (5.5, 0) of anchor point 3 corresponds to the second coordinate (width / 2*0.22, 0), the first coordinate (25, 0) of anchor point 4 corresponds to the second coordinate (width / 2, 0), the first coordinate (44.5, 0) of anchor point 5 corresponds to the second coordinate (width-width / 2, 0), and so on, to obtain the second coordinates of the remaining anchor points.

[0055] S303: According to the position of the anchor point, determine the corresponding second coordinate as the parameter value of the d attribute in the path element to obtain a second path character string.

[0056] In the embodiment of the present application, the specific process of step S303 refers to the relevant description of step S102 in the above embodiment, which will not be repeated here.

[0057] S304: Generate a superellipse according to the path element and the second path character string.

[0058] In the embodiment of the present application, the specific process of step S303 refers to the relevant description of step S102 in the above embodiment, which will not be repeated here.

[0059] In summary, according to the method for generating a super ellipse in an embodiment of the present application, the position and the first coordinate of the anchor point of the super ellipse in the design drawing are obtained, and according to the position of the anchor point, the corresponding first coordinate is determined as the parameter value of the d attribute in the path element of the scalable vector graphics, and the first path string is obtained. According to the path element and the first path string, a super ellipse is generated. The user only needs to input the design drawing to automatically and quickly generate the super ellipse, which is simple to implement.

[0060] To clearly illustrate the method for generating a superellipse in the embodiment of the present application, Figure 4The specific process of the method for generating a superellipse in the embodiment of the present application is described in detail. Figure 4 As shown, the method for generating a superellipse in an embodiment of the present application includes:

[0061] S401, identifying whether the current device is a mobile device. If not, executing step S402; if yes, executing step S405.

[0062] S402, obtaining the position and first coordinate of the anchor point in the design drawing.

[0063] S403: According to the position of the anchor point, determine the corresponding first coordinate as the parameter value of the d attribute in the path element of the scalable vector graphics to obtain a first path character string.

[0064] S404: Generate a superellipse according to the path element and the first path character string.

[0065] S405, obtaining the first screen width of the screen in the design drawing, the position of the anchor point, the first super ellipse width of the super ellipse, and the ratio of the position of the anchor point to the corresponding side.

[0066] S406, obtaining a second screen width of the screen of the current device;

[0067] S407, calculating the font size on the screen of the current device according to the first screen width and the second screen width;

[0068] S408, calculating the second super ellipse width according to the font size and the first super ellipse width.

[0069] S409, calculating the second coordinates according to the width and proportion of the second super ellipse.

[0070] S410, according to the position of the anchor point, determining the corresponding second coordinate as the parameter value of the d attribute in the path element, and obtaining a second path character string;

[0071] S411, generating a super ellipse according to the path element and the second path character string.

[0072] Figure 5 It is a block diagram of a device for generating a super ellipse according to the first embodiment of the present application.

[0073] like Figure 5 As shown, the superellipse generation device 500 of the embodiment of the present application includes: a first acquisition module 501, a first determination module 502 and a first generation module 503.

[0074] The first acquisition module 501 is used to acquire the position and first coordinates of the anchor point of the superellipse in the design drawing.

[0075] The first determining module 502 is used to determine the corresponding first coordinate as the parameter value of the d attribute in the path element of the scalable vector graphics according to the position of the anchor point, so as to obtain a first path character string.

[0076] The first generating module 503 is used to generate a super ellipse according to the path element and the first path character string.

[0077] In one embodiment of the present application, the first acquisition module 501 may specifically include: a first acquisition unit, configured to identify that the current device is a non-mobile device, and then acquire the position and first coordinates of the anchor point in the design diagram.

[0078] In one embodiment of the present application, the superellipse generating device 500 of the embodiment of the present application may also include: a second acquisition module, used to identify that the current device is a mobile device, and then obtain the first screen width of the screen in the design drawing, the position of the anchor point, the first superellipse width of the superellipse and the proportion of the position of the anchor point to the corresponding side; a calculation module, used to calculate the second coordinates of the anchor point in the screen of the current device according to the first screen width, the first superellipse width and the proportion; a second determination module, used to determine the corresponding second coordinates as the parameter value of the d attribute in the path element according to the position of the anchor point, and obtain a second path character string; a second generation module, used to generate a superellipse according to the path element and the second path character string.

[0079] In one embodiment of the present application, the calculation module may specifically include: a first calculation unit, used to calculate the second super ellipse width of the super ellipse in the screen of the current device based on the first screen width and the first super ellipse width; a second calculation unit, used to calculate the second coordinate based on the second super ellipse width and the ratio.

[0080] In one embodiment of the present application, the first calculation unit may specifically include: a first acquisition subunit, used to acquire the second screen width of the screen of the current device; a first calculation subunit, used to calculate the font size of the screen of the current device based on the first screen width and the second screen width; a second calculation subunit, used to calculate the second super ellipse width based on the font size and the first super ellipse width.

[0081] In one embodiment of the present application, the super ellipse generating device 500 of the embodiment of the present application may also include: a third acquisition module, used to acquire a background image; a filling module, used to fill the background image into the super ellipse to obtain a super ellipse avatar or icon.

[0082] It should be noted that the implementation process of each module, unit, and sub-unit of the super ellipse generation device of the embodiment of the present application can refer to the relevant description in the super ellipse generation method of the above embodiment, and will not be repeated here.

[0083] In summary, the super ellipse generation device of the embodiment of the present application obtains the position and the first coordinate of the anchor point of the super ellipse in the design drawing, and determines the corresponding first coordinate as the parameter value of the d attribute in the path element of the scalable vector graphics according to the position of the anchor point, obtains the first path character string, and generates the super ellipse according to the path element and the first path character string. The user only needs to input the design drawing to automatically and quickly generate the super ellipse, which is simple to implement.

[0084] According to an embodiment of the present application, the present application also provides an electronic device and a readable storage medium.

[0085] like Figure 6 , is a block diagram of an electronic device according to a method for generating a superellipse according to an embodiment of the present application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as intelligent voice interaction devices, personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples, and are not intended to limit the implementation of the present application described herein and / or required.

[0086] like Figure 6 As shown, the electronic device includes: one or more processors 601, a memory 602, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and can be installed on a common mainboard or installed in other ways as needed. The processor 601 can process instructions executed in the electronic device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In other embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 601 is taken as an example.

[0087] The memory 602 is a non-transient computer-readable storage medium provided in the present application. The memory stores instructions executable by at least one processor to enable the at least one processor to perform the method for generating a superellipse provided in the present application. The non-transient computer-readable storage medium of the present application stores computer instructions, which are used to enable a computer to perform the method for generating a superellipse provided in the present application.

[0088] The memory 602 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as the program instructions / modules corresponding to the method for generating a superellipse in the embodiment of the present application (for example, the attached Figure 5 The processor 601 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 602, that is, the superellipse generation method in the above method embodiment is implemented.

[0089] The memory 602 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the use of an electronic device according to the method for generating a superellipse, etc. In addition, the memory 602 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage devices. In some embodiments, the memory 602 may optionally include a memory remotely arranged relative to the processor 601, and these remote memories may be connected to the electronic device of the method for generating a superellipse via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0090] The electronic device of the superellipse generation method may further include: an input device 603 and an output device 604. The processor 601, the memory 602, the input device 603 and the output device 604 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.

[0091] The input device 603 can receive input digital or character information, and generate key signal input related to user settings and function control of the electronic device of the superellipse generation method, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a trackball, a joystick and other input devices. The output device 604 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display and a plasma display. In some embodiments, the display device may be a touch screen.

[0092] Various implementations of the systems and techniques described herein can be realized in digital electronic circuit systems, integrated circuit systems, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0093] These computer programs (also referred to as programs, software, software applications, or code) include machine instructions for programmable processors and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or means (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0094] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0095] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet.

[0096] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short).

[0097] The present application also provides a computer program product, including a computer program, which implements the method for generating a super ellipse as described above when executed by a processor.

[0098] According to the technical solution of the embodiment of the present application, the position and the first coordinate of the anchor point of the super ellipse in the design drawing can be obtained, and according to the position of the anchor point, the corresponding first coordinate is determined as the parameter value of the d attribute in the path element of the scalable vector graphics to obtain the first path character string, and the super ellipse is generated according to the path element and the first path character string. The user only needs to input the design drawing to automatically and quickly generate the super ellipse, which is simple to implement.

[0099] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.

[0100] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.

Claims

1. A method for generating a superellipse, comprising: Get the position and first coordinate of the anchor point of the superellipse in the design drawing; According to the position of the anchor point, determining the corresponding first coordinate as the parameter value of the d attribute in the path element of the scalable vector graphics to obtain a first path character string; Generate the superellipse according to the path element and the first path character string; The method further comprises: Identify the current device as a mobile device, and then obtain the first screen width of the screen in the design drawing, the position of the anchor point, the first super ellipse width of the super ellipse, and the ratio of the position of the anchor point to the corresponding side; Calculating a second coordinate of the anchor point on the screen of the current device according to the first screen width, the first super ellipse width, and the ratio; According to the position of the anchor point, the corresponding second coordinate is determined as the parameter value of the d attribute in the path element to obtain a second path character string; Generate the superellipse according to the path element and the second path character string; The parameters of the d attribute include M, C, and S, and the first path string is: M 0,{halfwidth} C 0,{dot1}{dot1},0{halfwidth},0 S{width0},{dot1}{width0},{halfwidth} {dot2},{width0}{halfwidth},{width0} 0,{dot2}0,{halfwidth}; wherein width0 represents the first superellipse width of the superellipse in the design drawing, halfwidth=width0 / 2, dot1=0.22*halfwidth, dot2=width0-dot1.

2. The generation method according to claim 1, wherein: The obtaining of the position and the first coordinate of the anchor point of the superellipse in the design drawing comprises: Identify the current device as a non-mobile device, and then obtain the position of the anchor point in the design diagram and the first coordinate.

3. The generation method according to claim 1, wherein: The calculating, according to the first screen width, the first super ellipse width, and the ratio, the second coordinate of the anchor point on the screen of the current device includes: Calculating a second super ellipse width of the super ellipse in the screen of the current device according to the first screen width and the first super ellipse width; The second coordinate is calculated according to the second super ellipse width and the ratio.

4. The generation method according to claim 2, wherein: The calculating a second super ellipse width of the super ellipse in the screen of the current device according to the first screen width and the first super ellipse width includes: Get the second screen width of the screen of the current device; Calculating a font size on the screen of the current device according to the first screen width and the second screen width; The second super ellipse width is calculated according to the font size and the first super ellipse width.

5. The generation method according to claim 1, further comprising: Get the background image; The background image is filled into the super ellipse to obtain a super ellipse avatar or icon.

6. A superellipse generating device, comprising: A first acquisition module is used to acquire the position and first coordinates of the anchor point of the superellipse in the design drawing; A first determining module, configured to determine the first coordinate corresponding to the anchor point as a parameter value of a d attribute in a path element of a scalable vector graphic according to the position of the anchor point, to obtain a first path character string; A first generating module, used for generating the superellipse according to the path element and the first path character string; The device further comprises: A second acquisition module is used to identify that the current device is a mobile device, and then obtain the first screen width of the screen in the design diagram, the position of the anchor point, the first super ellipse width of the super ellipse, and the proportion of the position of the anchor point to the corresponding side; a calculation module, configured to calculate a second coordinate of the anchor point on the screen of the current device according to the first screen width, the first super ellipse width and the ratio; A second determination module is used to determine the corresponding second coordinate as the parameter value of the d attribute in the path element according to the position of the anchor point, so as to obtain a second path character string; A second generating module, used for generating the superellipse according to the path element and the second path character string; The parameters of the d attribute include M, C, and S, and the first path string is: M 0,{halfwidth} C 0,{dot1}{dot1},0{halfwidth},0 S{width0},{dot1}{width0},{halfwidth} {dot2},{width0}{halfwidth},{width0} 0,{dot2}0,{halfwidth}; wherein width0 represents the first superellipse width of the superellipse in the design drawing, halfwidth=width0 / 2, dot1=0.22*halfwidth, dot2=width0-dot1.

7. The generating device according to claim 6, wherein: The first acquisition module includes The first acquisition unit is used to identify that the current device is a non-mobile device, and then acquire the position of the anchor point in the design diagram and the first coordinate.

8. The generating device according to claim 6, wherein: The calculation module comprises: A first calculation unit, configured to calculate a second super ellipse width of the super ellipse in the screen of the current device according to the first screen width and the first super ellipse width; The second calculation unit is used to calculate the second coordinate according to the second super ellipse width and the ratio.

9. The generating device according to claim 8, wherein: The first computing unit comprises: A first acquisition subunit, used to acquire a second screen width of the screen of the current device; A first calculation subunit, configured to calculate a font size on the screen of the current device according to the first screen width and the second screen width; The second calculation subunit is used to calculate the second super ellipse width according to the font size and the first super ellipse width.

10. The generating device according to claim 6, further comprising: The third acquisition module is used to acquire the background image; A filling module is used to fill the background image into the super ellipse to obtain a super ellipse avatar or icon.

11. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for generating a super ellipse according to any one of claims 1 to 5.

12. A computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to enable the computer to execute the method for generating a superellipse according to any one of claims 1 to 5.

13. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method for generating a superellipse according to any one of claims 1 to 5.