Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with attached drawing to the present invention make into
One step it is described in detail.
The flow diagram of the character effect method for drafting of one embodiment in Fig. 1 is please referred to, including step S101 is extremely walked
Rapid S103:
S101 obtains the character in text box, obtains the characters in a fancy style effect to be drawn of each character.It is obtained in this step
The characters in a fancy style effect to be drawn of each character, the comparison for subsequent step characters in a fancy style effect.
The characters in a fancy style effect is to be configured by content, pattern, shape, font spacing, the size etc. to characters in a fancy style,
The decorative effect of the characters in a fancy style of formation, including but not limited to luminous, shade, inverted image, frame, fuzzy and other effects.
S102 judges in the characters in a fancy style effect to be drawn of adjacent character with the presence or absence of identical characters in a fancy style effect, if so,
Every kind of the adjacent character identical characters in a fancy style effect is plotted to same drafting primitive respectively.
The primitive of drawing is the visual object (painting canvas) that provide one piece of operating system can be used for presentation content, it big
The small content by presenting determines that a primitive can only draw a kind of characters in a fancy style effect.
Every kind of adjacent character identical characters in a fancy style effect can be plotted to respectively same drafting primitive, also by this step
That is every kind of identical characters in a fancy style effect of adjacent character shares the same drafting primitive.For example, current character has frame and shade
Two kinds of effects, if its adjacent character is without both effects, current character needs two drafting primitives to draw the two
Effect, if previous character also has an effect of frame, the border effect of the border effect of current character and previous character is drawn
It makes on the same drafting primitive, and then reduces by a drafting primitive.Therefore, it can be reduced by this step and draw primitive
Quantity improves the drafting efficiency of characters in a fancy style effect.
Further, in step s101, the character attibute for obtaining each character, the character attibute includes character
Overstriking, italic, font, font size, one of underscore or a variety of combinations;Character is generated by character attibute and obtains word
Accord with the position of profile and each character.In step s 102, every kind of identical characters in a fancy style effect by the adjacent character
It is plotted to same drafting primitive respectively, including imitating every kind of the adjacent character identical characters in a fancy style according to the character outline
Fruit is plotted to same drafting primitive respectively.
Further, after the character outline for obtaining each character, judge whether the character outline of each character becomes
Change, if it is not, the corresponding effect layer of each character when last refresh is obtained, with the effect layer to respective symbols in text box
It is rendered.For example, when inputting or deleting character, other than character newly input or deletion, other characters' properties
It does not change, the character that attribute is not changed is not needed to repaint drafting primitive, reduce the drafting of characters in a fancy style effect
Number, to improve drafting efficiency.
S103 generates the corresponding effect layer of the drafting primitive, with the effect layer to adjacent character described in text box
It is rendered, the characters in a fancy style effect after display rendering.
Based on existing display technology, operating system can frequently refresh interface, and the hair light and shade in artistic effect
And other effects refresh when be very expendable can.This step is generated corresponding based on the drafting primitive generated in step S102
Effect layer, then effect rendering is carried out with the effect layer, reduce the quantity of system rendering, to improve rendering efficiency.
Further, described that adjacent character in text box is rendered with the effect layer, including obtain the character
The new location information in text box is laid out the effect layer according to new location information, for example, can will obtain
The effect layer of character is placed into the lower section of corresponding text, the layout of effect layer is carried out to the character, with effect layer after layout to text
Adjacent character is rendered in this frame.
Further, complete in text box after being rendered with the effect layer to adjacent character described in text box
When the characters in a fancy style effect of portion's character renders completion, the screenshot of the text box is obtained;The screenshot is shown to the text box
On corresponding position, the text box is hidden with the screenshot.Picture is placed into accordingly by this step by entire text box screenshot
On the position of text box, and real text box is hidden, so that operating system has only refreshed a picture when refreshing, and
Without refreshing the artistic effect of entire all characters of text box, the rendering efficiency of system is further improved.
Further, can the text box of monitoring system lose focus event, if the corresponding text box loses focus thing
Part is triggered, then determine text frame be in lose focus condition, so that it is determined that in text box alphabet characters in a fancy style effect
Rendering is completed, otherwise, it determines the characters in a fancy style effect of alphabet does not render completion in text box.
The characters in a fancy style effect method for drafting of the present embodiment, by obtaining the character in text box, and each character of acquisition
Characters in a fancy style effect to be drawn, every kind of adjacent character identical characters in a fancy style effect to be drawn is plotted to same drafting respectively
Primitive generates the corresponding effect layer of the drafting primitive, is rendered with the effect layer to adjacent character described in text box,
Characters in a fancy style effect after display rendering.Therefore, the present invention can be by every kind of adjacent character identical characters in a fancy style effect to be drawn
It is plotted to same drafting primitive respectively, reduces the quantity for drawing primitive, saves occupied system when drawing characters in a fancy style effect
System resource, to improve system effectiveness.
The following are a better embodiments of characters in a fancy style effect method for drafting of the invention, as shown in Fig. 2, including step
S201 to step S213:
S201 starts.
S202 obtains character.It is equipped with text box in present embodiment, obtains the character that user inputs in text box, and
Final characters in a fancy style effect is presented.
S203 refreshes character effect and shows.Refresh text box after obtaining character, so as to by the character newly inputted and effect
It is shown in text box.
S204 obtains character outline and position.The profile of character is needed when drawing artistic effect, the drafting of effect is based on word
Accord with profile;It needs to be placed into text box on the position of respective symbols after having drawn effect, therefore needs to obtain the position of current character
It sets.
S205, judges whether character outline is changed.The character attibute of each character is obtained, the character attibute includes character
Overstriking, italic, font, font size, one of underscore or a variety of combinations;Character is generated by character attibute and obtains word
The position for according with profile and each character, judges whether the character outline of each character changes, if so, S207 is entered step, if
It is no, enter step S206.
S206, effect layer before acquisition.Characters' property information obtains word when last refresh there is no variation
Corresponding effect layer is accorded with, such as: when being inserted into text among text box, all non-Alternative Attribute of the subsequent text in insertion position,
Position is only moved, then directly acquiring the effect layer drawn when last refreshing there is no need to repaint effect layer.
S207 judges whether adjacent character effect is identical.If so, entering step S209, otherwise, S208 is entered step.
S208 creates effect layer.Adjacent character effect is not identical, needs to re-establish effect layer.
S209 obtains adjacent character effect layer.
S210 draws effect layer.The identical characters in a fancy style effect of the adjacent character is plotted to same drafting primitive.
S211 is laid out effect layer.Character location information new in text box is obtained, according to new location information pair
The effect layer is laid out.
S212, effect rendering display.Respective symbols in text box are rendered with effect layer after layout, it is complete in text box
When the characters in a fancy style effect of portion's character renders completion, the screenshot of the text box is obtained;The screenshot is shown to the text box
On corresponding position, the text box is hidden with the screenshot.
S213 terminates.
In present embodiment, need to regenerate effect layer if character outline has modification, because character outline becomes,
So corresponding effect layer is also required to repaint.For example, there are two types of characters in a fancy style effects for current character, it is frame and yin respectively
Shadow, then just needing to repaint two effect layers.It is to directly generate two effect layers to draw effect in existing implementation
Fruit, this can increase by two drafting primitives in final text box, draw that primitive is more, calculating when refreshing and present all can be more
Add consumption performance.Present embodiment does not directly generate new drafting primitive, but judge current character effect whether with it is adjacent
The effect of character is identical, such as: there are two kinds of effects of frame and shade in current character, adjacent character has frame and the two kinds of effects that shine
Fruit then the border effect of current character and the border effect of adjacent character are plotted on the same drafting primitive, and then is reduced
One drafting primitive saves occupied system resource when drawing characters in a fancy style effect, to improve system effectiveness.
After characters in a fancy style is drawn, text box has also exited editing mode.Based on existing display technology, operating system meeting
It is frequent to refresh interface, and hair light and shade in artistic effect and other effects etc. are that very expendable can when refreshing.It will be whole
A text box screenshot, picture is placed on the position of corresponding text box, and real text box is hidden, so that operating system
Only refresh a picture when refreshing, and do not had to refresh real artistic effect, further increases system effectiveness.
The present invention also provides a kind of characters in a fancy style effect drawing systems, as shown in figure 3, including obtaining module 301, drafting module
302 and rendering module 303.
The shown module that obtains is used to obtain the character in text box, obtains the characters in a fancy style effect to be drawn of each character;
The drafting module 302 is used to judge to imitate in the characters in a fancy style effect to be drawn of adjacent character with the presence or absence of identical characters in a fancy style
Fruit, if so, every kind of the adjacent character identical characters in a fancy style effect is plotted to same drafting primitive respectively;And the wash with watercolours
Dye module 303 is for generating the corresponding effect layer of the drafting primitive, with the effect layer to adjacent character described in text box
It is rendered, the characters in a fancy style effect after display rendering.
The characters in a fancy style effect drawing system of the present embodiment, by obtaining the character in text box, and each character of acquisition
Characters in a fancy style effect to be drawn, every kind of adjacent character identical characters in a fancy style effect to be drawn is plotted to same drafting respectively
Primitive generates the corresponding effect layer of the drafting primitive, is rendered with the effect layer to adjacent character described in text box,
Characters in a fancy style effect after display rendering.Therefore, the present invention can be by every kind of adjacent character identical characters in a fancy style effect to be drawn
It is plotted to same drafting primitive respectively, reduces the quantity for drawing primitive, saves occupied system when drawing characters in a fancy style effect
System resource, to improve system effectiveness.
The acquisition module 301 includes character outline acquisition submodule in one of the embodiments, each for obtaining
The character attibute of character, the character attibute include one of the overstriking of character, italic, font, font size, underscore or a variety of
Combination;Character is generated by character attibute and obtains the position of character outline and each character;The drafting module 302 includes
Rendering submodule, for being plotted to every kind of the adjacent character identical characters in a fancy style effect respectively according to the character outline
Same drafting primitive.
The acquisition module 301 further includes the first rendering submodule in one of the embodiments, for judging each character
Character outline whether change, if it is not, the corresponding effect layer of character when last refresh is obtained, with the effect layer
Respective symbols in text box are rendered.By the embodiment, the character that attribute is not changed is not needed to repaint
Primitive is drawn, reduces the number of characters in a fancy style effect drafting, to improve drafting efficiency.
The first rendering submodule includes the second rendering submodule in one of the embodiments, described for obtaining
Character location information new in text box is laid out the effect layer according to new location information, with effect after layout
Layer renders adjacent character in text box.
The characters in a fancy style effect drawing system further includes display module in one of the embodiments, for described
The characters in a fancy style effect of alphabet, which renders, after effect layer renders adjacent character described in text box, in text box completes
When, obtain the screenshot of the text box;The screenshot is shown on the corresponding position of the text box, is hidden with the screenshot
The text box.Picture is placed on the position of corresponding text box by the embodiment by entire text box screenshot, and will be real
Text box is hidden, so that operating system has only refreshed a picture when refreshing, and does not have to refresh entire all words of text box
The artistic effect of symbol further improves the rendering efficiency of system.
The characters in a fancy style effect drawing system further includes monitoring module in one of the embodiments, is used for monitoring system
Text box lose focus event, if the corresponding text box loses focus event and is triggered, determine that text frame is in
Focus condition is lost, so that it is determined that the characters in a fancy style effect of alphabet renders completion in text box, otherwise, it determines complete in text box
The characters in a fancy style effect of portion's character does not render completion.
Each technical characteristic of embodiment described above can be combined arbitrarily, for simplicity of description, not to above-mentioned reality
It applies all possible combination of each technical characteristic in example to be all described, as long as however, the combination of these technical characteristics is not deposited
In contradiction, all should be considered as described in this specification.
The embodiments described above only express several embodiments of the present invention, and the description thereof is more specific and detailed, but simultaneously
Limitations on the scope of the patent of the present invention therefore cannot be interpreted as.It should be pointed out that for those of ordinary skill in the art
For, without departing from the inventive concept of the premise, various modifications and improvements can be made, these belong to guarantor of the invention
Protect range.Therefore, the scope of protection of the patent of the invention shall be subject to the appended claims.