Irregular view generation method and related device

By reading and clipping the text file of the scalable vector image, irregular views are generated, which solves the problem that the existing technology cannot display irregular views, and achieves efficient generation and display of irregular views.

CN118823162APending Publication Date: 2024-10-22小芒电子商务有限责任公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411087687.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-08
Publication Date
2024-10-22

AI Technical Summary

Technical Problem

The existing technology cannot effectively generate and display irregular views, especially in mobile Internet applications, and cannot realize the display of irregular views through the most basic system interface API.

Method used

By reading the text file of the scalable vector image, the original regular view that matches the target irregular view is obtained, and is trimmed based on the path data in the preset canvas to generate the target irregular view and adapt to the screen density for display. .

Benefits of technology

It reduces the difficulty of configuring irregular views, improves the efficiency of irregular view generation, and can effectively generate and display irregular views to meet business needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118823162A_ABST
    Figure CN118823162A_ABST
Patent Text Reader

Abstract

The invention discloses an irregular view generation method, and relates to the field of image processing, and the method comprises the steps: in response to a generation instruction of a target irregular view, reading a text file of a scalable vector diagram of the target irregular view, the text file comprising path data of at least one path node, the target irregular view is a view of the to-be-displayed business element. And obtaining an original view of the target irregular view, wherein the original view comprises any regular view. And in the canvas, cutting the original view based on the path data to generate a target irregular view. Visibly, according to the method, the irregular view of the to-be-displayed business element can be obtained by clipping the pre-configured regular view based on the path data of the scalable vector diagram of the to-be-displayed business element, and irregular views corresponding to various types of business elements do not need to be configured in advance; the configuration difficulty of the irregular view is reduced, and the generation efficiency of the irregular view is improved.
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, and in particular to a method for generating an irregular view and a related device. Background Art

[0002] In the development of mobile Internet, the user experience design of application App has gradually transitioned from the initial simplification and functionality to complexity, animation, and omnipotence. In the initial stage, the view shape design on the App is mostly conventional. For example, the views used to display buttons, texts or pictures in the App are all regular shapes, such as rectangles, squares, circles, and ellipses. The most basic system interface API of the mobile system can be used to quickly display regular views without the need for external resources.

[0003] As user demand grows, there is a need to display business elements in irregular views on the App. However, the display of irregular views cannot be achieved using the most basic system interface API. Summary of the invention

[0004] In view of the above problems, the present application provides a view generation method and related devices to achieve the purpose of generating irregular views on an application. The specific scheme is as follows:

[0005] The first aspect of the present application provides a method for generating an irregular view, comprising:

[0006] In response to a generation instruction of a target irregular view, a text file of a scalable vector graph of the target irregular view is read, the text file including path data of at least one path node, and the target irregular view is a view of a service element to be displayed;

[0007] Acquire an original view that matches the target irregular view, wherein the original view includes any regular view;

[0008] In a preset canvas, the original view is clipped based on the path data to generate the target irregular view.

[0009] In a possible implementation, before responding to the target irregular view generation instruction and reading the text file of the scalable vector map of the target irregular view, the irregular view generation method further includes:

[0010] Acquire a display instruction of the service element to be displayed, where the display instruction is used to instruct to display the service element to be displayed;

[0011] Based on a pre-configured element-view correspondence relationship, obtaining a view identifier corresponding to the service element to be displayed as a target view identifier, wherein the element-view correspondence relationship includes a correspondence relationship between the service element and the view identifier;

[0012] A generation instruction of the target irregular view is issued, wherein the generation instruction includes the target view identifier, and the generation instruction is used to instruct generation of the target irregular view.

[0013] In a possible implementation, reading a text file of a scalable vector map of the target irregular view includes:

[0014] Determining whether the view corresponding to the to-be-displayed service element is an irregular view based on the target view identifier;

[0015] If so, a text file of a scalable vector image indicated by the target view identifier is obtained from a pre-configured image file library, wherein the image file library stores a plurality of text files of scalable vector images.

[0016] In a possible implementation, the path data includes a plurality of commands arranged in sequence, and in a preset canvas, clipping the original view based on the path data to generate the target irregular view includes:

[0017] In the canvas, executing a plurality of commands in the path data sequentially on the original view to achieve clipping of the original view;

[0018] The cropped original view is used as the target irregular view.

[0019] In a possible implementation, in the canvas, sequentially executing multiple commands in the path data on the original view includes:

[0020] Obtaining a screen density of a scalable vector graph of the target irregular view as a first density;

[0021] Acquire the screen density of the view display screen of the service element to be displayed as the second density;

[0022] If the second density matches the first density, in the canvas, sequentially executing a plurality of commands in the path data on the original view;

[0023] If the second density does not match the first density, calculating a ratio of the second density to the first density as a density multiple;

[0024] Multiplying the parameters in the multiple commands in the path data by the density multiple to obtain multiple data of the path data;

[0025] In the canvas, a plurality of commands in the multiple data of the path data are sequentially executed on the original view.

