CN112527734B - Graphic processing method, device, electronic equipment and storage medium - Google Patents

Graphic processing method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112527734B
CN112527734B CN202011437439.2A CN202011437439A CN112527734B CN 112527734 B CN112527734 B CN 112527734B CN 202011437439 A CN202011437439 A CN 202011437439A CN 112527734 B CN112527734 B CN 112527734B
Authority
CN
China
Prior art keywords
data
processed
graphic
format
document
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011437439.2A
Other languages
Chinese (zh)
Other versions
CN112527734A (en
Inventor
邹涛
上官致伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202011437439.2A priority Critical patent/CN112527734B/en
Publication of CN112527734A publication Critical patent/CN112527734A/en
Application granted granted Critical
Publication of CN112527734B publication Critical patent/CN112527734B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/116Details of conversion of file system types or formats

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Document Processing Apparatus (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The application discloses a graphic processing method, a graphic processing device, electronic equipment and a storage medium, which relate to the technical field of data processing and can be used in the fields of cloud computing and cloud, and comprise the following steps: obtaining graphic data to be processed in a document to be processed; converting the graphic data to be processed into graphic data in a unified format; the uniform format graphic data is different from the data format of the graphic data to be processed; and outputting the uniform format graphic data by adopting a uniform data output format. The embodiment of the application can improve the convenience of online application of the electronic document.

Description

Graphic processing method, device, electronic equipment and storage medium
Technical Field
The application relates to the technical field of data processing, in particular to the technical field of graphic processing.
Background
The electronic document (Electronic Document) refers to a text material using a chemical magnetic material such as a computer disk, a magnetic disk, an optical disk and the like as a carrier, and can be accessed by a computer system and transmitted on a communication network. Various types of graphic data are inevitably included in electronic documents. In some cases, the same type of electronic document may have different data formats, such as presentation documents having two data formats [. Ppt ] and [. Pptx ], word documents having data formats [. Doc ], [. Docx ], [. Docm ], and [. Xml ]. Electronic documents of different data formats also differ in the data formats defined for the image data in the document. Therefore, the graphic data in the electronic documents with different data formats of the same type are unified, and the method has great significance for improving the convenience of the application of the electronic documents.
Disclosure of Invention
The embodiment of the application provides a graphic processing method, a graphic processing device, electronic equipment and a storage medium, which are used for improving the convenience of online application of electronic documents.
In a first aspect, an embodiment of the present application provides a graphics processing method, including:
obtaining graphic data to be processed in a document to be processed;
converting the graphic data to be processed into graphic data in a unified format; the uniform format graphic data is different from the data format of the graphic data to be processed;
And outputting the uniform format graphic data by adopting a uniform data output format.
In a second aspect, an embodiment of the present application provides a graphics processing apparatus, including:
the graphics data acquisition module is used for acquiring graphics data to be processed in the document to be processed;
The graphics data conversion module to be processed is used for converting the graphics data to be processed into the graphics data with the uniform format; the uniform format graphic data is different from the data format of the graphic data to be processed;
And the unified format graphic data output module is used for outputting the unified format graphic data by adopting a unified data output format.
In a third aspect, an embodiment of the present application provides an electronic device, including:
At least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the graphics processing method provided by the embodiments of the first aspect.
In a fourth aspect, embodiments of the present application also provide a non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the graphics processing method provided by the embodiments of the first aspect.
According to the embodiment of the application, the graphic data to be processed in the document to be processed is converted into the graphic data in the unified format, and the graphic data in the unified format obtained by conversion is output by adopting the unified data output format, so that the problem that the graphic data processing process of different data formats is complex when the existing electronic document is applied online can be solved, and the convenience of the electronic document in online application is improved.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The drawings are included to provide a better understanding of the present application and are not to be construed as limiting the application. Wherein:
FIG. 1 is a flow chart of a graphics processing method provided by an embodiment of the present application;
FIG. 2 is a schematic diagram of a general graphic element conversion system according to an embodiment of the present application;
FIG. 3 is a flow chart of a graphics processing method provided by an embodiment of the present application;
FIG. 4 is a schematic flow chart of obtaining graphic data to be processed in a document to be processed according to an embodiment of the present application;
FIG. 5 is a schematic diagram illustrating the effect of a method for storing graphic data in pptx presentation documents according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a data structure of unified parsing format data according to an embodiment of the present application;
FIG. 7 is a block diagram of a graphics processing apparatus according to an embodiment of the present application;
Fig. 8 is a schematic structural diagram of an electronic device for implementing a graphic processing method according to an embodiment of the present application.
Detailed Description
Exemplary embodiments of the present application will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present application are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Currently, the operation modes of electronic documents mainly include two kinds. One is to open and perform operations such as browsing or editing by using a local client, and the other is to open and perform operations such as browsing or editing online, namely, a web operation mode. It will be appreciated that if the electronic document is opened by means of a local client, the local client can effectively recognize the electronic document in a different data format even though the graphic data in the same type of electronic document may have a different data format, so as to correctly display the data in the electronic document, including text data, graphic data, and the like. However, when an electronic document is opened in an online manner, that is, when an electronic document in web form is opened, if graphic data of different data formats are included in the same type of electronic document, a graphic display error problem occurs.
Illustratively, ppt and pptx belong to two disparate format standards of MSPowerPoint, and are different in organization from the definition of document elements to the data. The ppt data format is binary data format, and is the default storage format of PowerPoint95, powerPoint97 and PowerPoint 2003. pptx is OOXML (Office Open XML) standard data format, which is a new data format published with PowerPoint 2007 and is also the default save format after PowerPoint 2007. In both data formats, there are also two different definition methods for the graphical object. Currently, online PowerPoint does not have an efficient solution to deal with the differences in the two formats for electronic documents, which can result in incorrect display of graphics data in the document. For example, when an electronic document in pptx format is opened by online PowerPoint, if there is a custom heart graphic in the electronic document, the online PowerPoint may appear to be unable to recognize the graphic or display the heart graphic as another graphic converted by default by the system, or the like. Thus, how to handle multi-format differences more effectively for web-form electronic documents is a very prominent issue in online electronic document solutions.
In one example, fig. 1 is a flowchart of a graphics processing method according to an embodiment of the present application, where the method may be implemented by a graphics processing apparatus, and the apparatus may be implemented by software and/or hardware, and may be generally integrated in an electronic device, where the graphics processing method is applicable to converting graphics with different data formats in the same type of electronic document into graphics with a uniform data format. The electronic device may be a computer device or various terminal devices, etc. Accordingly, as shown in fig. 1, the method includes the following operations:
s110, obtaining the graphic data to be processed in the document to be processed.
Wherein the document to be processed may be any type of electronic document in web form. The graphic data to be processed may be graphic data included in the document to be processed, which is required to be displayed on line.
In the embodiment of the application, the graphic data to be processed, which is included in the document to be processed, can be uniformly converted by the universal graphic element conversion system. Fig. 2 is a schematic structural diagram of a general graphic element conversion system according to an embodiment of the present application. In one specific example, as shown in FIG. 2, a universal graphic element conversion system may include a multi-format parser, a graphic object converter, and a unified format output engine. Wherein, the multi-format parser and the graphic object converter are in communication connection, and the graphic object converter and the unified format output engine are in communication connection. The multi-format parser, the graphic object converter and the unified format output engine cooperate with each other to perform unified processing and output on graphic data included in the electronic document.
The universal graphic element conversion system can be used with an online electronic document application to convert image data in an electronic document currently being processed by the online electronic document. Accordingly, if the universal graphic element conversion system detects that the online electronic document is opened, that is, detects a web-form to-be-processed document, the to-be-processed graphic data included in the to-be-processed document can be acquired through the multi-format parser.
S120, converting the graphic data to be processed into graphic data with a uniform format; the unified format graphics data is different from the data format of the graphics data to be processed.
Wherein the unified format graphic data may be graphic data having a unified data format and may support web display.
Correspondingly, after the graphic data to be processed in the document to be processed is obtained through the multi-format analyzer, the graphic data to be processed can be analyzed and stored by utilizing a self-defined data format organization architecture in the multi-format analyzer, and the graphic data to be processed is converted into a uniform data format and stored in a memory structure, so that node data and attribute data in the graphic data to be processed are reorganized by utilizing the uniform data format. That is, the multi-format parser may redefine the new data format as a unified data format to reorganize and sort the graphics data to be processed. Further, the graphic object converter may convert graphic data having a uniform data format into uniform format graphic data using graphic data stored in the memory structure. That is, the general graphic element conversion system may parse and save basic data of graphic data to be processed using a multi-format parser, and finally convert the saved graphic data into unified-format graphic data using a graphic object converter.
It follows that the generic graphic element conversion system can be utilized to convert graphic data to be processed into uniform format graphic data having a uniform data format, regardless of the data format. Optionally, the data format of the unified format graphics data may be, for example, JSON (JavaScript Object Notation ) or other formats, so long as the graphics data can be displayed online, and the embodiment of the present application does not limit the specific type of the data format of the unified format graphics data.
S130, outputting the uniform format graphic data by adopting a uniform data output format.
Wherein the unified data output format may be a graphic data output format redefined for unified format graphic data.
Accordingly, after the unified format graphic data corresponding to the graphic data to be processed is obtained, the unified format graphic data can be output by utilizing the unified format output engine, so that the graphic data to be processed with different data formats can finally output the same data format. For example, a unified data output format may be designed based on JSON, such that the graphics data to be processed in each type of document to be processed is ultimately output in JSON format. The JSON format is used for uniformly outputting the uniform format graphic data, so that not only can the basic elements of all the shape data in the graphic be defined, but also the subsequent expansion and upgrading are facilitated, and the expandability of the universal graphic element conversion system is improved.
It should be noted that, the graphics data to be processed according to the embodiments of the present application may include two types of graphics data, one is predefined graphics data, that is, the graphics to be processed is default graphics such as rectangle, triangle, arrow, etc. that are set by default in the document. The other is custom graphic data, such as graphics that can be custom set, such as free curves and polygons.
Therefore, the to-be-processed graphic data in the to-be-processed document is converted into the uniform-format graphic data with the uniform data format by utilizing the universal graphic element conversion system, and the uniform-format graphic data with the uniform data format is output by utilizing the uniform data output format, so that the to-be-processed graphic data with various data formats can be in the uniform data format supporting normal web display, and the web display is not performed by the original data format, thereby solving the problem that the to-be-processed graphic data with different data formats cannot be displayed normally on line, realizing the data processing process of graphic conversion processing, enabling the graphic data with different data formats to achieve the uniform graphic display effect, and effectively improving the convenience of the on-line application of the electronic document.
According to the embodiment of the application, the to-be-processed graphic data in the to-be-processed document is converted into the uniform format graphic data, and the uniform format graphic data obtained by conversion is output by adopting the uniform data output format, so that the problem that the graphic data processing process of different data formats is complex when the existing electronic document is applied online can be solved, the consistent graphic display effect of the graphic data in different data formats can be achieved, and the convenience of the electronic document on-line application is improved.
In an example, fig. 3 is a flowchart of a graphics processing method provided by an embodiment of the present application, where optimization and improvement are performed on the basis of the technical solutions of the foregoing embodiments, and various specific alternative implementations for obtaining graphics data to be processed in a document to be processed and converting the graphics data to be processed into graphics data in a uniform format are provided.
A method of graphics processing as shown in fig. 3, comprising:
s210, obtaining the graphic data to be processed in the document to be processed.
In an alternative embodiment of the present application, the document to be processed includes a first document to be processed and/or a second document to be processed; the graphics data to be processed comprise first graphics data to be processed and/or second graphics data to be processed, and the data formats of the first graphics data to be processed and the second graphics data to be processed are different.
Wherein the first document to be processed and the second document to be processed may be electronic documents having different data formats. The first document to be processed may include first graphic data to be processed therein, and the second document to be processed may include second graphic data to be processed therein. Since the data formats of the first document to be processed and the second document to be processed are different, the data formats of the first graphic data to be processed and the second graphic data to be processed are also different.
It should be noted that, the first document to be processed and the second document to be processed are both electronic documents of the same type, for example, are both Word documents or are both presentation documents. Because different types of electronic documents may have a plurality of corresponding different data formats, the documents to be processed may be further expanded according to the document type data, for example, a third document to be processed, a fourth document to be processed, and the like may be further included. Similarly, the to-be-processed graphic data corresponding to the third to-be-processed document is the third to-be-processed graphic data, and the to-be-processed graphic data corresponding to the fourth to-be-processed document is the fourth to-be-processed graphic data. The embodiment of the application does not limit the document type of the document to be processed and the graphic data type of the corresponding graphic data to be processed. It will be appreciated that the data formats of the graphics data to be processed of the unknown type are different from each other.
In an optional embodiment of the present application, if the document to be processed is a first document to be processed, the first document to be processed is a first type presentation document, and the data format of the graphic data to be processed is a binary format; acquiring the graphics data to be processed in the document to be processed may include the operations of: reading a top container in a document stream from a first document to be processed; acquiring a file list included in the top-level container; reading a file container according to the file list; reading a picture container according to a first parameter variable in the file container when the first parameter variable has a variable value; reading a graphic element container according to a second parameter variable in the picture container; and reading the graphic element container to acquire first graphic data to be processed.
In an alternative embodiment of the present application, the first graphic data to be processed in the first document to be processed is determined to be empty in case there is no variable value for the first parameter variable in the file container.
The document type of the first type of presentation document can be in a ppt format, and the data format of the graphics data to be processed in the ppt format of the document to be processed is a binary format. The file list may be a slide list and the file container may be a slide container. The first parameter variable may be a related variable in the slide container for representing the graphics data. The second parameter variable may be a related variable in the graphic element container for representing the shape data.
It should be noted that all file data in ppt binary format exists in one or more streams, and most of the data is stored in PowerPointDocument (document stream) streams. The content stored in the presentation document in ppt format is based on Record, which in turn includes both Container Record and Atom Record. A single shape is defined in OfficeArtSpContainer (shape data container) records whose shapeProp attribute is one OfficeArtFSP (type and base attribute) record. The RECINSTANCE field of the head OfficeArtRecordHeader (head) of OfficeArtFSP identifies the MSOSPT (shape type) enumeration value of the shape type. Other attributes are recorded in OfficeArtFOPT (attribute list) and OfficeArtTertiaryFOPT (attribute list). In addition, officeArtSpContainer include other data records, such as text and hyperlinks.
Thus, if the document to be processed is a first type presentation document, the graphics data to be processed may be acquired in a storage format of the presentation document in ppt format for the graphics data. Fig. 4 is a schematic flow chart of obtaining graphics data to be processed in a document to be processed according to an embodiment of the present application. In a specific example, as shown in fig. 4, the top container (DocumentContainer) in PowerPoint Document may be read from the first document to be processed, and all slide lists (SLIDELIST) may be further acquired, including the master slide, the layout slide, the slides, and the like, so that the slide (SlideListWithTextContainer) list is read as the file list. After the SlideListWithTextContainer list is obtained, the slide container (SlideContainer) is read based on the slide offset record (SlidePersistAtom) recorded at SlideListWithTextContainer. A determination is made as to whether the variable value exists for the drawing variable (first parameter variable) in SlideContainer. Reading a drawing container (DrawingContainer) according to the drawing variable if the variable value exists in the drawing variable; otherwise, the first type demonstration document does not include graphic data, and subsequent reading and analyzing operations are not needed, so that the reading operation of the graphic data is simplified, and meaningless data analyzing processes are avoided. Correspondingly, if there is a variable value for the drawing variable, then after reading DrawingContainer, the graphic element container is read (OfficeArtDgContainer) according to the OfficeArtDg variable (second parameter variable) in DrawingContainer. Since the related data of the graphic is recorded in OfficeArtDgContainer, officeArtDgContainer can be read to acquire the first graphic data to be processed.
In an alternative embodiment of the present application, the reading the graphic element container may include: reading a shape data container according to a third parameter variable in the graphic element container; and acquiring the graph shape type and the graph attribute data of the graph data to be processed according to the shape data container.
Wherein the third parameter variable may be a related variable in the graphic element container for representing the graphic data.
Further, the specific flow of reading the graphic element container may be: the shape data container (OfficeArtSpContainer) is read from the shape variable (third parameter variable) value in OfficeArtDgContainer. Wherein OfficeArtSpContainer stores mainly three types of graphics data, officeArtFSP records the types and basic attributes of graphics shapes, and OfficeArtFOPT and OfficeArtTertiaryFOPT records other attributes of graphics.
Thus, the first graphic data to be processed can be obtained comprehensively according to the storage format of the presentation document in the ppt format and the graphic data such as the type and the attribute of the first graphic data to be processed.
In an optional embodiment of the present application, if the document to be processed is a second document to be processed, the second document to be processed is a second type presentation document, and the data format of the second graphic data to be processed is an OOXML standard data format; acquiring the graphics data to be processed in the document to be processed may include the operations of: the following operations may be included: carrying out document analysis on the second document to be processed to obtain an analysis file; determining file style dependency relations among the target analysis files according to the dependency relation files of the analysis files; determining a graph searching sequence according to the file style dependency relationship; and searching the graphic data of the target analysis file according to the graphic search sequence to obtain second graphic data to be processed.
The analysis file may be a file obtained by analyzing the second document to be processed. The target resolution file may be a file for acquiring graphic data among the resolution files. The graphic search order may be a default setting in the general graphic element conversion system for searching for the second graphic data to be processed included in the second document to be processed. The file style dependencies may be dependencies between different types of target parsed files.
Note that the pptx format presentation document is a zip package and a complete document is composed of a plurality of XML (eXtensible Markup Language ) files. Fig. 5 is an effect schematic diagram of a storage mode of graphic data in pptx presentation documents according to an embodiment of the present application. In a specific example, as shown in fig. 5, a file directory structure of pptx is shown after the decompression of the file, and graphic data in pptx is stored in a slider xml file under the slider directory. The main content of a slide, such as text, tables, pictures and graphics, is stored in this file. Correspondingly, the data definition of the graph in the document is set by slides- > cSld- > spTree- > sp. Wherein the predefined graph is set in the prstGeom node and the custom graph is set in the custGeom node. The custGeom node further comprises sub-nodes such as pathlst, cxnlst, gdlst and avlst, which are respectively used for storing related data of the custom graph.
Correspondingly, if the document to be processed is a second type presentation document, the graphic data to be processed can be obtained according to the storage format of the presentation document in pptx format for the graphic data. Specifically, first, document analysis can be performed on the second document to be processed to obtain an analysis file. The analysis process of the second document to be processed mainly comprises file decompression and xml analysis. It should be noted that when the number of slides is large, the data size is relatively large, so that a flexible and efficient parsing method can be adopted in the file decompression process. For example, a 50-page text-to-text mixed presentation has two to three hundred files in a compressed package. At this time, all documents are not required to be decompressed to the memory, and the parsed files are read as required. After the analysis files are obtained, the file style dependency relationship between the target analysis files can be determined according to the dependency relationship files of the analysis files. It will be appreciated that each slide in the pptx format presentation document has a dependency file in addition to the underlying data itself. The top page slide file in the document is illustratively ppt/slips/slip 1.Xml. The dependency file of the top page slide in the document is ppt/slides/_rels/slide1.Xml. Rels. Therefore, the file style dependency relationship between the target analysis files can be determined according to the dependency relationship files obtained by analysis. The target resolution file may be a slide, a template, and a master. Specifically, a template (slidelayout) on which the current slide depends can be found through a dependency file slider xml. Rels of the top page slide, a master (SLIDEMASTER) pointed by the template is found through a dependency file slider layout1.Xml. Rels of the template, information of the master is read, and three groups of data of slide, slidelayout and SLIDEMASTER are summarized finally. File style dependencies exist between slide, slidelayout and SLIDEMASTER: slide-template-master. Correspondingly, after the file style dependency relationship between the target analysis files is obtained, the graph searching sequence can be determined according to the file style dependency relationship. That is, the graphic search order may be determined as: slide-template-master. And carrying out repeated-free graphic data searching on the graphic data included in the target analysis file according to the graphic searching sequence of the slide, the template and the mother plate, so as to obtain second graphic data to be processed.
According to the scheme, the graphic data to be processed are sequentially searched in the second document to be processed according to the determined graphic searching sequence, so that the searching efficiency of the graphic data can be improved, and the comprehensiveness of graphic searching is ensured.
It should be noted that, the above process of obtaining any type of graphics data to be processed in any type of document to be processed may be completed by a multi-format parser in the general graphics element conversion system.
S220, acquiring unified analysis format data of the graphic data to be processed.
The unified parsing format data may be graphic data obtained by defining graphic data to be processed by a general graphic element conversion system according to a predefined unified data definition format.
In order to realize efficient processing of graphics of the data to be processed, the universal graphics element conversion system may redefine the graphics data to be processed by using a predefined uniform data definition format after acquiring the graphics data to be processed, so as to acquire uniform parsing format data corresponding to the graphics data to be processed. Fig. 6 is a schematic diagram of a data structure of unified parsing format data according to an embodiment of the present application. In a specific example, as shown in fig. 6, the conversion of the unified data format of the graphics data to be processed may be completed by defining a unified data definition format formed by fields such as a graphics object, a graphics object attribute, a custom graphic, and a predefined graphic, so as to obtain unified parsing format data.
S230, judging whether the graphic data to be processed is of a first graphic type, if so, executing S240, otherwise, executing S250.
Wherein the first graphic type may be a predefined graphic type in the document to be processed.
S240, converting the graphic attribute data according to the unified analysis format data into the unified format graphic data.
It can be understood that, since the predefined graphics in the document to be processed are usually simple graphics shapes, and the original graphics data including specific data such as shapes and positions can be directly restored according to the unified parsing format data obtained from the graphics data to be processed. Therefore, if the first graphic type is included in the document to be processed, the graphic data to be processed of the first graphic type can be converted into the graphic data of the unified format directly according to the graphic attribute data of the unified parsing format data.
For example, for the to-be-processed graphic data of simple predefined graphics such as line segments, circles or rectangles, the to-be-processed graphic data can be directly converted into the corresponding to-be-processed graphic data according to the information such as the graphic attribute and the like included in the unified analysis format data converted from the read to-be-processed graphic data, so that the conversion efficiency of the to-be-processed graphic data is improved. Alternatively, the graphics data to be processed of the first graphics type may be understood as predefined graphics types as corresponding graphics data of a uniform format.
S250, determining the graphic data to be processed as a second graphic type, and determining datum point data of datum points in the unified analysis format data.
The second graphic type may be a graphic type customized in the document to be processed. The datum point data may be related data of datum points in the graph corresponding to the graph data to be processed, such as the number and the positions of the datum points, the connection mode among the datum points and the like.
It will be appreciated that since custom graphics in a document to be processed are typically relatively complex graphic shapes, such as multi-segment curves, irregular polygons, or curved polygons, etc. Graphics attribute data directly from unified parsing format data may not be converted into unified format graphics data. Therefore, in the embodiment of the present application, if it is determined that the graphics data to be processed is the second graphics type, the reference point data of the reference points in the unified parsing format data may be first determined.
And S260, determining the updating offset according to the graph attribute data of the unified analysis format data.
The update offset may be an offset of a new target position corresponding to the graphics shape corresponding to the graphics data to be processed after the data format conversion with respect to an original position in the document to be processed.
S270, determining target position coordinates of the datum point according to the updating offset.
The target position coordinates may be coordinates corresponding to a new target position corresponding to a graphics shape corresponding to the graphics data to be processed after data format conversion.
S280, converting the datum point data, the target position coordinates and the graphic attribute data into the graphic data in the unified format.
For most of complex graphics in the document to be processed, such as the graphics data to be processed corresponding to the second graphics type included in the document to be processed, the graphics data needs to be parsed into a custom graphics data type. Specifically, a plurality of reference points may be defined for the graphics shape corresponding to the graphics data to be processed, and the reference point data, such as the number and the position of the reference points, the connection mode between each reference point, and the like, may be obtained. The connection manner between the reference points may include various types, such as a straight line, a quadratic bezier curve, a cubic bezier curve, and a circular arc. Accordingly, after the datum point data is obtained, the updating offset of the new target position can be obtained according to the graph attribute data of the unified analysis format data, so that the new target position coordinate of the datum point can be calculated. The target position coordinate data of the new reference point may be stored in pathLst (drawn path) nodes in the unified parsing format data. After the datum point data and the target position coordinates corresponding to the datum point are obtained, the datum point data, the target position coordinates of the datum point and the graphic attribute data in the unified analysis format data can be converted into the unified format graphic data, so that the accuracy and the reliability of the conversion of the graphic data to be processed are ensured. Alternatively, the graphics data to be processed of the second graphics type may be corresponding to the graphics data of the unified format and may be understood as a custom graphics type.
Alternatively, the unified format graphic data including the predefined graphic type and the custom graphic type may be the JSON format graphic data.
And S290, outputting the uniform format graphic data by adopting a uniform data output format.
According to the technical scheme, different types of to-be-processed graphic data are acquired for different types of to-be-processed documents, and different conversion modes are adopted to convert the to-be-processed graphic data into the uniform format graphic data according to the types of the to-be-processed graphic data, so that the graphic data in different data formats can achieve a consistent graphic display effect, and the convenience of online application of the electronic document is improved.
In one example, fig. 7 is a block diagram of a graphics processing apparatus according to an embodiment of the present application, where the embodiment of the present application is applicable to a case where graphics in different data formats in the same type of electronic document are converted into graphics in a unified data format, where the apparatus is implemented by software and/or hardware, and is specifically configured in an electronic device. The electronic device may be a computer device or various terminal devices, etc.
A graphics processing apparatus 300 as shown in fig. 7, comprising: a graphics data to be processed acquisition module 310, a graphics data to be processed conversion module 320, and a unified format graphics data output module 330. Wherein,
A graphics data to be processed acquisition module 310, configured to acquire graphics data to be processed in a document to be processed;
A graphics data to be processed conversion module 320, configured to convert the graphics data to be processed into graphics data in a unified format; the uniform format graphic data is different from the data format of the graphic data to be processed;
And a unified format graphic data output module 330 for outputting the unified format graphic data in a unified data output format.
According to the embodiment of the application, the to-be-processed graphic data in the to-be-processed document is converted into the uniform format graphic data, and the uniform format graphic data obtained by conversion is output by adopting the uniform data output format, so that the problem that the graphic data processing process of different data formats is complex when the existing electronic document is applied online can be solved, the consistent graphic display effect of the graphic data in different data formats can be achieved, and the convenience of the electronic document on-line application is improved.
Optionally, the document to be processed includes a first document to be processed and/or a second document to be processed; the graphics data to be processed comprise first graphics data to be processed and/or second graphics data to be processed, and the data formats of the first graphics data to be processed and the second graphics data to be processed are different.
Optionally, the graphics data to be processed acquisition module 310 is specifically configured to: reading a top container in a document stream from a first document to be processed; acquiring a file list included in the top-level container; reading a file container according to the file list; reading a picture container according to a first parameter variable in the file container when the first parameter variable has a variable value; reading a graphic element container according to a second parameter variable in the picture container; and reading the graphic element container to acquire first graphic data to be processed.
Optionally, the graphics data to be processed acquisition module 310 is specifically configured to: reading a shape data container according to a third parameter variable in the graphic element container; and acquiring the graph shape type and the graph attribute data of the graph data to be processed according to the shape data container.
Optionally, the graphics data to be processed acquisition module 310 is further configured to: and determining that the first graphic data to be processed in the first document to be processed is empty under the condition that the variable value does not exist in the first parameter variable in the file container.
Optionally, the graphics data to be processed acquisition module 310 is specifically configured to: carrying out document analysis on the second document to be processed to obtain an analysis file; determining file style dependency relations among the target analysis files according to the dependency relation files of the analysis files; determining a graph searching sequence according to the file style dependency relationship; and searching the graphic data of the target analysis file according to the graphic search sequence to obtain second graphic data to be processed.
Optionally, the graphics data conversion module 320 to be processed is specifically configured to: acquiring unified analysis format data of the graphic data to be processed; and under the condition that the graphics data to be processed are determined to be the first graphics type, converting the graphics attribute data according to the unified analysis format data into the unified format graphics data.
Optionally, the graphics data conversion module 320 to be processed is specifically configured to: acquiring unified analysis format data of the graphic data to be processed; determining datum point data of datum points in the unified analysis format data under the condition that the graphic data to be processed is determined to be of a second graphic type; determining an updating offset according to the graph attribute data of the unified analysis format data; determining target position coordinates of the datum point according to the updating offset; and converting the datum point data, the target position coordinates and the graphic attribute data into the graphic data in the unified format.
Optionally, the first document to be processed is a first type demonstration document, and the data format of the graphic data to be processed is a binary format; the second to-be-processed document is a second type demonstration document, and the data format of the second to-be-processed graphic data is the data format of the OOXML standard.
The graphics processing device can execute the graphics processing method provided by any embodiment of the application, and has the corresponding functional modules and beneficial effects of the execution method. Technical details not described in detail in this embodiment may be referred to the graphics processing method provided in any embodiment of the present application.
Since the graphics processing apparatus described above is an apparatus capable of executing the graphics processing method in the embodiment of the present application, those skilled in the art will be able to understand the specific implementation of the graphics processing apparatus in the embodiment of the present application and various modifications thereof based on the graphics processing method described in the embodiment of the present application, so how the graphics processing apparatus implements the graphics processing method in the embodiment of the present application will not be described in detail herein. The apparatus used by those skilled in the art to implement the graphics processing method of the embodiments of the present application is within the scope of the present application.
In one example, the present application also provides an electronic device and a readable storage medium.
Fig. 8 is a schematic structural diagram of an electronic device for implementing a graphic processing method according to an embodiment of the present application. As shown in fig. 8, there is a block diagram of an electronic device of a graphic processing method according to an embodiment of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the applications described and/or claimed herein.
As shown in fig. 8, the electronic device includes: one or more processors 401, memory 402, and interfaces for connecting the components, including a high-speed interface and a low-speed interface. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions executing within the electronic device, including instructions stored in or on memory to display graphical information of the GUI on an external input/output device, such as a display device coupled to the interface. In other embodiments, multiple processors and/or multiple buses may be used, if desired, along with multiple memories and multiple memories. Also, multiple electronic devices may be connected, each providing a portion of the necessary operations (e.g., as a server array, a set of blade servers, or a multiprocessor system). One processor 401 is illustrated in fig. 8.
Memory 402 is a non-transitory computer readable storage medium provided by the present application. Wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to perform the graphics processing method provided by the present application. The non-transitory computer readable storage medium of the present application stores computer instructions for causing a computer to execute the graphics processing method provided by the present application.
The memory 402 is used as a non-transitory computer readable storage medium for storing non-transitory software programs, non-transitory computer-executable programs, and modules, such as program instructions/modules (e.g., the graphics data to be processed acquisition module 310, the graphics data to be processed conversion module 320, and the unified graphics data output module 330 shown in fig. 7) corresponding to a graphics processing method in an embodiment of the present application. The processor 401 executes various functional applications of the server and data processing, i.e., implements the graphics processing method in the above-described method embodiments, by running non-transitory software programs, instructions, and modules stored in the memory 402.
Memory 402 may include a storage program area that may store an operating system, at least one application program required for functionality, and a storage data area; the storage data area may store data created by use of an electronic device implementing the graphic processing method, and the like. In addition, memory 402 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory 402 may optionally include memory located remotely from processor 401, which may be connected to the electronic device implementing the graphics processing method via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device implementing the graphics processing method may further include: an input device 403 and an output device 404. The processor 401, memory 402, input device 403, and output device 404 may be connected by a bus or otherwise, for example in fig. 8.
The input device 403 may receive input numeric or character information and generate key signal inputs related to user settings and function control of an electronic device implementing the graphics processing method, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointer stick, one or more mouse buttons, a track ball, a joystick, etc. input devices. The output device 404 may include a display apparatus, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibration motors), among others. 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 implementations, the display device may be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASIC (application specific integrated circuit), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
These computing programs (also referred to as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented in a high-level procedural and/or object-oriented programming language, and/or in assembly/machine language. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, programmable Logic Devices (PLDs)) used to provide 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 used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here 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 a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the internet.
The computer system may include a client and a server. The client may be, but is not limited to, a smart phone, a notebook computer, a desktop computer, a tablet computer, a smart speaker, etc. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a server combined with a blockchain, or a cloud server for providing basic cloud computing services such as cloud computing, cloud service, cloud database, cloud storage and the like. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
According to the embodiment of the application, the to-be-processed graphic data in the to-be-processed document is converted into the uniform format graphic data, and the uniform format graphic data obtained by conversion is output by adopting the uniform data output format, so that the problem that the graphic data processing process of different data formats is complex when the existing electronic document is applied online can be solved, the consistent graphic display effect of the graphic data in different data formats can be achieved, and the convenience of the electronic document on-line application is improved.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present application may be performed in parallel, sequentially, or in a different order, provided that the desired results of the disclosed embodiments are achieved, and are not limited herein.
The above embodiments do not limit the scope of the present application. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application should be included in the scope of the present application.

Claims (16)

1. A graphics processing method, comprising:
obtaining graphic data to be processed in a document to be processed;
converting the graphic data to be processed into graphic data in a unified format; the uniform format graphic data is different from the data format of the graphic data to be processed;
outputting the uniform format graphic data by adopting a uniform data output format;
the obtaining the graphics data to be processed in the document to be processed comprises the following steps:
reading a top container in a document stream from a first document to be processed;
Acquiring a file list included in the top-level container;
reading a file container according to the file list;
Reading a picture container according to a first parameter variable in the file container when the first parameter variable has a variable value;
Reading a graphic element container according to a second parameter variable in the picture container;
Reading the graphic element container to obtain first graphic data to be processed;
Wherein said reading said graphic element container comprises:
Reading a shape data container according to a third parameter variable in the graphic element container;
And acquiring the graph shape type and the graph attribute data of the graph data to be processed according to the shape data container.
2. The method of claim 1, wherein the document to be processed comprises a first document to be processed and/or a second document to be processed; the graphics data to be processed comprise first graphics data to be processed and/or second graphics data to be processed, and the data formats of the first graphics data to be processed and the second graphics data to be processed are different.
3. The method of claim 1, further comprising:
And determining that the first graphic data to be processed in the first document to be processed is empty under the condition that the variable value does not exist in the first parameter variable in the file container.
4. The method of claim 1, wherein the obtaining graphics data to be processed in the document to be processed further comprises:
Carrying out document analysis on the second document to be processed to obtain an analysis file;
Determining file style dependency relations among the target analysis files according to the dependency relation files of the analysis files;
determining a graph searching sequence according to the file style dependency relationship;
and searching the graphic data of the target analysis file according to the graphic search sequence to obtain second graphic data to be processed.
5. The method of claim 1, wherein the converting the graphics data to be processed into uniform format graphics data comprises:
Acquiring unified analysis format data of the graphic data to be processed;
And under the condition that the graphics data to be processed are determined to be the first graphics type, converting the graphics attribute data according to the unified analysis format data into the unified format graphics data.
6. The method of claim 1, wherein the converting the graphics data to be processed into uniform format graphics data comprises:
Acquiring unified analysis format data of the graphic data to be processed;
determining datum point data of datum points in the unified analysis format data under the condition that the graphic data to be processed is determined to be of a second graphic type;
Determining an updating offset according to the graph attribute data of the unified analysis format data;
Determining target position coordinates of the datum point according to the updating offset;
And converting the datum point data, the target position coordinates and the graphic attribute data into the graphic data in the unified format.
7. The method of claim 2, wherein the first document to be processed is a first type of presentation document, and the data format of the graphics data to be processed is a binary format; the second to-be-processed document is a second type demonstration document, and the data format of the second to-be-processed graphic data is the data format of the OOXML standard.
8. A graphics processing apparatus, comprising:
the graphics data acquisition module is used for acquiring graphics data to be processed in the document to be processed;
The graphics data conversion module to be processed is used for converting the graphics data to be processed into the graphics data with the uniform format; the uniform format graphic data is different from the data format of the graphic data to be processed;
The unified format graphic data output module is used for outputting the unified format graphic data by adopting a unified data output format;
The graphics data acquisition module to be processed is specifically configured to:
reading a top container in a document stream from a first document to be processed;
Acquiring a file list included in the top-level container;
reading a file container according to the file list;
Reading a picture container according to a first parameter variable in the file container when the first parameter variable has a variable value;
Reading a graphic element container according to a second parameter variable in the picture container;
Reading the graphic element container to obtain first graphic data to be processed;
The graphics data acquisition module to be processed is specifically configured to: reading a shape data container according to a third parameter variable in the graphic element container;
And acquiring the graph shape type and the graph attribute data of the graph data to be processed according to the shape data container.
9. The apparatus of claim 8, wherein the document to be processed comprises a first document to be processed and/or a second document to be processed; the graphics data to be processed comprise first graphics data to be processed and/or second graphics data to be processed, and the data formats of the first graphics data to be processed and the second graphics data to be processed are different.
10. The apparatus of claim 8, wherein the graphics data to be processed acquisition module is further to:
And determining that the first graphic data to be processed in the first document to be processed is empty under the condition that the variable value does not exist in the first parameter variable in the file container.
11. The apparatus of claim 8, wherein the graphics data to be processed acquisition module is specifically configured to:
Carrying out document analysis on the second document to be processed to obtain an analysis file;
Determining file style dependency relations among the target analysis files according to the dependency relation files of the analysis files;
determining a graph searching sequence according to the file style dependency relationship;
and searching the graphic data of the target analysis file according to the graphic search sequence to obtain second graphic data to be processed.
12. The apparatus of claim 8, wherein the graphics data to be processed conversion module is specifically configured to:
Acquiring unified analysis format data of the graphic data to be processed;
And under the condition that the graphics data to be processed are determined to be the first graphics type, converting the graphics attribute data according to the unified analysis format data into the unified format graphics data.
13. The apparatus of claim 8, wherein the graphics data to be processed conversion module is specifically configured to:
Acquiring unified analysis format data of the graphic data to be processed;
determining datum point data of datum points in the unified analysis format data under the condition that the graphic data to be processed is determined to be of a second graphic type;
Determining an updating offset according to the graph attribute data of the unified analysis format data;
Determining target position coordinates of the datum point according to the updating offset;
And converting the datum point data, the target position coordinates and the graphic attribute data into the graphic data in the unified format.
14. The apparatus of claim 9, wherein the first document to be processed is a first type of presentation document, and the data format of the graphics data to be processed is a binary format; the second to-be-processed document is a second type demonstration document, and the data format of the second to-be-processed graphic data is the data format of the OOXML standard.
15. An electronic device, comprising:
At least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the graphics processing method of any one of claims 1-7.
16. A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the graphics processing method of any one of claims 1-7.
CN202011437439.2A 2020-12-07 2020-12-07 Graphic processing method, device, electronic equipment and storage medium Active CN112527734B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011437439.2A CN112527734B (en) 2020-12-07 2020-12-07 Graphic processing method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011437439.2A CN112527734B (en) 2020-12-07 2020-12-07 Graphic processing method, device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112527734A CN112527734A (en) 2021-03-19
CN112527734B true CN112527734B (en) 2024-06-28

Family

ID=74999426

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011437439.2A Active CN112527734B (en) 2020-12-07 2020-12-07 Graphic processing method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112527734B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107004286A (en) * 2014-12-01 2017-08-01 株式会社理光 Image processing apparatus, image processing method and computer-readable recording medium
CN107515845A (en) * 2017-08-25 2017-12-26 闫健 A kind of conversion of interactive virtual teaching aid and implementation method based on file content identification

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102005052056A1 (en) * 2005-10-31 2007-05-03 Advanced Micro Devices, Inc., Sunnyvale Graphic data analysis and visualizing system, has graphic module embedding graphics into exportable electronic document and associating graphics with hyperlink information that is embedded in electronic document
US10042820B2 (en) * 2015-07-31 2018-08-07 Konica Minolta Laboratory U.S.A., Inc. Method for converting OOXML formatted spreadsheets to HTML for web presentation
US11449665B2 (en) * 2019-03-15 2022-09-20 Accusoft Corporation Methods and apparatus for supporting the display and editing of OOXML document content using a web browser
CN111191422B (en) * 2019-12-31 2023-09-05 湖南中联重科智能技术有限公司 File format conversion method, device and computer readable storage medium
CN111581948B (en) * 2020-04-03 2024-02-09 北京百度网讯科技有限公司 Document analysis method, device, equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107004286A (en) * 2014-12-01 2017-08-01 株式会社理光 Image processing apparatus, image processing method and computer-readable recording medium
CN107515845A (en) * 2017-08-25 2017-12-26 闫健 A kind of conversion of interactive virtual teaching aid and implementation method based on file content identification

Also Published As

Publication number Publication date
CN112527734A (en) 2021-03-19

Similar Documents

Publication Publication Date Title
WO2020119485A1 (en) Page display method and device, apparatus, and storage medium
WO2018077085A1 (en) Application processing method, device and storage medium
CN110968601A (en) Data query processing method and device
US11677807B2 (en) System and method to standardize and improve implementation efficiency of user interface content
CN109471626B (en) Page logic structure, page generation method, page data processing method and device
CN112506854B (en) Page template file storage and page generation methods, devices, equipment and media
US10304225B2 (en) Chart-type agnostic scene graph for defining a chart
CN113448562B (en) Automatic logic code generation method and device and electronic equipment
CN113419789A (en) Method and device for generating data model script
CN116028028A (en) Request function generation method, device, equipment and storage medium
RU2679971C2 (en) Implementation of access to semantic content in development system
CN111026916B (en) Text description conversion method and device, electronic equipment and storage medium
CN108780443B (en) Intuitive selection of digital stroke groups
US11086498B2 (en) Server-side chart layout for interactive web application charts
CN111488144B (en) Data processing method and device
CN112527734B (en) Graphic processing method, device, electronic equipment and storage medium
CN115756452A (en) Target page code generation method, device, storage medium and program product
CN113094286A (en) Page testing method and device, storage medium and electronic equipment
US10761719B2 (en) User interface code generation based on free-hand input
US20200394152A1 (en) Digital design application plugin for content updates and delivery
CN111104409A (en) Database processing method and device, storage medium and electronic equipment
CN112882698A (en) Development environment generation method and device, computer storage medium and electronic device
CN113961242B (en) Method and device for converting layout file, electronic equipment and storage medium
US20230214093A1 (en) Paging content for user interface display
US20240126577A1 (en) Visualization of application capabilities

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant