Summary of the invention
The invention provides the generation method and the device of framing mask in a kind of set type, frame is the problem of single rectangular when image is set type in order to solve in the prior art, thereby provides a kind of more both artistic and practical frame to be used for setting type.
The invention provides the generation method of framing mask in a kind of the composing, may further comprise the steps:
Obtain the image that to set type;
Obtain clip path, frame transformation matrix of coordinates, the picture material transformation matrix of coordinates of described image;
Generate framing mask according to described frame transformation matrix of coordinates, picture material transformation matrix of coordinates by clip path.
The present invention also provides the generating apparatus of framing mask in a kind of the composing, comprises image collection module, clip path acquisition module, frame transformation matrix of coordinates acquisition module, picture material transformation matrix of coordinates acquisition module, framing mask generation module, wherein:
Image collection module is used to obtain the image that need set type;
The clip path acquisition module is used to obtain the clip path of the image that described image collection module obtains;
Frame transformation matrix of coordinates acquisition module is used to obtain the frame transformation matrix of coordinates of the image that described image collection module obtains;
Picture material transformation matrix of coordinates acquisition module is used to obtain the picture material transformation matrix of coordinates that described image collection module is obtained image;
The framing mask generation module is used for generating framing mask according to described frame transformation matrix of coordinates, picture material transformation matrix of coordinates by clip path.
Beneficial effect of the present invention is as follows:
Obtain clip path, frame transformation matrix of coordinates, the picture material transformation matrix of coordinates of the image that need set type during the invention process; And generate framing mask by clip path according to described frame transformation matrix of coordinates, picture material transformation matrix of coordinates.Not only consider the factor of frame transformation matrix of coordinates and picture material matrix in the invention process,, on the basis of clip path, generate new frame simultaneously also in conjunction with these two factors.As can be seen, in the generation scheme of this framing mask, can be so that the frame of image change complicated curve into by single rectangular, thus can realize composing effect more, more attractive in appearance.
Embodiment
Below in conjunction with accompanying drawing the specific embodiment of the present invention is described.
In all softwares for composing, each image object that need enter the space of a whole page generally comprises two parts, and a part is that frame portion, a part are the content of image object, is called picture material among the embodiment.Frame portion defines by the frame attribute, when the space of a whole page shows, picture material and frame is asked friendship, only demonstrates the picture material in the frame.Because being drained into the frame of the image in the space of a whole page all is a single rectangle, yet in actual process of typeset, image object need be embedded with other object such as various forms and literal piece and use, obviously, the single rectangular frame can't be combined closely with the frame of other object.For this reason, the generation method of framing mask made the frame of image change complicated curve into by single rectangular, thereby can realize composing effect more, more attractive in appearance during the embodiment of the invention provided and set type.
Fig. 1 is the generation method implementing procedure synoptic diagram of framing mask in setting type, and as shown in the figure, can may further comprise the steps in the enforcement:
Step 101, obtain the image that to set type;
Step 102, the clip path that obtains described image, frame transformation matrix of coordinates, picture material transformation matrix of coordinates;
Step 103, generate framing mask according to described frame transformation matrix of coordinates, picture material transformation matrix of coordinates by clip path, compare with the original frame of image, what obviously generated this moment is a new frame;
Step 104, described image is set type according to described generation framing mask.
In the step 102, the reduction path that obtains image obtains after specifically can adding when the image making by image processing software; And/or the image crisperding instrument by software for composing obtains.Particularly, in software for composing, there is an attribute in image itself, is called clip path.Clip path is that one or more curve is formed, and when the image that contains clip path enters the space of a whole page, only shows the picture material in the clip path, and its outer part does not show.The clip path of image has two sources, first kind can construction drawing as the time, utilize and to obtain as image processing softwares such as Photoshop, simple, by obtaining after the manual adding; Second kind can be utilized the instruments such as image crisperding of software for composing to obtain.
In the step 103, generate framing mask by clip path according to described frame transformation matrix of coordinates, picture material transformation matrix of coordinates, concrete enforcement can for:
When described frame transformation matrix of coordinates, when the picture material transformation matrix of coordinates is unit matrix, with clip path as framing mask;
When described frame transformation matrix of coordinates, when the picture material transformation matrix of coordinates is non-unit matrix, described frame transformation matrix of coordinates, the picture material transformation matrix of coordinates back of multiplying each other is obtained new transformation matrix, the coordinate put on the described clip path and the described new transformation matrix back of multiplying each other is obtained the new coordinate of each point, and the coordinate new according to described each point generates framing mask.
In actual applications, following situation can appear: after entering image, frame and image are not needed to carry out any conversion (such as convergent-divergent or rotation), but directly just generate new frame.At this moment, not needing to calculate the new transformation matrix of acquisition, all be unit matrix because do not need the matrix of conversion, but when image produced conversion, this matrix was non-unit matrix, and algorithm just need take one thing with another in the enforcement, and just need obtain new transformation matrix this moment.Feasible change action with these two matrixes generates new frame to the path.Therefore in implementing, can increase determining step, be used to judge that frame transformation matrix of coordinates, picture material transformation matrix of coordinates are that unit matrix also is non-unit matrix, and carry out corresponding step.At the frame transformation matrix of coordinates, when the picture material transformation matrix of coordinates is non-unit matrix, frame transformation matrix of coordinates and picture material transformation matrix of coordinates multiplied each other to obtain a new transformation matrix, coordinate and new matrix multiple with each point on the clip path, obtain the new coordinate of the new coordinate of this point as new clip path corresponding point, thereby obtain new clip path, and this clip path is got final product as new framing mask.
The embodiment of the invention also provides the generating apparatus of framing mask in a kind of the composing, describes below in conjunction with the concrete real-time mode of accompanying drawing to this device.
Fig. 2 is the generating apparatus structural representation of framing mask in setting type, as shown in the figure, comprise the image collection module, the framing mask generation module that link to each other with clip path acquisition module, frame transformation matrix of coordinates acquisition module, picture material transformation matrix of coordinates acquisition module respectively in the device, wherein:
Image collection module is used to obtain the image that need set type;
The clip path acquisition module is used to obtain the clip path of the image that described image collection module obtains;
Frame transformation matrix of coordinates acquisition module is used to obtain the frame transformation matrix of coordinates of the image that described image collection module obtains;
Picture material transformation matrix of coordinates acquisition module is used to obtain the picture material transformation matrix of coordinates of the image that described image collection module obtains;
The framing mask generation module is used for generating framing mask according to described frame transformation matrix of coordinates, picture material transformation matrix of coordinates by clip path.
In the clip path acquisition module, can comprise first acquiring unit and/or second acquisition unit, wherein:
First acquiring unit obtains described clip path after being used for adding when the image making by image processing software, such as can construction drawing as the time, utilize and obtain as image processing softwares such as Photoshop, simple, by obtaining after the manual adding;
Second acquisition unit is used for obtaining described clip path by the image crisperding instrument of software for composing, obtains such as the instruments such as image crisperding that can utilize software for composing.
The framing mask generation module can also comprise judging unit, first generation unit, second generation unit in the device, wherein:
Judging unit, be used to judge that described frame transformation matrix of coordinates, picture material transformation matrix of coordinates are that unit matrix also is non-unit matrix, when described frame transformation matrix of coordinates, when the picture material transformation matrix of coordinates is unit matrix, triggering first generation unit handles, when described frame transformation matrix of coordinates, when the picture material transformation matrix of coordinates is non-unit matrix, trigger second generation unit and handle;
First generation unit is used for clip path as framing mask;
Second generation unit, be used for described frame transformation matrix of coordinates, the picture material transformation matrix of coordinates back of multiplying each other is obtained new transformation matrix, the coordinate put on the described clip path and the described new transformation matrix back of multiplying each other is obtained the new coordinate of each point, and the coordinate new according to described each point generates framing mask.
Can further include type-setting module in the device, be used for described image being set type according to the framing mask that described framing mask generation module generates.
Again the generation of framing mask being implemented to lift an example in addition below describes.Describe image and literal piece that need shown in Figure 3 are set type among the embodiment and carried out image mixed character typeset.
The image of Fig. 3 for needing to set type is a pair of shoes shown in the figure, is called figure A among the embodiment.Fig. 4 presses clip path display image content synoptic diagram for needing layout images, is called figure B among the embodiment.Fig. 5 as shown in the figure, can comprise the steps: in the enforcement for framing mask generates the implementing procedure synoptic diagram
Obtain out the clip path that needs layout images in step 501, the image that from the space of a whole page, enters, be that figure A is obtained in this example, effect after obtaining is shown in figure B, and as can be seen from the figure, the frame of image becomes the frame that clip path surrounds by initial rectangle;
Step 502, since in the space of a whole page framing mask may be rotated, operation such as convergent-divergent, so from the attribute of frame, obtain the transformation matrix of coordinates of frame;
Step 503, obtain the transformation matrix of coordinates of picture material, because entering the image object of the space of a whole page is made up of two parts, a part is the frame object that comprises image, another part is a picture material itself, and image itself also may exist geometric transformations such as rotation, convergent-divergent, so need extract the transformation matrix of coordinates of image from the attribute of image itself;
Step 504, respectively the transformation matrix of coordinates of frame and the transformation matrix of coordinates of picture material are affacted on the clip path, generate a new clip path;
In the enforcement, the transformation matrix of coordinates of the transformation matrix of coordinates of frame and picture material multiplied each other obtain a new transformation matrix, coordinate and new matrix multiple with each point on the clip path, obtain the new coordinate of the new coordinate of this point, thereby obtain new clip path as new clip path corresponding point;
Step 505, the frame attribute in the image object attribute is replaced with new clip path, promptly obtained the new frame of image;
Step 506, refresh and show image object with new clip path, because clip path must be included in this rectangular area of the minimum outsourcing frame of image object, so affected viewing area is inevitable in this rectangular area, refresh this zone, can show image object with new clip path.
By after the above-mentioned enforcement, distinguish as shown in the figure with the effect of implementing not according to the manner:
Fig. 6 is after will scheming the A rotation change, carries out effect synoptic diagram behind the mutually exclusive pattern and character with the literal piece, and as can be seen, the outer zone of clip path does not enter literal in the image, and effect is obviously bad; Fig. 7 is for after transferring clip path to frame, carries out effect synoptic diagram behind the mutually exclusive pattern and character with the literal piece, and as shown in the figure, the effect of this moment obviously will promote a lot.
As can be seen from the above-described embodiment, the scheme of generation framing mask provided by the invention makes the frame of image change complicated curve into by single rectangular, thereby can realize composing effect more, more attractive in appearance.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.