CN115640789A - Slide processing method and device, electronic equipment and storage medium - Google Patents

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

Info

Publication number
CN115640789A
CN115640789A CN202211221966.9A CN202211221966A CN115640789A CN 115640789 A CN115640789 A CN 115640789A CN 202211221966 A CN202211221966 A CN 202211221966A CN 115640789 A CN115640789 A CN 115640789A
Authority
CN
China
Prior art keywords
diagram
item
edited
determining
graphic
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.)
Pending
Application number
CN202211221966.9A
Other languages
Chinese (zh)
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 Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Wuhan Kingsoft Office Software Co Ltd
Original Assignee
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Wuhan Kingsoft Office Software 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 Kingsoft Office Software Inc, Zhuhai Kingsoft Office Software Co Ltd, Wuhan Kingsoft Office Software Co Ltd filed Critical Beijing Kingsoft Office Software Inc
Priority to CN202211221966.9A priority Critical patent/CN115640789A/en
Publication of CN115640789A publication Critical patent/CN115640789A/en
Pending legal-status Critical Current

Links

Images

Abstract

The embodiment of the invention provides a method and a device for processing a slide, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a slide to be processed, and determining a diagram to be edited in the slide to be processed; determining a target diagram item in the diagram to be edited; editing the target diagram item to obtain an edited diagram in the slide to be processed; and carrying out graph layout on the edited graph to obtain the target graph in the slide to be processed. Therefore, the automatic editing of the graphic in the slide can be realized, the manual operation is avoided, the operation is simplified, and the editing efficiency is improved.

Description