[0026] In a possible implementation, multiplying the parameters in the plurality of commands in the path data by the density multiple to obtain multiple data of the path data includes:

[0027] Sequentially parse out a command identification sequence and a parameter sequence from the plurality of commands in the path data, wherein the command identification sequence includes command identifications arranged in sequence, and the parameter sequence includes parameters arranged in sequence;

[0028] Multiply each parameter in the parameter sequence by the density multiple to obtain a density adaptation parameter;

[0029] Concatenate the command identifiers and density adaptation parameters located at the same sequence in the command identifier sequence and the parameter sequence to obtain a command;

[0030] The spliced ​​commands are arranged in order to obtain multiple data of the path data.

[0031] A second aspect of the present application provides a device for generating an irregular view, including:

[0032] A file reading unit, configured to read a text file of a scalable vector map of a target irregular view in response to a generation instruction of the target irregular view, wherein the text file includes path data of at least one path node, and the target irregular view is a view of a service element to be displayed;

[0033] An original view acquisition unit, configured to acquire an original view matching the target irregular view, wherein the original view includes any regular view;

[0034] A view clipping unit is used to clip the original view based on the path data in a preset canvas to generate the target irregular view.

[0035] A third aspect of the present application provides a computer program product, comprising computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the method for generating an irregular view of the first aspect or any implementation of the first aspect.

[0036] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:

[0037] The memory is used to store computer programs;

[0038] The processor is used to execute the computer program so that the electronic device can implement the method for generating an irregular view of the first aspect or any implementation manner of the first aspect.

[0039] In a fifth aspect, the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can generate an irregular view of the method of the first aspect or any implementation of the first aspect.

[0040] By means of the above technical solution, the present application provides a method for generating an irregular view and a related device, which responds to a generation instruction of a target irregular view, reads a text file of a scalable vector map of the target irregular view, wherein the text file includes path data of at least one path node, and the target irregular view is a view of the business element to be displayed. The original view of the target irregular view is obtained, and the original view includes any regular view. In the canvas, the original view is cropped based on the path data to generate a target irregular view. It can be seen that the method can obtain an irregular view of the business element to be displayed by cropping a pre-configured regular view based on the path data of the scalable vector map of the business element to be displayed, without pre-configuring irregular views corresponding to various types of business elements, thereby reducing the configuration difficulty of irregular views and improving the generation efficiency of irregular views. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0042] Figure 1 A schematic diagram of a system architecture is shown;

[0043] Figure 2 An optional hardware structure diagram of the terminal 100 is shown;

[0044] Figure 3 A schematic diagram of the structure of a server 200 is provided;

[0045] Figure 4 A schematic diagram of a specific implementation flow of a method for generating an irregular view provided in an embodiment of the present application;

[0046] Figure 5 A schematic diagram of a specific implementation flow of a method for generating an irregular view provided in an embodiment of the present application;

[0047] Figure 6A specific implementation flow chart of a method for generating an irregular view provided in an embodiment of the present application;

[0048] Figure 7 A schematic diagram of the structure of an irregular view generating device provided in an embodiment of the present application;

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

[0050] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.

[0051] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0052] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0053] The present application can be applied in the field of image processing, and is applied to, but not limited to, scenarios for generating irregular views displayed on application interfaces. Irregular views have complex shapes, and generally an irregular view is limited to displaying one business element. For example, a ticket stub view is an irregular view, which is a view with a row of circular holes added around a rectangular view. It is understandable that the ticket stub view is only used to display ticket stub business elements generated in various businesses. Therefore, the present application provides a view generation method to solve the problem of difficulty in generating irregular views and high flexibility requirements.

[0054] This application can be applied to, but is not limited to, a mobile operating system. The mobile operating system includes a terminal and a server, which are described below:

[0055] See also Figure 1 , Figure 11 shows a schematic diagram of a system architecture. The system may include a terminal 100 and a server 200. The server 200 may include one or more servers ( Figure 1 In the description, a server is included as an example), and the server 200 can provide the method provided in the embodiment of the present application for one or more terminals.

[0056] Among them, a business processing application configured with a view generation function can be installed on the terminal 100. The above application and web page can provide an interface. The terminal 100 can receive relevant parameters entered by the user on the view generation interface, for example, a bill view generation instruction triggered after the business operation is completed, and send the above parameters to the server 200. The server 200 can obtain the processing result based on the received parameters and return the processing result to the terminal 100.

[0057] It should be understood that in some optional implementations, the terminal 100 can also complete the action of obtaining the processing result based on the received parameters by itself without the cooperation of the server, and the embodiments of the present application are not limited to this.

[0058] Next describe Figure 1 The product form of the mid-terminal 100;

[0059] The terminal 100 in the embodiment of the present application can be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., and the embodiment of the present application does not impose any limitation on this.

[0060] Figure 2 An optional hardware structure diagram of the terminal 100 is shown.

