[specific embodiment]
To keep the purposes, technical schemes and advantages of the embodiment of the present application clearer, below in conjunction with the embodiment of the present application
In attached drawing, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that described embodiment is
Some embodiments of the present application, instead of all the embodiments.Based on the embodiment in the application, those of ordinary skill in the art
Every other embodiment obtained without creative efforts, shall fall in the protection scope of this application.
Fig. 1 is the flow diagram for the Graphics and Image Processing that one embodiment of the application provides.As shown in Figure 1, the party
Method includes:
101, browser obtains the interactive command for being used to indicate progress graph and image processing that user issues.
102, above-mentioned interactive command is sent to server by browser, to indicate server progress graph and image processing and return
Return the graph image that graph and image processing generates.
103, browser receives the graph image that server returns.
104, browser shows above-mentioned graph image.
The present embodiment provides a kind of Graphics and Image Processings, can be executed by browser.The browsing utensil of the present embodiment
There is the function of interacting with user, such as browser can realize the interaction with user by included interactive command system.It is based on
The function of interacting with user, what the available user of browser issued is used to indicate the interactive command for carrying out graph and image processing.
In addition, the browser of the present embodiment also has the function of interacting with server, and it is based on the function, realized logical with server
Letter.
It is worth noting that the graph and image processing that the present embodiment is related to can be the processing for generating new graph image,
It is also possible to modify the processing of existing graphics image.The processing of modification existing graphics image can be in modification existing graphics image
The various processing such as color, shape, the scaling of parts of images.
Specifically, interactive command, interaction life can be issued to browser when user is desired with graph and image processing
Order is used to indicate carry out graph and image processing.Browser obtains the interactive command that user issues.
For example, user can be passed to interactive command to browser by various external equipments.For example, user can specifically lead to
It crosses the modes such as mouse click, right click, sliding and issues interactive command to browser.In another example browser can provide a user one
Input frame, then user can input interactive command to browser by keyboard.
In the present embodiment, browser get user sending instruction carry out graph and image processing interactive command it
Afterwards, which is sent to server, to indicate server progress graph and image processing and return to graph and image processing life
At graph image.
For server, the interactive command that browser is sent is received, is determined according to the interactive command and carries out graph image
Parameter needed for processing.In the present embodiment, parameter needed for carrying out graph and image processing can be determined by interactive command.
Optionally, various parameters needed for the interactive command that user issues can carry progress graph and image processing, example
As may include: the second ginseng needed for instruction carries out processing indicated by the first parameter of the first parameter and progress of which kind of processing
Number.For example, the first parameter can indicate to draw new graph image, the second parameter may include: graph image drafting position,
Color used in the location index of data needed for the size of graph image, graphing image or required data, drafting etc.
Deng.In another example the first parameter can indicate modification existing graphics image, the second parameter may include: the mark of existing graphics image
Know, modifier area, modified color and shape etc..
Based on the optional embodiment, server can be carried out directly needed for graph and image processing from acquisition in interactive command
Parameter.
Optionally, the interactive command that user issues is corresponding with various parameters needed for progress graph and image processing.For example,
Parameter needed for carrying out various graph and image processings can be preset, and friendship needed for being set for various graph and image processings
Parameter needed for every kind of graph and image processing and interactive command are formed corresponding relationship by mutually order.
Based on the optional embodiment, server can according to the corresponding relationship between preset interactive command and parameter,
Parameter corresponding with the interactive command that user issues is obtained as parameter needed for carrying out graph and image processing.
After parameter needed for server determines progress graph and image processing according to interactive command, carried out according to these parameters
Graph and image processing generates graph image, and the graph image of generation is returned to browser
Browser receives the graph image that server returns and is shown, realizes the interactive graphics figure based on browser
As system, the advantage for the graphic image system that can be interacted is given full play to, such as user can be by sending commands to change browsing
The content or browser of graph image shown by device can also using line segment fluctuate show the magnitude of data and
Trend, etc..
In the present embodiment, browser can be interacted with user, and obtain user's sending is used to indicate carry out graph image
The interactive command of processing, and by the way that interactive command is sent to server, instruction server carries out graph and image processing and returns
Graph and image processing graph image generated, and then the graph image that display server returns, realize based on browser
Interactive graphic images system, since graph and image processing is completed by server, so whether do not supported by browser can
The limitation of the graphics technology of programming is conducive to the advantage for giving full play to the graphic image system that can be interacted.
Fig. 2 is the flow diagram for the Graphics and Image Processing that another embodiment of the application provides.As shown in Fig. 2, should
Method includes:
201, browser obtains the interactive command for being used to indicate progress graph and image processing that user issues.
202, browser judges whether itself has the ability by being programmatically-generated graph image;If it is judged that
It is no, execution step 203;If it is judged that being yes, execution step 205.
203, above-mentioned interactive command is sent to server by browser, to indicate server progress graph and image processing and return
The graph image that graph and image processing generates is returned, and executes step 204.
204, browser receives the graph image that server returns, and executes step 206.
205, browser carries out graph and image processing according to above-mentioned interactive command, to generate graph image, and executes step
206。
206, browser shows graph image.
Optionally, browsing implement body can judge in the following ways whether itself has by being programmatically-generated figure
The ability of shape image:
Browser execution detects code, to detect whether browser provides graph image generation interface;
If detecting, graph image generates interface, determines that browser has the energy by being programmatically-generated graph image
Power;
If graph image, which is not detected, generates interface, determine that browser does not have by being programmatically-generated graph image
Ability.
Programming language JavaScript can be used to write in above-mentioned detection code.
Graph image is generated in view of canvas technology or svg technology can be used in browser, then above-mentioned detection generation
Code can be used for detecting whether browser supports canvas technology or svg technology, specifically, for detecting whether browser provides
The corresponding graph image of canvas technology generates interface or the corresponding graph image of svg technology generates interface.
It is, for example, possible to use one section of JavaScript codes to judge, whether browser has canvas technology corresponding
Graph image generates interface.A kind of implementation of JavaScript code is as follows:
Var canvas=document.createElement (' canvas ');
After running above-mentioned JavaScript code, if canvas is equal to undefined (undefined), it is determined that browser is not
Have the corresponding graph image of canvas technology and generates interface (not supporting canvas technology).
Similarly, one section of JavaScript code can be used to judge whether browser has the corresponding figure of svg technology
Image generates interface.A kind of implementation of JavaScript code is as follows:
Var svg=document.createElement (' svg ');
After running above-mentioned JavaScript code, if svg is equal to undefined (undefined), it is determined that browser does not have
Interface is generated for the corresponding graph image of svg technology.
It is worth noting that if browser has the corresponding graph image of one of both the above technology and generates interface, it is clear
Device of looking at has the ability by being programmatically-generated graph image;Only do not have the corresponding graphic diagram of any of the above technology
When as generating interface, browser does not just have the ability by being programmatically-generated graph image.
Method provided in this embodiment is similar with the method that embodiment illustrated in fig. 1 provides, and difference is: in the present embodiment
In, browser needs to judge whether itself has the ability by being programmatically-generated graph image, leads to when browser does not have
When crossing the ability for being programmatically-generated graph image, graph and image processing is carried out to generate graph image by server;When
When browser has the ability by being programmatically-generated graph image, browser oneself carries out graph and image processing to generate figure
Shape image.The part similar with embodiment illustrated in fig. 1 repeats no more in the present embodiment, reference can be made to the description of Fig. 1.
In the present embodiment, browser passes through the ability with by being programmatically-generated graph image that judges whether, and
When having the ability by being programmatically-generated graph image, browser oneself carries out graph and image processing to generate graphic diagram
Picture can mitigate the processing load of server while guaranteeing that interactive graphic images system may be implemented.
The another embodiment of the application provides a kind of server according to interactive command, carries out graph and image processing to generate
The method of graph image, the embodiment can be realized based on above-mentioned Fig. 1 and embodiment shown in Fig. 2.Specifically, server can be with
According to the Graphics Programming code that interactive command, operation are realized using browser graphic image technique, to carry out graph image
It handles and generates graph image.In simple terms, the graphics technology that the server of the application can support browser to be supported,
Therefore same set of Graphics Programming code can be used with browser.Based on this, developer need to only write a set of graphic diagram
As programming code, development efficiency can be improved.Optionally, the Graphics Programming code can be deployed in browsing respectively in advance
On device and server, in order to browser and server use.Wherein, programming language can be used in developer, such as
JavaScript generates interface controlling the graph image of browser and generates graph image.And the figure of these control browsers
The code that image generates interface generation graph image is referred to as Graphics Programming code.
For example, it is contemplated that most graph image systematic functions of browser may be implemented to node-webkit technology, because
The Graphics Programming code of this application can be realized using node-webkit technology.Server can be based in this way
Nodejs platform is realized.
It is worth noting that method provided by the present application is suitable for various browsers, whether do not supported to compile by browser
The limitation of the graphics technology of journey, such as can be used for ie6, the browsers such as ie7, ie8.
It should be noted that for the various method embodiments described above, for simple description, therefore, it is stated as a series of
Combination of actions, but those skilled in the art should understand that, the application is not limited by the described action sequence because
According to the application, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art should also know
It knows, the embodiments described in the specification are all preferred embodiments, related actions and modules not necessarily the application
It is necessary.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, there is no the portion being described in detail in some embodiment
Point, reference can be made to the related descriptions of other embodiments.
Fig. 3 is the structural schematic diagram for the browser that one embodiment of the application provides.As shown in figure 3, the browser includes: to obtain
Modulus block 31, sending module 32, receiving module 33 and display module 34.
Module 31 is obtained, for obtaining the interactive command for being used to indicate progress graph and image processing of user's sending.
Sending module 32 is connect with module 31 is obtained, and the interactive command for will acquire the acquisition of module 31 is sent to service
Device, to indicate server progress graph and image processing and return to the graph image of graph and image processing generation.
Receiving module 33, for receiving the graph image of server transmission.
Display module 34 is connect with receiving module 33, for showing the received graph image of receiving module 33.
Further, as shown in figure 4, the browser further include: detection module 35 is connect with sending module 32, for sending out
Before sending module 32 that interactive command is sent to server, whether detection browser itself has by being programmatically-generated figure
The ability of image, and when detecting that browser does not have the ability by being programmatically-generated graph image, triggering sends mould
Block 32, which is executed, is sent to server for interactive command, to indicate server progress graph and image processing and return to graph and image processing
The operation of the graph image of generation.
In an optional embodiment, detection module 35 is particularly used in:
Operation detection code, to detect whether browser has graph image generation interface;
If detecting, graph image generates interface, determines that browser has the energy by being programmatically-generated graph image
Power;
If graph image, which is not detected, generates interface, determine that browser does not have by being programmatically-generated graph image
Ability.
Browser provided in this embodiment can be interacted with user, and obtain user's sending is used to indicate carry out graphic diagram
As the interactive command of processing, and by the way that interactive command is sent to server, instruction server carries out graph and image processing and returns
Graph and image processing graph image generated, and then the graph image that display server returns are returned, is realized based on browser
Interactive graphic images system, since graph and image processing is completed by server, so whether not supported by browser
The limitation of programmable graphics technology is conducive to the advantage for giving full play to the graphic image system that can be interacted.
Fig. 5 is the structural schematic diagram for the server that one embodiment of the application provides.As shown in figure 5, the server includes: to connect
Receive module 51, graph and image processing module 52 and sending module 53.
Receiving module 51 should for receiving the interactive command for being used to indicate progress graph and image processing of browser transmission
Interactive command is that user issues.
Graph and image processing module 52 is connect with receiving module 51, for according to the received interactive command of receiving module 51
Graph and image processing is carried out, to generate graph image.
Sending module 53 is connect with graph and image processing module 52, the figure for generating graph and image processing module 52
Shape image is sent to browser, so that browser shows graph image.
In an optional embodiment, graph and image processing module 52 is particularly used in: received according to receiving module 51
Interactive command, the Graphics Programming code that operation is realized using browser graphic image technique, to carry out graph and image processing
And generate graph image.
Server provided in this embodiment is matched with browser provided by the above embodiment, is sent according to browser
Interactive command carries out graph and image processing, and the graph image of generation is sent to browser, so that browser realizes interactive mode
Graphic image system, provide condition to give full play to the advantage for the graphic image system that can be interacted.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description,
The specific work process of device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In several embodiments provided herein, it should be understood that disclosed system, device and method can be with
It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the unit
It divides, only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple units or components
It can be combined or can be integrated into another system, or some features can be ignored or not executed.Another point, it is shown or
The mutual coupling, direct-coupling or communication connection discussed can be through some interfaces, the indirect coupling of device or unit
It closes or communicates to connect, can be electrical property, mechanical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme
's.
It, can also be in addition, each functional unit in each embodiment of the application can integrate in one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list
Member both can take the form of hardware realization, can also realize in the form of hardware adds SFU software functional unit.
The above-mentioned integrated unit being realized in the form of SFU software functional unit can store and computer-readable deposit at one
In storage media.Above-mentioned SFU software functional unit is stored in a storage medium, including some instructions are used so that a computer
It is each that equipment (can be personal computer, server or the network equipment etc.) or processor (processor) execute the application
The part steps of embodiment the method.And storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only memory (Read-
Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic or disk etc. it is various
It can store the medium of program code.
Finally, it should be noted that above embodiments are only to illustrate the technical solution of the application, rather than its limitations;Although
The application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it still may be used
To modify the technical solutions described in the foregoing embodiments or equivalent replacement of some of the technical features;
And these are modified or replaceed, each embodiment technical solution of the application that it does not separate the essence of the corresponding technical solution spirit and
Range.