Figure layer pixel alignment detection method based on iOS system
Technical field
The present invention relates to field of mobile terminals, particularly a kind of figure layer pixel alignment detection method based on iOS system.
Background technology
The figure layer pixel of iOS system is alignd and is referred in iOS system, original position of the figure layer in interface relative to window
Correspondence integer pixel.When pixel is not lined up, pattern edge can seem fuzzy, therefore whether pixel aligns and influence whether interface
Fineness and fluency.Different from pc client exploitation, Mobile solution exploitation is in developmental stage, there is Technical Architecture not
Ripe, professional shortage, the version iteration factor such as frequently, the design and developer for causing Mobile solution are had at interface
Compromise is made in layout details and runnability, to exchange the shorter version updating cycle for.
The development process of current each Internet firm is substantially designer by the UI of a certain or several screen resolutions
Mark figure gives developer, again by technological means such as self adaptation coordinate, relativeness, proportional zooms when developer programs, complete
The adaptation of the screen resolution of figure is marked into all UI.The process of this adaptation is it is possible that the unjustified problem of pixel.Such as
There is the unjustified figure layer of pixel in the figure layer at fruit interface, then can have a negative impact in rendering content, for example:Figure layer correspondence
Text show fuzzy, or increase cpu load when picture processing is carried out, so as to reduce operational efficiency.Fig. 1 is taken from
The screenshot capture of iPhone6Plus equipment, the text on the left side be its place figure layer pixel it is unjustified in the case of display effect, it is right
The text on side is the display effect under its place figure layer pixel alignment condition, it is seen that, after the alignment of figure layer pixel, text shows
Become apparent from.
Current is related in development process, although also can detect to whether figure layer pixel aligns, but the detection side
Visual determination of the method by testing staff, without seeking unity of standard, whether text obscures the possibility for also recognizing, aligns as picture
Basic None- identified.Also, this detection method easily causes testing staff's visual fatigue, and people is under visual fatigue state for detection
Its detection efficiency and accuracy even more drastically decline, poor reliability.
The content of the invention
In order to overcome the deficiencies in the prior art, the present invention to propose a kind of figure layer pixel alignment detection side based on iOS system
Method, the method can not only automatic detection figure layer pixel whether align, moreover it is possible to judging that figure layer pixel is further when unjustified
The problem of specifying comes from the figure layer itself or upper level figure layer, so as to orientation problem root, provides just for the adjustment of later stage figure layer
Profit.
The present invention provides a kind of figure layer pixel alignment decision method based on iOS system, and methods described comprises the steps:
The coordinate (x, y) of S1, acquisition figure layer relative to its place window;
S2, pixel point location reference value Vx and Vy that calculate the figure layer, wherein Vx=x × scale, Vy=y × scale,
Scale represents the screen multiplying power of window place screen;
S3, judge whether Vx and Vy is all approximately equal to integer, if so, then judge that the figure layer is alignd relative to window pixel, if
It is no, then judge that the figure layer is unjustified relative to window pixel.
Further, judge that figure layer also includes afterwards relative to window pixel is unjustified:
The coordinate (tx, ty) of S31, the acquisition figure layer relative to upper level figure layer;
S32, pixel point location reference value Vtx and Vty that calculate upper level figure layer, wherein Vtx=tx × scale, Vty=
Ty × scale, scale represent the screen multiplying power of window place screen;
S33, judge whether Vtx and Vty is all approximately equal to integer, if so, then judge that the Coordinate Problem of the figure layer causes this
Figure layer is unjustified relative to window pixel, if it is not, then judging that the Coordinate Problem of the upper level figure layer of the figure layer causes the figure layer
It is unjustified relative to window pixel.
Further, also include after step S33:S34, cause the figure layer when the Coordinate Problem for judging the figure layer
Relative to window pixel it is unjustified when, record and/or identify the figure layer;When the coordinate of the upper level figure layer for judging the figure layer
Problem causes the figure layer unjustified relative to window pixel, records and/or identify the upper level figure layer of the figure layer.
Specifically, the figure layer is the upper left corner of the figure layer relative to the figure layer institute relative to the coordinate of its place window
In the coordinate of window, the figure layer is the upper left corner of the figure layer relative to upper level figure layer relative to the coordinate of upper level figure layer
Coordinate.
Preferably, when judging whether Vx, Vy, Vtx and Vty are approximately equal to integer, the degree of accuracy of Vx, Vy, Vtx and Vty is protected
The decimal digits for staying is consistent.
Preferably, when judging whether Vx, Vy, Vtx and Vty are approximately equal to integer, the degree of accuracy of Vx, Vy, Vtx and Vty is equal
Retain to percentile.
Correspondingly, present invention also offers a kind of figure layer pixel alignment detection method based on iOS system, methods described bag
Include:Window chromosome layer is obtained, the All Layers in window are begun stepping through from the chromosome layer, alignd using above-mentioned figure layer pixel
Decision method carries out pixel alignment and judges to each figure layer, and after the completion of All Layers judge, feedback and judge result.
The invention has the advantages that:
(1) the inventive method can not only automatic detection figure layer pixel whether align, moreover it is possible to judging figure layer pixel not
During alignment, further clear and definite problem comes from the figure layer itself or upper level figure layer, so as to orientation problem root, is later stage figure
Layer adjustment provides facility.
(2) the inventive method is applied to application and development stage and test phase, with quick, efficiency high of pinpointing the problems, no
The advantage in version iteration cycle is affected, can make that interface layout is finer, it is more smooth to run with auxiliary development personnel optimization application.
(3) precision of testing result is improve using the inventive method, the defect that Visual Observations Observations cause to judge by accident is compensate for.
Also, the inventive method reduces the access threshold of figure layer pixel alignment detection, reducing the specialized capability to testing staff will
Ask, even if not understanding that the personnel of principle can still complete to detect work.
Description of the drawings
In order to be illustrated more clearly that technical scheme, below will be to wanting needed for embodiment or description of the prior art
The accompanying drawing for using is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the present invention, right
For those of ordinary skill in the art, on the premise of not paying creative work, can be obtaining which according to these accompanying drawings
Its accompanying drawing.
Fig. 1 is taken from the screenshot capture of iPhone6Plus equipment;
Fig. 2 is the flow chart of the figure layer pixel alignment detection method based on iOS system;
Fig. 3 is the flow chart of the figure layer pixel alignment decision method based on iOS system;
Fig. 4 is that the design sketch before detection labelling is carried out using the inventive method;
Fig. 5 is that the design sketch after detection labelling is carried out using the inventive method.
Specific 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 carried out clear, complete
Site preparation is described, it is clear that described embodiment is only a part of embodiment of the invention, rather than the embodiment of whole.It is based on
Embodiment in the present invention, those of ordinary skill in the art obtained on the premise of creative work is not made it is all its
His embodiment, belongs to the scope of protection of the invention.
In the present invention, whether pixel alignment refers to whether figure layer aligns relative to window pixel to figure layer, therefore, judging figure
Whether layer in pixel alignment procedure, should with figure layer relative to window coordinate being calculated and be judged.If judging mesh
Whether layer of marking on a map in pixel alignment procedure, and acquisition is the target figure layer coordinate (x ', y ') of one-level figure layer thereon relatively, even if
Calculated Vx ' and Vy ' are approximately equal to integer, can not think that target figure layer is alignd relative to window pixel, because if
Upper level figure layer is unjustified relative to window pixel, then target figure layer is also unjustified relative to window pixel.Correspondingly, mesh
The unjustified reason of layer pixel of marking on a map can be divided into two classes, and a class is that the coordinate of target figure layer itself is problematic, and a class is then mesh
Mark on a map layer upper level figure layer coordinate it is problematic.In consideration of it, can by obtain target figure layer relative to window coordinate come
Judge the whether pixel alignment of target figure layer, further by coordinate of the target figure layer relative to upper level figure layer being obtained judging mesh
The unjustified reason of layer pixel of marking on a map, the present invention program is according to above-mentioned thinking.
Fig. 2 is flow chart of the present invention based on the figure layer pixel alignment detection method of iOS system, and the testing process includes:
Step one:Detection trigger event.For example:A toolbar floating window is write on status system hurdle, there is provided labelling, clear
Except, close etc. option, by click on labelling option come detection trigger event;Or timing automatic detection program is set, reach inspection
The survey time automatic detection trigger time;Or by shaking detection trigger etc..In practice, the form of detection trigger event has
Various, here is not repeated one by one.
Step 2:The window in screen is obtained, from the beginning of the chromosome layer of the window, using depth-first, breadth First
Or other traversal methods, the judgement of pixel alignment is carried out by the figure layer in a pair of windows.Fig. 3 is the figure layer picture based on iOS system
The flow chart of element alignment decision method, the decision method of the pixel alignment are specially:
The coordinate (x, y) of S1, acquisition figure layer relative to its place window, coordinate of the figure layer relative to its place window
For the figure layer the upper left corner relative to the figure layer place window coordinate, wherein x represents the horizontal seat of the pixel in the figure layer upper left corner
Mark, y represent the pixel vertical coordinate in the figure layer upper left corner.
S2, pixel point location reference value Vx and Vy that calculate the figure layer, wherein Vx=x × scale, Vy=y × scale,
Scale represents the screen multiplying power of window place screen;Figure layer coordinate is multiplied by screen multiplying power and can navigate to the specific pixel of figure layer
Point.
S3, judge whether Vx and Vy is all approximately equal to integer, when judging whether Vx and Vy is all approximately equal to integer, take four houses five
The method for entering round numbers, degree of accuracy retain to percentile, such as Vx=1.001, then can be determined that Vx is approximately equal to integer, Vy=
1.021, then can be determined that Vy is not approximately equal to integer;
If Vx and Vy are approximately equal to integer, judge that the figure layer is alignd relative to window pixel, perform S4;
If one or two is not approximately equal to integer during Vx and Vy appoints, judge that the figure layer is unjustified relative to window pixel,
Following steps are performed further:
The coordinate (tx, ty) of S31, the acquisition figure layer relative to upper level figure layer, the figure layer is relative to upper level figure
The coordinate of layer is the coordinate of the upper left corner relative to upper level figure layer of the figure layer, and wherein tx represents the pixel in the figure layer upper left corner
Abscissa, ty represent the pixel vertical coordinate in the figure layer upper left corner;
S32, pixel point location reference value Vtx and Vty that calculate upper level figure layer, wherein Vtx=tx × scale, Vty=
Ty × scale, scale represent the screen multiplying power of window place screen;
S33, judge whether Vtx and Vty is all approximately equal to integer, judge whether Vx and Vy is all approximately equal to integer one with above-mentioned
Sample, when judging whether Vtx and Vty is all approximately equal to integer, the method for equally taking round number is judgement before and after guarantee
The concordance of standard, the decimal digits that the degree of accuracy of Vx, Vy, Vtx and Vty retains are consistent, Vtx and Vty degree of accuracy equally retains
To percentile;
If Vtx and Vty are approximately equal to integer, judge that the Coordinate Problem of the figure layer causes the figure layer relative to window picture
Element is unjustified;
If one or two is not approximately equal to integer during Vtx and Vty appoints, the coordinate of the upper level figure layer of the figure layer is judged
Problem causes the figure layer unjustified relative to window pixel;
S34, when the Coordinate Problem for judging the figure layer causes the figure layer unjustified relative to window pixel, record and/
Or identify the figure layer;When the Coordinate Problem of the upper level figure layer for judging the figure layer cause the figure layer relative to window pixel not
Alignment, records and/or identifies the upper level figure layer of the figure layer.Specifically, can be by the pixel unjustified figure layer place page, seat
The information such as mark are recorded with document form, to be remotely sent to related personnel;Or pixel unjustified figure layer is adopted
Conspicuous color is marked, and directly to feed back to tester from interface, referring to Fig. 4-5, Fig. 4 is to be entered using the inventive method
Design sketch before row detection labelling, Fig. 5 is the design sketch after labelling, and the font of circular pattern and side in Fig. 5 is by with eye-catching
Color mark out, shows that the pixel of pattern or word place figure layer is unjustified.
The coordinate of S4, the next figure layer of acquisition relative to its place window, and execution step S2, S3.
Step 3:Judge whether to complete to judge that if so, then output judges knot to the pixel alignment of All Layers in window
Really, if it is not, then return to step two.
The figure layer pixel alignment detection method of the present invention can make interface layout more smart with auxiliary development personnel optimization application
Carefully, run more smooth.Relative to existing development process, it has the advantage that:
1st, quickly can pinpoint the problems on stream, efficiency high does not affect the version iteration cycle.
2nd, no technical threshold, does not understand that the personnel of principle can still complete to detect work.
3rd, testing result is more accurate, compensate for the shortcoming of Visual Observations Observations easily erroneous judgement.
Above disclosed is only a kind of preferred embodiment of the present invention, can not limit certainly the present invention's with this
Interest field, therefore the equivalent variations made according to the claims in the present invention, still belong to the scope covered by the present invention.