[0061] refer to Figure 2 As shown, the terminal 100 may include a radio frequency unit 110, a memory 120, an input unit 130, a display unit 140, a camera 150 (optional), an audio circuit 160 (optional), a speaker 161 (optional), a microphone 162 (optional), an earphone jack 163 (optional), a processor 170, an external interface 180, a power supply 190 and other components. Those skilled in the art will appreciate that Figure 2 These are merely examples of terminals or multi-function devices and do not constitute limitations on the terminals or multi-function devices, which may include more or fewer components than those shown in the figures, or combinations of certain components, or different components.

[0062] The input unit 130 can be used to receive input digital or character information, and generate key signal input related to the user settings and function control of the portable multifunctional device. Specifically, the input unit 130 may include a touch screen 131 (optional) and / or other input devices 132. The touch screen 131 can collect user touch operations on or near it (such as operations performed by the user using any suitable object such as fingers, joints, stylus, etc. on or near the touch screen), and drive the corresponding connection device according to a pre-set program. The touch screen can detect the user's touch action on the touch screen, convert the touch action into a touch signal and send it to the processor 170, and can receive and execute commands sent by the processor 170; the touch signal at least includes contact point coordinate information. The touch screen 131 can provide an input interface and an output interface between the terminal 100 and the user. In addition, the touch screen can be implemented using multiple types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch screen 131, the input unit 130 can also include other input devices. Specifically, other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.

[0063] Among them, the input device 132 can receive input data and the like.

[0064] The display unit 140 may be used to display information input by the user or provided to the user, various menus of the terminal 100, interactive interfaces, file display, and / or playback of any multimedia file. In an embodiment of the present application, the display unit 140 may be used to display an interface of the generation process of the irregular view, processing results, etc.

[0065] The memory 120 can be used to store instructions and data. The memory 120 can mainly include an instruction storage area and a data storage area. The data storage area can store various data, such as multimedia files, texts, etc.; the instruction storage area can store software units such as operating systems, applications, instructions required for at least one function, or their subsets and extensions. It can also include a non-volatile random access memory; provide the processor 170 with hardware, software and data resources including management of computing and processing equipment, and support control software and applications. It is also used for the storage of multimedia files, and the storage of running programs and applications.

[0066] The processor 170 is the control center of the terminal 100. It uses various interfaces and lines to connect various parts of the entire terminal 100. By running or executing instructions stored in the memory 120 and calling data stored in the memory 120, it executes various functions of the terminal 100 and processes data, thereby controlling the terminal device as a whole. Optionally, the processor 170 may include one or more processing units; preferably, the processor 170 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface and application program, and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 170. In some embodiments, the processor and the memory may be implemented on a single chip, and in some embodiments, they may also be implemented separately on separate chips. The processor 170 may also be used to generate corresponding operation control signals, send them to corresponding components of the computing and processing device, read and process data in the software, especially read and process data and programs in the memory 120, so that each functional module therein performs corresponding functions, thereby controlling the corresponding components to act according to the requirements of the instructions.

[0067] The memory 120 may be used to store software codes related to the method for generating irregular views, and the processor 170 may execute the steps of the method for generating irregular views, and may also schedule other units (such as the input unit 130 and the display unit 140) to implement corresponding functions.

[0068] The radio frequency unit 110 (optional) can be used for receiving and sending information or receiving and sending signals during a call, for example, after receiving the downlink information of the base station, it is sent to the processor 170 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (Low Noise Amplifier, LNA), a duplexer, etc. In addition, the radio frequency unit 110 can also communicate with network devices and other devices through wireless communication. The wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (Global System of Mobile communication, GSM), General Packet Radio Service (General Packet Radio Service, GPRS), Code Division Multiple Access (Code Division Multiple Access, CDMA), Wideband Code Division Multiple Access (Wideband Code Division Multiple Access, WCDMA), Long Term Evolution (Long Term Evolution, LTE), email, Short Messaging Service (SMS), etc.

[0069] In this embodiment of the present application, the RF unit 110 can send data to the server 200 and receive processing results sent by the server 200.

[0070] It should be understood that the radio frequency unit 110 is optional and can be replaced by other communication interfaces, such as a network port.

[0071] The terminal 100 also includes a power supply 190 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 170 through a power management system, so that the power management system can manage charging, discharging, power consumption and other functions.

[0072] The terminal 100 further includes an external interface 180 , which may be a standard Micro USB interface or a multi-pin connector, and may be used to connect the terminal 100 to communicate with other devices, or to connect a charger to charge the terminal 100 .

[0073] Although not shown, the terminal 100 may also include a flashlight, a wireless fidelity (WiFi) module, a Bluetooth module, sensors with different functions, etc., which are not described in detail here. Some or all of the methods described below may be applied in the following embodiments. Figure 2 In the terminal 100 shown.

[0074] Next describe Figure 1 The product form of the server 200;

[0075] Figure 3 An optional hardware structure diagram of a server 200 is provided, such as Figure 3 As shown, the server 200 includes a bus 201, a processor 202, a communication interface 203, and a memory 204. The processor 202, the memory 204, and the communication interface 203 communicate with each other via the bus 201.

