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 derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a flowchart of an embodiment of a method for processing vector graphics provided by the present invention, where the method provided by the present embodiment is suitable for collecting and playing back a drawn vector graphics, and the method can be executed by a processing apparatus for vector graphics. As shown in fig. 1, the method of this embodiment may include:
and S110, receiving a collecting instruction.
In this embodiment, vector graphics can be drawn through vector graphics software, and a collection instruction sent by a user can be received, so as to record the vector graphics in the drawing process.
And S120, acquiring a touch sensing signal generated by a user triggering a screen, and acquiring a vector graph drawn on the canvas according to the acquisition instruction and the touch sensing signal to acquire a first dynamic vector graph.
In this embodiment, taking a processing device of vector graphics as a terminal device with a touch screen as an example, description will be given of drawing graphics: when a user starts to draw a graph on a blank canvas, when a finger starts to touch a screen and slides, the device acquires a touch sensing signal generated when the user touches the screen, and acquires a vector graph drawn on the canvas according to an acquisition instruction and the touch sensing signal triggered by the user before to acquire a first dynamic vector graph.
S130, acquiring a corresponding first dynamic data frame according to the first dynamic vector graph, and storing the first dynamic data frame in a vector data file; the first dynamic data frame comprises vector data corresponding to the collected first dynamic vector graphics, a first time and a dynamic vector graphics identifier, wherein the first time comprises the time when the user touches the screen or the time length when the user slides on the screen.
In this embodiment, recording of the vector graphics is generally based on acquisition and recording of the vector graphics, and image frames corresponding to the vector graphics are acquired and stored in the prior art, which may occupy a large storage space; in the method provided by this embodiment, a dynamic data frame corresponding to a collected first dynamic vector graphic is obtained according to the collected first dynamic vector graphic, where the data frame includes vector data corresponding to the first dynamic vector graphic, a first time, and a dynamic vector graphic identifier, and fig. 2 is a schematic structural diagram of a data frame provided in an embodiment of the present invention; specifically, the vector data is a regular data string formed by converting relative coordinates and combination rules of dynamic vector graphics in drawing into numbers and letters, and the vector data and the vector graphics can be converted into each other through a certain algorithm rule, wherein the first time is the recorded drawing time of the first dynamic vector graphics, specifically the time when the user touches the screen, or the time length when the user slides on the screen. Different from the prior art, in the embodiment, the first dynamic vector graphics are converted into the data frames and then stored in the vector data file in the form of the data structure, so that the occupation of the storage space is reduced.
In the processing method for the vector graphics provided by this embodiment, the dynamic vector graphics during drawing are acquired through the received acquisition instruction and the touch sensing signal generated by the screen triggered by the user, the acquired dynamic vector graphics are converted into a dynamic data frame form, and the dynamic vector graphics are stored in the vector data file in the form of a data structure, so that the problem of increased storage space caused by the way of storing the vector graphics in the image frame in the prior art is solved, the storage space occupied by the stored vector graphics is reduced, and the service performance of the terminal device for recording the vector graphics is improved.
Further, in another embodiment of the present invention, on the basis of the embodiment shown in fig. 1, the method further includes:
if the current user stops touching the screen, acquiring a first static vector graph on the current canvas, acquiring a corresponding first static data frame according to the first static vector graph or all static vector graphs stored in the first static vector graph and the vector data file, and storing the first static data frame in the vector data file; wherein the first static data frame includes vector data corresponding to the first static vector graphic, a second time, and a static vector graphic identifier; or the first static data frame includes vector data corresponding to the first static vector graphic, vector data corresponding to all static vector graphics stored before, the second time, and the static vector graphic identifier; the second time comprises the time corresponding to the current time when the user stops touching the screen.
It should be noted that the vector graphics currently drawn by the user are dynamic vector graphics, and when the user finishes drawing the current dynamic vector graphics, the dynamic vector graphics are converted into static vector graphics.
Fig. 3 is a vector graph provided by the method shown in fig. 1 of the present invention, and fig. 4 is a vector data file corresponding to the vector graph provided by the method shown in fig. 1 of the present invention, so as to illustrate a process of drawing the vector graph shown in fig. 3 on a canvas by a user, which illustrates a processing method of the vector graph provided by this embodiment; when a user triggers a point one position of a screen, recording a vector graph at the moment of triggering the point to generate a data frame 1, wherein the data frame 1 comprises a dynamic vector graph identifier, the corresponding time comprises the time when a finger touches the point one position of the screen, and the vector data comprises vector data corresponding to a line one (point one), and similarly, data frames 2-8 in a vector data file can be obtained; it should be noted that the data frame 4 is generated when the user stops drawing the line one, and the line one is converted from a dynamic vector graph into a static vector graph, so that the vector data of the data frames 3 and 4 are the same, and the graph identifier and time are different; in addition, the data frame 8 is generated when the user stops drawing the line two, at this time, the line two is converted into a static vector graphic from a dynamic vector graphic, and different from the data frame 4, the vector data of the data frame 8 comprises the vector data corresponding to the line two converted into the static vector graphic and the vector data corresponding to the static vector graphic line I stored before; in a specific implementation, the data frame further includes a separator for separating the statements between the two data frames, when the vector data file is read, the separator is used as an interval for reading and analyzing the data frames, and when the vector data file is recorded, the separator of the last data frame is a cut-off.
In the processing method of the vector graphics provided in this embodiment, the collection of the dynamic vector graphics is to record the currently drawn dynamic vector graphics, and the collection of the static vector graphics not only records the currently generated static vector graphics, but also records all the static vector graphics stored on the canvas.
FIG. 5 is a flowchart illustrating a method for processing vector graphics according to another embodiment of the present invention. As shown in fig. 5, the method of this embodiment may include:
and S210, receiving a collecting instruction.
S220, acquiring a touch sensing signal generated by a user triggering a screen, and acquiring a vector graph drawn on a canvas according to the acquisition instruction and the touch sensing signal to acquire a first dynamic vector graph.
S230, acquiring a corresponding first dynamic data frame according to the first dynamic vector graph, and storing the first dynamic data frame in a vector data file; the first dynamic data frame comprises vector data corresponding to the collected first dynamic vector graphics, a first time and a dynamic vector graphics identifier, wherein the first time comprises the time when the user touches the screen or the time length when the user slides on the screen.
S240, if the user stops touching the screen at present, acquiring a first static vector graph on the current canvas, acquiring a corresponding first static data frame according to the first static vector graph or the first static vector graph and all static vector graphs stored in the vector data file, and storing the first static data frame in the vector data file; the first static data frame comprises the first static vector graphics, vector data corresponding to all the stored static vector graphics, a second time and a static vector graphics identifier.
And S250, receiving an editing instruction, wherein the editing instruction comprises M vector graphics to be edited and corresponding editing parameters.
In the method for processing a vector graphic provided in this embodiment, a user may also edit a vector graphic that has been already drawn, and all the finished vector graphics are static vector graphics before editing, for example, the user may send an editing instruction to M finished vector graphics on a canvas, where the editing instruction includes the M vector graphics to be edited and corresponding editing parameters.
And S260, editing the corresponding vector graphics to be edited on the canvas according to the editing parameters in sequence, and collecting the edited vector graphics in sequence to obtain the corresponding second dynamic vector graphics.
S270, acquiring corresponding second dynamic data frames according to the M second dynamic vector graphs, and storing the second dynamic data frames in a vector data file; the second dynamic data frame comprises the sum of the vector data corresponding to the M second dynamic vector graphics, a third time and a dynamic vector graphics identifier, wherein the third time comprises the time length for editing the vector graphics to be edited.
In this embodiment, M vector graphics to be edited indicated by an editing instruction are selected, the M static vector graphics are converted into dynamic vector graphics, and the selected M dynamic vector graphics are edited according to editing parameters in the editing instruction; in specific implementation, the editing processing on the selected vector graphics may be editing of the selected vector graphics by a user, such as stretching, moving, changing colors and shapes, and correspondingly, the edited vector graphics are collected again, and a corresponding second dynamic vector graphics is obtained and stored in a vector data file; in another method for processing a vector graphic provided in this embodiment, the selected vector graphic may be edited by a user through a preset algorithm rule on a vector level, specifically, the content of the vector data is edited, and accordingly, the edited data frame is directly stored in a vector data file.
In the processing method for the vector graphics provided by this embodiment, the dynamic vector graphics during drawing are acquired through the received acquisition instruction and the touch sensing signal generated by the screen triggered by the user, the acquired dynamic vector graphics are converted into a dynamic data frame form, and the dynamic vector graphics are stored in the vector data file in the form of a data structure, so that the problem of increased storage space caused by the way of storing the vector graphics in the image frame in the prior art is solved, the storage space occupied by the stored vector graphics is reduced, and the service performance of the terminal device for recording the vector graphics is improved. In addition, according to the selection and the editing of the received editing instruction, the data frame corresponding to the vector graphics is also stored after the editing, so that the resolution of the graphics can be ensured by editing the vector graphics, and the display effect of the vector graphics is ensured; furthermore, in the recording process of the vector graphics, when the vector graphics are changed, the vector graphics are acquired and converted and stored into data frames, so that the problem that a large amount of redundant data is stored due to the fact that image frames corresponding to the vector graphics captured every second are stored in the prior art is solved, and waste of storage space is reduced.
Further, in another embodiment of the present invention, on the basis of the embodiment shown in fig. 5, the method may further include:
s280, collecting other vector graphics except the vector graphics to be edited on the canvas, acquiring a corresponding second static data frame according to the other vector graphics, and storing the second static data frame in a vector data file; the second static data frame comprises the sum of vector data corresponding to other vector graphics, a fourth time and a static vector graphics identifier; the fourth time is the time when the user selects the first vector graphics to be edited.
It should be noted that, the number of the edited static vector graphics on the canvas is greater than or equal to M, where M static vector graphics included in the editing instruction are converted into dynamic vector graphics, and although other static vector graphics not included in the editing instruction are not changed, they need to be collected again and converted into data frames for storage according to the editing instruction of the vector graphics on the canvas.
FIG. 6 is a flowchart illustrating a method for processing vector graphics according to another embodiment of the present invention. As shown in fig. 6, the method may specifically include:
and S310, receiving a collecting instruction.
S320, acquiring a touch sensing signal generated by a user triggering a screen, and acquiring a vector graph drawn on the canvas according to the acquisition instruction and the touch sensing signal to acquire a first dynamic vector graph.
S330, acquiring a corresponding first dynamic data frame according to the first dynamic vector graph, and storing the first dynamic data frame in a vector data file; the first dynamic data frame comprises vector data corresponding to the collected first dynamic vector graphics, a first time and a dynamic vector graphics identifier, wherein the first time comprises a time length from the time when the user touches the screen to the time when the user stops touching the screen.
S340, if the user stops touching the screen at present, acquiring a first static vector graph on the current canvas, acquiring a corresponding first static data frame according to the first static vector graph or the first static vector graph and all static vector graphs stored in the vector data file, and storing the first static data frame in the vector data file; the first static data frame comprises the first static vector graphics, vector data corresponding to all the stored static vector graphics, a second time and a static vector graphics identifier.
And S350, starting a timer to start timing.
In this embodiment, the recording instruction of the vector graphic is completed, and the vector graphic can be played back according to the saved vector data file, and the relative time generated by the vector graphic is recorded in the data frame during recording, so that the relative time during playback can be obtained in a manner of timing by a timer during playback.
And S360, reading the data frames from the data frames stored in the vector data file according to the received playback instruction in sequence.
In this embodiment, according to a received playback instruction of a user for a vector graphic, reading stored data frames from a vector data file corresponding to the vector graphic, and generally reading and analyzing the data frames sequentially according to an acquisition order; in a specific implementation, a part of the data frames may be read first, and then the data frames may be sequentially analyzed according to the order of the data frames.
S370, acquiring the time in the read data frame, and acquiring the relative time recorded by the timer when the data frame is read.
S380, if the difference between the time in the data frame and the relative time recorded by the timer when the data frame is read is less than or equal to zero, loading the vector data in the data frame.
In the present embodiment, in the playback of the vector graphics, the relative time recorded by the timer may reflect the relative position with the time in the read data frame, so that, taking the time recorded by the timer as a time reference, the saved data frame is played back, and if the difference between the time in the data frame and the relative time recorded by the timer is less than or equal to zero, it indicates that the current time from the beginning of timing exceeds the relative time recorded by the data frame, and thus the vector data in the data frame is immediately loaded.
Similarly, the method for processing a vector graphic provided in this embodiment further includes:
s390, if the difference between the time in the data frame and the relative time recorded by the timer when the data frame is read is greater than zero, loading the vector data in the data frame after the difference between the time in the data frame and the relative time recorded by the timer when the data frame is read.
It should be noted that in this embodiment, S380 and S390 have no explicit sequence.
For example, fig. 7 is a playback process of a vector graphic provided by the method shown in fig. 6 according to the present invention, and specifically plays back the vector data file provided in fig. 4. It should be noted that, the processing method of a vector graphics provided in this embodiment specifically includes, when vector data in a data frame is loaded: if the vector graphic identifier in the data frame is a static vector graphic identifier, emptying the canvas and then loading the vector data in the data frame; or, if the vector graphics identifier in the data frame is the dynamic vector graphics identifier, replacing the dynamic vector graphics corresponding to the vector data in the data frame with the dynamic vector graphics on the current canvas. For example, the vector graphic identifiers in the data frames 4 and 8 are static vector graphic identifiers, so that all vector graphics on the canvas need to be emptied, and then the vector data in the data frames are loaded, and since all vector graphics on the current canvas are stored for the static vector graphics during acquisition, all graphics in the recorded canvas can be displayed by emptying the canvas during playback; for another example, the vector graphics identifiers in the data frames 6 and 7 are dynamic vector graphics identifiers, when the data frame 7 is loaded, the vector graphics corresponding to the data frame 6 is displayed on the current canvas, the dynamic vector graphics in the data frame 6 is replaced by the dynamic vector graphics corresponding to the data frame 7, and the static vector graphics in the data frame 7 is the same as the data frame 6, and therefore remains unchanged.
In the processing method for the vector graphics provided by this embodiment, the dynamic vector graphics during drawing are acquired through the received acquisition instruction and the touch sensing signal generated by the screen triggered by the user, the acquired dynamic vector graphics are converted into a dynamic data frame form, and the dynamic vector graphics are stored in the vector data file in the form of a data structure, so that the problem of increased storage space caused by the way of storing the vector graphics in the image frame in the prior art is solved, the storage space occupied by the stored vector graphics is reduced, and the service performance of the terminal device for recording the vector graphics is improved. In addition, according to the data frames stored in the vector data file, the corresponding vector graphics are played back, the playback process is the same as the sequence of recording the data frames, and the dynamic display effect can clearly show the drawing process; further, vector graphics stored in the form of data frames are displayed in a zooming mode during playback, the vector graphics are displayed on the basis of the vector data in the data frames, and the resolution of the vector graphics during playback and the display effect of a screen can be guaranteed.
Further, in the processing method of the vector graphics provided in each of the embodiments of the present invention, when the vector graphics drawn on the canvas are collected according to the collection instruction, the voice information during drawing the vector graphics may also be recorded, where the voice information may specifically be explanation of the drawing process of the vector graphics, and the like; correspondingly, when the vector data file corresponding to the vector graphics is read according to the playback instruction, the recorded voice information can also be read, and the voice information and the vector graphics are played back at the same time.
Fig. 8 is a schematic structural diagram of an embodiment of a vector graphics processing apparatus according to the present invention. As shown in fig. 8, the processing apparatus for vector graphics provided in this embodiment specifically includes: the device comprises a receiving module 11, an acquisition module 12 and a dynamic data frame acquisition module 13.
The receiving module 11 is configured to receive an acquisition instruction.
The acquisition module 12 is configured to acquire a touch sensing signal generated by a user triggering a screen, and acquire a vector graph drawn on a canvas according to the acquisition instruction and the touch sensing signal received by the receiving module 11, so as to acquire a first dynamic vector graph.
A dynamic data frame obtaining module 13, configured to obtain a corresponding first dynamic data frame according to the first dynamic vector graph collected by the collecting module 12, and store the first dynamic data frame in a vector data file; the first dynamic data frame comprises vector data corresponding to the collected first dynamic vector graphics, a first time and a dynamic vector graphics identifier, wherein the first time comprises the time when the user touches the screen or the time length when the user slides on the screen.
The vector graphics processing apparatus according to the embodiment of the present invention is configured to execute the vector graphics processing method according to the embodiment of fig. 1 of the present invention, and has corresponding functional modules, which implement similar principles and technical effects, and are not described herein again.
Fig. 9 is a schematic structural diagram of a vector graphics processing apparatus according to another embodiment of the present invention. The vector graphics processing apparatus provided in this embodiment is based on the apparatus structure shown in fig. 8, and the apparatus further includes:
a static data frame obtaining module 14, configured to, when the user stops touching the screen at present, collect a first static vector graphic on a current canvas, obtain a corresponding first static data frame according to the first static vector graphic, or the first static vector graphic and all static vector graphics stored in the vector data file, and store the first static data frame in the vector data file; wherein the first static data frame includes vector data corresponding to the first static vector graphics, a second time, and a static vector graphics identifier; or the first static data frame includes vector data corresponding to the first static vector graphic, vector data corresponding to all static vector graphics stored before, the second time, and the static vector graphic identifier; the second time comprises the time corresponding to the current time when the user stops touching the screen.
It should be noted that the vector graphics currently drawn by the user are dynamic vector graphics, and when the user finishes drawing the current dynamic vector graphics, the dynamic vector graphics are converted into static vector graphics.
Preferably, the receiving module 11 is further configured to receive an editing instruction, where the editing instruction includes M vector graphics to be edited and corresponding editing parameters.
The apparatus may further include: and the processing module 15 is configured to sequentially edit the corresponding vector graphics to be edited on the canvas according to the editing parameters received by the receiving module 11, and sequentially collect the edited vector graphics to obtain a corresponding second dynamic vector graphics.
In this embodiment, correspondingly, the dynamic data frame obtaining module 13 is further configured to obtain, according to the M second dynamic vector graphics, a corresponding second dynamic data frame, and store the second dynamic data frame in the vector data file; the second dynamic data frame comprises the sum of the vector data corresponding to the M second dynamic vector graphics, a third time and a dynamic vector graphics identifier, wherein the third time comprises the time length for editing the vector graphics to be edited.
The vector graphics processing apparatus according to the embodiment of the present invention is configured to execute the vector graphics processing method according to the embodiment of fig. 5 of the present invention, and has corresponding functional modules, which implement similar principles and technical effects, and are not described herein again.
FIG. 10 is a flowchart illustrating a vector graphics processing apparatus according to another embodiment of the present invention. The vector graphics processing device provided by the embodiment is based on the device structure shown in fig. 9,
the processing module 15 is further configured to collect other vector graphics on the canvas besides the vector graphics to be edited; correspondingly, the static data frame obtaining module 14 is further configured to obtain a corresponding second static data frame according to the other vector graphics, and store the second static data frame in the vector data file; wherein the second static data frame includes a sum of vector data corresponding to the other vector graphics, a fourth time, and a static vector graphics identifier; the fourth time is a time when the user selects the first vector graphics to be edited.
It should be noted that, the number of the edited static vector graphics on the canvas is greater than or equal to M, where M static vector graphics included in the editing instruction are converted into dynamic vector graphics, and although other static vector graphics not included in the editing instruction are not changed, they need to be collected again and converted into data frames for storage according to the editing instruction of the vector graphics on the canvas.
Preferably, the apparatus may further comprise:
and the timing module 16 is used for starting a timer to start timing.
And a reading module 17, configured to read data frames in sequence from the data frames stored in the vector data file according to the received playback instruction.
And a time obtaining module 18, configured to obtain the time in the read data frame, and obtain the relative time recorded by the timer when the data frame is read.
And a loading module 19, configured to load the vector data in the data frame when a difference between a time in the data frame and a relative time recorded by the timer when the data frame is read is less than or equal to zero.
The loading module 19 is further configured to load the vector data in the data frame after the difference between the time in the data frame and the relative time recorded by the timer when the data frame is read is greater than zero.
It should be noted that, in the processing apparatus for vector graphics provided in this embodiment, when the loading module 19 loads the vector data in the data frame, the processing apparatus specifically includes: if the vector graphic identifier in the data frame is a static vector graphic identifier, emptying the canvas and then loading the vector data in the data frame; or, if the vector graphics identifier in the data frame is a dynamic vector graphics identifier, replacing the dynamic vector graphics corresponding to the vector data in the data frame with the dynamic vector graphics on the current canvas.
The vector graphics processing apparatus according to the embodiment of the present invention is configured to execute the vector graphics processing method according to the embodiment of fig. 6 of the present invention, and has corresponding functional modules, which implement similar principles and technical effects, and are not described herein again.
Further, the vector graphics processing apparatus provided in each of the above embodiments of the present invention may further include: the voice recording module is used for recording voice information when the vector graphics are drawn when the vector graphics drawn on the canvas are collected according to the collection instruction, and the voice information can be specifically explanation of the vector graphics drawing process and the like; correspondingly, when the reading module reads the vector data file corresponding to the vector graphics according to the playback instruction, the reading module can also read the recorded voice information, so that the loading module can play back the voice information and the vector graphics at the same time.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.