Summary of the invention
In order to reduce the size of a little nine figures, storage resource is saved, this specification embodiment provides a kind of nine figure of compression point
Method and device, technical solution are as follows:
According to the 1st of this specification embodiment the aspect, a kind of method of nine figure of compression point is provided, for nine figure of compression point
Lateral dimension, which comprises
Determine each compressible transversal stretching region in nine figure of point;
From each compressible transversal stretching region determined, at least one transversal stretching region is selected;
For each transversal stretching region of selection, the lateral dimension in the transversal stretching region is compressed, and adjust the transverse direction
The size of the corresponding transversal stretching marking line of stretching region, so that after the signable compression out of the transversal stretching marking line adjusted
The transversal stretching region;
Wherein it is determined that each compressible transversal stretching region in nine figure of point, comprising:
For each transversal stretching marking line of nine figure of point, determines and correspond to the transversal stretching mark in nine figure of point
The transversal stretching region of timberline;
Judge whether the transversal stretching region meets the first specified requirements;First specified requirements is to stretch in the transverse direction
It is identical with the color of each pixel in a line in contracting region;
If so, determining that the transversal stretching region is compressible.
According to the 2nd of this specification embodiment the aspect, a kind of method of nine figure of compression point is provided, for nine figure of compression point
Longitudinal size, which comprises
Determine each compressible longitudinal extension region in nine figure of point;
From the compressible each longitudinal extension region determined, at least one longitudinal extension region is selected;
For the stretching region longitudinally in each of selection, the longitudinal size in the longitudinal extension region is compressed, and adjusts the longitudinal direction
The size of the corresponding longitudinal extension marking line of stretching region, so that after the signable compression out of the longitudinal extension marking line adjusted
The longitudinal extension region;
Wherein it is determined that each compressible longitudinal extension region in nine figure of point, comprising:
For the marking line that stretches longitudinally in each of nine figure of point, determines and correspond to the longitudinal extension mark in nine figure of point
The longitudinal extension region of timberline;
Judge whether the longitudinal extension region meets the second specified requirements;Second specified requirements is to stretch in the longitudinal direction
In contracting region, the color of each pixel in same row is identical;
If so, determining that the longitudinal extension region is compressible.
According to the 3rd of this specification embodiment the aspect, a kind of device of nine figure of compression point is provided, for nine figure of compression point
Lateral dimension, described device include:
Determining module determines each compressible transversal stretching region in nine figure of point;
Selecting module selects at least one transversal stretching region from each compressible transversal stretching region determined;
Compression module compresses the lateral dimension in the transversal stretching region, and adjust for each transversal stretching region of selection
The size of the corresponding transversal stretching marking line in the whole transversal stretching region, so that the transversal stretching marking line adjusted is signable
Compressed transversal stretching region out;
Wherein, the determining module includes:
It determines submodule, for each transversal stretching marking line of nine figure of point, determines and correspond in nine figure of point
The transversal stretching region of the transversal stretching marking line;
Judgement processing submodule, judges whether the transversal stretching region meets the first specified requirements, the first specified item
Part is, identical with the color of each pixel in a line in the transversal stretching region;If so, determining the transversal stretching
Region is compressible.
According to the 4th of this specification embodiment the aspect, a kind of device of nine figure of compression point is provided, for nine figure of compression point
Longitudinal size, described device include:
Determining module determines each compressible longitudinal extension region in nine figure of point;
Selecting module selects at least one longitudinal extension region from the compressible each longitudinal extension region determined;
Compression module compresses the longitudinal size in the longitudinal extension region for the stretching region longitudinally in each of selection, and adjusts
The size of the corresponding longitudinal extension marking line in the whole longitudinal extension region, so that the longitudinal extension marking line adjusted is signable
Compressed longitudinal extension region out;
Wherein, the determining module includes:
It determines submodule, for the marking line that stretches longitudinally in each of nine figure of point, determines and correspond in nine figure of point
The longitudinal extension region of the longitudinal extension marking line;
Judging treatmenting module, judges whether the longitudinal extension region meets the second specified requirements, second specified requirements
For in the longitudinal extension region, the color of each pixel in same row is identical;If so, determining the longitudinal extension area
Domain is compressible.
Technical solution provided by this specification embodiment, for putting any transversal stretching region of nine figures, if
It is identical with the color of each pixel in a line in the transversal stretching region, then illustrate that the transversal stretching region has cross
To compressibility, in this way, transverse compression can be carried out to the transversal stretching region, to reduce the lateral dimension of nine figures of point.Similarly,
The longitudinal size of a little nine figures can also be reduced.By this specification embodiment, the size for nine figure of point manually drawn can be compressed
Size promotes picture compression rate.
It should be understood that above general description and following detailed description be only it is exemplary and explanatory, not
This specification embodiment can be limited.
In addition, any embodiment in this specification embodiment does not need to reach above-mentioned whole effects.
Specific embodiment
The principle of nine figures of point is introduced herein.Fig. 1 is that nine diagram of point is intended to.As shown in Figure 1, by manually scheming in png
The surrounding of piece draws the marking line of four black.Wherein, the effect of two transversal stretching marking lines of top is to indicate png figure
Piece horizontally telescopic regional scope;The effect of the longitudinal extension marking line on the left side is to indicate png picture in the longitudinal direction
Telescopic regional scope;The effect of spacing marking line is to indicate using png picture as background, in the longitudinal direction in the longitudinal direction on the right
The regional scope of displayable content;The effect of spacing marking line is indicated using png picture as background, in cross in following transverse direction
The regional scope of upward displayable content.
It should be noted that the emphasis paid close attention to herein be point nine figures size and how nine figure of non-dots shows content, therefore,
It can't excessively refer to spacing marking line and spacing marking line in transverse direction in longitudinal direction.
A and 2b referring to fig. 2 can determine corresponding transversal stretching area according to each transversal stretching marking line of nine figures of point
Domain can determine corresponding longitudinal extension region according to the marking line that stretches longitudinally in each of nine figures of point.Android system needs to carry out
When picture renders, the size for needing the picture rendered can be determined according to the screen size of mobile phone first, then rendering as needed
Picture size (lateral dimension and longitudinal size), size adjusting is carried out to nine figures of point and (transversal stretching and/or longitudinal is stretched
Contracting).When stretching to nine figures of point, horizontally can only stretch transversal stretching region, and can only stretch longitudinal stretch in the longitudinal direction
Contracting region.
Since nine figures of point can actually be considered as the rendering template of picture used in Android system, the size of point nine figures itself
Size is not to influence the key factor of the size of picture rendered, therefore, how in nine figure of retention point necessary letter
Under the premise of breath, reduces the size of nine figures of point to save storage resource, be assistant officer's technical problem to be solved in an engineering practice.
To solve this technical problem, it in one or more embodiments of this specification, automatically attempts to manually drawing
To nine figure of point compressed, if it find that point nine figures in there are unnecessary redundancies, just redundancy is deleted, with press
The size of nine figure of point reduction.
Specifically, for any transversal stretching region for putting nine figures, if in the transversal stretching region, it is same
The color of each pixel on row is identical, then explanation, which carries out transverse compression to the transversal stretching region, not will lead to a little nine figure
Necessary information (will not influence Android system and transversal stretching is carried out to nine figures of point) is lost, it therefore, can be to the transversal stretching area
Domain carries out transverse compression, and the pixel reduce is redundancy.
Similarly, for putting any longitudinal extension region of nine figures, if in the longitudinal extension region, in a line
Each pixel color it is identical, then explanation to the longitudinal extension region carry out longitudinal compression not will lead to a little nine figures lose
Necessary information (will not influence Android system to point nine figures carry out longitudinal extension), therefore, can to the longitudinal extension region into
Row longitudinal compression, the pixel reduce are redundancy.
In order to make those skilled in the art more fully understand the technical solution in this specification embodiment, below in conjunction with this
Attached drawing in specification embodiment is described in detail the technical solution in this specification embodiment, it is clear that described
Embodiment is only a part of the embodiment of this specification, instead of all the embodiments.The embodiment of base in this manual,
Those of ordinary skill in the art's every other embodiment obtained, all should belong to the range of protection.
Below in conjunction with attached drawing 3 and attached drawing 5, the technical program is described in detail.
The executing subject of method shown in Fig. 3 and method shown in Fig. 5 can be realization nine figures of point compression purpose and develop
Nine figure condensing routines of point.In practical applications, the nine figure condensing routine of point can integrate in nine figure drawing programs of point, as
One functional module of nine figure drawing programs of point.
In practical applications, after user draws to obtain a little nine figures based on png picture, nine figures of point can be input to a little nine figure
Condensing routine judges whether to compress nine figures of point, if it can, carrying out nine figures of point by putting nine figure condensing routines
Compression, compressed nine figure of point is exported to user.
It should be noted that method shown in Fig. 3 is used for the lateral dimension of nine figure of compression point, method shown in fig. 5 is used for
The longitudinal size of nine figure of compression point.Fig. 3 can be realized independently with method shown in fig. 5, can also be implemented in combination with and (both be attempted
The lateral dimension of nine figure of compression point, and attempt the longitudinal size of nine figure of compression point).
Fig. 3 is a kind of flow diagram of the method for nine figure of compression point that this specification embodiment provides, including following step
It is rapid:
S300: each compressible transversal stretching region in nine figure of point is determined.
It should be noted that nine figures of point are generally made of the png picture of rectangle and the black marking line of png picture surrounding.
Nine figures of point can have 1 transversal stretching marking line, it is possible to have more than 1 transversal stretching marking line.Each transversal stretching
The corresponding horizontal line stretching region of marking line is also rectangle.
In special circumstances, the size for putting the transversal stretching marking line of nine figures can be 1 pixel, in this way, transversal stretching
The size of marking line is specially a pixel, and the lateral dimension in transversal stretching region correspondingly is specially a pixel, in shape
A trunk line in a little nine figures is shown as in formula.It should be appreciated that transversal stretching line and transversal stretching region described herein
Concept enumerate the special circumstances.
In this specification embodiment, each compressible transversal stretching region in nine figure of point is determined, implement are as follows:
For each transversal stretching marking line of nine figure of point, the cross for corresponding to the transversal stretching marking line in nine figure of point is determined
To stretching region;Judge whether the transversal stretching region meets the first specified requirements;If so, determining that the transversal stretching region can
Compression, if not, it is determined that the transversal stretching region is incompressible.
Wherein, first specified requirements is, in the transversal stretching region, with the color of each pixel in a line
It is identical.
The principle being related to herein to the first specified requirements is illustrated.Android system is carrying out picture rendering based on nine figures of point
When, the transversal stretching Region extension and shrinking of nine figures can will be horizontally put to suitably sized according to screen size.If laterally stretched
Any color for traversing the pixel on line in contracting region is all identical, then illustrating the cross in transversal stretching region in a little nine figures
Even if being compressed to size, necessary information will not be lost, that is, will not influence Android system and transversal stretching region is carried out laterally
It is flexible.
Based on the above principles, the transversal stretching region for meeting the first specified requirements is the cross with lateral compressibility
To stretching region.
It is emphasized that also just not compressed if the lateral dimension in transversal stretching region is exactly originally 1 pixel
Necessity, therefore, it is this in special circumstances, be considered as transversal stretching region and be unsatisfactory for first specified requirements.
S302: from each compressible transversal stretching region determined, at least one transversal stretching region is selected.
In this specification embodiment, if there is more than one meets the transversal stretching region of the first specified requirements, then may be used
To select one or more transversal stretchings region to be compressed.The standard of selection can be set according to actual needs, specifically can be with
It is all transverse compressed grooves for meeting the first specified requirements of selection.
S304: for each transversal stretching region of selection, the lateral dimension in the transversal stretching region is compressed, and adjusting should
The size of the corresponding transversal stretching marking line in transversal stretching region.
It, can be by the transversal stretching region for each transversal stretching region of selection in this specification embodiment
Lateral dimension is suitably compressed.It is possible to further by 1 pixel of lateral dimension boil down in the transversal stretching region, in this way,
Can actually be collapsed into a little nine figures one of the transversal stretching region traverses line.
In addition it is also necessary to according to the compressed transversal stretching region, to adjust correspondingly transversal stretching marking line, so that
The transversal stretching marking line adjusted still is able to indicate the compressed transversal stretching region.
Fig. 4 is the schematic diagram that this illustrates nine figure of transverse compression point that embodiment provides.It should be noted that nine figures of point is vertical
Into flexible marking line, longitudinal direction spacing marking line, spacing marking line is not shown in FIG. 4 in transverse direction.It is assumed that point
Two transversal stretching regions of nine figures all meet the first specified requirements, and the lateral dimension of each transverse compressed groove is compressed to
1 pixel.The transversal stretching marking line collapse of nine figure of point after transverse compression is black pixel point, and corresponding transversal stretching region collapses
It is condensed to the wide trunk line of 1 pixel.
With continued reference to Fig. 4.Android system can still carry out picture rendering using nine figure of point after transverse compression.It is specific and
Speech, Android system can determine the actual size for needing the picture rendered according to the size of mobile phone screen.For example, after transverse compression
The lateral dimension (i.e. width) of nine figure of point be 10 pixels, and Android system needs to be rendered lateral dimension based on nine figures of point and be
The picture of 20 pixels.Android system can be by the lateral dimension in the transversal stretching region one (lateral dimension is 1 pixel) on the left side
11 pixels are stretched as, the transversal stretching region two (lateral dimension is 1 pixel) on the right are not processed.Android system can also incite somebody to action
The lateral dimension in the transversal stretching region one (lateral dimension is 1 pixel) on the left side is stretched as 6 pixels, by the transversal stretching area on the right
The lateral dimension in domain two (lateral dimension is 1 pixel) is also stretched as 6 pixels.Then, the lateral dimension for the picture that final rendering goes out
For 20 pixels.
Fig. 5 is a kind of flow diagram of the method for nine figure of compression point that this specification embodiment provides, including following step
It is rapid:
S500: each compressible longitudinal extension region in nine figure of point is determined.
Determine each compressible longitudinal extension region in nine figure of point, comprising: longitudinally in each for nine figure of point
Flexible marking line determines the longitudinal extension region for corresponding to the longitudinal extension marking line in nine figure of point;Judge that the longitudinal direction is stretched
Whether contracting region meets the second specified requirements;If so, determining that the longitudinal extension region is compressible.Wherein, described second is specified
Condition is, in the longitudinal extension region, the color of each pixel in same row is identical.
S502: from the compressible each longitudinal extension region determined, at least one longitudinal extension region is selected.
It specifically can choose all longitudinal compression regions for meeting second specified requirements.
S504: for the stretching region longitudinally in each of selection, the longitudinal size in the longitudinal extension region is compressed, and adjusting should
The size of the corresponding longitudinal extension marking line in longitudinal extension region.
It can be specifically directed to the stretching region longitudinally in each of selection, by the longitudinal size boil down to 1 in the longitudinal extension region
Pixel.
Since method shown in fig. 5 and method shown in Fig. 3 are consistent in principle, it is not repeated to illustrate.
By one or more embodiments of this specification, the size that can further compress nine figure of point manually drawn is big
It is small, promote picture compression rate.
It should also be noted that, in practice, user then needs if it is intended to make the size for nine figure of point drawn smaller
Before nine figure of graphical pointv, png picture is cut manually, redundancy section is reduced, then the png picture after cutting
Surrounding draw marking line.However, this mode is more troublesome for a user, also, manually referring to the precision of picture not yet
Height cannot achieve optimal cutting effect.
In this specification embodiment, user does not have to consider how to obtain smallest size of nine figure of point, but by putting nine figures
Condensing routine automatically compresses nine figures of point, can farthest remove the redundancy in a little nine figures, and it is empty to save storage
Between.
In addition, some nine figures of point may be merely able to when method shown in Fig. 3 is used in combination with method shown in fig. 5
It is compressed, and cannot be compressed in transverse direction in the longitudinal direction;Some nine figures of point may be merely able to be compressed in the longitudinal direction, and
It cannot horizontally be compressed;Some nine figures of point can may horizontally be compressed, and can also be compressed in the longitudinal direction.
For can horizontally compress, nine figure of point that can be also compressed in the longitudinal direction can in compression sequence
Transverse compression is carried out to first carry out method shown in Fig. 3, then executes method shown in fig. 5 and carries out longitudinal compression.It is of course also possible to
Longitudinal compression is first carried out, then carries out transverse compression.
Fig. 6 is a kind of device for nine figure of compression point that this specification embodiment provides, the lateral ruler for nine figure of compression point
Very little, described device includes:
Determining module 601 determines each compressible transversal stretching region in nine figure of point;
Selecting module 602 selects at least one transversal stretching area from each compressible transversal stretching region determined
Domain;
Compression module 603 compresses the lateral dimension in the transversal stretching region for each transversal stretching region of selection,
And the size of the corresponding transversal stretching marking line in the transversal stretching region is adjusted, so that the transversal stretching marking line adjusted can
Indicate the compressed transversal stretching region;
Wherein, the determining module includes:
Determine submodule 6011, for each transversal stretching marking line of nine figure of point, it is right in nine figure of point to determine
It should be in the transversal stretching region of the transversal stretching marking line;
Judgement processing submodule 6012, judges whether the transversal stretching region meets the first specified requirements, and described first refers to
Fixed condition is, identical with the color of each pixel in a line in the transversal stretching region;If so, determining the transverse direction
Stretching region is compressible.
The selecting module 602 selects all compressible transverse compressed grooves.
The compression module 603, for each transversal stretching region of selection, by the lateral dimension in the transversal stretching region
1 pixel of boil down to.
Fig. 7 is the device for nine figure of another compression point that this specification embodiment provides, the longitudinal direction for nine figure of compression point
Size, described device include:
Determining module 701 determines each compressible longitudinal extension region in nine figure of point;
Selecting module 702 selects at least one longitudinal extension area from the compressible each longitudinal extension region determined
Domain;
Compression module 703 compresses the longitudinal size in the longitudinal extension region for the stretching region longitudinally in each of selection,
And the size of the corresponding longitudinal extension marking line in the longitudinal extension region is adjusted, so that the longitudinal extension marking line adjusted can
Indicate the compressed longitudinal extension region;
Wherein, the determining module includes:
Determine submodule 7011, for the marking line that stretches longitudinally in each of nine figure of point, it is right in nine figure of point to determine
It should be in the longitudinal extension region of the longitudinal extension marking line;
Judgement processing submodule 7012, judges whether the longitudinal extension region meets the second specified requirements, and described second refers to
Fixed condition is, in the longitudinal extension region, the color of each pixel in same row is identical;If so, determining the longitudinal direction
Stretching region is compressible.
The selecting module 702 selects all compressible longitudinal compression regions.
The compression module 703, for the stretching region longitudinally in each of selection, by the longitudinal size in the longitudinal extension region
1 pixel of boil down to.
This specification embodiment also provides a kind of computer equipment, includes at least memory, processor and is stored in
On reservoir and the computer program that can run on a processor, wherein processor realizes the institute of Fig. 3 and/or 5 when executing described program
The method shown.
Fig. 8 shows one kind provided by this specification embodiment and more specifically calculates device hardware structural schematic diagram,
The equipment may include: processor 1010, memory 1020, input/output interface 1030, communication interface 1040 and bus
1050.Wherein processor 1010, memory 1020, input/output interface 1030 and communication interface 1040 are real by bus 1050
The now communication connection inside equipment each other.
Processor 1010 can use general CPU (Central Processing Unit, central processing unit), micro- place
Reason device, application specific integrated circuit (Application Specific Integrated Circuit, ASIC) or one
Or the modes such as multiple integrated circuits are realized, for executing relative program, to realize technical side provided by this specification embodiment
Case.
Memory 1020 can use ROM (Read Only Memory, read-only memory), RAM (Random Access
Memory, random access memory), static storage device, the forms such as dynamic memory realize.Memory 1020 can store
Operating system and other applications are realizing technical solution provided by this specification embodiment by software or firmware
When, relevant program code is stored in memory 1020, and execution is called by processor 1010.
Input/output interface 1030 is for connecting input/output module, to realize information input and output.Input and output/
Module can be used as component Configuration (not shown) in a device, can also be external in equipment to provide corresponding function.Wherein
Input equipment may include keyboard, mouse, touch screen, microphone, various kinds of sensors etc., output equipment may include display,
Loudspeaker, vibrator, indicator light etc..
Communication interface 1040 is used for connection communication module (not shown), to realize the communication of this equipment and other equipment
Interaction.Wherein communication module can be realized by wired mode (such as USB, cable etc.) and be communicated, can also be wirelessly
(such as mobile network, WIFI, bluetooth etc.) realizes communication.
Bus 1050 include an access, equipment various components (such as processor 1010, memory 1020, input/it is defeated
Outgoing interface 1030 and communication interface 1040) between transmit information.
It should be noted that although above equipment illustrates only processor 1010, memory 1020, input/output interface
1030, communication interface 1040 and bus 1050, but in the specific implementation process, which can also include realizing normal fortune
Other assemblies necessary to row.In addition, it will be appreciated by those skilled in the art that, it can also be only comprising real in above equipment
Component necessary to existing this specification example scheme, without including all components shown in figure.
This specification embodiment also provides a kind of computer readable storage medium, is stored thereon with computer program, the journey
Method shown in Fig. 3 and/or 5 is realized when sequence is executed by processor.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize information store.Information can be computer readable instructions, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable
Programmable read only memory (EEPROM), flash memory or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM),
Digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape magnetic disk storage or other magnetic storage devices
Or any other non-transmission medium, can be used for storage can be accessed by a computing device information.As defined in this article, it calculates
Machine readable medium does not include temporary computer readable media (transitory media), such as the data-signal and carrier wave of modulation.
As seen through the above description of the embodiments, those skilled in the art can be understood that this specification
Embodiment can be realized by means of software and necessary general hardware platform.Based on this understanding, this specification is implemented
Substantially the part that contributes to existing technology can be embodied in the form of software products the technical solution of example in other words,
The computer software product can store in storage medium, such as ROM/RAM, magnetic disk, CD, including some instructions are to make
It obtains a computer equipment (can be personal computer, service equipment or the network equipment etc.) and executes this specification embodiment
Method described in certain parts of each embodiment or embodiment.
System, method, module or the unit that above-described embodiment illustrates can specifically realize by computer chip or entity,
Or it is realized by the product with certain function.A kind of typically to realize that equipment is computer, the concrete form of computer can
To be personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media play
In device, navigation equipment, E-mail receiver/send equipment, game console, tablet computer, wearable device or these equipment
The combination of any several equipment.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for method reality
For applying example, since it is substantially similar to the method embodiment, so describing fairly simple, related place is referring to embodiment of the method
Part explanation.Embodiment of the method described above is only schematical, wherein described be used as separate part description
Module may or may not be physically separated, can be each module when implementing this specification example scheme
Function realize in the same or multiple software and or hardware.Can also select according to the actual needs part therein or
Person's whole module achieves the purpose of the solution of this embodiment.Those of ordinary skill in the art are not the case where making the creative labor
Under, it can it understands and implements.
The above is only the specific embodiment of this specification embodiment, it is noted that for the general of the art
For logical technical staff, under the premise of not departing from this specification embodiment principle, several improvements and modifications can also be made, this
A little improvements and modifications also should be regarded as the protection scope of this specification embodiment.