[0076] The bus 201 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0077] The processor 202 may be any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0078] The memory 204 may include a volatile memory, such as a random access memory (RAM). The memory 204 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard drive (HDD), or a solid state drive (SSD).

[0079] The memory 204 may be used to store software codes related to the method for generating irregular views, and the processor 202 may execute the steps of the method for generating irregular views of the chip, and may also schedule other units to implement corresponding functions.

[0080] It should be understood that the above-mentioned terminal 100 and server 200 can be centralized or distributed devices, and the processors in the above-mentioned terminal 100 and server 200 (such as processor 170 and processor 202) can be hardware circuits (such as application specific integrated circuit (ASIC), field-programmable gate array (FPGA), general-purpose processor, digital signal processor (DSP), microprocessor or microcontroller, etc.), or a combination of these hardware circuits. For example, the processor can be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.

[0081] In one possible implementation, a view generation method provided in an embodiment of the present application is applied to an application configured in a mobile terminal. The application is used to execute various services pre-configured by the mobile operating system, and during the execution of various services, an irregular view is generated for displaying various business elements. It should be noted that the structure of the mobile terminal can refer to the above embodiment.

[0082] See also Figure 4 , Figure 4 The specific implementation process of the method for generating an irregular view provided in the embodiment of the present application is as follows: Figure 4 As shown, the method may include steps S401 to S403, and these steps are described in detail below.

[0083] S401 . In response to a target irregular view generation instruction, read a text file of a scalable vector map of a target irregular view.

[0084] In this embodiment, the text file includes at least one path node, a path node includes a set of path data, the path data includes multiple commands, and a command includes a command identifier and corresponding parameters. Among them, a command identifier is used to indicate a type of operation command, and the parameter corresponding to the command identifier is used to indicate the specific operation content of the command. Usually, a set of command data is formed by splicing the command identifier and the corresponding parameters.

[0085] The following introduces common command data and corresponding specific operation contents:

[0086] The command "M x,y" means moving to the coordinates (x, y);

[0087] The command "L x,y" means drawing a straight line to the coordinates (x, y);

[0088] The command "H x" means horizontal line to x coordinate;

[0089] The command "V y" means vertical line to y coordinate;

[0090] The command “C x1,y1, x2,y2, x,y” represents a cubic Bezier curve;

[0091] The command “S x2,y2, x,y” represents a smooth cubic Bezier curve;

[0092] The command “Q x1,y1, x,y” represents a quadratic Bezier curve;

[0093] The command "T x,y" represents a smooth quadratic Bezier curve;

[0094] The command “A rx,ry x-axis-rotation large-arc-flag,sweep-flag x,y” indicates an elliptical arc;

[0095] The command "Z" means closing the path.

[0096] Take the text file W1 of the scalable vector graph as an example. W1 includes a path node path. The example of path is as follows:

[0097] <path d="M10 10 L50 10 L50 50 L10 50 Z M60 60 Q80 10, 100 60 T140 60"

[0098] fill="none"

[0099] stroke="black" / >

[0100]

[0101] Among them, "path" is the path node identifier, "d" is the path data identifier, "fill" is the fill attribute identifier, and "stroke" is the border attribute identifier. The parsing result of W1 is:

[0102] Starting from coordinate point (10, 10), draw a line to coordinate point (50, 10), then to coordinate point (50, 50), then to coordinate point (10, 50), and finally close the path to form a rectangle. Starting from coordinate point (60, 60), draw a quadratic Bezier curve to coordinate point (100, 60), with the control point at coordinate point (80, 10), and then draw a smooth quadratic Bezier curve to coordinate point (140, 60).

[0103] The fill property is no fill, and the border is black.

[0104] In this embodiment, the generation instruction of the target irregular view can be triggered by the user or by the display instruction of the target business element, wherein the target irregular view is any irregular view, and the target irregular view is used to display the target business element. For example, after the approval business node is executed, the generation instruction of the bill business element is triggered, and a text file of a pre-built scalable vector diagram is searched from the scalable vector diagram database based on the bill business element.

[0105] In one possible approach, scalable vector graphics are pre-configured for various types of business elements of various types of business nodes in the business system, and the correspondence between the business elements and the scalable vector graphics is stored in a scalable vector graphics database. When a generation instruction for a business element is received, a text file of the scalable vector graphics corresponding to the business element is read.

[0106] S402: Select an original view that matches the target irregular view from pre-configured regular views.

[0107] In a possible implementation, regular views of different shapes are configured in advance according to business requirements, and a regular view is randomly selected as the original view of the target irregular view. Alternatively, based on the shape features of the regular views, the regular view with the highest matching degree with the shape features of the target irregular view is selected as the original view of the target irregular view.

[0108] S403: In a preset canvas, the original view is clipped based on the command in the path data to generate a target irregular view.