Slide processing method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for processing a slide, an electronic device, and a storage medium.
Background
A presentation includes a plurality of pages, each page being a slide, for presenting static content (e.g., text, pictures) and dynamic content (e.g., video, audio). With the widespread use of presentations, there is a need for a producer to edit the illustrations in the slides, for example, involving adding or deleting illustration items of the illustrations in the slides, when making the presentation, since the illustrations in the slides do not conform to the intended effect.
In the related art, for the addition or deletion of the pictorial items shown in the slide, the pictorial items are manually selected, and the pictorial items are copied or deleted, and after the pictorial items shown in the slide are added or deleted, the pictorial items are manually rearranged to achieve a better visual effect. In this way, manual operation is required and the operation is cumbersome to edit the diagrams in the slide, resulting in low editing efficiency.
Disclosure of Invention
In order to solve the technical problems that manual operation is needed and the operation is complicated to edit the icons in the slides, which results in low editing efficiency, embodiments of the present invention provide a slide processing method, an apparatus, an electronic device, and a storage medium. The specific technical scheme is as follows:
in a first aspect of the embodiments of the present invention, there is provided a method for processing a slide, where the method includes:
acquiring a slide to be processed, and determining a diagram to be edited in the slide to be processed;
determining a target diagram item in the diagram to be edited;
editing the target diagram item to obtain an edited diagram in the slide to be processed;
and carrying out graph layout on the edited graph to obtain the target graph in the slide to be processed.
In an optional embodiment, the determining a target pictorial item in the diagram to be edited includes:
determining a diagram representation item to be duplicated in the diagram to be edited;
the editing the target diagram item to obtain the edited diagram in the slide to be processed comprises:
executing the following processing on the slide show item to be processed to obtain an edited diagram in the slide show to be processed:
acquiring an extended graphic item of the graphic to be edited according to the graphic item to be edited;
acquiring a first section number text shape in the first shape of the extended illustration item and a second section number text shape in the second shape of the first illustration item of the diagram to be edited;
updating a first text in the first section number text shape according to a second text in the second section number text shape;
determining the rest text shapes except the first section number text shape in the first shape, and setting the rest text shapes as placeholder shapes.
In an optional embodiment, the determining the to-be-repeated graphic item in the to-be-edited graphic includes:
determining a diagram item structure of a first diagram item in the diagram to be edited, and grouping the first diagram item according to the diagram item structure;
determining a determination strategy of the diagram items to be duplicated in the diagram to be edited according to the grouping quantity of the first diagram items;
and determining the graph items to be duplicated in the graph to be edited through the determination strategy.
In an optional embodiment, the determining a diagram item structure of a first diagram item in the diagram to be edited includes:
acquiring first coordinates of a second shape in a first diagram item of the diagram to be edited, wherein the first coordinates comprise vertex coordinates of a circumscribed rectangle of the second shape;
and determining a structure matrix corresponding to the first diagram item based on the first coordinate, and characterizing the diagram item structure of the first diagram item in the diagram to be edited by using the structure matrix.
In an optional embodiment, the determining, based on the first coordinate, a structural matrix corresponding to the first illustration item includes:
sorting the X-axis coordinate values in the first coordinates, sorting the Y-axis coordinate values in the first coordinates,
replacing the X-axis coordinate value with a first sequential value corresponding to the X-axis coordinate value, and replacing the Y-axis coordinate value with a second sequential value corresponding to the Y-axis coordinate value to obtain a matrix coordinate of the first coordinate;
selecting a maximum first sequence value from the first sequence values, and selecting a maximum second sequence value from the second sequence values;
constructing an empty matrix of M x N according to the maximum first sequential value and the maximum second sequential value, wherein N comprises the maximum first sequential value, and M comprises the maximum second sequential value;
determining a shape serial number of the second shape corresponding to the first coordinate in the first representation item;
and replacing matrix elements in the empty matrix corresponding to the matrix coordinate of the first coordinate with the shape sequence number to obtain a structural matrix corresponding to the first diagram item.
In an alternative embodiment, said grouping said first pictorial item according to said pictorial item structure comprises:
dividing the first diagram entries having the same structural matrix into a group.
In an optional embodiment, the determining a strategy for determining the to-be-copied diagram item in the to-be-edited diagram according to the grouping number of the first diagram item includes:
under the condition that the first diagram items are divided into one group or three groups or more, determining a first determination strategy of diagram items to be replicated in the diagram to be edited;
the determining, by the determination policy, to-be-duplicated diagram items in the diagram to be edited includes:
determining the parity condition of the expansion representation items in the diagram to be edited based on the first determination strategy, wherein the parity condition represents that the expansion representation items belong to odd-numbered items or even-numbered items;
and determining the graph items to be duplicated in the graph to be edited in a reverse order according to the parity condition of the expanded graph items.
In an optional embodiment, the determining, in reverse order, the to-be-edited graph items in the to-be-edited graph according to the parity of the extended graph items includes:
in the case that the odd-even condition represents that the expansion diagram item belongs to an odd item, determining a first diagram item of a first odd item in the diagram to be edited in a reverse order;
determining a first diagram item of a first odd-numbered item as a diagram item to be duplicated in the diagram to be edited;
in the case that the parity condition represents that the extension diagram item belongs to an even number item, determining a first diagram item of a first even number item in the diagram to be edited in a reverse order;
and determining the first diagram item of the first even item as a diagram item to be duplicated in the diagram to be edited.
In an optional embodiment, the determining, according to the number of groups of the first diagram item, a determination policy for determining a diagram item to be duplicated in the diagram to be edited includes:
under the condition that the first diagram items are divided into two groups, determining a second determination strategy of the diagram items to be duplicated in the diagram to be edited;
the determining, by the determination policy, a drawing item to be edited in the drawing to be edited includes:
determining grouping conditions of the first diagram items in the diagram to be edited based on the second determination strategy;
and determining the diagram items to be duplicated in the diagram to be edited according to the grouping condition of the first diagram items.
In an optional embodiment, the determining a target pictorial item in the diagram to be edited includes:
determining a to-be-deleted pictorial item in the to-be-edited pictorial;
the editing the target diagram item to obtain an edited diagram in the slide to be processed includes:
and executing a deleting instruction on the diagram item to be deleted to obtain an edited diagram in the slide to be processed.
In an optional embodiment, the determining the illustration item to be deleted in the illustration to be edited includes:
acquiring the sequence number of a diagram item of a first diagram item in the diagram to be edited, and determining the first diagram item with the largest sequence number of the diagram item;
and determining the first diagram item with the largest sequence number of the diagram items as the diagram items to be deleted in the diagram to be edited.
In an optional embodiment, before the graphic layout is performed on the edited graphic and the target graphic in the slide to be processed is obtained, the method further includes:
determining a scale of a third shape in the edited graphical second representation item;
acquiring second coordinates of the third shape, wherein the second coordinates comprise vertex coordinates of a circumscribed rectangle of the third shape;
and scaling the second coordinate, the width and the height of the third shape and the font size of the third text in the third shape by utilizing the scaling ratio.
In an alternative embodiment, the determining a scale of the third shape in the edited graphical second representation item includes:
acquiring the number of first pictorial items of a first pictorial item in the diagram to be edited, and acquiring the number of second pictorial items of a second pictorial item in the diagram after the diagram is edited;
and acquiring the quotient of the first graphic item quantity and the second graphic item quantity, and determining the arithmetic square root of the quotient as the scaling of the third shape in the edited graphic second item.
In an optional embodiment, the performing the graphic layout on the edited graphic to obtain the target graphic in the slide to be processed includes:
identifying the typesetting mode of a first diagram item in the diagram to be edited;
typesetting the extension diagram items in the edited diagram according to the typesetting mode to obtain an initial typesetting diagram in the slide to be processed;
and carrying out graphic layout on the initially laid-out graphic according to a visual gravity center coincidence algorithm to obtain a target graphic in the slide to be processed.
In an optional embodiment, the identifying the layout mode of the first diagram item in the diagram to be edited includes:
dividing a first graphic item in the graphic diagram to be edited into N groups according to the graphic item serial number of the first graphic item in the graphic diagram to be edited, wherein N =2,3, \8230;, N is the same as the number of the first graphic items of the first graphic item;
for the n groups of any one of the division cases, the following processing is performed:
acquiring third coordinates of the second shape in each group of first illustration items, wherein the third coordinates comprise vertex coordinates of a circumscribed rectangle of the second shape;
determining a first difference value between X-axis coordinate values in adjacent third coordinates and a second difference value between Y-axis coordinate values in adjacent third coordinates;
acquiring fourth coordinates of a first circumscribed rectangle formed by each group of first graphic items, wherein the fourth coordinates comprise vertex coordinates of the first circumscribed rectangle;
determining a third difference value between the coordinate values of the X axis in the adjacent fourth coordinates and a fourth difference value between the coordinate values of the Y axis in the adjacent fourth coordinates;
and under the condition that the variance of the first difference value and the second difference value is smaller than a variance threshold value, and the variance of the third difference value and the fourth difference value is smaller than a variance threshold value, determining that the first graph item in the graph to be edited is in linear typesetting.
In an optional embodiment, the typesetting, according to the typesetting manner, the extended diagram items in the edited diagram to obtain a first-typeset diagram in the slide to be processed includes:
acquiring a fifth coordinate, wherein the fifth coordinate comprises a vertex coordinate of a circumscribed rectangle of the first pictorial item in the last group of the n groups;
adjusting the fifth coordinate according to the first difference and the second difference, or the third difference and the fourth difference to obtain a sixth coordinate;
acquiring a seventh coordinate of a second circumscribed rectangle formed by the extended pictorial item, wherein the seventh coordinate comprises a vertex coordinate of the second circumscribed rectangle;
and adjusting the seventh coordinate to the sixth coordinate to obtain the initially laid type diagram in the slide to be processed.
In an optional embodiment, the identifying the layout mode of the first diagram item in the diagram to be edited includes:
determining a straight line formed by the center points of circumscribed rectangles of adjacent first diagram items in the diagram to be edited;
determining the perpendicular bisectors of all the straight lines, and judging whether the perpendicular bisectors of all the straight lines intersect;
under the condition that the perpendicular bisectors of all the straight lines are intersected, judging whether the distances between the intersection points of the perpendicular bisectors of all the straight lines and all the central points are equal or not;
and under the condition that the distances between the intersection points and all the central points are equal, determining that the first diagram item in the diagram to be edited is the radial typesetting.
In an optional embodiment, the typesetting, according to the typesetting manner, the extended diagram items in the edited diagram to obtain a first-typeset diagram in the slide to be processed includes:
acquiring an included angle formed by a central point of a circumscribed rectangle of an adjacent first pictorial item in the pictorial to be edited and the intersection point;
and adjusting the expansion diagram items according to the included angle and the distance to obtain the initial typesetting diagram in the slide to be processed.
In an optional embodiment, the performing the graphic layout on the edited graphic representation to obtain the target graphic representation in the slide to be processed includes:
acquiring a preset typesetting mode;
typesetting the edited graphic representation by using the preset typesetting mode to obtain an initial typesetting graphic representation in the slide to be processed;
and carrying out graphic layout on the initially laid-out graphic diagram according to a visual gravity center coincidence algorithm to obtain a target graphic diagram in the slide to be processed.
In an optional embodiment, the graphic layout of the initially laid-out graphic representation according to a visual barycenter coincidence algorithm to obtain a target graphic representation in the slide to be processed includes:
determining an original visual gravity center of the diagram to be edited;
and adjusting the target visual gravity center of the initially laid-out graphic representation so as to enable the target visual gravity center to coincide with the original visual gravity center, and obtaining the target graphic representation in the slide to be processed.
In an optional embodiment, the determining an original visual center of gravity of the diagram to be edited includes:
determining an original central point of the circumscribed rectangle of the diagram to be edited, and searching a position extending upwards by a preset distance in the vertical direction of the original central point;
and determining the position as the original visual gravity center of the diagram to be edited.
In an optional embodiment, the adjusting the target visual center of gravity of the initially laid-out drawing so that the target visual center of gravity coincides with the original visual center of gravity to obtain the target drawing in the slide to be processed includes:
determining the area of a fourth shape in a third graphic item of the initial layout drawing, and determining barycentric coordinates of the fourth shape in the third graphic item according to the original visual barycenter and the area;
and adjusting a fourth shape in the third graphic item according to the barycentric coordinate to obtain a target graphic in the slide to be processed.
In an optional embodiment, after obtaining the target icon in the slide to be processed, the method further includes:
determining a diagram typesetting area in the slide to be processed and a third circumscribed rectangle formed by the target diagram;
and under the condition that the third circumscribed rectangle does not exceed the diagram typesetting area, displaying a target diagram in the slide to be processed.
In an optional embodiment, the method further comprises:
under the condition that the third circumscribed rectangle exceeds the graphic layout area, determining the proportion of the third circumscribed rectangle exceeding the graphic layout area;
and zooming the target graphic representation according to the proportion, determining the scaled target graphic representation as a primary typesetting graphic representation, and jumping to the step of adjusting the target visual barycenter of the primary typesetting graphic representation so as to enable the target visual barycenter to coincide with the original visual barycenter to obtain the target graphic representation in the slide to be processed.
In an optional embodiment, the determining the illustration typesetting area in the slide to be processed includes:
removing the edited graphic from the slide to be processed to obtain a target slide, and rendering the target slide to obtain a background image;
rasterizing the background image to obtain a raster image, and determining a diagram color corresponding to the edited diagram;
determining an original circumscribed rectangle corresponding to the edited graphic, and expanding outwards according to the grid of the grid image on the basis of the original circumscribed rectangle;
determining similarity between the color in the target grid of the grid image and the background color of the original circumscribed rectangle;
stopping expanding under the condition that the similarity is smaller than a preset similarity threshold value and the color in the target grid of the grid image is in conflict with the color of the diagram to obtain an initial layout area of the diagram;
and cutting areas of non-illustrated text shapes, table shapes and diagram shapes from the illustrated initial typesetting area to obtain an illustrated typesetting area.
In an optional embodiment, the determining the color of the diagram corresponding to the edited diagram includes:
acquiring a target text shape in the diagram item of the diagram after the diagram is edited, and determining the text color of the text in the target text shape as the diagram color corresponding to the diagram after the diagram is edited;
alternatively, the first and second electrodes may be,
acquiring a graph shape in a second graphic item of the edited graphic, and determining the proportion of graph colors in the graph shape;
and determining the color of the graph with the proportion exceeding a preset proportion threshold value as the color of the graph corresponding to the edited graph.
In an optional embodiment, in a case that the similarity is smaller than a preset similarity threshold and the color in the target grid of the grid image conflicts with the color of the illustration, the method further includes, before obtaining the initial layout area of the illustration:
converting colors in a target grid of the grid image into a first gray value, and converting the graphic colors into a second gray value;
and determining that the color in the target grid of the grid image conflicts with the color of the graph under the condition that the first gray value and the second gray value are in the same gray interval.
In a second aspect of the embodiments of the present invention, there is also provided a slide processing apparatus, including:
the slide acquisition module is used for acquiring a slide to be processed;
the diagram determining module is used for determining a diagram to be edited in the slide to be processed;
the diagram item determining module is used for determining a target diagram item in the diagram to be edited;
the graphic item editing module is used for editing the target graphic item to obtain an edited graphic in the slide to be processed;
and the graphic layout module is used for carrying out graphic layout on the edited graphic to obtain the target graphic in the slide to be processed.
In an alternative embodiment, the pictorial item determination module includes:
a to-be-duplicated diagram item determining submodule, configured to determine to-be-duplicated diagram items in the diagram to be edited;
the pictorial item editing module is specifically configured to:
executing the following processing on the slide show item to be processed to obtain an edited diagram in the slide show to be processed:
acquiring an extended graphic item of the graphic to be edited according to the graphic item to be edited;
acquiring a first section number text shape in the first shape of the extended illustration item and a second section number text shape in the second shape of the to-be-edited illustration first illustration item;
updating a first text in the first section number text shape according to a second text in the second section number text shape;
determining the rest text shapes except the first section number text shape in the first shape, and setting the rest text shapes as placeholder shapes.
In an alternative embodiment, the to-be-repeated representation item determination sub-module includes:
the diagram item structure determining unit is used for determining the diagram item structure of a first diagram item in the diagram to be edited;
a pictorial item grouping unit operable to group the first pictorial item according to the pictorial item structure;
the strategy determining unit is used for determining a determining strategy of the graph items to be duplicated in the graph to be edited according to the grouping quantity of the first graph items;
and the to-be-duplicated drawing item determining unit is used for determining the to-be-duplicated drawing items in the to-be-edited drawing through the determining strategy.
In an optional embodiment, the pictorial item structure determining unit specifically includes:
a first coordinate obtaining subunit, configured to obtain first coordinates of a second shape in a first diagram item of the diagram to be edited, where the first coordinates include vertex coordinates of a circumscribed rectangle of the second shape;
and the structure matrix determining subunit is configured to determine, based on the first coordinate, a structure matrix corresponding to the first diagram item, and characterize the diagram item structure of the first diagram item in the diagram to be edited by using the structure matrix.
In an optional embodiment, the structural matrix determining subunit is specifically configured to:
sorting the X-axis coordinate values in the first coordinates, and sorting the Y-axis coordinate values in the first coordinates;
replacing the X-axis coordinate values with first sequential values corresponding to the X-axis coordinate values, and replacing the Y-axis coordinate values with second sequential values corresponding to the Y-axis coordinate values to obtain matrix coordinates of the first coordinates;
selecting a maximum first sequence value from the first sequence values, and selecting a maximum second sequence value from the second sequence values;
constructing an empty matrix of M x N according to the maximum first sequential value and the maximum second sequential value, wherein N comprises the maximum first sequential value, and M comprises the maximum second sequential value;
determining a shape serial number of the second shape corresponding to the first coordinate in the first representation item;
and replacing matrix elements in the empty matrix corresponding to the matrix coordinate of the first coordinate with the shape sequence number to obtain a structural matrix corresponding to the first diagram item.
In an optional embodiment, the pictorial item grouping unit is specifically configured to:
dividing the first diagram entries having the same structural matrix into a group.
In an optional implementation manner, the policy determining unit is specifically configured to:
under the condition that the first diagram items are divided into one group or three groups or more, determining a first determination strategy of diagram items to be replicated in the diagram to be edited;
the to-be-repeated presentation item determining unit specifically comprises:
a parity condition determining subunit, configured to determine, based on the first determination policy, a parity condition of an extended representation item in the diagram to be edited, where the parity condition characterizes that the extended representation item belongs to an odd term or an even term;
and the to-be-duplicated diagram item determining subunit is used for determining the to-be-duplicated diagram items in the diagram to be edited in a reverse order according to the parity condition of the expansion diagram items.
In an alternative embodiment, the to-be-repeated presentation item determining subunit is specifically configured to:
if the odd-even condition indicates that the expansion diagram item belongs to odd items, determining a first diagram item of a first odd item in the diagram to be edited in a reverse order;
determining a first diagram item of a first odd item as a diagram item to be edited in the diagram to be edited;
if the parity condition represents that the expansion diagram item belongs to an even number item, determining a first diagram item of a first even number item in the diagram to be edited in a reverse order;
and determining the first diagram item of the first even item as a diagram item to be repeated in the diagram to be edited.
In an optional implementation manner, the policy determining unit is specifically configured to:
under the condition that the first diagram items are divided into two groups, determining a second determination strategy of the diagram items to be duplicated in the diagram to be edited;
the to-be-repeated presentation item determining unit is specifically configured to:
determining grouping conditions of the first diagram items in the diagram to be edited based on the second determination strategy;
and determining the diagram items to be duplicated in the diagram to be edited according to the grouping condition of the first diagram items.
In an alternative embodiment, the pictorial item determination module includes:
the to-be-deleted diagram item determining submodule is used for determining the to-be-deleted diagram item in the to-be-edited diagram;
the pictorial item editing module is specifically configured to:
and executing a deleting instruction on the diagram item to be deleted to obtain an edited diagram in the slide to be processed.
In an optional embodiment, the to-be-deleted diagram item determining sub-module is specifically configured to:
acquiring the sequence number of a diagram item of a first diagram item in the diagram to be edited, and determining the first diagram item with the largest sequence number of the diagram item;
and determining the first diagram item with the largest sequence number of the diagram items as the diagram item to be deleted in the diagram to be edited.
In an optional embodiment, the apparatus further comprises:
a scale determination module for determining a scale of a third shape in the edited second pictorial item;
a second coordinate obtaining module, configured to obtain a second coordinate of the third shape, where the second coordinate includes a vertex coordinate of a circumscribed rectangle of the third shape;
and the scaling module is used for scaling the second coordinate, the width and the height of the third shape and the font size of the third text in the third shape by using the scaling.
In an optional embodiment, the scaling module is specifically configured to:
acquiring the first number of the pictorial items of the first pictorial item in the pictorial to be edited and acquiring the second number of the pictorial items of the second pictorial item in the pictorial after being edited;
and acquiring the quotient of the first graphic item quantity and the second graphic item quantity, and determining the arithmetic square root of the quotient as the scale of the third shape in the edited graphic second item.
In an optional embodiment, the graphic layout module specifically includes:
the layout mode identification submodule is used for identifying the layout mode of a first diagram item in the diagram to be edited;
the layout sub-module of the graphic item is used for typesetting the extended graphic item in the edited graphic representation according to the typesetting mode to obtain an initial layout graphic representation in the slide to be processed;
and the graphic layout sub-module is used for carrying out graphic layout on the initially laid-out graphic according to a visual gravity center coincidence algorithm to obtain a target graphic in the slide to be processed.
In an optional embodiment, the layout style identification submodule is specifically configured to:
dividing a first graphic item in the graphic diagram to be edited into N groups according to the graphic item serial number of the first graphic item in the graphic diagram to be edited, wherein N =2,3, \8230;, N is the same as the number of the first graphic items of the first graphic item;
for the n groups of any one of the division cases, performing the following processing:
acquiring third coordinates of the second shape in each group of first representation items, wherein the third coordinates comprise vertex coordinates of a circumscribed rectangle of the second shape;
determining a first difference value between X-axis coordinate values in adjacent third coordinates and a second difference value between Y-axis coordinate values in adjacent third coordinates;
acquiring fourth coordinates of a first circumscribed rectangle formed by each group of first pictorial items, wherein the fourth coordinates comprise vertex coordinates of the first circumscribed rectangle;
determining a third difference value between the coordinate values of the X axis in the adjacent fourth coordinates and a fourth difference value between the coordinate values of the Y axis in the adjacent fourth coordinates;
and under the condition that the variance of the first difference value and the second difference value is smaller than a variance threshold value, and the variance of the third difference value and the fourth difference value is smaller than a variance threshold value, determining that the first graph item in the graph to be edited is in linear typesetting.
In an optional embodiment, the illustration item typesetting sub-module is specifically configured to:
acquiring a fifth coordinate, wherein the fifth coordinate comprises vertex coordinates of a circumscribed rectangle of the first pictorial item in the n groups of the last group;
adjusting the fifth coordinate according to the first difference and the second difference, or the third difference and the fourth difference to obtain a sixth coordinate;
acquiring a seventh coordinate of a second circumscribed rectangle formed by the extended pictorial item, wherein the seventh coordinate comprises a vertex coordinate of the second circumscribed rectangle;
and adjusting the seventh coordinate to the sixth coordinate to obtain the initial typesetting diagram in the slide to be processed.
In an optional embodiment, the layout style identification submodule is specifically configured to:
determining a straight line formed by the center points of circumscribed rectangles of adjacent first diagram items in the diagram to be edited;
determining the perpendicular bisectors of all the straight lines, and judging whether the perpendicular bisectors of all the straight lines intersect;
under the condition that the perpendicular bisectors of all the straight lines are intersected, judging whether the distances between the intersection points of the perpendicular bisectors of all the straight lines and all the central points are equal or not;
and under the condition that the distances between the intersection points and all the central points are equal, determining that the first diagram item in the diagram to be edited is the radial typesetting.
In an optional embodiment, the illustration item typesetting sub-module is specifically configured to:
acquiring an included angle formed by a central point of a circumscribed rectangle of an adjacent first pictorial item in the pictorial to be edited and the intersection point;
and adjusting the expansion diagram items according to the included angle and the distance to obtain the initial typesetting diagram in the slide to be processed.
In an optional embodiment, the diagram layout module specifically includes:
the typesetting mode acquisition submodule is used for acquiring a preset typesetting mode;
the graphic initial layout submodule is used for typesetting the edited graphic by utilizing the preset typesetting mode to obtain an initial layout graphic in the slide to be processed;
and the graphic layout sub-module is used for carrying out graphic layout on the initially laid-out graphic according to a visual gravity center coincidence algorithm to obtain a target graphic in the slide to be processed.
In an optional embodiment, the diagram layout sub-module specifically includes:
the gravity center determining unit is used for determining the original visual gravity center of the diagram to be edited;
and the gravity center adjusting unit is used for adjusting the target visual gravity center of the initially laid-out graphic representation so as to enable the target visual gravity center to coincide with the original visual gravity center, and the target graphic representation in the slide to be processed is obtained.
In an alternative embodiment, the center of gravity determining unit is specifically configured to:
determining an original central point of the circumscribed rectangle of the diagram to be edited, and searching a position extending upwards by a preset distance in the vertical direction of the original central point;
and determining the position as the original visual gravity center of the diagram to be edited.
In an optional embodiment, the center of gravity adjusting unit is specifically configured to:
determining the area of a fourth shape in a third graphic item of the initial layout drawing, and determining the barycentric coordinate of the fourth shape in the third graphic item according to the original visual barycenter and the area;
and adjusting a fourth shape in the third graphic item according to the barycentric coordinates to obtain a target graphic in the slide to be processed.
In an optional embodiment, the diagram layout sub-module further includes:
a layout area determining unit, configured to determine a diagram layout area in the slide to be processed and a third circumscribed rectangle formed by the target diagram;
and the graph display module is used for displaying the target graph in the slide to be processed under the condition that the third circumscribed rectangle does not exceed the graph typesetting area.
In an optional embodiment, the diagram layout sub-module further includes:
the proportion determining unit is used for determining the proportion of the third circumscribed rectangle exceeding the graphic layout area under the condition that the third circumscribed rectangle exceeds the graphic layout area;
and a graphic scaling unit, configured to scale the target graphic according to the scale, determine the scaled target graphic as an initial layout graphic, and skip to the step of adjusting the target visual center of gravity of the initial layout graphic so that the target visual center of gravity coincides with the original visual center of gravity, thereby obtaining the target graphic in the slide to be processed.
In an optional embodiment, the layout region determining unit specifically includes:
a slide rendering subunit, configured to remove the edited icon from the slide to be processed to obtain a target slide, and render the target slide to obtain a background image;
the rasterization subunit is used for performing rasterization processing on the background image to obtain a raster image;
the color determining subunit is used for determining the color of the diagram corresponding to the edited diagram;
the expansion subunit is configured to determine an original external rectangle corresponding to the edited icon, and expand the original external rectangle according to the grid of the grid image;
a similarity determining subunit, configured to determine a similarity between a color in a target grid of the grid image and a background color of the original circumscribed rectangle;
an expansion stopping subunit, configured to stop expansion to obtain an initial layout area of the icon when the similarity is smaller than a preset similarity threshold and a color in a target grid of the grid image conflicts with an icon color;
and the region cutting unit is used for cutting regions of non-illustrated text shapes, table shapes and diagram shapes from the initial illustration layout region to obtain an illustration layout region.
In an optional embodiment, the color determining subunit is specifically configured to:
acquiring a target text shape in the diagram item of the diagram after the diagram is edited, and determining the text color of the text in the target text shape as the diagram color corresponding to the diagram after the diagram is edited;
alternatively, the first and second liquid crystal display panels may be,
acquiring a graph shape in a second graph item of the edited graph, and determining the proportion of graph colors in the graph shape;
and determining the color of the graph with the ratio exceeding a preset ratio threshold value as the color of the graph corresponding to the edited graph.
In an optional embodiment, the layout region determining unit further includes:
a color conversion subunit, configured to convert a color in a target grid of the grid image into a first grayscale value, and convert the diagram color into a second grayscale value;
a color conflict determination subunit, configured to determine that a color in a target grid of the grid image conflicts with an illustration color when the first grayscale value and the second grayscale value are in a same grayscale interval.
In a third aspect of the embodiments of the present invention, there is further provided an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
a processor configured to implement the slide processing method according to any one of the first aspect described above when executing a program stored in a memory.
In a fourth aspect of the embodiments of the present invention, there is also provided a storage medium having instructions stored therein, which when run on a computer, cause the computer to perform the slide processing method according to any one of the first aspects.
In a fifth aspect of the embodiments of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the slide processing methods described above.
The technical scheme provided by the embodiment of the invention comprises the steps of obtaining a slide to be processed, determining a diagram to be edited in the slide to be processed, determining a target diagram item in the diagram to be edited, editing the target diagram item to obtain an edited diagram in the slide to be processed, and typesetting the edited diagram to obtain the target diagram in the slide to be processed. The target pictorial item of the pictorial to be edited in the slide to be processed is determined, the target pictorial item is edited to obtain the edited pictorial to be processed in the slide to be processed, and the pictorial layout is carried out on the edited pictorial to obtain the target pictorial in the slide to be processed, so that the pictorial to be processed in the slide can be automatically edited, manual operation is avoided, operation is simplified, and editing efficiency is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic flow chart illustrating an implementation of a slide processing method according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a target pictorial item in a diagram to be edited in accordance with an embodiment of the present invention;
FIG. 3 is a diagram illustrating an object in a slide to be processed according to an embodiment of the present invention;
fig. 4 is a schematic flow chart illustrating another implementation of a slide processing method according to an embodiment of the present invention;
fig. 5 is a schematic flow chart illustrating an implementation of a method for determining a representation item to be replicated according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating item partitioning in an editorial representation, according to an embodiment of the present invention;
FIG. 7 is a schematic flow chart illustrating an implementation of a method for determining an item structure according to an embodiment of the present invention;
FIG. 8 is a flow chart illustrating an implementation of another method for determining a structure of an item according to an embodiment of the present invention;
FIG. 9 is a schematic diagram illustrating an implementation flow of a graphical layout method according to an embodiment of the present invention;
fig. 10 is a schematic flow chart illustrating an implementation of a linear typesetting identification method according to an embodiment of the present invention;
FIG. 11 is a diagram illustrating a linear typesetting according to an embodiment of the invention;
fig. 12 is a schematic flow chart illustrating an implementation of a radiation typesetting identification method according to an embodiment of the present invention;
FIG. 13 is a schematic view of the intersection of perpendicular bisectors in an embodiment of the present invention;
FIG. 14 is a flowchart illustrating an implementation of a method for determining a layout area according to an embodiment of the present invention;
fig. 15 is a flowchart illustrating another slide processing method according to another embodiment of the present invention;
fig. 16 is a schematic configuration diagram of a slide processing apparatus shown in the embodiment of the present invention;
fig. 17 is a schematic structural diagram of an electronic device shown in the embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
First, the abbreviations and key terms involved in the embodiments of the present invention are explained:
the PPT diagram refers to a text graphic schematic, namely, logic and auxiliary communication are expressed through intuitively understandable graphs. The diagram in PPT is one of the main differences between the designers PPT and Word.
The PPT diagram item refers to a group formed by shape polymerization in the PPT diagram, and one diagram is formed by at least two diagram items.
The PPT graphic typesetting refers to the position of a PPT graphic item on PPT, so that a reader can experience an excellent visual effect, and the standard of the excellent effect in the invention is visual gravity center balance.
The PPT shapes refer to basic elements forming PPT demonstration, and are mainly classified into the following types according to functions:
text shapes refer to elements of a slide where a user can enter text. The viewer may obtain the author's expression directly from the textual content. It is used in the figures as a title, description, figure item number, etc.
Picture shapes, which refer to picture elements in a slide, are typically used as a background or to guide the schematic information in conjunction with text. Which in the illustration is generally a solid decoration.
The figure shape refers to a figure formed by combining line segments, rectangles, circles and the like in the slide into a geometric figure. Used as icons of different sizes in the slides. Which in the illustration is generally an item decoration.
The shape attribute refers to basic information of a shape in the PPT, and the attribute used in the embodiment of the present invention includes: shape type, text, position, size, circumscribed rectangle, whether visible or not. The above attributes can be obtained through a secondary development interface of the WPS Office VBA or the Microsoft Office VBA.
The visual balance is the visual force balance taking the visual gravity center as a fulcrum. The visual centre of gravity of a figure is e.g. 5% higher than its geometric centre, forces similar to those of a physical field exist between the elements in the visual field (or the feeling of existence of forces), and the forces generated in the visual field are different for different shapes of symbols, different colours, different grids, different sizes, different positions.
As shown in fig. 1, an implementation flow diagram of a slide processing method provided in an embodiment of the present invention is applied to an electronic device, and the method may specifically include the following steps:
s101, obtaining a slide to be processed, and determining a diagram to be edited in the slide to be processed.
In the embodiment of the present invention, when the user switches to the current slide, the current slide may be determined as the slide to be processed, so that the slide to be processed may be obtained, and the to-be-edited icon in the slide to be processed may be determined, so as to add or delete the icon item to the to-be-edited icon through subsequent processing.
The graphic representations in the slide to be processed may be marked, so that for the determination of the graphic representations to be edited, the marked graphic representations in the slide to be processed may be directly read as the graphic representations to be edited, or for the determination of the graphic representations to be edited, the determination may be performed through a graphic representation identification process, and for the graphic representation identification process, the existing process may be referred to, which is not repeated herein.
It should be noted that the slide to be processed may be any slide in the presentation, where the type of the diagram in the slide includes, but is not limited to, a side-by-side type (used by the user to express a document outline, a directory, etc.), a flow type (used by the user to express an action, a logical sequence), and a time axis (used by the user to express a time-series structure), and this is not limited by the embodiment of the present invention.
In addition, it should be noted that the diagram in the embodiment of the present invention belongs to the same concept as the smart graph of the PPT product of WPS and the SmartArt of the PPT product of microsoft.
And S102, determining a target diagram item in the diagram to be edited.
In the embodiment of the invention, for the graphs to be edited in the slideshow to be processed, the target graph item in the graphs to be edited can be determined, so that the target graph item can be edited subsequently, and the purpose of adding the graph item or deleting the graph item to be edited can be achieved.
For example, for a slide to be processed, as shown in fig. 2, a third item of diagram item of a diagram to be edited in the slide to be processed may be determined as a target diagram item in the diagram to be edited, so as to perform an editing operation on the target diagram item subsequently, thereby achieving the purpose of adding a diagram item to the diagram to be edited or deleting a diagram item.
And S103, editing the target graphic item to obtain an edited graphic in the slide to be processed.
And S104, carrying out diagram layout on the edited diagram to obtain a target diagram in the slide to be processed.
In the embodiment of the present invention, for the target pictorial item, the target pictorial item may be edited to obtain an edited diagram in the slide to be processed, and then the edited diagram is subjected to diagram typesetting to obtain the target diagram in the slide to be processed.
For example, as shown in fig. 2, a third item of the diagram to be edited in the slide to be processed is determined as a target diagram item in the diagram to be edited, the target diagram item is edited to obtain an edited diagram in the slide to be processed, and then the edited diagram is typeset to obtain a target diagram in the slide to be processed, as shown in fig. 3.
Through the above description of the technical solution provided by the embodiment of the present invention, the target pictorial item of the pictorial to be edited in the slide to be processed is determined, the target pictorial item is edited to obtain the pictorial to be edited in the slide to be processed, and the pictorial layout is performed on the pictorial to be edited to obtain the target pictorial to be processed in the slide to be processed.
As shown in fig. 4, an implementation flow diagram of another slide processing method provided in an embodiment of the present invention is applied to an electronic device, and the method may specifically include the following steps:
s401, obtaining a slide to be processed, and determining a diagram to be edited in the slide to be processed.
In the embodiment of the present invention, this step is similar to the step S101, and the embodiment of the present invention does not limit this.
S402, determining the diagram item to be duplicated in the diagram to be edited.
In the embodiment of the invention, for the diagram to be edited in the slide to be processed, in order to implement the diagram item extension on the diagram to be edited, the diagram item to be duplicated in the diagram to be edited may be determined, so as to implement the diagram item extension on the diagram to be edited based on the diagram item to be duplicated.
For the determination of the representation item to be replicated, reference is made to the method illustrated in FIG. 5. As shown in fig. 5, an implementation flow diagram of a to-be-repeated drawing item determining method provided in an embodiment of the present invention is applied to an electronic device, and specifically includes the following steps:
s501, determining the graph item structure of a first graph item in the graph to be edited, and grouping the first graph item according to the graph item structure.
In the embodiment of the invention, the diagram item structure of the first diagram item in the diagram to be edited is determined, wherein the diagram item structure refers to the position relation of all shapes inside each first diagram item in the diagram to be edited, and does not consider the distance between the shapes.
For the diagram item structure of the first diagram item in the diagram to be edited, the first diagram item can be grouped according to the diagram item structure, which means that the first diagram items with the same diagram item structure are divided into a group.
For example, as shown in fig. 6, a first item of diagram item and a second item of diagram item in the diagram to be edited have the same diagram item structure and are then divided into a group, and a third item of diagram item and a fourth item of diagram item have the same diagram item structure and are then divided into a group.
For the determination of the illustration item structure of the first illustration item in the illustration to be edited, reference is made to the method illustrated in fig. 7. As shown in fig. 7, an implementation flow diagram of a method for determining an illustration item structure provided in an embodiment of the present invention is applied to an electronic device, and specifically includes the following steps:
s701, acquiring first coordinates of a second shape in a first diagram item of the diagram to be edited, wherein the first coordinates comprise vertex coordinates of a circumscribed rectangle of the second shape.
In the embodiment of the present invention, first coordinates of a second shape in each first illustration item of the illustration to be edited are obtained, where the second shape refers to all shapes in each first illustration item of the illustration to be edited, and the first coordinates include vertex coordinates (for example, any one of four vertex coordinates, or center point coordinates) of a circumscribed rectangle of the second shape, for example, top left vertex coordinates.
For example, for the diagram to be edited, as shown in fig. 2, the first coordinates of the second shape in the first diagram item of the diagram to be edited are obtained, where the first coordinates include the coordinates of the top left vertex of the circumscribed rectangle of the second shape, as shown in table 1 below.
Figure BDA0003878800690000131
TABLE 1
S702, determining a structure matrix corresponding to the first graphic item based on the first coordinate, and representing the graphic item structure of the first graphic item in the graphic to be edited by using the structure matrix.
In the embodiment of the present invention, for a first coordinate of a second shape in a first diagram item of a diagram to be edited, a structure matrix corresponding to the first diagram item may be determined based on the first coordinate, and the structure matrix is used to characterize a diagram item structure of the first diagram item in the diagram to be edited. Here the structural matrix is equivalent to the discrete coordinates of the second shape in the first pictorial item.
It should be noted that, here, the first illustration items are in one-to-one correspondence with the structure matrix, which means that any first illustration item in the illustration to be edited has a corresponding structure matrix, and is determined by the first coordinates of the second shape in the first illustration item, as shown in table 2 below.
First pictorial item Structural matrix
Illustration item 1 Structural matrix 1
Illustration item 2 Structural matrix 2
Illustration item 3 Structural matrix 3
Illustration item 4 Structural matrix 4
TABLE 2
For the determination of the pictorial item structure of the first pictorial item, reference is made to the method illustrated in FIG. 8. As shown in fig. 8, an implementation flow diagram of another method for determining a structure of a pictorial item provided in an embodiment of the present invention is applied to an electronic device, and specifically includes the following steps:
s801, sorting the X-axis coordinate values in the first coordinates, and sorting the Y-axis coordinate values in the first coordinates.
S802, replacing the X-axis coordinate value with a first sequence value corresponding to the X-axis coordinate value, and replacing the Y-axis coordinate value with a second sequence value corresponding to the Y-axis coordinate value to obtain a matrix coordinate of the first coordinate.
S803, selecting a maximum first sequential value from the first sequential values, and selecting a maximum second sequential value from the second sequential values.
And S804, constructing an empty matrix of M x N according to the maximum first sequence value and the maximum second sequence value, wherein N comprises the maximum first sequence value, and M comprises the maximum second sequence value.
And S805, determining the shape serial number of the second shape corresponding to the first coordinate in the first graphic item.
S806, replacing matrix elements in the empty matrix corresponding to the matrix coordinates of the first coordinates with shape serial numbers to obtain a structural matrix corresponding to the first diagram item.
In the embodiment of the invention, for a first coordinate of a second shape in a diagram to be edited and illustrated first diagram item, the X-axis coordinate values in the first coordinate are sequenced, the Y-axis coordinate values in the first coordinate are sequenced, the X-axis coordinate values are replaced by first sequence values corresponding to the X-axis coordinate values, and the Y-axis coordinate values are replaced by second sequence values corresponding to the Y-axis coordinate values, so that the matrix coordinate of the first coordinate is obtained. Then, the maximum first sequence value is selected from the first sequence values, the maximum second sequence value is selected from the second sequence values, an M-N empty matrix is constructed according to the maximum first sequence value and the maximum second sequence value, N comprises the maximum first sequence value, M comprises the maximum second sequence value, the shape serial number of the second shape corresponding to the first coordinate in the first representation item is determined (the shape serial number is marked in the process of identifying the shape in the first representation item), the matrix elements in the empty matrix corresponding to the matrix coordinate of the first coordinate are replaced by the shape serial numbers, and the structural matrix corresponding to the first representation item is obtained.
It should be noted that, the sorting of the X-axis coordinate value and the Y-axis coordinate value is not an exact sorting of numerical values, but a sorting with a little error, that is, a comparison within a certain threshold range, for example, X1 and X2, and if the difference between X1 and X2 is within the threshold range, they are considered to be in the same order, that is, the sequential values are the same. Further, for an empty matrix of M × N, it means that each element initial value in the matrix of M × N is 0, and the shape number is unique in the first drawing item.
For example, taking the illustration item 1 in the above table 1 as an example, regarding the upper left vertex coordinates (X1, Y1) of the second shape "01" in the illustration item 1, the upper left vertex coordinates (X2, Y2) of the second shape "lesson review" in the illustration item 1, the X-axis coordinate values of the two upper left vertex coordinates are sorted, and the Y-axis coordinate values of the two upper left vertex coordinates are sorted, the sorting result of the X-axis coordinate values is X1, X2, the sorting result of the Y-axis coordinate values is Y1, Y2, where the first sequential value of X1 in the sorting result of the X-axis coordinate values is 1, where the first sequential value of X2 in the sorting result of the X-axis coordinate values is 2, where the second sequential value of Y1 in the sorting result of the Y-axis coordinate values is 1, where the second sequential value of Y2 in the sorting result of the Y-axis coordinate values is 1, then the X-axis coordinate values in the above-mentioned left upper vertex coordinates (X1, Y1) and left upper vertex coordinates (X2, Y2) are replaced with the first sequential values corresponding to the X-axis coordinate values, and the Y-axis coordinate values in the above-mentioned left upper vertex coordinates (X1, Y1) and left upper vertex coordinates (X2, Y2) are replaced with the second sequential values corresponding to the Y-axis coordinate values, where the above-mentioned left upper vertex coordinates (X1, Y1) can be transformed into (1, 1), the above-mentioned left upper vertex coordinates (X2, Y2) can be transformed into (2, 1), and where (1, 1), (2, 1) are matrix coordinates.
Then, the maximum first sequence value is selected from the first sequence values, where the maximum first sequence value is 2, the maximum second sequence value is selected from the second sequence values, where the maximum second sequence value is 1, a 1 × 2 empty matrix is constructed according to the maximum first sequence value and the maximum second sequence value, the shape number 1 of the second shape "01" corresponding to the top left vertex coordinate (x 1, y 1) in the illustration item 1 is determined, the shape number 2 of the second shape "top course" corresponding to the top left vertex coordinate (x 2, y 2) in the illustration item 1 is determined, the matrix element (i.e., the matrix element in the 1 st row and the 1 st column) in the empty matrix corresponding to the matrix coordinate (1, 1) of the top left vertex coordinate (x 1, y 1) is replaced with the shape number 1, the matrix element (i.e., the 1 st row and the column element) in the empty matrix corresponding to the matrix coordinate (2, 1) of the top left vertex coordinate (x 2, y 2) is replaced with the shape number 1, and the matrix element (i.e., the 1 st row and the column element) in the empty matrix corresponding to the shape of the top left vertex coordinate (x 1, y 1) is replaced with the shape matrix element, so that the shape of the empty matrix element, and the shape of the top left vertex coordinate (1, 2) can be obtained as the structure of the structure item as shown in the structure of the figure. Similar processing is performed for the above illustration item 2, illustration item 3 and illustration item 4, so that corresponding structure matrixes can be obtained.
(1 2)。
In the embodiment of the present invention, after the structure matrix corresponding to the first diagram item in the diagram to be edited is obtained, the first diagram item may be grouped by using the structure matrix, that is, the first diagram items having the same structure matrix may be divided into a group.
For example, as shown in table 1, if the configuration matrix of the illustration item 1 is the same as that of the illustration item 2, the illustration item 1 and the illustration item 2 may be divided into one group, and if the configuration matrix of the illustration item 3 is the same as that of the illustration item 4, the illustration item 3 and the illustration item 4 may be divided into one group.
S502, determining a determination strategy of the graph items to be duplicated in the graph to be edited according to the grouping number of the first graph items.
And S503, determining the diagram item to be copied in the diagram to be edited by determining the strategy.
In the embodiment of the invention, for the grouping situation of the first illustration item in the illustration to be edited, the determination policy of the illustration to be duplicated in the illustration to be edited may be determined according to the grouping number of the first illustration item, and then the illustration to be duplicated in the illustration to be edited is determined by the determination policy. Wherein different grouping quantities have different corresponding determination strategies.
Specifically, under the condition that the first diagram items are divided into one group or three groups or more, a first determination strategy of diagram items to be copied in the diagram to be edited is determined, the parity condition of the expansion diagram items in the diagram to be edited is determined based on the first determination strategy, the parity condition represents that the expansion diagram items belong to odd-numbered items or even-numbered items, and the diagram items to be copied in the diagram to be edited are determined in a reverse order according to the parity condition of the expansion diagram items.
Wherein, in the case that the odd-even condition representation extension diagram item belongs to the odd number item, the first diagram item of the first odd number item in the diagram to be edited is determined in the reverse order; determining a first diagram item of a first odd-numbered item as a diagram item to be duplicated in a diagram to be edited; in the case that the parity condition characterizes that the expansion diagram item belongs to an even item, determining a first diagram item of a first even item in the diagram to be edited in a reverse order; and determining the first diagram item of the first even item as a diagram item to be duplicated in the diagram to be edited.
For example, in the case that the parity case characterization extension diagram item belongs to item 5, then diagram item 3 of item 3 in the diagram to be edited may be determined in reverse order, and diagram item 3 of item 3 may be determined as the diagram item to be copied in the diagram to be edited; in the case that the parity condition representation expansion diagram item belongs to the 6 th item, the diagram item 4 of the 4 th item in the diagram to be edited can be determined in a reverse order, and the diagram item 4 of the 4 th item is determined as the diagram item to be copied in the diagram to be edited.
In addition, in the case that the first diagram items are divided into two groups, a second determination strategy of the diagram items to be duplicated in the diagram to be edited is determined, the grouping situation of the first diagram items in the diagram to be edited is determined based on the second determination strategy, and the diagram items to be duplicated in the diagram to be edited are determined through the grouping situation of the first diagram items. For the grouping case where the first illustrated item is divided into two groups, the grouping case can be roughly classified into three types.
For example, the letters a and B represent two different icon structures, the first icon is divided into two groups, and there are three types of grouping: AABB, ABAB, and ABBA, where AABB represents that illustration item 1 and illustration item 2 are divided into a group, illustration item 3 and illustration item 4 are divided into a group, where ABAB represents that illustration item 1 and illustration item 3 are divided into a group, illustration item 2 and illustration item 4 are divided into a group, and where ABBA represents that illustration item 1 and illustration item 4 are divided into a group, and illustration item 2 and illustration item 3 are divided into a group.
In the case that the grouping condition of the first pictorial item belongs to the first-class grouping condition (such as the above AABB), the first pictorial item with the largest pictorial item sequence number in the second group may be determined as the pictorial item to be duplicated in the pictorial representation to be edited, while the pictorial item structure of the first pictorial item with the smallest pictorial item sequence number in the second group is adjusted to be the same as the pictorial item structure of the first pictorial item in the first group.
For example, in the case where the grouping condition of the first illustration item belongs to AABB, then the expanded trend of the illustration to be edited is AAABBB. Here, AABB, i.e. illustration item 1 and illustration item 3, are divided into a first group, and illustration item 2 and illustration item 4 are divided into a second group, at this time, illustration item 4 may be determined as an illustration item to be copied in the illustration to be edited, and the structure of illustration item 3 may be adjusted to the same structure as that of illustration item 1 and illustration item 2, i.e. by dividing illustration item 3 into the first group, so that it may be ensured that the extension trend remains unchanged.
In a case that the grouping situation of the first pictorial item belongs to the second type of grouping situation (such as the aforementioned ABAB), the processing here is similar to the processing of the case that the first pictorial item is divided into a group, and the details of the embodiment of the present invention are not repeated here.
In the case that the grouping condition of the first diagram item belongs to the third type of grouping condition (such as ABBA mentioned above), the diagram item to be duplicated in the diagram to be edited may be determined according to the extension trend of the first diagram item in the diagram to be edited.
For example, in the case where the grouping condition of the first pictorial item belongs to ABBA, then the expanded trend of the pictorial item to be edited is ABBAABBA. Here, ABBA represents that the illustration item 1 and the illustration item 4 are divided into a group, and the illustration item 2 and the illustration item 3 are divided into a group, then according to the extension trend, the illustration item 1 may be determined as a drawing item to be repeated in the illustration to be edited, subsequently, the illustration item 2 may be determined as a drawing item to be repeated in the illustration to be edited, and so on according to the extension trend, so that it may be ensured that the extension trend remains unchanged.
S403, executing the following processing on the to-be-copied illustration item to obtain an edited illustration in the to-be-processed slide.
S404, obtaining the expansion diagram item of the diagram to be edited according to the diagram item to be duplicated.
S405, a first section number text shape in the first shape of the extended illustration item and a second section number text shape in the second shape of the first illustration item to be edited are obtained.
S406, updating the first text in the first section number text shape according to the second text in the second section number text shape.
S407, determining the rest text shapes except the first section number text shape in the first shape, and setting the rest text shapes as placeholder shapes.
In the embodiment of the present invention, for a to-be-copied presentation item, the following processing may be performed on the to-be-copied presentation item to obtain an edited diagram in a to-be-processed slide: the method comprises the steps of obtaining an extended pictorial item of an icon to be edited according to the pictorial item to be copied (namely, copying the pictorial item to be copied to obtain the extended pictorial item of the icon to be edited, pasting the extended pictorial item into the icon to be edited), obtaining a first section number text shape in a first shape of the extended pictorial item and a second section number text shape in a second shape of the first pictorial item to be edited, updating (sequentially) the first text in the first section number text shape according to a second text in the second section number text shape, determining the rest text shapes except the first section number text shape in the first shape, and setting the rest text shapes as placeholder shapes.
It should be noted that, the (orderly) updating of the first text in the first section number text shape according to the second text in the second section number text shape may be incrementally and orderly updating of the first text in the first section number text shape based on the second text in the second section number text shape. For example, if the second text is 03, the first text may be 04, which is not limited in this embodiment of the present invention.
It should be noted that, in the above steps S404 to S407, the case where the section number text shape exists in the to-be-edited drawing is referred to, and in the case where the section number text shape does not exist in the to-be-edited drawing, the following processing is performed on the to-be-copied drawing item to obtain the edited drawing in the to-be-processed slide: copying the to-be-copied representation item to obtain an extended representation item of the to-be-edited representation, pasting the extended representation item into the to-be-edited representation, determining all text shapes in the extended representation item, and setting all text shapes as placeholder shapes, namely, the operation of updating the section number text shapes is not required to be executed.
And S408, carrying out diagram layout on the edited diagram to obtain a target diagram in the slide to be processed.
In the embodiment of the invention, the edited graph can be subjected to graph typesetting to obtain the target graph in the slide to be processed. In order to maintain the visual center balance, all shapes of the diagram need to be zoomed when the diagram item changes, and the zooming can be proportional zooming.
Therefore, the scaling of the third shape in the edited second diagram item can be determined, the second coordinate of the third shape is obtained, wherein the second coordinate includes the vertex coordinate of the circumscribed rectangle of the third shape (the vertex coordinate here refers to the top-left vertex coordinate), the second coordinate, the width and the height of the third shape, and the font size of the third text in the third shape are scaled by using the scaling, and the edited diagram is subjected to diagram layout after scaling processing, so that the target diagram in the slide to be processed is obtained.
Wherein, for the third shapes in the edited second illustration items, it means that all the third shapes in each second illustration item are illustrated after editing. Assuming that the scaling ratio is r, for each third shape, the coordinates of the top left vertex of the circumscribed rectangle of the third shape, the width and height of the third shape, and the font size of the third text in the third shape are scaled with the scaling ratio, as shown below.
The scaled new upper left coordinate of the third shape is represented as Point ((pn.x-p.x) × r + p.x, (pn.y-p.y) × r + p.y), where pn.x is the X coordinate of the upper left vertex coordinate Pn of the circumscribed rectangle of the third shape, pn.y is the Y coordinate of the upper left vertex coordinate Pn of the circumscribed rectangle of the third shape, p.x is the X coordinate of the upper left vertex coordinate P of the circumscribed rectangle of the second pictorial item of the third shape, p.y is the Y coordinate of the upper left vertex coordinate P of the circumscribed rectangle of the second pictorial item of the third shape, and the width and height of the third shape are both multiplied by a coefficient r, i.e., width r, height r, and the font size of the third text of the third shape is also changed to font size r.
Wherein, for the scale of the third shape in the edited second diagram item, the scale can be determined as follows: acquiring the quantity of first pictorial items of a first pictorial item in a pictorial to be edited, and acquiring the quantity of second pictorial items of a second pictorial item in the pictorial after being edited; a quotient of the first number of pictorial items and the second number of pictorial items is obtained, and an arithmetic square root of the quotient is determined as a scale of the third shape in the edited pictorial second item.
Alternatively, the scaling for the third shape in the edited second pictorial item may be determined as follows: obtaining a first area sum of second shapes (all shapes are referred to herein) in a first diagram item to be edited, obtaining a second area sum of third shapes (all shapes are referred to herein) in a second diagram item after editing, obtaining a quotient of the first area sum and the second area sum, and taking an arithmetic square root of the quotient as a scaling ratio of the third shapes in the second diagram item after editing. It should be noted that, the arithmetic square root is only an example, and the embodiment of the present invention does not limit this.
For example, a first number of pictorial items of a first pictorial item in the pictorial item to be edited, i.e., an old pictorial item number, is obtained, a second number of pictorial items of a second pictorial item in the pictorial item after editing, i.e., a new pictorial item number, is obtained, a quotient of the first number of pictorial items and the second number of pictorial items, i.e., the old pictorial item number/the new pictorial item number, is obtained, and an arithmetic square root of the quotient is determined as a scaling r of a third shape in the second pictorial item after editing.
In addition, in the embodiment of the present invention, if the edited diagram belongs to the situation of diagram item extension, the diagram layout is performed on the edited diagram to obtain the target diagram in the slide to be processed, and reference may be made to the diagram layout method shown in fig. 9. As shown in fig. 9, an implementation flow diagram of the graphic typesetting method provided by the embodiment of the present invention is applied to an electronic device, and the method specifically includes the following steps:
s901, identifying the typesetting mode of the first graphic item in the diagram to be edited.
And S902, typesetting the extended graphic items in the edited graphic representation according to the typesetting mode to obtain an initially typesetted graphic representation in the slide to be processed.
In the embodiment of the invention, for the diagram to be edited, namely the original diagram, a certain typesetting rule exists, in order to follow the typesetting rule of the original diagram of the user, the typesetting mode of the first diagram item in the diagram to be edited can be identified, wherein the typesetting mode comprises linear typesetting or radiation typesetting.
For the identified typesetting mode of the first graphic item in the diagram to be edited, the expanded graphic item in the diagram after being edited can be typeset according to the typesetting mode to obtain the initially typesetting diagram in the slide to be processed, so that the typesetting rule of the original diagram of the user can be followed.
For the identification of the linear typesetting, reference may be made to the method shown in fig. 10. As shown in fig. 10, an implementation flow diagram of the method for identifying a linear typesetting provided by the embodiment of the present invention is shown, and the method is applied to an electronic device, and specifically may include the following steps:
s1001, dividing the first graphic item in the graphic to be edited into N groups according to the graphic item serial number of the first graphic item in the graphic to be edited, wherein N =2,3, \8230;, N, N are the same as the number of the first graphic items of the first graphic item.
In the embodiment of the invention, for the diagram to be edited, the first diagram item in the diagram to be edited can be divided into N groups according to the sequence number of the diagram item of the first diagram item in the diagram to be edited, wherein N =2,3, \8230 \ 8230, and N, N are the same as the number of the first diagram items of the first diagram item.
For example, assuming that there are N first pictorial items in the diagram to be edited, the first pictorial item in the diagram to be edited may be divided into 2 groups, 3 groups, \8230 \ N groups, which means that the first pictorial item in the diagram to be edited is divided multiple times, according to the sequence number of the pictorial item of the first pictorial item in the diagram to be edited.
It should be noted that, the above 2 groups represent that the first diagram item in the diagram to be edited is divided into two groups, and the 3 groups represent that the first diagram item in the diagram to be edited is divided into three groups, and so on, which is not limited in this embodiment of the present invention.
In addition, the division is to divide into n groups on average, if there is the remaining first pictorial item after dividing into n groups on average, then it can divide into this n groups in order, for example, the total number of pictorial items is 5 items, and divide into 3 groups, where group 1 includes pictorial item 1 and pictorial item 2, group 2 includes pictorial item 3 and pictorial item 4, and group 3 includes pictorial item 5.
S1002, for n groups of any of the division cases, executes the following processing.
S1003, acquiring third coordinates of the second shape in each group of first graphic items, wherein the third coordinates comprise vertex coordinates of a circumscribed rectangle of the second shape.
S1004, a first difference between the X-axis coordinate values in adjacent third coordinates and a second difference between the Y-axis coordinate values in adjacent third coordinates are determined.
S1005, obtaining fourth coordinates of the first circumscribed rectangle formed by each group of the first pictorial items, wherein the fourth coordinates include vertex coordinates of the first circumscribed rectangle.
S1006, a third difference between the X-axis coordinate values in the adjacent fourth coordinates and a fourth difference between the Y-axis coordinate values in the adjacent fourth coordinates are determined.
S1007, under the condition that the variance of the first difference value and the second difference value is smaller than the variance threshold value and the variance of the third difference value and the fourth difference value is smaller than the variance threshold value, the first graph item in the graph to be edited is determined to be linearly typeset.
In the embodiment of the present invention, for n groups of any of the above-described division cases, the following processing may be performed: acquiring third coordinates of the second shape in each group of the first pictorial item, wherein the third coordinates include vertex coordinates of circumscribed rectangles of the second shape, determining a first difference value between X-axis coordinate values in adjacent (where adjacent refers to the case where adjacent is 1 to 2,2 to 3) third coordinates, and a second difference value between Y-axis coordinate values in adjacent third coordinates, acquiring fourth coordinates of the first circumscribed rectangles formed by the groups of the first pictorial item, wherein the fourth coordinates include vertex coordinates of the first circumscribed rectangle, determining a third difference value between X-axis coordinate values in adjacent fourth coordinates, and a fourth difference value between Y-axis coordinate values in adjacent fourth coordinates, and determining that the first pictorial item in the pictorial item to be edited is linear in the case where a variance between the first difference value and the second difference value is smaller than a variance threshold, and a variance between the third difference value and the fourth difference value is smaller than the variance threshold, as shown in fig. 11. The vertex coordinates here may be, for example, the top left vertex coordinates.
Thus, if the variance between the first difference and the second difference is smaller than the variance threshold, and the variance between the third difference and the fourth difference is smaller than the variance threshold, it indicates that the n groups of the division cases are that the X and Y axis changes of the vertex coordinates of the shapes in each group are isodyne, and the X and Y axis changes of the vertex coordinates (for example, the coordinates of the upper left point) of the circumscribed rectangles between the groups are isodyne, and at this time, it is considered that the condition for linear composition is satisfied, and it can be determined that the first diagram item in the diagram to be edited is linear composition. In the case of dividing the shape into 2 groups, it is possible to consider only whether or not the X-and Y-axis changes of the vertex coordinates of the shapes in the group are equal differences, without considering the groups.
Therefore, typesetting is carried out on the extension graphic items according to the linear typesetting to obtain an initial typesetting graphic representation in the slide to be processed, namely a fifth coordinate is obtained, wherein the fifth coordinate comprises the vertex coordinate of the circumscribed rectangle of the first graphic item in the last group of n groups; adjusting the fifth coordinate according to the first difference and the second difference, or the third difference and the fourth difference to obtain a sixth coordinate; acquiring a seventh coordinate of a second circumscribed rectangle formed by the expanded representation item, wherein the seventh coordinate comprises a vertex coordinate of the second circumscribed rectangle; and adjusting the seventh coordinate to be a sixth coordinate to obtain the initial typesetting diagram in the slide to be processed. The method is characterized in that on the basis of the vertex coordinates of the circumscribed rectangle of the second pictorial item of the last item in the edited diagram, the vertex coordinates of the second circumscribed rectangle formed by the expanded pictorial item can be obtained by adjusting the first difference value and the second difference value or the third difference value and the fourth difference value, and then the adjustment is carried out according to the vertex coordinates.
For example, a fifth coordinate is obtained, where the fifth coordinate includes vertex coordinates (Xn, yn) of a circumscribed rectangle of a first pictorial item in a last group of n groups (e.g., the above 3 groups), and the sixth coordinate is obtained by adjusting the fifth coordinate according to a first difference and a second difference, or a third difference and a fourth difference, where the sixth coordinate is Point (Xn + dx, yn + dy), where dx and dy may be the first difference and the second difference, or the third difference and the fourth difference, so that a seventh coordinate of a second circumscribed rectangle formed by an extended pictorial item may be adjusted to Point (Xn + dx, yn + dy), and an initial layout diagram in a slide to be processed is obtained. Thus, the initial layout graph also meets the linear layout.
It should be noted that, for the extended pictorial item, if it can be divided into n groups of last items (as the above group 3 includes pictorial item 5, the extended pictorial item belongs to pictorial item 6, and it is divided into group 3), which means that the extended pictorial item and the first pictorial item in the n groups of last items belong to the group of internal pictorial items, the fifth coordinate may be the vertex coordinate of the circumscribed rectangle of the first pictorial item of the last item in the n groups of last items, and the fifth coordinate is adjusted according to the first difference and the second difference to obtain the sixth coordinate; acquiring a seventh coordinate of a second circumscribed rectangle formed by the expanded representation item, wherein the seventh coordinate comprises a vertex coordinate of the second circumscribed rectangle; and adjusting the seventh coordinate to be a sixth coordinate to obtain the initial typesetting diagram in the slide to be processed.
Furthermore, for the extended pictorial item, if it is not divided into the n groups of last groups, but can be divided into n +1 groups, meaning that the extended pictorial item and the first pictorial item in the n groups of last groups belong to the inter-group pictorial item (if group 3 includes pictorial item 5, pictorial item 6, and the extended pictorial item belongs to pictorial item 7, which is divided into group 4), the fifth coordinate may be the vertex coordinate of the circumscribed rectangle of the first pictorial item in the n groups of last groups, and at this time, the fifth coordinate is adjusted according to the third difference and the fourth difference to obtain the sixth coordinate; acquiring a seventh coordinate of a second circumscribed rectangle formed by the expanded representation item, wherein the seventh coordinate comprises a vertex coordinate of the second circumscribed rectangle; and adjusting the seventh coordinate to be a sixth coordinate to obtain the initially composed graphic in the slide to be processed.
Further, for the identification of the radial composition, the method shown in fig. 12 may be referred to. As shown in fig. 12, an implementation flow diagram of a radiation typesetting identification method provided in the embodiment of the present invention is shown, and the method is applied to an electronic device, and specifically may include the following steps:
s1201, determining a straight line formed by the center points of the circumscribed rectangles of the adjacent first diagram items in the diagram to be edited.
In the embodiment of the present invention, for the icon to be edited, a straight line formed by the center point of the circumscribed rectangle of the adjacent first icon item in the icon to be edited may be determined, as shown in fig. 13.
And S1202, determining the perpendicular bisectors of all the straight lines, and judging whether the perpendicular bisectors of all the straight lines intersect.
In the embodiment of the invention, whether the perpendicular bisectors of all the straight lines intersect or not is judged for the perpendicular bisectors of all the straight lines.
It should be noted that, for judging whether the perpendicular bisectors of all the straight lines intersect, intersection points of adjacent perpendicular bisectors may be determined, then for these intersection points, the distance between every two intersection points is calculated, and if the distance is smaller than a set threshold, it may be judged that the perpendicular bisectors of all the straight lines intersect, and the intersection point here may be any one of the intersection points of the adjacent perpendicular bisectors.
And S1203, under the condition that the perpendicular bisectors of all the straight lines intersect, judging whether the distances between the intersection points of the perpendicular bisectors of all the straight lines and all the central points are equal.
In the embodiment of the invention, under the condition that the perpendicular bisectors of all the straight lines intersect, whether the distances between the intersection points of the perpendicular bisectors of all the straight lines and all the center points are equal or not is judged.
It should be noted that, for determining whether the distances between the intersection points of the perpendicular bisectors of all the straight lines and all the center points are equal, the distances between the intersection points and all the center points may be calculated, and it is determined whether the distances are within a certain threshold range, and if so, it may be determined that the distances between the intersection points of the perpendicular bisectors of all the straight lines and all the center points are equal.
S1204, under the condition that the distances between the intersection points and all the central points are equal, determining that the first graphic item in the diagram to be edited is the radial typesetting.
In the embodiment of the present invention, under the condition that the perpendicular bisectors of all the straight lines intersect and the distances between the intersection point of the perpendicular bisectors of all the straight lines and all the center points are equal, it may be determined that the first diagram item in the diagram to be edited is the radial typesetting.
The expanded graphic items are typeset according to the radiation typesetting to obtain a primary layout representation in the slide to be processed, namely an included angle formed by a central point and an intersection point of a circumscribed rectangle of an adjacent first graphic item in the diagram to be edited is obtained; and adjusting the expansion diagram items according to the included angles and the distances to obtain the initially composed diagram in the slide to be processed. Thus, the initial typesetting illustration also meets the requirement of radial typesetting.
And S903, carrying out graphic layout on the primary layout graphic according to the visual gravity center coincidence algorithm to obtain a target graphic in the slide to be processed.
In the embodiment of the invention, visual balance, namely visual gravity balance, is maintained, and in the layout design, the closer the composition is to the balance position of the gravity center, the more harmonious aesthetic feeling is aroused. Therefore, when the graphic item of the graphic is changed, the visual center of gravity of the graphic can be adjusted to the original position.
Based on the method, for the initially laid-out diagram in the slide to be processed, the diagram layout can be carried out on the initially laid-out diagram according to the visual gravity center coincidence algorithm to obtain the target diagram in the slide to be processed, and the coincidence of the visual gravity centers before and after the diagram editing can be ensured, namely the visual gravity centers before and after the diagram editing are unchanged.
The original visual center of gravity of the diagram to be edited can be determined, and then the target visual center of gravity of the initially laid out diagram is adjusted, so that the target visual center of gravity is overlapped with the original visual center of gravity, and the target diagram in the slide to be processed is obtained. The adjustment is automatic, and the visual center of gravity is not changed before and after the diagram editing without human intervention.
For the determination of the original visual barycenter of the diagram to be edited, the following method can be referred to: determining an original center point of a circumscribed rectangle of the diagram to be edited, searching a position extending a preset distance upwards in the vertical direction of the original center point (for example, the preset distance may be 5% of the height of the circumscribed rectangle of the diagram to be edited), and determining the position as an original visual center of gravity of the diagram to be edited.
Wherein, the calculation formula for the visual barycentric coordinate is as follows: Σ (area of each shape in the figure ×. Barycentric coordinates of each shape)/∑ (area of each shape in the figure). Under the condition that the original visual barycenter of the diagram to be edited is known, the area of the fourth shape in the third diagram item of the layout diagram is known, the barycenter coordinate of the fourth shape in the third diagram item of the layout diagram can be deduced through the visual barycenter coordinate calculation formula, and therefore the fourth shape can be adjusted based on the barycenter coordinate, so that the visual barycenter is overlapped before and after diagram editing, namely the visual barycenter is unchanged before and after diagram editing.
Based on the area, the area of the fourth shape in the third graphic item of the initial layout drawing can be determined, and the barycentric coordinate of the fourth shape in the third graphic item is determined according to the original visual barycenter and the area; and adjusting the fourth shape in the third graphic item according to the barycentric coordinates to obtain a target graphic representation in the slide to be processed.
In addition, in the embodiment of the present invention, for the layout of the graphic, there is a certain layout area, where the layout area refers to the maximum range in which the graphic can be laid out in the current slide. For layout areas, the following three rules generally need to be satisfied:
1. the typesetting area comprises a circumscribed rectangle of the diagram to be edited, so that the original position of the diagram placed by a user is kept, and the principle of keeping the gravity center of the original vision unchanged is met.
2. The layout area does not contain the non-pictorial text shape, table shape and diagram shape of the slide to be processed, in order to avoid the pictorial conflict with the shape of the text or table or diagram.
3. The background color of the typesetting area does not conflict with the color of the graphic text, and the aim is to avoid the conflict between the color of the graphic text and the background color, so that the situation that the graphic is not clear can be distinguished by naked eyes of a user.
Based on the layout area, the layout area of the drawing in the slide to be processed and a third circumscribed rectangle formed by the target drawing are determined, and the target drawing in the slide to be processed is shown under the condition that the third circumscribed rectangle does not exceed the layout area of the drawing.
It should be noted that, the displaying of the target icon in the slide to be processed here may be displaying the slide to be processed in the center of the current interface, where the slide to be processed contains the icon to be edited, that is, the original slide of the user, displaying the slide to be processed obtained by the present invention on the right side of the interface, and where the slide to be processed contains the target icon, that is, displaying two different slides to be processed on the same interface.
Determining the proportion of the third circumscribed rectangle exceeding the layout area shown in the figure under the condition that the third circumscribed rectangle exceeds the layout area shown in the figure; and zooming the target graphic representation according to the proportion, determining the zoomed target graphic representation as a primary layout graphic representation, jumping to adjust the target visual gravity center of the primary layout graphic representation to enable the target visual gravity center to be coincident with the original visual gravity center, and obtaining the target graphic representation in the slide to be processed. By continuously iterating in this way, it can be ensured that the third circumscribed rectangle of the target diagram does not exceed the diagram layout area, and the target visual barycenter of the target diagram coincides with the original visual barycenter of the diagram to be edited.
For the determination of the illustration layout area, reference may be made to the method shown in fig. 14. As shown in fig. 14, an implementation flow diagram of the method for determining the layout region in the drawing provided by the embodiment of the present invention is applied to an electronic device, and the method may specifically include the following steps:
and S1401, removing the edited graphic representation from the slide to be processed to obtain an object slide, and rendering the object slide to obtain a background image.
In the embodiment of the invention, for the slide to be processed, the edited graphic can be removed from the slide to be processed to obtain the target slide, and the target slide is rendered to obtain the background image.
It should be noted that, for the rendering of the target slide, reference may be made to the prior art, and the embodiments of the present invention are not described herein in detail.
And S1402, rasterizing the background image to obtain a raster image, and determining the corresponding diagram color of the diagram after editing.
In the embodiment of the present invention, in order to reduce the calculation amount, the background image may be rasterized to obtain a raster image. In which a grid of 5 x 5 or 10 x 10 or arbitrary pixel values can be set.
In addition, in the embodiment of the present invention, it is further required to determine a diagram color corresponding to the diagram after editing, where the diagram color is used to determine whether the diagram after editing conflicts with the background color of the slide to be processed.
The method comprises the steps of acquiring a target text shape in an illustration item of an edited illustration, and determining the text color of the text in the target text shape as the illustration color corresponding to the edited illustration, wherein if the target text shape is multiple, the illustration color can also be multiple, and the multiple illustration colors cannot conflict with the background color of the slide to be processed.
Or acquiring the graphic shape in the second graphic item of the edited graphic, and determining the proportion of the graphic color in the graphic shape; and determining the graph color with the proportion exceeding a preset proportion threshold value as the graph color corresponding to the edited graph.
And S1403, determining an original external rectangle corresponding to the edited graphic, and expanding outwards according to the grid of the grid image on the basis of the original external rectangle.
In the embodiment of the present invention, an original circumscribed rectangle (i.e., a circumscribed rectangle of an image to be edited) corresponding to the edited image may be determined, and the original circumscribed rectangle is used as a basis to expand outward according to the grid of the grid image. Here, the expansion may be to the periphery.
S1404, determining a similarity between the color in the target grid of the grid image and the background color of the original circumscribed rectangle.
S1405, stopping expanding under the condition that the similarity is smaller than a preset similarity threshold value and the color in the target grid of the grid image is in conflict with the color of the diagram to obtain an initial layout area of the diagram.
In the embodiment of the invention, the similarity between the color in the target grid of the grid image and the background color of the original circumscribed rectangle is determined, and the expansion is stopped under the condition that the similarity is smaller than a preset similarity threshold value and the color in the target grid of the grid image is in conflict with the color of the graph to obtain the initial typesetting area of the graph.
Converting colors in a target grid of the grid image into a first gray value, and converting the representation colors into a second gray value; and determining that the color in the target grid of the grid image conflicts with the color of the graph under the condition that the first gray value and the second gray value are in the same gray interval, otherwise, not conflicting.
It should be noted that, here, converting the color in the target grid of the raster image into the first gray scale value refers to converting all colors in the target grid (refer to all colors in the target grid region) into the first gray scale value, and determining that the color in the target grid of the raster image conflicts with the color shown in the drawing when the first gray scale value and the second gray scale value in the preset proportion are in the same gray scale interval, otherwise, the color in the target grid of the raster image does not conflict. Here, the preset ratio refers to a ratio between a first gray value in the same gray interval as a second gray value and all the first gray values, for example, if more than 80% of the first gray value and the second gray value are in the same gray interval, it is determined that the color in the target grid of the grid image conflicts with the illustrated color.
S1406, cutting out the areas of the non-illustrated text shape, the table shape and the diagram shape from the initial illustration layout area to obtain an illustration layout area.
In the embodiment of the present invention, after the area expansion is completed, the initial layout area of the graphic representation is an circumscribed rectangle, and then the areas of the non-graphic text shape (i.e., the text shape not belonging to the graphic representation), the table shape and the diagram shape in the slide to be processed are cut out, so that the final graphic representation layout area can be obtained. Here, the clipping is performed according to the circumscribed rectangle of the non-illustrated text shape, table shape, and diagram shape in the slide to be processed.
Through the above description of the technical solution provided by the embodiment of the present invention, by determining a diagram item to be copied in a diagram to be edited, copying the diagram item to be copied to obtain an extended diagram item of the diagram to be edited, pasting the extended diagram item into the diagram to be edited, obtaining a first-section number text shape in a first shape of the extended diagram item, and a second-section number text shape in a second shape of the first diagram item to be edited, sequentially updating a first text in the first-section number text shape according to a second text in the second-section number text shape, determining the remaining text shapes in the first shape except the first-section number text shape, setting the remaining text shapes as placeholder shapes, thus obtaining an edited diagram in a slide to be processed, performing diagram layout on the edited diagram to obtain an object diagram layout in the slide to be processed, thus, automatic editing of the diagram in the slide can be realized, manual operation is avoided, operation is simplified, and editing efficiency is improved.
As shown in fig. 15, a schematic implementation flow diagram of another slide processing method according to an embodiment of the present invention is applied to an electronic device, and the method specifically includes the following steps:
s1501, acquiring the slide to be processed, and determining the diagram to be edited in the slide to be processed.
In the embodiment of the present invention, this step is similar to the step S101, and the embodiment of the present invention does not limit this.
S1502, the diagram items to be deleted in the diagram to be edited are determined.
In the embodiment of the present invention, for the graph to be edited in the slide to be processed, in order to delete the graph item of the graph to be edited, the graph item to be deleted in the graph to be edited may be determined, so as to delete the graph item of the graph to be edited based on the graph item to be deleted.
The method comprises the steps of obtaining a sequence number of a diagram item of a first diagram item in a diagram to be edited, determining a first diagram item with the largest sequence number of the diagram item, and determining the first diagram item with the largest sequence number of the diagram item as a diagram item to be deleted in the diagram to be edited.
And S1503, executing a deletion instruction on the to-be-deleted diagram item to obtain an edited diagram in the to-be-deleted slide.
In the embodiment of the present invention, for a to-be-deleted pictorial item in a to-be-edited pictorial item, a deletion instruction may be executed on the to-be-deleted pictorial item to obtain an edited pictorial item in a to-be-processed slideshow.
S1504, acquiring a preset typesetting mode.
And S1505, typesetting the edited graphic representation by using a preset typesetting mode to obtain the initially typesetted graphic representation in the slide to be processed.
And S1506, performing graphic layout on the initially arranged graphic display according to the visual gravity center coincidence algorithm to obtain a target graphic in the slide to be processed.
In the embodiment of the present invention, a preset typesetting manner may be obtained, where the preset typesetting manner at least includes one of the following: vertical typesetting, horizontal typesetting, grid typesetting and radiation typesetting. And then, typesetting the edited diagram by using a preset typesetting mode to obtain a primary typesetting diagram in the slide to be processed, and performing diagram typesetting on the primary typesetting diagram according to a visual gravity center superposition algorithm to obtain a target diagram in the slide to be processed.
In order to keep the visual center balance, all shapes of the diagram need to be zoomed under the condition that the diagram item changes, so that before the edited diagram is typeset by using a preset typesetting mode to obtain the initial layout diagram in the slide to be processed, the zoom ratio of the third shape in the second diagram item of the edited diagram is determined, the second coordinate of the third shape is obtained, wherein the second coordinate comprises the vertex coordinates of the circumscribed rectangle of the third shape, and the second coordinate, the width and the height of the third shape and the word size of the third text in the third shape are zoomed by using the zoom ratio. And after zooming, typesetting the edited graphic representation by using a preset typesetting mode to obtain the initially typesetted graphic representation in the slide to be processed.
For the vertical typesetting and the horizontal typesetting, all the graphic items are indicated to be arranged on a vertical line or a horizontal line, the horizontal line can vertically pass through the central point of the circumscribed rectangle of the original graphic, the ordering of the graphic items follows the sequence numbers of the identified graphic items marked, and the arrangement sequence is from left to right or from top to bottom.
For the grid typesetting, all the graphic items are indicated to be arranged on the grid, the central point of the circumscribed rectangle of the grid is kept to be overlapped with the central point of the circumscribed rectangle of the original graphic, the sequence of the central points follows the sequence numbers of the graphic items marked by the identified graphic items, and the arrangement sequence is from left to right or from top to bottom.
The radiation typesetting means that all the graphic items are arranged on a circular arc line with a certain center and a certain radius, the central points of the circumscribed rectangles of the graphic items are kept to be overlapped with the central points of the circumscribed rectangles of the original graphic, the ordering of the items follows the sequence numbers of the graphic items marked by the identified graphic items, and the arrangement sequence is from left to right.
Through the above description of the technical solution provided by the embodiment of the present invention, the to-be-deleted pictorial item in the to-be-edited pictorial item is determined, the deletion instruction is executed on the to-be-deleted pictorial item, the edited pictorial item in the to-be-processed slideshow is obtained, the edited pictorial item is typeset in the preset typesetting mode, the initially-typesetted pictorial item in the to-be-processed slideshow is obtained, and the pictorial typesetting is performed on the initially-typesetted pictorial item according to the visual center-of-gravity superposition algorithm, so that the target pictorial item in the to-be-processed slideshow is obtained, thereby realizing automatic editing of the pictorial item in the slideshow, avoiding manual operation, simplifying operation, and improving editing efficiency. And the visual gravity center is unchanged before and after the diagram item to be edited is deleted, so that a better visual effect can be ensured.
In addition, the slide processing method provided by the embodiment of the present invention may be executed multiple times, where the structure of the current processing is used as an input of the next processing, that is, the target icon in the slide to be processed obtained this time, and is used as an icon to be edited in the slide to be processed of the next processing, and the specific number of times of execution may be set according to an actual situation. Also, the same applies to the above slide to be processed, i.e., the original slide before the pictorial editing is not performed, for the pictorial layout.
Corresponding to the above method embodiment, an embodiment of the present invention further provides a slide processing apparatus, as shown in fig. 16, the apparatus may include: a slide acquiring module 1610, a diagram determining module 1620, a diagram item determining module 1630, a diagram item editing module 1640, and a diagram typesetting module 1650.
A slide obtaining module 1610 configured to obtain a slide to be processed;
a diagram determining module 1620, configured to determine a diagram to be edited in the slide to be processed;
a pictorial item determining module 1630, configured to determine a target pictorial item in the diagram to be edited;
the graphic item editing module 1640 is configured to edit the target graphic item to obtain an edited graphic in the slide to be processed;
and the graphic layout module 1650 is used for performing graphic layout on the edited graphic to obtain the target graphic in the slide to be processed.
The embodiment of the present invention further provides an electronic device, as shown in fig. 17, which includes a processor 171, a communication interface 172, a memory 173 and a communication bus 174, wherein the processor 171, the communication interface 172, and the memory 173 complete mutual communication through the communication bus 174,
a memory 173 for storing computer programs;
the processor 171, when executing the program stored in the memory 173, implements the following steps:
acquiring a slide to be processed, and determining a diagram to be edited in the slide to be processed; determining a target diagram item in the diagram to be edited; editing the target diagram item to obtain an edited diagram in the slide to be processed; and carrying out graphic layout on the edited graphic, and obtaining the target graphic in the slide to be processed.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM), and may also include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Alternatively, the memory may be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In still another embodiment of the present invention, there is also provided a storage medium having stored therein instructions that, when run on a computer, cause the computer to execute the slide processing method described in any of the above embodiments.
In yet another embodiment, a computer program product containing instructions is provided, which when run on a computer, causes the computer to perform the slide processing method described in any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a storage medium or transmitted from one storage medium to another, for example, from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The storage medium may be any available medium that can be accessed by a computer or a data storage device including one or more integrated servers, data centers, and the like. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (29)

