Summary of the invention
Embodiment of the present invention technical matters to be solved is, a kind of method and device of drawing skin picture is provided, in the process of control or window being carried out to pinup picture design, just can see the final effect that realizes, the repetition compilation process of avoiding frequent amendment to bring, has improved efficiency.
For solving above-mentioned technical matters, the embodiment of the present invention provides a kind of method of drawing skin picture, comprising:
Multiple skin picture merger in picture library are become to the integrated picture of skin, and define the positional information of each skin picture on the integrated picture of described skin;
The skin picture that need to draw for current control or window selection;
From the integrated picture of described skin, obtain the pixel of described skin picture according to positional information corresponding to described skin picture, and the pixel of described skin picture is plotted on described control or window;
Control after the pixel of described skin picture or the effect of window described in demonstration, are drawn.
Further, the step of the positional information of each skin picture of described definition on the integrated picture of described skin is specially:
The positional information of each skin picture on the integrated picture of described skin described in use XML document definition.
Further, the step of the described skin picture that need to draw for current control or window selection further comprises:
From cell library, be the resource information of control or window described in described control or window selection, the resource information of described control or window at least comprises attribute, state, the control item information of control or window.
Further, the described step that described pixel is plotted on described control or window further comprises:
The pixel of described skin picture is adapted to the step that the size of described control or window stretches or dwindles processing; And/or
Load the resource information of described control or window, described resource information one of at least comprises in the attribute, state, control item information of control or window.
Further, the method further comprises:
Load in advance the step of skin picture to picture library by picture loader; And
Load in advance the resource information of describing control or window to cell library by resource loader.
Should, the embodiment of the present invention provides a kind of device of drawing skin picture, comprising:
Merging unit, for multiple skin picture merger of picture library are become to the integrated picture of skin, and defines the positional information of each skin picture on the integrated picture of described skin;
Interface control selected cell, the skin picture that is used to current control or window selection to draw;
Drawing unit, for obtaining the pixel of described skin picture from the integrated picture of described skin according to positional information corresponding to described skin picture, and is plotted in the pixel of described skin picture on described control or window;
Output unit, for having drawn control after the pixel of described skin picture or the effect of window described in showing.
Further, this device further comprises:
Picture loader, for loading at least one skin picture to picture library in advance; And
Resource loader, for loading the resource information for describing control or window to cell library in advance.
Further, this device further comprises:
Position definition subelement, for by described each skin picture, the positional information on the integrated picture of described skin is generated as XML file.
Further, described drawing unit further comprises:
Skin picture position acquisition subelement, for obtaining the positional information of selected skin picture at the integrated picture of described skin from described XML file;
Picture pixel is obtained subelement, for the positional information of obtaining according to described skin picture position acquisition subelement, copies the pixel of described skin picture from the integrated picture of described skin;
Matching treatment subelement, the processing that stretches or dwindle for described picture pixel being obtained to the pixel of the described skin picture that subelement copies to, obtains the skin matching with the size of described control or window and mates picture;
Draw subelement, be plotted to described control or window for the skin coupling picture that described matching treatment subelement is obtained;
Resource information loads subelement, for selecting the resource information of described control or window to be loaded on described control or window from cell library interface control selected cell.
Further, described resource information comprises attribute, state, the control item information of control or window, and the attribute of described control or window at least comprises the one of script file, logical block, logical block, logic state.
Implement the embodiment of the present invention, there is following beneficial effect:
Method and the device of the drafting skin picture of the embodiment of the present invention, by before control or window are drawn to skin picture, the multiple skin picture merger in picture library being become to the integrated picture of skin, the positional information by each skin picture of XML document definition on the integrated picture of described skin; Only need can from the integrated picture of skin, obtain by the positional information in XML file the pixel of described skin picture, and described pixel is plotted on described control or window, and control after skin picture or the effect of window described in showing in real time, are drawn, drawing in skin picture process without calling a large amount of independent skin picture files, only need obtain according to positional information the pixel of skin picture like this; In addition, due to the effect that can show in real time after control or window rendered images, thereby the repetition compilation process of having avoided frequent amendment to bring has improved the efficiency of software development.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiment.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtaining under creative work prerequisite, belong to the scope of protection of the invention.
As shown in Figure 1, the structure of the first embodiment of the device of the drafting skin picture of embodiment of the present invention composition schematic diagram; A kind of device 1 of drawing skin picture that the embodiment of the present invention provides comprises:
Picture library 10, for storing multiple skin pictures for control or window, these skin pictures can be the pictures of various forms;
Cell library 11, for storing the resource information for describing control or window, this resource information comprises attribute, state, the control item information of control or window, wherein, attribute can be the attribute of describing control or window such as script file, logical block, logical block, logic state etc., state is such as " pressing " to control or " relievings " state, and control item can be such as for scroll bar, the projects such as the draw runner of the arrow at its two ends, centre;
Interface control selected cell 13, be used to current control or window from picture library 11, to select to need the skin picture of drafting, and be the resource information that current control or window are selected described control or window from cell library 11, particularly, only need to select title or the mark of described skin picture;
Drawing unit 14 obtains the pixel of skin picture according to positional information corresponding to the selected skin picture of interface control selected cell 13, and this pixel is plotted on control or window from the integrated picture of skin; Particularly, according to title or the mark of interface control selected cell 13 selected skin pictures, in XML file, search the positional information that this skin picture is corresponding, thereby obtain pixel corresponding in the integrated picture of skin according to this positional information; Be understandable that, in drawing unit 14, need to load the selected resource information of interface control selected cell simultaneously; The integrated picture of described skin is formed by the multiple skin picture merger in described picture library, and has defined the positional information of each skin picture on the integrated picture of described skin;
Output unit 15, for exporting and showing the effect of drawing the control or the window that there are skin picture through drawing unit 14.
It should be noted that, the device of drawing skin picture can also comprise Merging unit 12, for the multiple scrappy skin picture of picture library 10 is integrated into the integrated picture of skin, and defines the positional information of each skin picture on the integrated picture of described skin; Wherein, this merger can be such as the stickup of picture pixel, Merging unit 12 pastes the pixel of the skin picture that may use in picture library 10 on a large figure (being called the integrated picture of skin under this large figure), in existing technology, each skin picture is independent file, it is cumbersome when each skin picture is loaded, after they are integrated in an integrated picture of skin, to the drawing skin picture and all can call from the integrated picture of this skin of multiple controls or window, being equivalent to can image sharing; Be understandable that, Merging unit 12 also can merger become the integrated picture of multiple skins, for example, the picture of same type is integrated on an integrated picture of skin, in the present invention, can adopt multiple order that each skin picture is integrated in the integrated picture of skin; In addition, define the integrated picture of skin at each skin picture place and the position in the integrated picture of this skin with XML file.This XML file can be loaded in internal memory, and need not directly multiple independent skin picture files be directly loaded in internal memory, has saved space and the service efficiency of internal memory.
Also it should be noted that, the device of drawing skin picture also can not comprise Merging unit 12, multiple scrappy skin picture in picture library 10 is integrated into step on the integrated picture of skin and realizes by other devices of drawing beyond the device of skin picture, such as art designing's device etc.
Further, the device 1 of this drafting skin picture also comprises:
Picture loader 16, for loading at least one skin picture to picture library 10 in advance; And
Resource loader 17, for the resource information loading for describing control or window to cell library 11 in advance.
As shown in Figure 2, be the structural representation of Merging unit 12 in Fig. 1.
This Merging unit 12 comprises:
Picture merger subelement 120, for being integrated into the integrated picture of skin by the pixel of the multiple skin pictures that are selected from picture library 10;
Position definition subelement 122, for by above-mentioned each skin picture, the positional information on the integrated picture of skin is generated as XML file.
It should be noted that, when the device of drafting skin picture does not comprise Merging unit 12, can comprise separately position definition subelement 122.
As shown in Figure 3, be the structural representation of unit 14 of drawing in Fig. 1.This drawing unit 14 further comprises:
Skin picture position acquisition subelement 140, obtain the positional information of selected skin picture for generating XML file from Merging unit 12, particularly, according to the title of selected skin picture or mark, in XML file, search and obtain positional information corresponding to this skin picture, this positional information is included in which integrated picture of skin, for example, in which scope (coordinate range) of the integrated picture of this skin;
Picture pixel is obtained subelement 141, for the positional information of obtaining according to skin picture position acquisition subelement 140, copies the pixel of this skin picture from the integrated picture of corresponding skin;
Matching treatment subelement 142, carry out such as the processing that stretches or dwindle for picture pixel being obtained to the pixel of the skin picture that subelement 141 copies to, obtain the skin matching with the size of current control or window and mate picture, be understandable that, the process of above-mentioned coupling is not limited to the processing that stretches or dwindle, in other some embodiment, can comprise some other necessary processing procedures, for example carry out that Alpha synthesizes etc.;
Draw subelement 143, be plotted to control or window for the skin coupling picture that matching treatment subelement 142 is obtained;
Resource information loads subelement 144, for interface control selected cell 13 is loaded on to this control or window from this control of cell library 11 selections or the resource information of window.
The device of the drafting skin picture of the embodiment of the present invention can be realized in IDE, utilize its plug-in part technology in IDE, to realize such as skin file management, control or the association attributes setting of window skin and skin file and cut figure, facilitate developer skin source picture to be carried out to management, extraction, the setting of corresponding control or window skin, obtain skin picture pixel; In the visual design window of IDE, obtain the examples such as its window, control, in conjunction with the skin picture pixel of obtaining, in design process, draw the skin of window and each control, realize the effect of What You See Is What You Get.
The drafting skin picture device of the embodiment of the present invention, undertaken before control or window draw by Merging unit, the multiple skin picture merger in picture library being become to the integrated picture of skin, the positional information by each skin picture of XML document definition on the integrated picture of described skin; Drawing unit only need can obtain by the positional information in XML file the pixel of described skin picture from the integrated picture of skin, and described pixel is plotted on described control or window, and control after described skin picture or the effect of window described in showing in real time, are drawn, drawing in skin picture process without calling a large amount of independent skin picture files, only need obtain according to positional information the pixel of skin picture like this; In addition, due to the effect that can show in real time after control or window rendered images, thereby the repetition compilation process of having avoided frequent amendment to bring has improved the efficiency of software development.
As shown in Figure 4, be the process flow diagram of the first embodiment of a kind of method of drawing skin picture of embodiments of the invention.This flow process comprises:
Step S400, multiple skin picture merger in picture library are become to the integrated picture of skin, and define the positional information of each skin picture on the integrated picture of described skin, particularly, can be by Merging unit, the pixel of the skin picture that may use in picture library to be pasted on the integrated picture of one or more skin; In addition, define the integrated picture of skin at each skin picture place and the position in the integrated picture of this skin with XML file; This XML file can be loaded in internal memory, and need not directly multiple independent skin picture files be directly loaded in internal memory, has saved space and the service efficiency of internal memory.
Step S402, the skin picture that need to draw for current control or window selection, particularly, can be to select to need skin picture title or the mark of drawing, and from cell library, selects its resource information for current control or window.
Step S404, from the integrated picture of skin, obtain the pixel of this skin picture according to positional information corresponding to this skin picture, and described pixel is plotted on this control or window, particularly, according to the title of selected skin picture or mark, in XML file, search and obtain positional information corresponding to this skin picture, which integrated picture of skin is this positional information be included in and for example, in which scope (coordinate range) of the integrated picture of this skin, copies the pixel of this skin picture according to this positional information from the integrated picture of corresponding skin;
the pixel of this skin picture copying to is carried out such as stretching or the processing dwindled, obtain with current control or the skin coupling picture that the size of window matches; This skin coupling picture is plotted on control or window;the resource information of this control of selecting from cell library or window is loaded on this control or window simultaneously.
Step S406, show and drawn control after described skin picture or the effect of window, this step is equivalent to a preview process, thereby avoid the repetition compilation process after at every turn the skin picture of controlling being loaded, make developer can obtain the effect of What You See Is What You Get, thereby improved efficiency.
Be understandable that, before above-mentioned steps, need to load skin picture and load in advance the resource information of describing control or window by resource loader to cell library to picture library by picture loader in advance.Meanwhile, more details can be referring to the explanation of the aforementioned embodiment to Fig. 1.
Implement the embodiment of the present invention, by before control or window are drawn to skin picture, the multiple skin picture merger in picture library being become to the integrated picture of skin, the positional information by each skin picture of XML document definition on the integrated picture of described skin; Only need can from the integrated picture of skin, obtain by the positional information in XML file the pixel of described skin picture, and described pixel is plotted on described control or window, and control after described skin picture or the effect of window described in showing in real time, are drawn, like this drawing in skin picture process without calling a large amount of independent skin picture files, the pixel that only need obtain according to positional information skin picture, has reduced the resource taking in program development; In addition, due to the effect that can show in real time after control or window rendered images, thereby the repetition compilation process of having avoided frequent amendment to bring has improved the efficiency of software development;
In addition, in an embodiment of the present invention, allow and use the window of same pattern skin or control or window can share skin picture resource, without repeating loading.
One of ordinary skill in the art will appreciate that all or part of flow process realizing in above-described embodiment method, can carry out the hardware that instruction is relevant by computer program to complete, described program can be stored in a computer read/write memory medium, this program, in the time carrying out, can comprise as the flow process of the embodiment of above-mentioned each side method.Wherein, described storage medium can be magnetic disc, CD, read-only store-memory body (Read-Only Memory, ROM) or random store-memory body (Random Access Memory, RAM) etc.
Above disclosed is only preferred embodiment of the present invention, the interest field that certainly can not limit the present invention with this, and the equivalent variations of therefore doing according to the claims in the present invention, still belongs to the scope that invention is contained.