[0109] In this embodiment, the canvas is a pre-configured drawing area on the page. An optional canvas is a Canvas canvas. Canvas is a tag in HTML5 that can be used to create interactive content such as graphics and animations. It is equivalent to placing a canvas on the page of the browser, and Javascript can be used to operate the graphics on the Canvas. Specifically, the original view is clipped based on the command in the path data in the canvas, and the method for generating the target irregular view can be to execute the command in the path data on the canvas to realize the clipping of the original view.

[0110] It can be seen from the above technical solution that an irregular view generation method provided by an embodiment of the present application responds to a generation instruction of a target irregular view, reads a text file of a scalable vector map of a target irregular view, wherein the text file includes path data of at least one path node, and the target irregular view is a view of a business element to be displayed. The original view of the target irregular view is obtained, and the original view includes any regular view. In the canvas, the original view is cropped based on the path data to generate a target irregular view. It can be seen that the method can obtain an irregular view of a business element to be displayed by cropping a pre-configured regular view based on the path data of a scalable vector map of a business element to be displayed, without pre-configuring irregular views corresponding to various types of business elements, thereby reducing the configuration difficulty of irregular views and improving the generation efficiency of irregular views to meet the business needs of generating irregular views.

[0111] In a possible implementation, in the canvas, the original view is clipped based on the command in the path data. When the target irregular view is generated, in order to improve the adaptability of the irregular view to the screen, the path data is adapted to the screen density based on the target screen density of the business element to be displayed and the initial screen density of the scalable vector map of the target irregular view, so that the screen density of the path data is converted from the initial screen density to the target screen density. Figure 5 , take the canvas as Canvas canvas as an example, Figure 5 The specific implementation process of the method for generating an irregular view provided in the embodiment of the present application is as follows: Figure 5 As shown, this method specifically includes:

[0112] S501: Obtain a display instruction of a service element to be displayed.

[0113] In this embodiment, the display instruction is used to instruct to display the service element to be displayed.

[0114] In this embodiment, the display instruction may also include shape information of an irregular graphic, which is used to describe the shape of the view used to display the business element to be displayed. For example, the business element to be displayed is a bill. When the time for displaying the bill is reached, the display instruction of the bill is obtained. The display instruction of the bill is used to indicate the display of the bill view. The display instruction may also include a shape description of the bill view: circular holes are evenly arranged on the four edges of the rectangle.

[0115] S502: Based on the pre-configured element-view correspondence relationship, obtain a view identifier corresponding to the business element to be displayed as a target view identifier.

[0116] In this embodiment, the element-view correspondence relationship includes a correspondence relationship between a service element and a view identifier, wherein the view identifier is used to uniquely identify a scalable vector graphics image of a view.

[0117] In this embodiment, a corresponding scalable vector map is drawn and generated in advance based on the shape information of the irregular graphics of each business element, the scalable vector map is stored in a preset graphic database with a view identifier as an identifier, and the correspondence between the business element and the view identifier is stored.

[0118] S503: Issue a target irregular view generation instruction.

[0119] In this embodiment, the generating instruction includes a target view identifier, and the generating instruction is used to instruct to generate a target irregular view.

[0120] S504: In response to the target irregular view generation instruction, confirm whether the view corresponding to the to-be-displayed service element is an irregular view based on the target view identifier.

[0121] In this embodiment, each view identifier may be pre-labeled with a label indicating whether it is regular, and whether the view indicated by the target view identifier is regular may be quickly identified based on the label.

[0122] It can be understood that the rule view can be implemented based on system interface calls.

[0123] S505: If yes, obtain a text file of a scalable vector image indicated by the target view identifier from a pre-configured image file library.

[0124] In this embodiment, the image file library stores a plurality of text files of scalable vector graphics.

[0125] S506: Select an original view that matches the target irregular view from pre-configured regular views.

[0126] In this embodiment, multiple rule views are pre-configured based on business requirements, and the rule views include a rectangular view, a circular view, a triangular view, and the like.

[0127] S507: Obtain the screen density of the scalable vector map of the target irregular view as the first density.

[0128] In this embodiment, when drawing each scalable vector map, the screen density of the scalable vector map is recorded, and the correspondence between the view identifier and the screen density is stored. This step can directly determine the screen density of the scalable vector map of the target irregular view based on the target view identifier.

[0129] S508: Obtain the screen density of the view display screen of the service element to be displayed as the second density.

[0130] In this embodiment, the screen density of the terminal device running the application is obtained based on a preset information collection interface.

[0131] S509: If the second density matches the first density, in the canvas, execute multiple commands in the path data in sequence on the original view.

[0132] In this embodiment, the second density matches the first density, which means that the second density is equal to the first density.

[0133] S510: If the second density does not match the first density, calculate a ratio of the second density to the first density as a density multiple.

[0134] S511 . Multiply the parameters in the multiple commands in the path data by the density multiple to obtain multiple data of the path data.

[0135] In this embodiment, the path data includes multiple commands, each command includes a command identifier and a parameter, and the parameters in the multiple commands in the path data are multiplied by a density multiple to achieve the purpose of expanding the parameters by the density multiple.

[0136] In this embodiment, the command identification sequence and parameter sequence in the multiple commands in the path data are parsed in sequence, wherein the command identification sequence includes command identifications arranged in sequence, and the parameter sequence includes parameters arranged in sequence. Each parameter in the parameter sequence is multiplied by a density multiple to obtain a density adaptation parameter. The command identifications and density adaptation parameters at the same sequence in the command identification sequence and the parameter sequence are spliced ​​to obtain a command. The spliced ​​commands are arranged according to the sequence to obtain multiple data of the path data. In this way, the disassembly, multiple expansion and assembly of the command can be realized to generate multiple data of the path data.

[0137] S512: In the canvas, execute multiple commands in the multiple data of the path data in sequence on the original view.

[0138] S513: Output the cropped original view as the target irregular view.

[0139] It can be seen from the above technical solution that the method for generating an irregular view provided by the embodiment of the present application is to crop the original view based on the command in the path data. When generating the target irregular view, the screen multiple is first calculated based on the screen density of the current screen and the screen density of the scalable vector map of the target irregular view, and the parameters in the command in the path data are enlarged by the screen multiple, and then the original view is cropped based on the command after the enlargement to generate the target irregular view. Since the parameters in the path data are enlarged by the screen multiple, the screen density of the path data matches the current screen, so that the irregular view obtained by cropping is adapted to the current screen.

[0140] Furthermore, S501 to S503 provide a method for generating a target irregular view generation instruction, and the irregular view to be displayed can be quickly located through the pre-configured corresponding relationship.

[0141] Further, S504-S505 provide a specific method for obtaining a text file of a scalable vector map of a target irregular view, and according to a pre-configured correspondence and a pre-stored scalable vector map of a target irregular view, a scalable vector map of the current target irregular view can be quickly obtained. In another optional implementation, a text file of a scalable vector map of a target irregular view can be generated in real time based on shape information in a display instruction of a business element to be displayed.

[0142] In another possible implementation, the scalable vector graphics of the irregular view are all irregular shaped scalable vector graphics with single screen density and transparency, which are called transparent low-resolution SVG images. In S403, in the canvas, the original view is cropped based on the command in the path data to generate the target irregular view. First, the screen density of the view display screen of the business element to be displayed is obtained to obtain the target multiple, and the parameters in the command in the path data are expanded by the target multiple. Then, the original view is cropped based on the command after the target multiple is expanded to generate the target irregular view. Still taking the Canvas canvas as an example, Figure 6 A specific implementation flow chart of a method for generating an irregular view provided in an embodiment of the present application, such as Figure 6 As shown, the method for generating an irregular view includes:

[0143] 1. First, use the platform-specific technology on the mobile operating system (such as Android or iOS) to implement a regular graphic view, such as a rectangular card view.

[0144] 2. Based on business needs, generate a low-resolution (single screen density) scalable vector SVG transparent image of an irregular graphic (also called an irregular business graphic) that meets the business element display requirements, and place the SVG transparent image into the application.

[0145] 3. Use the code to read the text content of the text file of the SVG transparent image in the application.

[0146] 4. Parse the path data contained in the path node (also known as path node) of the text content, also known as path data. Use the canvas tool provided by the Android platform or the iOS platform to translate the path data into shape path data that can be recognized by the corresponding mobile platform.

[0147] It should be noted that irregular graphics are graphics with the lowest resolution. If they are displayed directly on the screen of a terminal device, problems such as incorrect display position of the image content and incomplete display content may occur.

[0148] 5. Disassemble and calculate the path data according to the rules, and finally merge them into usable data, that is, multiple data. Specifically, use the interface provided by the mobile system to read the multiple of the screen density as the target multiple, group the path data, and then expand the numerical parameters in each group by the target multiple. Finally, reassemble each group according to the original arrangement order, thereby outputting path data that perfectly matches the target screen density.

[0149] For example, the raw data of SVG path data is as follows:

[0150] <path d="M1033.42,668.084L1132.08,0L1131.5,0L265.36,0L35.5284,140.202L-0.04550500000000002,480.409L1033.42,668.084ZM1130.92,1L1032.58,666.916L1.045505,479.591L36.4716,140.798L265.64,1L1130.92,1Z" fill-rule="evenodd" fill="#D8D8D8" fill-opacity="1" / >

[0151] The specific method of processing the original data to generate new path data that can adapt to the target screen density includes:

[0152] 1. Extract the path data from the original data through code to obtain the path data:

[0153] M1033.42,668.084L1132.08,0L1131.5,0L265.36,0L35.5284,140.202L-0.04550500000000002,480.409L103 3.42,668.084ZM1130.92,1L1032.58,666.916L1.045505,479.591L36.4716,140.798L265.64,1L1130.92,1Z.

[0154] 2. Read the screen density of the screen that displays the business element to be displayed, for example, the screen density density = 3.0.

