A kind of method and image of removing float shows control
Technical field
The present invention relates to image processing, relate in particular to a kind of method and image of removing float and show control.
Background technology
In the process of using without handle control, for improving development efficiency, all interface elements are all by inheriting without handle control; So when control be integer coordinate time, interface element all based on integer coordinate, develop, therefore exploitation speed change animation will produce the phenomenon of shake; Speed change animation comprises that current smart machine drags scroll bar or with hand during to certain direction slip screen, mobile effect (from fast to slow, finally to stop) is accelerated in the change of picture, etc.;
For example: when current picture moving is about to stop first the speed with 0.25 pixel/S slide 1 second, then 0.15 pixel/S slides 1 second, last 0.1 pixel/S was slided 1 second time, because interface element is developed based on integer coordinate, based on the principle that rounds up, when mobile number of pixels is more than or equal to 0.5, picture just moves, therefore, 0.25*1+0.15*1+0.1*1=0.5 pixel, through 3 seconds, picture 1 pixel that just moves right suddenly, can make user feel that picture produces jitter phenomenon.
Summary of the invention
The technical problem to be solved in the present invention is to use integer coordinate easily to cause that picture produces the defect of shake for control in prior art, provides a kind of and removes picture produces jitter phenomenon method and image because speed change moves and show control.
The technical solution adopted for the present invention to solve the technical problems is:
A kind of method of removing float is provided, comprises the following steps:
Obtain the indication range information that image shows control, described image shows that control adopts the movement of integer coordinate control image;
Indication range Information generation the first image display area that shows control according to described image, the image that electronic equipment need to be shown shows in described the first image display area; Described the first image display area adopts the movement of floating-point coordinate control image.
In the method for removal float of the present invention, described image shows that the indication range information of control is to there being the second image display area, and described the first image display area is positioned at described the second image display area; In described the second image display area, the viewing area beyond described the first image display area is set to transparent.
In the method for removal float of the present invention, the back gauge of described the first image display area and described the second image display area is more than or equal to 0.5 pixel.
In the method for removal float of the present invention, also comprise the pixel value that the second image display area moves described in cumulative record.
The present invention solves another technical scheme that its technical matters adopts:
Provide a kind of image of removing float to show control, this control comprises:
Information acquisition unit, for obtaining the indication range information of image demonstration control, described image shows that control adopts the movement of integer coordinate control image;
The first image display area, it shows control indication range Information generation according to described image, shows therein for the image that electronic equipment need to be shown; Described the first image display area adopts the movement of floating-point coordinate control image.
In image demonstration control of the present invention, described image shows that control also comprises second image display area corresponding with the indication range information of described image demonstration control, and described the first image display area is positioned at described the second image display area; In described the second image display area, the viewing area beyond described the first image display area is set to transparent.
Image of the present invention shows that in control, the back gauge of described the first image display area and described the second image display area is more than or equal to 0.5 pixel.
In image demonstration control of the present invention, described image shows that control also comprises bulk registration module, for the pixel value that described in cumulative record, the second image display area moves.
The beneficial effect that the present invention produces is: the present invention shows that by image control adopts integer coordinate to move, and the first image display area that shows the indication range Information generation of control according to image adopts the movement of floating-point coordinate control image, thereby when speed change moves image demonstration control, can visually make the movement of the first image display area more smooth, solve image in prior art and shown that control moves middle meeting in speed change and produces the problem of float.
Accompanying drawing explanation
Below in conjunction with drawings and Examples, the invention will be further described, in accompanying drawing:
Fig. 1 is the process flow diagram that the embodiment of the present invention is removed the method for float;
Fig. 2 is the structural representation that the embodiment of the present invention is removed the image demonstration control of float;
Fig. 3 A is that the image of the embodiment of the present invention shows the position relationship of control between mobile front the second image display area and the first image display area;
Fig. 3 B is that the image of the embodiment of the present invention shows the position relationship of control between mobile rear the second image display area and the first image display area.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.
As shown in Figure 1, the embodiment of the present invention is removed the method for float, comprises the following steps:
S1, obtain image and show the indication range information of control, image shows that control adopts the movement of integer coordinate control image; Indication range information defines the indication range of control, is the boundary coordinate of original control.
S2, according to image, show indication range Information generation first image display area of control, the image that electronic equipment need to be shown shows in the first image display area; The first image display area adopts the movement of floating-point coordinate control image.
In the embodiment of the present invention, image shows that the indication range information of control is to there being the second image display area, and the first image display area is positioned at the second image display area; In the second image display area, the viewing area beyond the first image display area is set to transparent.
Such setting is carried out being moved apart of the first image display area and the second image display area, when making image show that control moves, the second image display area moves with integer coordinate, and the first image display area moves with floating point type, gives visually a kind of sensation of smoothness of people.
Before starting movement, relation between the first image display area and the second image display area as shown in Figure 3A, after whole control moves 1.3 pixels, due to the second image display area use is integer coordinate, so the second image display area reality has only moved i.e. 1 pixel (rounding up) of an integer that approaches 1.3 most, and the first image display area adopts floating point type, therefore out and outly 1.3 pixels have been moved, so the control effect after mobile as shown in Figure 3 B.
Because all demonstrations are in the first image display area, and in the second image display area, viewing area beyond the first image display area is transparent, so give people feel truly moved 1.3 pixels, thereby solved the image that is set to all over integer coordinate, show the jitter problem that brings because speed change moves of control.
Further, in the embodiment of the present invention, when the second image display area moves, the pixel value that also this second image display area of cumulative record moves.The buffer memory border that cumulative record control the second image display area moves can be set, record the pixel value that the second image display area moves, such as above, the second image display area has moved 1.3 pixels, although it has moved 1 pixel, but record the second image display area moves 1.3 pixels, when time control the second image display area continues mobile 0.4 pixel instantly, with regard to cumulative record the second image display area, move 1.3+0.4=1.7 pixel so, therefore the second image display area will move 1 pixel forward on the basis of originally having moved 1 pixel again, 2 pixels have been moved altogether, but it should be noted that, the first image display area has moved 1.7 pixels in fact altogether.By cumulative record the second image display area movement value, control the position that the second image display area moves, can avoid the actual mobile gap of the second image display area of causing because of the difference between integer coordinate and floating-point coordinate and the first image display area excessive.
As shown in Figure 2, the image that the embodiment of the present invention can be removed float shows that control comprises information acquisition unit 10 and the first image display area 20, information acquisition unit 10, for obtaining the indication range information of image demonstration control, image shows that control adopts the movement of integer coordinate control image; The first image display area 20, it shows control indication range Information generation according to image, shows therein for the image that electronic equipment need to be shown; The first image display area 20 adopts the movement of floating-point coordinate control image.
Image shows that control also comprises that second image display area 30, the first image display area 20 corresponding with the indication range information of image demonstration control are positioned at the second image display area 30; In the second image display area 30, the viewing area beyond the first image display area 20 is set to transparent.
The first above-mentioned image display area 20 and the movement of the second image display area 30 are separately carried out, and the second image display area 30 moves with integer coordinate, and the first image display area 20 moves with floating-point coordinate, give visually a kind of sensation of smoothness of people.
In the embodiment of the present invention, the back gauge of the first image display area 20 and the second image display area 30 is more than or equal to 0.5 pixel, and the upper limit is not particularly limited, as long as viewing area does not shorten a bit into.
Further, in the embodiment of the present invention, this control also comprises bulk registration module 40, for when the second image display area 30 moves, and the pixel value that this second image display area 30 of cumulative record moves.Its concrete cumulative record process, and how the second image display area 30 to move above and to have a detailed description according to cumulative record, do not repeat them here.Bulk registration module 40 can reduce the gap of the actual movement that the second image display area 30 causes because coordinate precision is different from the first image display area 20.
Should be understood that, for those of ordinary skills, can be improved according to the above description or convert, and all these improvement and conversion all should belong to the protection domain of claims of the present invention.