1. A method for slide processing, the method comprising:
acquiring a slide to be processed, and determining a diagram to be edited in the slide to be processed;
determining a target diagram item in the diagram to be edited;
editing the target diagram item to obtain an edited diagram in the slide to be processed;
and carrying out graph layout on the edited graph to obtain the target graph in the slide to be processed.
2. The method according to claim 1, wherein the determining the target pictorial item in the diagram to be edited comprises:
determining a diagram item to be duplicated in the diagram to be edited;
the editing the target diagram item to obtain the edited diagram in the slide to be processed comprises:
executing the following processing on the slide show item to be processed to obtain an edited diagram in the slide show to be processed:
acquiring an extended graphic item of the graphic to be edited according to the graphic item to be edited;
acquiring a first section number text shape in the first shape of the extended illustration item and a second section number text shape in the second shape of the to-be-edited illustration first illustration item;
updating a first text in the first section number text shape according to a second text in the second section number text shape;
determining the rest text shapes except the first section number text shape in the first shape, and setting the rest text shapes as placeholder shapes.
3. The method according to claim 2, wherein the determining of the diagram item to be copied in the diagram to be edited comprises:
determining a diagram item structure of a first diagram item in the diagram to be edited, and grouping the first diagram item according to the diagram item structure;
determining a determination strategy of the diagram items to be duplicated in the diagram to be edited according to the grouping quantity of the first diagram items;
and determining the drawing items to be edited in the drawing to be edited through the determination strategy.
4. The method according to claim 3, wherein the determining the diagram item structure of the first diagram item in the diagram to be edited comprises:
acquiring first coordinates of a second shape in a diagram first diagram item to be edited, wherein the first coordinates comprise vertex coordinates of a circumscribed rectangle of the second shape;
and determining a structure matrix corresponding to the first diagram item based on the first coordinate, and characterizing the diagram item structure of the first diagram item in the diagram to be edited by using the structure matrix.
5. The method of claim 4, wherein determining the structural matrix corresponding to the first pictorial item based on the first coordinate comprises:
sorting the X-axis coordinate values in the first coordinates, and sorting the Y-axis coordinate values in the first coordinates;
replacing the X-axis coordinate values with first sequential values corresponding to the X-axis coordinate values, and replacing the Y-axis coordinate values with second sequential values corresponding to the Y-axis coordinate values to obtain matrix coordinates of the first coordinates;
selecting a maximum first sequence value from the first sequence values, and selecting a maximum second sequence value from the second sequence values;
constructing an empty matrix of M x N according to the largest first sequence value and the largest second sequence value, wherein N comprises the largest first sequence value, and M comprises the largest second sequence value;
determining a shape serial number of the second shape corresponding to the first coordinate in the first representation item;
and replacing matrix elements in the empty matrix corresponding to the matrix coordinate of the first coordinate with the shape sequence number to obtain a structural matrix corresponding to the first diagram item.
6. The method according to claim 3, wherein the determining policy for determining the drawing items to be edited in the drawing to be edited according to the grouping number of the first drawing items comprises:
under the condition that the first diagram items are divided into one group or three groups or more, determining a first determination strategy of diagram items to be replicated in the diagram to be edited;
the determining, by the determination policy, to-be-duplicated diagram items in the diagram to be edited includes:
determining the parity condition of the expansion diagram item in the diagram to be edited based on the first determination strategy, wherein the parity condition represents that the expansion diagram item belongs to an odd item or an even item;
and determining the graph items to be duplicated in the graph to be edited in a reverse order according to the parity condition of the expanded graph items.
7. The method according to claim 6, wherein the determining the diagram items to be duplicated in the diagram to be edited according to the parity of the extension diagram items in reverse order comprises:
in the case that the odd-even condition represents that the expansion diagram item belongs to an odd item, determining a first diagram item of a first odd item in the diagram to be edited in a reverse order;
determining a first diagram item of a first odd-numbered item as a diagram item to be duplicated in the diagram to be edited;
in the case that the parity condition represents that the extension diagram item belongs to an even number item, determining a first diagram item of a first even number item in the diagram to be edited in a reverse order;
and determining the first diagram item of the first even item as a diagram item to be duplicated in the diagram to be edited.
8. The method according to claim 3, wherein the determining a determination policy for the representation items to be copied in the representation to be edited according to the grouping number of the first representation items comprises:
under the condition that the first diagram items are divided into two groups, determining a second determination strategy of the diagram items to be duplicated in the diagram to be edited;
the determining, by the determination policy, to-be-duplicated diagram items in the diagram to be edited includes:
determining grouping conditions of the first diagram items in the diagram to be edited based on the second determination strategy;
and determining the diagram items to be duplicated in the diagram to be edited according to the grouping condition of the first diagram items.
9. The method according to claim 1, wherein the determining the target pictorial item in the diagram to be edited comprises:
determining a to-be-deleted pictorial item in the to-be-edited pictorial;
the editing the target diagram item to obtain the edited diagram in the slide to be processed comprises:
and executing a deleting instruction on the diagram item to be deleted to obtain an edited diagram in the slide to be processed.
10. The method according to claim 9, wherein the determining of the to-be-deleted pictorial item in the to-be-edited pictorial item comprises:
acquiring the sequence number of a diagram item of a first diagram item in the diagram to be edited, and determining the first diagram item with the largest sequence number of the diagram item;
and determining the first diagram item with the largest sequence number of the diagram items as the diagram item to be deleted in the diagram to be edited.
11. The method according to claim 1, wherein before the performing the diagram layout on the edited diagram to obtain the target diagram in the slide to be processed, the method further comprises:
determining a scale of a third shape in the edited graphical second representation item;
acquiring a second coordinate of the third shape, wherein the second coordinate comprises a vertex coordinate of a circumscribed rectangle of the third shape;
and scaling the second coordinate, the width and the height of the third shape and the font size of the third text in the third shape by using the scaling ratio.
12. The method of claim 11, wherein said determining a scale of a third shape in said edited graphical representation second item comprises:
acquiring the first number of the pictorial items of the first pictorial item in the pictorial to be edited and acquiring the second number of the pictorial items of the second pictorial item in the pictorial after being edited;
and acquiring the quotient of the first graphic item quantity and the second graphic item quantity, and determining the arithmetic square root of the quotient as the scale of the third shape in the edited graphic second item.
13. The method according to claim 2, wherein said performing graph layout on the edited graph to obtain the target graph in the slide to be processed comprises:
identifying the typesetting mode of a first diagram item in the diagram to be edited;
typesetting the extension diagram items in the edited diagram according to the typesetting mode to obtain an initial typesetting diagram in the slide to be processed;
and carrying out graphic layout on the initially laid-out graphic diagram according to a visual gravity center coincidence algorithm to obtain a target graphic diagram in the slide to be processed.
14. The method according to claim 13, wherein the identifying the layout mode of the first pictorial item in the diagram to be edited comprises:
dividing a first graphic item in the graphic diagram to be edited into N groups according to the graphic item serial number of the first graphic item in the graphic diagram to be edited, wherein N =2,3, \8230;, N is the same as the number of the first graphic items of the first graphic item;
for the n groups of any one of the division cases, performing the following processing:
acquiring third coordinates of the second shape in each group of first illustration items, wherein the third coordinates comprise vertex coordinates of a circumscribed rectangle of the second shape;
determining a first difference value between X-axis coordinate values in adjacent third coordinates and a second difference value between Y-axis coordinate values in adjacent third coordinates;
acquiring fourth coordinates of a first circumscribed rectangle formed by each group of first pictorial items, wherein the fourth coordinates comprise vertex coordinates of the first circumscribed rectangle;
determining a third difference value between the coordinate values of the X axis in the adjacent fourth coordinates and a fourth difference value between the coordinate values of the Y axis in the adjacent fourth coordinates;
and under the condition that the variance of the first difference value and the second difference value is smaller than a variance threshold value, and the variance of the third difference value and the fourth difference value is smaller than a variance threshold value, determining that the first graph item in the graph to be edited is in linear typesetting.
15. The method according to claim 14, wherein said typesetting said extended diagram item in said edited diagram according to said typesetting manner to obtain a first layout diagram in said slide to be processed comprises:
acquiring a fifth coordinate, wherein the fifth coordinate comprises vertex coordinates of a circumscribed rectangle of the first pictorial item in the n groups of the last group;
adjusting the fifth coordinate according to the first difference and the second difference, or the third difference and the fourth difference to obtain a sixth coordinate;
acquiring a seventh coordinate of a second circumscribed rectangle formed by the extended pictorial item, wherein the seventh coordinate comprises a vertex coordinate of the second circumscribed rectangle;
and adjusting the seventh coordinate to the sixth coordinate to obtain the initial typesetting diagram in the slide to be processed.
16. The method according to claim 13, wherein the identifying the layout mode of the first illustration item in the illustration to be edited comprises:
determining a straight line formed by the center points of circumscribed rectangles of adjacent first diagram items in the diagram to be edited;
determining the perpendicular bisectors of all the straight lines, and judging whether the perpendicular bisectors of all the straight lines intersect;
under the condition that the perpendicular bisectors of all the straight lines are intersected, judging whether the distances between the intersection points of the perpendicular bisectors of all the straight lines and all the central points are equal or not;
and under the condition that the distances between the intersection point and all the central points are equal, determining that the first diagram item in the diagram to be edited is the radial typesetting.
17. The method according to claim 16, wherein said typesetting said extended diagram item in said edited diagram according to said typesetting manner to obtain a first layout diagram in said slide to be processed comprises:
acquiring an included angle formed by a central point of a circumscribed rectangle of an adjacent first pictorial item in the pictorial to be edited and the intersection point;
and adjusting the expansion diagram item according to the included angle and the distance to obtain the initially laid-out diagram in the slide to be processed.
18. The method according to claim 1, wherein said performing graph layout on the edited graph to obtain the target graph in the slide to be processed comprises:
acquiring a preset typesetting mode;
typesetting the edited graphic representation by using the preset typesetting mode to obtain an initial typesetting graphic representation in the slide to be processed;
and carrying out graphic layout on the initially laid-out graphic diagram according to a visual gravity center coincidence algorithm to obtain a target graphic diagram in the slide to be processed.
19. The method according to claim 13 or 18, wherein said graphic layout of the initially laid out graphic representation according to the visual barycenter coincidence algorithm to obtain the target graphic representation in the slide to be processed comprises:
determining an original visual gravity center of the diagram to be edited;
and adjusting the target visual gravity center of the initially laid-out graphic representation so as to enable the target visual gravity center to coincide with the original visual gravity center, thereby obtaining the target graphic representation in the slide to be processed.
20. The method of claim 19, wherein said determining an original visual centroid of said representation to be edited comprises:
determining an original central point of the circumscribed rectangle of the diagram to be edited, and searching a position extending upwards by a preset distance in the vertical direction of the original central point;
and determining the position as the original visual gravity center of the diagram to be edited.
21. The method of claim 19, wherein said adjusting the target visual center of gravity of the original layout drawing to make the target visual center of gravity coincide with the original visual center of gravity to obtain the target drawing in the slide to be processed comprises:
determining the area of a fourth shape in a third graphic item of the initial layout drawing, and determining the barycentric coordinate of the fourth shape in the third graphic item according to the original visual barycenter and the area;
and adjusting a fourth shape in the third graphic item according to the barycentric coordinate to obtain a target graphic in the slide to be processed.
22. The method of claim 19, wherein after obtaining the target icon in the slide to be processed, the method further comprises:
determining a diagram typesetting area in the slide to be processed and a third circumscribed rectangle formed by the target diagram;
and under the condition that the third circumscribed rectangle does not exceed the diagram typesetting area, displaying a target diagram in the slide to be processed.
23. The method of claim 22, further comprising:
under the condition that the third circumscribed rectangle exceeds the graphic layout area, determining the proportion of the third circumscribed rectangle exceeding the graphic layout area;
and zooming the target graphic representation according to the proportion, determining the scaled target graphic representation as a primary typesetting graphic representation, and jumping to the step of adjusting the target visual barycenter of the primary typesetting graphic representation so as to enable the target visual barycenter to coincide with the original visual barycenter to obtain the target graphic representation in the slide to be processed.
24. The method according to claim 22, wherein said determining a layout area of a graphic in said slide to be processed comprises:
removing the edited graphic from the slide to be processed to obtain a target slide, and rendering the target slide to obtain a background image;
rasterizing the background image to obtain a raster image, and determining a diagram color corresponding to the edited diagram;
determining an original external rectangle corresponding to the edited diagram, and expanding outwards according to the grid of the grid image on the basis of the original external rectangle;
determining similarity between colors in a target grid of the grid image and background colors of the original circumscribed rectangle;
stopping expanding under the condition that the similarity is smaller than a preset similarity threshold value and the color in the target grid of the grid image is in conflict with the color of the diagram to obtain an initial layout area of the diagram;
and cutting areas of non-illustrated text shapes, table shapes and diagram shapes from the illustrated initial typesetting area to obtain an illustrated typesetting area.
25. The method according to claim 24, wherein said determining the icon color corresponding to the edited icon comprises:
acquiring a target text shape in the diagram item of the diagram after the diagram is edited, and determining the text color of the text in the target text shape as the diagram color corresponding to the diagram after the diagram is edited;
alternatively, the first and second liquid crystal display panels may be,
acquiring a graph shape in a second graphic item of the edited graphic, and determining the proportion of graph colors in the graph shape;
and determining the color of the graph with the ratio exceeding a preset ratio threshold value as the color of the graph corresponding to the edited graph.
26. The method of claim 24, wherein, in case that the similarity is less than a preset similarity threshold and the color in the target grid of the grid image conflicts with the color of the icon, stopping the expansion and obtaining the initial layout area of the icon, further comprising:
converting colors in a target grid of the grid image into a first gray value, and converting the graphic colors into a second gray value;
and determining that the color in the target grid of the grid image conflicts with the color of the graph under the condition that the first gray value and the second gray value are in the same gray interval.
27. A slide processing apparatus, characterized in that the apparatus comprises:
the slide acquisition module is used for acquiring a slide to be processed;
the diagram determining module is used for determining a diagram to be edited in the slide to be processed;
the diagram item determining module is used for determining a target diagram item in the diagram to be edited;
the graphic item editing module is used for editing the target graphic item to obtain an edited graphic in the slide to be processed;
and the graphic layout module is used for carrying out graphic layout on the edited graphic to obtain the target graphic in the slide to be processed.
28. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1-26 when executing a program stored in a memory.
29. A storage medium on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-26.
CN202211221966.9A 2022-10-08 2022-10-08 Slide processing method and device, electronic equipment and storage medium Pending CN115640789A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211221966.9A CN115640789A (en) 2022-10-08 2022-10-08 Slide processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211221966.9A CN115640789A (en) 2022-10-08 2022-10-08 Slide processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115640789A true CN115640789A (en) 2023-01-24