[0155] 3. After decomposing the letter identifiers and numeric parameters in the path data, multiply each number by the value of the screen density, and then reorganize the letter identifiers and numeric parameters in the original order to obtain the multiple data:

[0156] M3100.26,2004.252L3396.24,0L3394.5,0L796.08,0L106.5852,420.606L-0.13651500000000006,1441.227L310 0.26,2004.252ZM3392.76,3L3097.74,2000.748L3.136515,1438.773L109.4148,422.394L796.92,3L3392.76,3Z

[0157] 6. Use the path data to clip the input regular graphic View on the canvas, and the clipped view is an irregular business graphic view that is consistent with the shape of the SVG transparent image.

[0158] It can be seen that since the digital parameters in the original path data are single-time data, the multiple data obtained by amplifying the single-time data based on the target screen density and then assembling the multiple data in sequence is the path data that can adapt to the current target screen density.

[0159] In summary, the present invention generates an SVG transparent image of an irregular graphic, then parses and uses the path data of the SVG transparent image to cut out the corresponding graphic, and finally adapts the original path data to the screen density, so that all devices can display normally, and the path data and the graphic can accurately match, providing users with a higher viewing experience. Since this solution adds a method for adapting to various screen densities, combined with the screen density of the current terminal device, the algorithm rules are used to disassemble, calculate, and synthesize the path data, and other data processing steps to generate new path data, and then the canvas operation at the mobile platform level is performed to obtain irregular graphics adapted to the current device.

[0160] A method for generating an irregular view provided in an embodiment of the present application is introduced above. A device for executing the method for generating an irregular view is introduced below.

[0161] See also Figure 7 , Figure 7 The structure diagram of an irregular view generation device provided in an embodiment of the present application is shown in FIG. Figure 7 As shown, the irregular view generating device 700 includes:

[0162] A file reading unit 701 is configured to read a text file of a scalable vector map of a target irregular view in response to a generation instruction of the target irregular view, wherein the text file includes path data of at least one path node, and the target irregular view is a view of a service element to be displayed;

[0163] The original view acquisition unit 702 is configured to select an original view matching the target irregular view from pre-configured regular views;

[0164] The view clipping unit 703 is used to clip the original view based on the path data in a preset canvas to generate the target irregular view.

[0165] In a possible implementation, the irregular view generation device further includes a view generation indication unit, which is used to obtain a display instruction of a to-be-displayed business element before reading a text file of a scalable vector map of the target irregular view in response to the generation instruction of the target irregular view, wherein the display instruction is used to instruct the display of the to-be-displayed business element; based on a pre-configured element-view correspondence relationship, obtain a view identifier corresponding to the to-be-displayed business element as a target view identifier, wherein the element-view correspondence relationship includes a correspondence relationship between a business element and a view identifier; and issue a generation instruction of the target irregular view, wherein the generation instruction includes the target view identifier, and the generation instruction is used to instruct the generation of the target irregular view.

[0166] In a possible implementation, when the file reading unit is used to read the text file of the scalable vector map of the target irregular view, it is specifically used to:

[0167] Determining whether the view corresponding to the to-be-displayed service element is an irregular view based on the target view identifier;

[0168] If so, a text file of a scalable vector image indicated by the target view identifier is obtained from a pre-configured image file library, wherein the image file library stores a plurality of text files of scalable vector images.

[0169] In a possible implementation, the path data includes a plurality of commands arranged in sequence, and the view clipping unit is used to clip the original view based on the path data in a preset canvas to generate the target irregular view, specifically for:

[0170] In the canvas, a plurality of commands in the path data are sequentially executed on the original view to achieve clipping of the original view; and the clipped original view is used as the target irregular view.

[0171] In a possible implementation, the view clipping unit is used to execute the plurality of commands in the path data in sequence on the original view in the canvas, specifically to:

[0172] Obtaining a screen density of a scalable vector graph of the target irregular view as a first density;

[0173] Acquire the screen density of the view display screen of the service element to be displayed as the second density;

[0174] If the second density matches the first density, in the canvas, sequentially executing a plurality of commands in the path data on the original view;

[0175] If the second density does not match the first density, calculating a ratio of the second density to the first density as a density multiple;

[0176] Multiplying the parameters in the multiple commands in the path data by the density multiple to obtain multiple data of the path data;

[0177] In the canvas, a plurality of commands in the multiple data of the path data are sequentially executed on the original view.

[0178] In a possible implementation, the view clipping unit is used to multiply the parameters in the plurality of commands in the path data by the density multiple to obtain the multiple data of the path data, specifically to:

[0179] Sequentially parse out a command identification sequence and a parameter sequence from the plurality of commands in the path data, wherein the command identification sequence includes command identifications arranged in sequence, and the parameter sequence includes parameters arranged in sequence;

[0180] Multiply each parameter in the parameter sequence by the density multiple to obtain a density adaptation parameter;

[0181] Concatenate the command identifiers and density adaptation parameters located at the same sequence in the command identifier sequence and the parameter sequence to obtain a command;

