Detailed Description
The method of the present invention will be described in an embodiment that employs an algorithm to reduce an electronic document so that the reduced document can be displayed on the screen of the handheld device. The electronic file is reduced according to the width of the electronic file and the width of the screen of the handheld device.
In addition, the method is characterized in that: in this context, all units of measure of height and width are pixels (pixels).
Referring to FIG. 2, FIG. 2 shows a digital handheld device 30 displaying an electronic document 38 on a screen 34 according to the method of the present invention; in the present embodiment, the digital handheld device 30 is a personal digital assistant 30, and the electronic document 38 can be a web page. Of course, the present invention is not limited to a PDA 30, but can also be applied to a device having a display unit screen with pixels as basic display units, such as a mobile phone, a capsule-type personal computer or any other digital handheld device. The PDA 30 includes a user interface 32. the user interface 32 includes a stylus, although not shown. The screen 34 also shows a vertical scroll 36. The electronic file 38 is shown as being scaled down according to the method of the present invention.
The screen 34 of the pda is a touch-sensitive TFT matrix, which includes a plurality of pixels, and the width of the screen 34 is 240 pixels and the height is 320 pixels. The size of the screen 34 and the resolution are not limited to the application of the present invention, and therefore, even the pda 30 with a resolution of 160 × 160 pixels can use the method of the present invention. The user can operate the components displayed on the screen 34 by using a stylus to operate the vertical scroll 36 or by using the user interface 32. For example, the user may control the vertical scroll 36 to display the currently invisible portion of the reduced document 38.
The reduced file 38 displayed on the pda screen 34 is a reduced copy of the original file. Referring to FIG. three A, the original file 40 has a width ranging from 0 to 809 pixels on the x-axis, and thus has a width of 810 pixels; while the height of the original document 40 ranges from 0 to 1973 pixels on the y-axis, and thus its height is 1974 pixels. Note that the origin (0, 0) of this x-y coordinate system is at the upper left corner of the original file 40. The size of an array of pixels 46 in the original document 40 is shown highlighted. The original document 40 is displayed on a screen of a personal computer having a display area 42. The display range 42 represents a resolution of 1024 x 768 pixels in a pc screen, with the x-axis ranging from 0 to 1023 pixels and the y-axis ranging from 0 to 767 pixels. The entire width of the original document 40 is exactly the same as the extent 42 of the pc screen and can therefore be displayed completely on the screen of the pc. According to embodiments of the present invention, the width and height of the original file 40 may be any value, and the width of the original file 40 is greater than the width of the screen 34 of the PDA.
As shown in FIG. 3b, the reduced file 38 has a width 203 pixels with coordinates ranging from 0 to 202 pixels; and high 494 pixels with coordinates ranging from 0 to 493 pixels. Note that the reduced file 38 has a regional origin in the upper left corner with an x-y axis. As shown in FIG. 2, PDA screen content 44 represents the size of PDA screen 34, wherein the width is 240 pixels and the height is 320 pixels. Thus, the x-axis coordinates of the PDA screen content 44 range from 0 to 239 pixels, while the y-axis ranges from 0 to 319 pixels. A pixel 48, corresponding to the pixel array 46, is displayed in a more pronounced size over the reduced document 38.
The method divides the original file 40 by 4 to create a reduced file 38. The reduction ratio "k" is 4, which is obtained by dividing 240 pixels of the width of the screen 34 of the PDA by 810 pixels of the width of the original document 40 and carrying them unconditionally. Using this method to determine the reduction ratio "k" ensures that the width of the reduced document 38 does not exceed the range 44 that can be displayed by the PDA, and the equation is as follows:
wherein,
k is a scale down and is noted in the parenthesis of the unconditional carry;
WOis the width of the original document 40;
WRSto reduce the width of the file, in this case the width of the screen 34 of the personal digital assistant;
the width of the reduced document 38 is 203 pixels as described above, and the number "203" is obtained by dividing the width of the original document 40 by 4, 810 pixels, wherein the fraction of the decimal point is processed in an unconditional carry manner. If the fraction of the result is unconditionally discarded, the data loss will result. The same procedure is followed to reduce the height 493 pixels of the file 38. And its reduction by a factor k is the difference between the height of the original file 40 and the height of the pda 34. However, in this embodiment, the width is the most important spatial consideration.
When the size of the reduced file 38 is determined, the data of the original file 40 must be processed. The method uses an array of pixels to sample the pixels of the original file 40 to create a reduced file 38. The method proceeds with mapping the pixels of the reduced file 38 into the pixel array of the original file 40 by the following equation:
CVRto reduce the pixel color values of the document 38 at coordinates (x, y);
CVOis the pixel color value of the original document 40 at the coordinate (k · x + i, k · y + j);
k is the reduction ratio of the reduced file 38 obtained by equation 1-1;
i is a reference point on the x-axis in the pixel array of the original file 40;
i is the upper boundary line of the pixel array in the x-axis direction;
j is a reference point on the y-axis in the pixel array of the original file 40;
j is the upper boundary line of the pixel array in the y-axis direction;
the method calculates for each pixel in the scaled-down file 38 in all existing (x, y) coordinates using equations 1-2. Referring to fig. 4A and 4B, enlarged views of the pixel array 46 and the corresponding pixels 48 are shown. The width and height of the square pixel array 46 are usually set equal to a reduction ratio "k", which is 4 in this example, and by setting the upper limit of I and J to "k-1", we obtain "4-1 to 3". The (x, y) coordinate of the pixel 48 in the reduced file 38 is (8, 7). The corresponding pixel array 46 has an origin in the original document 40 with (x, y) coordinates (32, 28) and a point farthest from the origin with (x, y) coordinates (35, 31). The pixels of the pixel array 46 and the pixels 48 of the respective colors are shaded differently in fig. 4A and 4B.
In practice, the method will calculate the color values of red, green and blue three times for each pixel in the reduced document 38 using equations 1-2. The color value CVOAnd CVRRepresents a certain color value of a pixel in the reduced file 38. equivalently, the method calculates a color value of three colors represented as a red, green, and blue triplet (triplets) of the pixel array 46 by averaging using equations 1-2 to obtain the red, green, and blue color value of the pixel 48.
In the region of the original document 40, the upper limits I and J of the pixel array 46 are the reduction ratio "k" minus one, and thus the size of the pixel array 46 is equal to the reduction ratio "k" in both the x and y directions. However, when this approach is followed to downscale the rightmost and bottommost pixels of the file 38, the values of I and J must also be reduced to fit the true size of the original file 40, and are not limited by the factor that it is to be a multiple of the downscale "k". Equations 1-3 and 1-4 show how I and J are determined.
Wherein,
i is the upper limit of the pixel array in the x direction; note that brackets are left out unconditionally;
k is the reduction ratio of the reduced file 38 determined in equation 1-1;
WRto narrow the width of the file 38;
j is the upper limit of the pixel array in the y direction; note that brackets are left out unconditionally;
HRto reduce the height of the document 38;
WR-1 and HRThe two terms-1 correspond to the pixels of the rightmost column and the bottommost row of the scaled-down file 38, respectively. The upper limits of I and J are always less than or equal to "k-1", and thus the width and height of the pixel array 46 are limited to a range less than or equal to the reduction scale "k".
The PDA 30 shown in FIG. 2 further includes a processor and a memory, which have the capability of performing the above-mentioned operations. The memory stores an original file 40. The processor performs the method as described for the original file 40 and uses a small area of the memory to do the work of building a reduced file. Finally, the reduced file 38 is stored in memory and displayed on the screen 34 of the personal digital assistant 30.
Referring to fig. 5, fig. 5 is a flowchart of a method of the present invention. The flow chart shows the method starting at coordinate (0, 0) and spanning the entire document according to the (x, y) coordinate axis:
step 100: starting;
step 102: reading an original file 40 stored in the memory of the personal digital assistant;
step 104: generating a dot matrix image file of the original file 40 and storing the dot matrix image file in a buffer;
step 106: the reduced ratio "k" is determined in equation 1-1 based on the size of the original document 40 and the PDA screen 34.
Step 108: setting the y-axis to 0, which represents the first line in the reduced file 38;
step 110: setting the x-axis to 0, which represents the first column in the reduced file 38;
step 112: determining I and J using equations 1-3 and 1-4, and determining the size of the pixel array based on (x, y) coordinates;
step 114: determining a red, green and blue color value of each pixel in the (x, y) coordinates using equation 1-2, and determining a color value of each pixel in the reduced document based thereon;
step 116: increasing the x-axis coordinate;
step 118: is the last existing x-axis coordinate out of bounds? If so, go to step 120; if not, go to step 112;
step 120: increasing the y-axis coordinate;
step 122: is the last existing y-axis coordinate out of bounds? If so, go to step 124; if not, go to step 110;
step 124: displaying the scaled-down file 38 on the screen 34 of the personal digital assistant;
step 126: and (6) ending.
After the reduced file 38 is created, stored in the memory of the PDA 30 and displayed on the PDA screen 34, the user may simply scroll the vertical scroll bar to read the reduced file 38. If the user wants to see more carefully, he can easily point to a portion of the reduced document 38 via the user interface 32 to display that portion of the original document 40 on the PDA screen 34. Wherein the original document 40 aligns the exact center of the portion of the document with the location pointed to by the user on the user interface 32. This feature enables the present invention to ensure that the reduced document 38 does not miss any of the original document 40. Of course, if the original file 40 is too large to read the reduced file 38, then the reduced file 38 may be used as a "map" of the original file 40. When the user jumps from the reduced file 38 to the original file 40 mode and then jumps back to the reduced file 38 from the original file 40, the pda 30 does not need to rebuild the reduced file 38 again, and the pda 30 can retrieve the reduced file 38 directly from the memory.
The above method, and in particular equation 1-2, produces a scaled-down document 38 whose RGB color values for the pixels are obtained by an algorithm that averages the RGB colors. Of course, different averaging algorithms may be used. The accumulation method of equations 1-2 can be changed to a method using linear or non-linear weighting instead of weighting each pixel's color value equally. Alternatively, instead of using the accumulation method, an intermediate value method or the remaining numerical methods may be used. Finally, the method for determining the color value of the reduced file 38 may not use the RGB color values as the calculation target, for example, the gray scale or monochrome mode may be used as the standard for color calculation.
In addition, equations 1-2, 1-3, and 1-4 limit the amount of time that each pixel in reduced file 38 must be aligned to an array of pixels in original file 30. This one-to-one relationship necessitates that at most a single pixel array be available for each pixel in the scaled-down file 38. This limitation can be modified to allow a pixel to be used with multiple arrays, however, the slight read quality increase in the scaled-down document 38 does not take into account the additional load on the central processor of the PDA. This variant embodiment may allow the reduction ratio "k" to be a real number.
Finally, the original document to be read is reduced by taking the larger value of the width reduction ratio and the height reduction ratio as the actual reduction ratio 'k', so that the user can be ensured to read the reduced original document on the screen of the personal digital assistant without adjusting the scroll on the screen.
Compared with the prior art, the invention allows an electronic file to be completely displayed on the screen of a digital handheld device in a reduced size. The invention provides a convenient reading mode for users and can ensure that the information in the document can be identified by naked eyes. The present invention also makes it as simple as displaying a reduced file for the digital handheld device to view the original file.
The above description is only a preferred embodiment of the present invention, and all equivalent changes and modifications made in accordance with the claims of the present invention should be covered by the claims of the present invention.