Family

ID=84941571

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211221966.9A Pending CN115640789A (en) 2022-10-08 2022-10-08 Slide processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115640789A (en)

Similar Documents

Publication Publication Date Title
US10417316B2 (en) Emphasizing a portion of the visible content elements of a markup language document
JP5851607B2 (en) Kanji composition method and apparatus, character composition method and apparatus, and font library construction method
US7593012B2 (en) Graphics image generation method, program and statistical data drawing apparatus
US9563630B2 (en) Dimensional conversion in presentations
CA2154760C (en) A method for automatically displaying map symbols
US9983760B2 (en) Apparatus, method and computer readable recording medium for arranging a plurality of items automatically in a canvas
Wu et al. ViSizer: a visualization resizing framework
KR20160025519A (en) Selecting and editing visual elements with attribute groups
US10565560B2 (en) Alternative people charting for organizational charts
US20120290925A1 (en) Incremental Graphic Object Layout Editing
US20120331378A1 (en) System and method for timeline visualization and interaction
KR20210122837A (en) Table processing methods, devices, smart interactive tablets and storage media
CN107526576B (en) Method and device for displaying view components of page
CN115640789A (en) Slide processing method and device, electronic equipment and storage medium
JP3922396B2 (en) Layout device and display device
CN109426458B (en) Method and device for printing relation graph
JP2024501735A (en) Method and computer-readable medium for automatic placement and matching of graphs in a diagram
JPH09146949A (en) Automatic article layout device
CN115087954A (en) Screen data editing program, screen data editing device, and screen data editing method
US11600028B1 (en) Semantic resizing of line charts
CN116719597B (en) Self-adaptive view rendering method and creation method based on grid layout
US9024965B2 (en) Determining a layout of graphic objects according to a layout density map
CN116976296A (en) Method, device, electronic equipment and storage medium for setting oblique lines in unit cell
Miyazaki et al. An occlusion-reduced 3d hierarchical data visualization technique
CN116541108A (en) Display layout typesetting conversion method, device, computer equipment and storage medium

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