Embodiment
Below in conjunction with each accompanying drawing, the main of embodiment of the present invention technical scheme is realized principle, embodiment and set forth in detail the beneficial effect that should be able to reach.
In order to solve prior art Problems existing, embodiments providing a kind of picture layout method, as shown in Figure 1, comprising the following steps:
Step 101, acquisition viewing area size, the shown original size of picture and the quantity of shown picture, the original size of each shown picture is identical;
Step 102, according to viewing area size, the size of each shown picture is adjusted by same adjustment mode, until the size of each shown picture reaches maximum, and the whole overall widths being shown picture after adjustment are not more than the width of viewing area size, overall height is not more than the height of viewing area size.
Concrete, obtain the viewing area size of display terminal, this size is made a reservation for by the operating system of display terminal, such as, under screen mode toggle, can obtain the size of whole display screen; Under non-screen mode toggle, the current available display screen size of display terminal operating system can be obtained.
Further, obtain and be shown the original size of picture and the quantity of shown picture, wherein, the original size of each shown picture is identical.During in order to Show Picture in viewing area, can the size of accommodation picture, such as, when picture is few, the size of picture is tuned up; When picture is many, the size of picture is turned down, provide in the embodiment of the present invention as under type, can according to viewing area size, adjustment is shown the size of picture, until the size being shown picture reaches maximum, and the whole overall widths being shown picture after adjustment are not more than the width of viewing area size, and overall height is not more than the height of viewing area size.
Mode one: according to viewing area size, the original size being shown picture, determine the picture columns that viewing area holds; When the overall width being all shown picture is not more than the width of viewing area size, adjust the height of each shown picture, until the overall height being all shown picture equals the height of viewing area size.
Mode two: according to viewing area size, the original size being shown picture, determine the picture line number that viewing area holds; When the overall height being all shown picture is not more than the height of viewing area size, adjust the width of each shown picture, until the overall width being all shown picture equals the width of viewing area size.
Aforesaid way one and mode two all adopt determines picture edge length, the mode of another edge length that stretches, after namely determining often to go to place how many pictures, adjusts the height of often row picture, make shown picture entirety all can be positioned at viewing area, and reach the full-size under this kind of condition.
Mode three: when being shown the Ratio invariableness of the height and the width of picture, adopts the width means being shown picture to be all shown overall width and the overall height of picture; By all the shown overall height of picture and the height of viewing area compare; When the overall height being all shown picture is less than the height of viewing area, the original width of each shown picture is started to increase with 1 unit picture element, until the overall width being all shown picture is greater than the width of viewing area size, and this overall width being all shown picture before increasing unit picture element is not more than the width of viewing area size, or the overall height being all shown picture is greater than the height of viewing area size, and this overall height being all shown picture before increasing unit picture element is not more than the height of viewing area size; Be shown the width of picture before this being increased unit picture element, be defined as the width of the shown picture after adjusting; According to the ratio of the height and the width of shown picture, and the width of shown picture after adjustment, determine the height of shown picture; When the overall height being all shown picture is greater than the height of viewing area, the original width of shown picture is started to reduce with 1 unit picture element, until the overall height being all shown picture is not more than the height of viewing area size, and this overall height being all shown picture before reducing unit picture element is greater than the height of viewing area size; By the width of this shown picture, be defined as the width of the shown picture after adjusting; According to the ratio of the height and the width of shown picture, and the width of shown picture after adjustment, determine the height of shown picture.
Wherein, according to the original width of shown picture and the width of viewing area size, determine the picture columns that viewing area holds; According to the original width of picture columns and shown picture, represent the overall width being all shown picture; According to the quantity of shown picture, and the picture columns that viewing area holds, determine the wish arrangement line number of picture; According to the original width for arrangement line number and shown picture, determine the overall height being all shown picture.
Mode four: when being shown the Ratio invariableness of the height and the width of picture, adopts the height of described shown picture to represent overall width and the overall height of all shown pictures, the described all shown overall width of picture and the width of described viewing area are compared, when the described overall width being all shown picture is less than the width of described viewing area, the original height of each shown picture is started to increase with 1 unit picture element, until the described overall width being all shown picture is greater than the width of described viewing area size, and the overall width of this described all shown picture before increasing unit picture element is not more than the width of described viewing area size, or the overall height being all shown picture is greater than the height of described viewing area size, and the overall height of this described all shown picture before increasing unit picture element is not more than the height of described viewing area size, be shown the height of picture before this being increased unit picture element, be defined as the height of the shown picture after adjusting, according to the ratio of the height and the width of described shown picture, and the height of shown picture after adjustment, determine the width of described shown picture, when the overall width of described shown picture is greater than the width of described viewing area, the original height of each shown picture is started to reduce with 1 unit picture element, until the overall width being all shown picture is not more than the width of described viewing area size, and the overall width of this described all shown picture before reducing unit picture element is greater than the width of described viewing area size, by the height of this shown picture, be defined as the height of the shown picture after adjusting, according to the ratio of the height and the width of described shown picture, and the height of shown picture after adjustment, determine the width of described shown picture.
Wherein, according to the original height of shown picture and the height of viewing area size, determine the picture line number that viewing area holds; According to the original height of picture columns and shown picture, represent the overall height being all shown picture; According to the quantity of shown picture, and the picture line number that viewing area holds, determine the wish arrangement columns of picture; According to the original height for arrangement columns and shown picture, determine the overall width being all shown picture.
When shown picture cannot one direction stretch time, be namely shown the Ratio invariableness of height and the width of picture, then can adopt aforesaid way three and mode four.The width being shown picture or the overall width and the overall height that highly represent all shown pictures is used in mode three and mode four, like this by adjustment parameter, the height that the overall width being all shown picture is less than the width of viewing area, overall height is less than viewing area can be made, and make the maximal value being resized to permission of shown picture as much as possible.Such as, supposing that viewing area is of a size of: width is 1000 pixels, is highly 500 pixels; The original size being shown picture is: width is 100 pixels, is highly 75 pixels, and the quantity being shown picture is 100; Then use the original width being shown picture, the picture columns that can obtain viewing area accommodation is 1000/100=10 row, and the overall width being shown picture is 1000 pixels; The wish arrangement line number of picture is that 100/10=10 is capable, the overall height being shown picture is 10*75=750, now, the overall height being shown picture is greater than the height of viewing area, then the original width of each shown picture is started to reduce with 1 unit picture element, until the overall height being shown picture is not more than the height of viewing area size, and this overall height being shown picture before reducing unit picture element is greater than the height of viewing area size.
After adjusting the width and height being shown picture, due to the adjacent placement of picture, white space may be there is in viewing area, in order to strengthen aesthetic property, can by the width of the white space of the viewing area of acquisition, the average often row that arrive are shown picture, as the lateral separation that adjacent picture arranges; By the height of the white space of the viewing area of acquisition, average to often going shown picture, as the longitudinal separation that adjacent picture is capable.
Pass through foregoing description, can find out, use the picture layout method that the embodiment of the present invention provides, by viewing area size, picture number, the size of adaptive adjustment picture, guarantee all complete displays of energy of all pictures, and reach possible full-size, thus, when picture is less, the size of picture display is comparatively large, ensures sharpness; When picture is more, picture can completely show, and guarantees monitor speed.
Below by specific embodiment, the picture layout method that the embodiment of the present invention provides is described in detail, as shown in Figure 2, when being shown the Ratio invariableness of the height and the width of picture, comprises the following steps:
Step 201, basis are shown the original height of picture and the height of viewing area size, determine the picture line number that viewing area holds;
Step 202, original height according to picture columns and shown picture, represent the overall height being all shown picture;
Step 203, basis are shown the quantity of picture, and the picture line number that viewing area holds, and determine the wish arrangement columns of picture;
Step 204, according to for arrangement columns and the original height of shown picture, determine the overall width being all shown picture;
Step 205, to compare being all shown the overall width of picture and the width of viewing area, if be less than, execution step 206; If be greater than, perform step 208; If equal, be then shown the original width of picture and be highly defined as the width after adjusting and height, performing step 210.
Step 206, by the original height of shown picture with 1 unit picture element start increase, until the overall width being all shown picture is greater than the width of viewing area size, and this overall width being all shown picture before increasing unit picture element is not more than the width of viewing area size, or the overall height being all shown picture is greater than the height of viewing area size, and this overall height being all shown picture before increasing unit picture element is not more than the height of viewing area size;
Step 207, this is increased the height being shown picture before unit picture element, be defined as the height of the shown picture after adjusting; According to the ratio of the height and the width of shown picture, and the height of shown picture after adjustment, determine the width of shown picture, perform step 210;
Step 208, by the original height of shown picture with 1 unit picture element start reduce, until the overall width being all shown picture is not more than the width of viewing area size, and this overall width being shown picture before reducing unit picture element is greater than the width of viewing area size;
Step 209, by the height of this shown picture, be defined as the height of shown picture after adjusting; According to the ratio of the height and the width of shown picture, and the height of shown picture after adjustment, determine the width of shown picture;
Step 210, the width of white space of viewing area that will obtain, be on average shown picture, as the lateral separation of adjacent picture row to every row; By the height of the white space of the viewing area of acquisition, average to often going shown picture, as the longitudinal separation that adjacent picture is capable.
Use the width means overall width of shown picture identical with the process that above-mentioned steps 201 to 210 describes with the principle of overall height, do not repeat them here.
Wherein, when performing step 206, comparatively realized by a recycle ratio, detailed process as shown in Figure 3, comprises the following steps:
Step 301, by the original height of shown picture with 1 unit picture element start increase; The pixel count of each increase can according to circumstances set, such as, increase by 1 unit picture element at every turn.
Step 302, increase are shown the height of picture, obtain the height after being shown this increase of picture;
Step 303, the overall height after increasing and the height of viewing area to be compared, if be less than, perform step 304; If be greater than, then the height before this being increased, as the shown picture height after adjustment, performs step 305;
Step 304, according to increase after height, determine increase after overall width, the width of overall width and viewing area is compared; If be less than, perform step 302; If be greater than, then the height before this being increased is as the shown picture height after adjustment;
Step 305, according to the height of shown picture after adjustment, determine the width of the shown picture after adjusting.
Pass through foregoing description, can find out, use the picture layout method that the embodiment of the present invention provides, by viewing area size, picture number, the size of adaptive adjustment picture, guarantee all complete displays of energy of all pictures, and reach possible full-size, thus, when picture is less, the size of picture display is comparatively large, ensures sharpness; When picture is more, picture can completely show, and guarantees monitor speed.
Based on same inventive concept, the embodiment of the present invention additionally provides a kind of picture placement device, as shown in Figure 4, comprising:
Acquisition module 401, for obtaining viewing area size, being shown the original size of picture and the quantity of shown picture, the original size of each described shown picture is identical;
Adjusting module 402, for according to described viewing area size, the size of each described shown picture is adjusted by same adjustment mode, until the size of each described shown picture reaches maximum, and the whole overall widths being shown picture after adjustment are not more than the width of described viewing area size, overall height is not more than the height of described viewing area size.
Preferably, described acquisition module 401, specifically under screen mode toggle, obtains the size of whole display screen; Under non-screen mode toggle, obtain the current available display screen size of display terminal operating system.
Preferably, described adjusting module 402, for the original size according to described viewing area size, described shown picture, determines the picture columns that viewing area holds; When the overall width being all shown picture is not more than the width of described viewing area size, adjust the height of each described shown picture, until the overall height being all shown picture equals the height of described viewing area size; Or
According to the original size of described viewing area size, described shown picture, determine the picture line number that viewing area holds; When the overall height being all shown picture is not more than the height of described viewing area size, adjust the width of each described shown picture, until the overall width being all shown picture equals the width of described viewing area size; Or
During the Ratio invariableness of the height and the width of described shown picture, the width means of described shown picture is adopted all to be shown overall width and the overall height of picture;
The described all shown overall height of picture and the height of described viewing area are compared;
When the described overall height being all shown picture is less than the height of described viewing area,
The original width of each shown picture is started to increase with 1 unit picture element, until the overall width being all shown picture is greater than the width of described viewing area size, and the overall width of this described all shown picture before increasing unit picture element is not more than the width of described viewing area size, or the overall height being all shown picture is greater than the height of described viewing area size, and the overall height of this described all shown picture before increasing unit picture element is not more than the height of described viewing area size; Be shown the width of picture before this being increased unit picture element, be defined as the width of the shown picture after adjusting; According to the ratio of the height and the width of described shown picture, and the width of shown picture after adjustment, determine the height of described shown picture;
When the overall height of described shown picture is greater than the height of described viewing area,
The original width of each shown picture is started to reduce with 1 unit picture element, until the overall height being all shown picture is not more than the height of described viewing area size, and the overall height of this described all shown picture before reducing unit picture element is greater than the height of described viewing area size; By the width of this shown picture, be defined as the width of the shown picture after adjusting; According to the ratio of the height and the width of described shown picture, and the width of shown picture after adjustment, determine the height of described shown picture; Or
During the Ratio invariableness of the height and the width of described shown picture, the overall width and overall height that adopt the height of described shown picture to represent all to be shown picture;
The described all shown overall width of picture and the width of described viewing area are compared;
When the described overall width being all shown picture is less than the width of described viewing area,
The original height of each shown picture is started to increase with 1 unit picture element, until the described overall width being all shown picture is greater than the width of described viewing area size, and the overall width of this described all shown picture before increasing unit picture element is not more than the width of described viewing area size, or the overall height being all shown picture is greater than the height of described viewing area size, and the overall height of this described all shown picture before increasing unit picture element is not more than the height of described viewing area size; Be shown the height of picture before this being increased unit picture element, be defined as the height of the shown picture after adjusting; According to the ratio of the height and the width of described shown picture, and the height of shown picture after adjustment, determine the width of described shown picture;
When the overall width of described shown picture is greater than the width of described viewing area,
The original height of each shown picture is started to reduce with 1 unit picture element, until the overall width being all shown picture is not more than the width of described viewing area size, and the overall width of this described all shown picture before reducing unit picture element is greater than the width of described viewing area size; By the height of this shown picture, be defined as the height of the shown picture after adjusting; According to the ratio of the height and the width of described shown picture, and the height of shown picture after adjustment, determine the width of described shown picture.
Preferably, said apparatus also comprises:
Characterization module 403, for according to the original width of described shown picture and the width of described viewing area size, determines the picture columns that described viewing area holds; According to the original width of described picture columns and shown picture, represent the overall width being all shown picture; According to the quantity of described shown picture, and the picture columns that described viewing area holds, determine the wish arrangement line number of picture; According to the described original width for arranging line number and described shown picture, determine the overall height being all shown picture; Or
According to the original height of described shown picture and the height of described viewing area size, determine the picture line number that described viewing area holds; According to the original height of described picture columns and shown picture, represent the overall height being all shown picture; According to the quantity of described shown picture, and the picture line number that described viewing area holds, determine the wish arrangement columns of picture; According to the described original height for arranging columns and described shown picture, determine the overall width being all shown picture.
Preferably, said apparatus also comprises:
Processing module 404, for the width of white space of viewing area that will obtain, is on average shown picture, as the lateral separation of adjacent picture row to every row; By the height of the white space of the viewing area of acquisition, average to often going shown picture, as the longitudinal separation that adjacent picture is capable.
Pass through foregoing description, can find out, the picture layout method using the embodiment of the present invention to provide and device, by viewing area size, picture number, the size of adaptive adjustment picture, guarantee all complete displays of energy of all pictures, and reach possible full-size, thus, when picture is less, the size of picture display is comparatively large, ensures sharpness; When picture is more, picture can completely show, and guarantees monitor speed.
Those skilled in the art should understand, embodiments of the invention can be provided as method, system or computer program.Therefore, the present invention can adopt the form of complete hardware embodiment, completely software implementation or the embodiment in conjunction with software and hardware aspect.And the present invention can adopt in one or more form wherein including the upper computer program implemented of computer-usable storage medium (including but not limited to magnetic disk memory, CD-ROM, optical memory etc.) of computer usable program code.
The present invention describes with reference to according to the process flow diagram of the method for the embodiment of the present invention, equipment (system) and computer program and/or block scheme.Should understand can by the combination of the flow process in each flow process in computer program instructions realization flow figure and/or block scheme and/or square frame and process flow diagram and/or block scheme and/or square frame.These computer program instructions can being provided to the processor of multi-purpose computer, special purpose computer, Embedded Processor or other programmable data processing device to produce a machine, making the instruction performed by the processor of computing machine or other programmable data processing device produce device for realizing the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
These computer program instructions also can be stored in can in the computer-readable memory that works in a specific way of vectoring computer or other programmable data processing device, the instruction making to be stored in this computer-readable memory produces the manufacture comprising command device, and this command device realizes the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
These computer program instructions also can be loaded in computing machine or other programmable data processing device, make on computing machine or other programmable devices, to perform sequence of operations step to produce computer implemented process, thus the instruction performed on computing machine or other programmable devices is provided for the step realizing the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
Although describe the preferred embodiments of the present invention, those skilled in the art once obtain the basic creative concept of cicada, then can make other change and amendment to these embodiments.So claims are intended to be interpreted as comprising preferred embodiment and falling into all changes and the amendment of the scope of the invention.
Obviously, those skilled in the art can carry out various change and modification to the present invention and not depart from the spirit and scope of the present invention.Like this, if these amendments of the present invention and modification belong within the scope of the claims in the present invention and equivalent technologies thereof, then the present invention is also intended to comprise these change and modification.