[0182] The spliced ​​commands are arranged in order to obtain multiple data of the path data.

[0183] The present application also provides an electronic device in an embodiment. Figure 8 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 8The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0184] like Figure 8 As shown, the electronic device may include a processing device (e.g., a central processing unit, a view processor, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 to a random access memory (RAM) 803. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 803. The processing device 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0185] Typically, the following devices may be connected to the I / O interface 805: input devices 806 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 807 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 808 including, for example, a memory card, a hard disk, etc.; and communication devices 809. The communication device 809 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0186] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any of the methods for generating irregular views provided in the embodiments of the present application.

[0187] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any method for generating an irregular view provided in an embodiment of the present application.

[0188] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

[0189] Through the description of the above implementation methods, the technicians in the relevant field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structures used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation method in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, U disk, mobile hard disk, ROM, RAM, disk or optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, training equipment, or network equipment, etc.) to execute the methods described in each embodiment of the present application.

[0190] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0191] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, a computer, a training device, or a data center to another website, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

Claims

1. A method for generating an irregular view, characterized in that: include: In response to a target irregular view generation instruction, reading a text file of a scalable vector graph of the target irregular view, the text file including path data of at least one path node, the target irregular view being a view of a service element to be displayed; Selecting an original view that matches the target irregular view from pre-configured regular views; In a preset canvas, the original view is clipped based on the path data to generate the target irregular view.

2. The method for generating an irregular view according to claim 1, wherein: Before reading the text file of the scalable vector map of the target irregular view in response to the target irregular view generation instruction, the irregular view generation method further includes: Obtaining a display instruction for a service element to be displayed, wherein the display instruction is used to instruct display of the service element to be displayed; Based on a pre-configured element-view correspondence relationship, obtaining a view identifier corresponding to the service element to be displayed as a target view identifier, wherein the element-view correspondence relationship includes a correspondence relationship between the service element and the view identifier; A generation instruction for the target irregular view is issued, where the generation instruction includes the target view identifier, and the generation instruction is used to instruct generation of the target irregular view.

3. The method for generating an irregular view according to claim 2, wherein: The step of reading the text file of the scalable vector graph of the target irregular view includes: Determining whether the view corresponding to the to-be-displayed service element is an irregular view based on the target view identifier; If so, a text file of a scalable vector image indicated by the target view identifier is obtained from a pre-configured image file library, where the image file library stores a plurality of text files of scalable vector images.

4. The method for generating an irregular view according to claim 1, wherein: The path data includes a plurality of commands arranged in sequence, and the step of clipping the original view based on the path data in a preset canvas to generate the target irregular view includes: In the canvas, sequentially executing a plurality of commands in the path data on the original view to achieve clipping of the original view; The cropped original view is used as the target irregular view.

5. The method for generating an irregular view according to claim 4, wherein: The step of sequentially executing the plurality of commands in the path data on the original view in the canvas includes: Obtaining a screen density of a scalable vector graph of the target irregular view as a first density; Acquire the screen density of the view display screen of the service element to be displayed as the second density; If the second density matches the first density, executing, in the canvas, a plurality of commands in the path data on the original view in sequence; If the second density does not match the first density, calculating a ratio of the second density to the first density as a density multiple; Multiplying the parameters in the plurality of commands in the path data by the density multiple to obtain multiple data of the path data; In the canvas, a plurality of commands in the multiple data of the path data are sequentially executed on the original view.

6. The method for generating an irregular view according to claim 5, wherein: The step of multiplying the parameters in the plurality of commands in the path data by the density multiple to obtain multiple data of the path data includes: Sequentially parsing out a command identification sequence and a parameter sequence from the plurality of commands in the path data, wherein the command identification sequence includes command identifications arranged in sequence, and the parameter sequence includes parameters arranged in sequence; Multiplying each parameter in the parameter sequence by the density multiple to obtain a density adaptation parameter; splicing the command identifiers and density adaptation parameters located at the same position in the command identifier sequence and the parameter sequence to obtain a command; Arrange the spliced ​​commands in order to obtain multiple data of the path data.

7. A device for generating an irregular view, characterized in that: include: a file reading unit, configured to read, in response to a generation instruction of a target irregular view, a text file of a scalable vector graph of the target irregular view, the text file including path data of at least one path node, the target irregular view being a view of a service element to be displayed; an original view acquiring unit, configured to select an original view matching the target irregular view from pre-configured regular views; A view clipping unit is configured to clip the original view based on the path data in a preset canvas to generate the target irregular view.

8. A computer program product, characterized in that The method comprises computer-readable instructions, which, when executed on an electronic device, enable the electronic device to implement the method for generating an irregular view according to any one of claims 1 to 6.

9. An electronic device, characterized in that: comprising at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is configured to execute the computer program so as to enable the electronic device to implement the method for generating an irregular view according to any one of claims 1 to 6.

10. A computer storage medium, characterized in that The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the method for generating an irregular view as described in any one of claims 1 to 6.