Embodiment
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, the present invention is further detailed explanation below in conjunction with the drawings and specific embodiments.
The present invention can be used in numerous general or special purpose computingasystem environment or the configuration.For example: personal computer, server computer, handheld device or portable set, plate equipment, multicomputer system, the system based on microprocessor, network PC, small-size computer, mainframe computer, comprise distributed computing environment of above any system or equipment or the like.The present invention is preferably applied in the embedded system.
The present invention can describe in the general context of the computer executable instructions of being carried out by computing machine, for example program module.Usually, program module comprises the routine carrying out particular task or realize particular abstract, program, object, assembly, data structure or the like.Also can in distributed computing environment, put into practice the present invention, in these distributed computing environment, by by communication network connected teleprocessing equipment execute the task.In distributed computing environment, program module can be arranged in the local and remote computer-readable storage medium that comprises memory device.
One of core idea of the embodiment of the invention is, size according to required dot character, adjust the size of the character picture of dot character formation this dot character is carried out convergent-divergent, thereby in system, only need to preserve a dot character file, just can realize the use of the dot character file of different font sizes, not only can save system space and resource, reduce system cost, can also improve the situation of dot character magnification distortion.
With reference to figure 2, show a kind of process flow diagram of adjusting the big submethod embodiment 1 of dot character of the present invention, specifically can may further comprise the steps:
Step 201, obtain the scalability information of dot character;
Described scalability information is meant the information that need amplify or dwindle dot character, in practice, can obtain the character boundary in a dot character file of being stored from embedded system, as the original size of dot character; Obtain the target sizes of the dot character of the current needs of user from user interface, original size and the target sizes according to this dot character can obtain the amplification of this dot character or the information of dwindling then, as scaling, convergent-divergent multiple etc.
Thereby, in a preferred embodiment of the present invention, can obtain the scalability information of dot character by following substep:
Substep A1, obtain the original size information of described dot character and default target sizes information;
Substep A2, the described original size information of contrast and target sizes information acquisition scalability information.
For example, the original size that obtains dot character is srcW*srcH, and target sizes is dstW*dstH; Wherein, srcW is the width of dot character original image, and srcH is the height of dot character original image, and dstW is the width of dot character target image, and dstH is the height of dot character target image; According to described dot character original size and target sizes, calculating scalability information be: width scaling srcW/dstW=w1/w2, height scaling srcH/dstH=h1/h2; If w1〉w2, h1〉h2, carry out reduction operation according to this scaling to the source images of this dot character so; If w1<w2, h1<h2 carries out amplifieroperation according to this scaling to the source images of this dot character so.
For obtaining preferable zooming effect, in practice, can be that unit carries out convergent-divergent with each dot character; When convergent-divergent, can be the unit that convergent-divergent is handled with the pixel value (Pixel) of dot character.Certainly, the dot character string that those skilled in the art form with a plurality of dot characters is that unit carries out convergent-divergent, perhaps, adopts the convergent-divergent unit of other dot character, also is feasible, and the present invention need not this to be limited.
Step 202, the dot character of being stored is converted to character picture;
The form of described character picture can be any picture format, as yuv format, rgb format etc.Suppose dot character shown in Figure 1 " 0 " is converted to yuv format, obtaining the work at present environmental background is white, and concrete conversion operations is:
A1, when reading in when being " _ ", assignment is respectively: Y=FFh, U=80h, V=80h;
A2, when being " X " when reading in, assignment is respectively: Y=00h, U=80h, V=80h;
A3, constitute 1 concrete pixel by the value of above-mentioned two YUV;
A4, generate 1 line data of image according to the dot character data structure of 1 row, all row constitute 1 entire image altogether.
This image promptly can be used as the source images that carries out zoom operations.
In practice, the method that obtains the work at present environment can be for calling distinctive gui (Graphical User Interface, graphic user interface) function, or obtain system's current images background colour; Then with the dot character file directly and another road input of system merge (merger), at character color according to particular color or the acquisition of negate special effect processing.
Certainly, above-mentioned conversion regime only is a kind of example, and it all is feasible that those skilled in the art adopt any image conversion method of the prior art, and the present invention does not limit this.
Step 203, described character picture is amplified or reduction operation according to described scalability information.
In specific implementation, described amplification or reduction operation at character picture can adopt any image zoom algorithm to realize.Be well known that the basic thought of realizing image zoom is that each point coordinate of source images is transferred to the new coordinate of target image respective point by the distortion computing, but can cause the coordinate of an impact point so can not integer usually.So when doing the amplification conversion, need to calculate the point that generation is not mapped to; And when dwindling conversion, need some points of deletion.Below introduce several image zoom algorithms commonly used:
One, nearest-neighbor method:
Its ultimate principle is exactly that this in non-integer coordinates work rounds up, and gets the color of the point at nearest integral point coordinate place.Promptly take out earlier adjacent four points of source images, then the position of target image respective point with these four points compared, the value of a nearest point (rgb value or YUV value) is composed point to reposition.
Two, linear interpolation method:
This method is on the basis of nearest field method, near the color value of the several points new point is averaged composes to this point again.
Three, two-dimensional linear method of interpolation:
Its principle also is that near point is averaged, but it adds different flexible strategy to the color value of each point, and these flexible strategy are exactly the position of each point apart from this point.Its computing method are as follows:
P=n*b*PA+n*(1-b)*PB+(1-n)*b*PC+(1-n)*(1-b)*PD
Wherein: n is the poor of the Y-axis coordinate of immediate row below the v (the Y-axis coordinate of mapping back respective point in source images generally is not integer) and v; Same b is also similar, but it is the X-axis coordinate.PA-PD be respectively (u, v) around the color (usefulness TCanvas Pixels attribute) of immediate four (upper left, upper right, lower-left, bottom right) source images points.P is (u, interpolation color v), i.e. (x, approximate color y).
Four, the convergent-divergent algorithm of spatial domain:
This method needs at first image is converted to the data of frequency domain by Fourier transform or the like, with various wave filters image is handled then.
Below by two concrete examples the zoom operations in the embodiment of the invention is further specified.
Example 1, character picture is carried out reduction operation, specifically can may further comprise the steps:
The original size of step C1, acquisition dot character is srcW*srcH, and target sizes is dstW*dstH; Wherein, srcW is the width of dot character original image, and srcH is the height of dot character original image, and dstW is the width of dot character target image, and dstH is the height of dot character target image;
Step C2, calculating scalability information are: width scaling srcW/dstW=w1/w2, height scaling srcH/dstH=h1/h2; Because this example is to carry out reduction operation, so w1〉w2, h1〉h2;
Step C3, carry out the scaled operation of horizontal direction, particularly, can adopt floor function and ceil function calculation width ratio respectively, be s1=floor (w1/w2), s2=ceil (w1/w2), according to the mean value of described s1pixels of following algorithm computation or s2pixels, described pixel value pixel num span is 0-srcW-1;
Described algorithm specifically can be realized by following code:
1) initial sum=0, step=0, num=0//initialization operation
2)step=step+w2,sum=sum+data[num]num=num+1
3)If?step>=w1,then
step=step-w1
If?step>=w2-w1%w2
Output sum/s2//output sum/s2
else
Output sum/s1//output sum/s1
sum=0
Else if step<w1, then don ' t output//do not export
4)return?to?2)
5) step C4, carry out the scaled operation of vertical direction according to the method described above, concrete with reference to above-mentioned algorithm.
A kind of concrete condition of using this example is: suppose srcW/dstW=9/2, i.e. and w1=9, w2=2 can obtain s1=4, s2=5.Concrete convergent-divergent algorithm is as follows:
w2-w1%w2=1
step=0sum=0
Num=0, step=2, sum=data[0], step=2<9, no output//this kind situation is not exported
Num=1, step=4, sum=sum+data[1], step=4<9, no output//this kind situation is not exported
Num=2, step=6, sum=sum+data[2], step=6<9, no output//this kind situation is not exported
Num=3, step=8, sum=sum+data[3], step=8<9, no output//this kind situation is not exported
Num=4,step=10,sum=sum+data[4],step=10>9,
Step=10-9=1, step 〉=1, output is sum/s2, // be output as sum/s2
Then?sum=0
Num=5, step=3, sum=sum+data[5], step=3<9, no output//this kind situation is not exported
Num=6, step=5, sum=sum+data[6], step=5<9, no output//this kind situation is not exported
Num=7, step=7, sum=sum+data[7], step=7<9, no output//this kind situation is not exported
Num=8,step=9,sum=sum+data[8],step=9=9,
Step=9-9=0, step<1, output is sum/s1 ,/be output as sum/s2
Then?sum=0
Example 2: character picture is carried out amplifieroperation, specifically can may further comprise the steps:
The original size of step D1, acquisition dot character is srcW*srcH, and target sizes is dstW*dstH; Wherein, srcW is the width of dot character original image, and srcH is the height of dot character original image, and dstW is the width of dot character target image, and dstH is the height of dot character target image;
Step D2, calculating scalability information are: width scaling srcW/dstW=w1/w2, height scaling srcH/dstH=h1/h2; Wherein, 1<w2/w1<=2,1<h2/h1<=2;
Step D3, adopt linear interpolation method in this example, carry out the amplifieroperation in proportion of horizontal direction, described algorithm specifically can be realized by following code:
1) initial step=w1, num=0, output data[0] // initialization operation
2)num=num+1
3)output?data[num-1]*(w2-step)/w2+data[num]*step/w2
4)step=step+w1
5)if?step<=w2?return?to?3)
else?step=step-w2?return?to?2)
Else step 〉=result of w2 and num=srcW-1 output last result//output last time
Step D4, carry out the amplifieroperation in proportion of vertical direction according to the method described above, concrete with reference to above-mentioned algorithm.
A kind of concrete condition of using this example is: suppose srcW=6, dstW=10, srcW/dstW=3/5, i.e. w1=3, w2=5
Concrete convergent-divergent algorithm is as follows:
initial?step=3 Num=0 ouput?data[0]
Num=1?output?data[0]*2/5+data[1]*3/5?step=3+3=6>5?step=6-5=1
Num=2?output?data[1]*4/5+data[2]*1/5?step=1+3=4<5
Num=2?output?data[1]*1/5+data[2]*4/5?step=4+3=7>5step=7-5=2
Num=3?output?data[2]*3/5+data[3]*2/5?step=2+3=5<=5
output?data[3] step=5+3=8>5?step=8-5=3
Num=4?output?data[3]*2/5+data[4]*3/5?step=3+3=6>5step=6-5=1
Num=5?output?data[4]*4/5+data[5]*1/5?step=1+3=4<5
output?data[4]*1/5+data[5]*4/5?step=4+3=7>5?and?Num=srcW-1
output?data[4]*1/5+data[5]*4/5
Above-mentioned example all is the convergent-divergent in proportion (being image level amplifies simultaneously or dwindle simultaneously with vertical) at image, in practice, also can upwards amplify or reduction operation in level or vertical folk prescription, can also carry out level or vertical folk prescription simultaneously to amplifying or reduction operation, the present invention does not limit this.And it all is feasible that those skilled in the art adopt any image zoom algorithm according to actual needs, and the present invention also need not this to be limited.
With reference to figure 3, show a kind of process flow diagram of adjusting the method embodiment 2 of dot character size of the present invention, specifically can may further comprise the steps:
Step 301, obtain the scalability information of dot character;
Step 302, the dot character of being stored is converted to character picture;
Step 303, described character picture is amplified or reduction operation according to described scalability information;
Character picture after step 304, the described amplification of preservation or the reduction operation is to buffer memory.
Present embodiment and difference embodiment illustrated in fig. 2 be, increased the step of character picture behind the buffer memory convergent-divergent, thereby improve the processing speed of embedded system.
In specific implementation, for saving the resource of embedded system, at every turn can two dot characters that will use of a buffer memory.The space of two characters promptly is set in the buffer memory of embedded system, a dot character that is used for storing behind the convergent-divergent, the dot character that another storage is to be exported, the dot character in these two spaces is changed back and forth, forms ping-pong mechanism; After system moves, just formed a streamline, dynamically the dot character that is positioned at scale space is input to be positioned at and treats output region, thereby effectively improved the processing speed of embedded system.
For example, suppose in the buffer memory to exist two dot character space buf0 and buf1, described buffer memory amplify or reduction operation after character picture operation can for:
Be kept at buf0 or buf1 in step e 1, the judgement; If be kept among the buf0 execution in step E2; If be kept among the buf1 execution in step E3;
Step e the 2, the 1st, 3,5,7...... time are saved in dot character among the buf0; Execution in step E4 then;
Step e the 3, the 2nd, 4,6,8...... time are saved in dot character among the buf1; Execution in step E5 then;
Step e 4, after buf0 finishes writing, when writing buf1, output buf0;
Step e 5, after buf1 finishes writing, when writing buf0, output buf1.
Certainly, those skilled in the art are provided with the buffer zone of other quantity according to actual conditions, as 1,3 etc. all be feasible, the present invention does not limit this.
As another preferred embodiment, the present invention can also comprise:
Character picture after step 305, the described amplification of output or the reduction operation.
In practice, character picture after described amplification or the reduction operation can be exported to the display end of embedded system, can also need use the place of dot character to call for other, as merging dot character file and other data Layer etc., the present invention limit this.
Behind the character picture after obtaining convergent-divergent,, can also carry out smoothing processing to the character picture after described amplification or the reduction operation for obtaining display effect better.For example, adopt the Gauss fuzzy algorithm to add a zone of transition around the word meeting, perhaps, adopt the weighted mean algorithm to carry out smoothing processing etc., the present invention does not also limit the mode that adopts smoothing processing.
With reference to figure 4, show a kind of process flow diagram of adjusting the method embodiment 3 of dot character size of the present invention, specifically can may further comprise the steps:
Step 401, obtain the scalability information of dot character;
Step 402, the dot character of being stored is converted to character picture;
Step 403, described character picture is amplified or reduction operation according to described scalability information;
Step 404, the character picture after described amplification or the reduction operation is converted to dot character;
Dot character after step 405, the described conversion of preservation is to buffer memory;
Dot character after step 406, the described conversion of output.
Present embodiment and difference embodiment illustrated in fig. 3 are, have increased the step that character picture behind the convergent-divergent is converted to dot character, thereby have satisfied the processing demands of different embedded systems.In this case, the dot character file can be preserved with the form of dot matrix in internal memory, and the method that character picture is converted to dot character can adopt any method of the prior art, and the present invention need not this to be limited.
For example, obtain the background color information and the character color information of character picture, insert corresponding identification according to different colouring informations in respective point respectively then.As the background color that obtains the current character image is white, and character color is a black; When certain a bit is white in reading image, output corresponding identification " _ "; In reading image on the other hand during black, output corresponding identification " X "; In the size area of dot character, carry out during described conversion, be converted to a complete dot character to guarantee character picture.
Need to prove, for aforesaid each method embodiment, for simple description, so it all is expressed as a series of combination of actions, but those skilled in the art should know, the present invention is not subjected to the restriction of described sequence of movement, because according to the present invention, some step can adopt other orders or carry out simultaneously.Secondly, those skilled in the art also should know, the embodiment described in the instructions all belongs to preferred embodiment, and related action and module might not be that the present invention is necessary.
With reference to figure 5, show a kind of structured flowchart of adjusting the device embodiment 1 of dot character size of the present invention, preferred, only need store a dot character file in the described embedded system, described device specifically can comprise with lower unit:
Scalability information acquiring unit 501 is used to obtain the scalability information of dot character;
Preferably, described scalability information acquiring unit 501 can comprise following subelement:
Original size is obtained subelement, is used to obtain the original size information of described dot character;
Target sizes is obtained subelement, is used to obtain the target sizes information of described dot character;
Contrast subunit is used to contrast described original size information and target sizes information acquisition scalability information.
Image conversion unit 502, the dot character that is used for being stored is converted to character picture;
Zoom operations unit 503 is used for according to described scalability information described character picture being amplified or reduction operation.
For obtaining display effect better, the embodiment of the invention can also comprise:
Smoothing processing unit 504 is used for the character picture after described amplification or the reduction operation is carried out smoothing processing.
In a preferred embodiment of the present invention, can also comprise:
First buffer unit 505 is used to preserve character picture after described amplification or the reduction operation to buffer memory.
Preferably, in embodiments of the present invention, can also comprise:
First output unit 506 is used to export the character picture after described amplification or the reduction operation.
With reference to figure 6, show and use the flow chart of steps that preferred embodiment shown in Figure 5 carries out the adjustment of dot character size, specifically can may further comprise the steps:
The original size of step 601, scalability information acquiring unit is obtained subelement, obtains the original size information of dot character from the dot character file of embedded system storage;
The target sizes of step 602, scalability information acquiring unit is obtained subelement, extracts the target sizes information of the dot character of user interface setting;
The contrast subunit of step 603, scalability information acquiring unit contrasts described original size information and target sizes information acquisition scalability information;
Step 604, image conversion unit are converted to character picture with the dot character of being stored;
Step 605a, if current scalability information be amplification message, then the zoom operations unit carries out amplifieroperation according to described scalability information to described character picture;
Step 605b, if current scalability information be the information of dwindling, then the zoom operations unit carries out reduction operation according to described scalability information to described character picture;
Step 606, first buffer unit are preserved character picture after described amplification or the reduction operation to buffer memory;
Step 607, first output unit are exported the character picture after described amplification or the reduction operation.
With reference to figure 7, show a kind of structured flowchart of adjusting the device embodiment 2 of dot character size of the present invention, preferred, only need store a dot character file in the described embedded system, described device specifically can comprise with lower unit:
Scalability information acquiring unit 701 is used to obtain the scalability information of dot character;
Image conversion unit 702, the dot character that is used for being stored is converted to character picture;
Zoom operations unit 703 is used for according to described scalability information described character picture being amplified or reduction operation.
Dot matrix converting unit 704 is used for the character picture after described amplification or the reduction operation is converted to dot character.
In a preferred embodiment of the present invention, can also comprise:
Second buffer unit 705 is used to preserve dot character after the described conversion to buffer memory.
Second output unit 706 is used to export the dot character after the described conversion.
Preferably, the device of adjustment dot character size of the present invention is preferably applied in the embedded system.
Because device embodiment of the present invention is substantially corresponding to preceding method embodiment, so not detailed part in the description of present embodiment can just not given unnecessary details at this referring to the related description in the previous embodiment.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, and what each embodiment stressed all is and the difference of other embodiment that identical similar part is mutually referring to getting final product between each embodiment.
At last, also need to prove, in this article, relational terms such as first and second grades only is used for an entity or operation are made a distinction with another entity or operation, and not necessarily requires or hint and have the relation of any this reality or in proper order between these entities or the operation.
More than to provided by the present inventionly a kind ofly be used for the method for the adjustment dot character size of embedded system, a kind of device and a kind of embedded system that is used for the adjustment dot character size of embedded system is described in detail, used specific case herein principle of the present invention and embodiment are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, the part that all can change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.