Read the portable electric appts and the rendering intent thereof of multi-page document
Technical field
The present invention relates to a kind of rendering intent of on portable electric appts, reading multi-page document, and adopt the portable electric appts that this method can quick and smooth read purposefully multi-page document.
Background technology
In the actual life, along with a large amount of of mobile device (being portable electric appts, such as PDA, smart mobile phone or panel computer etc.) popularize, the demand of on mobile device, reading the multi-page document of PDF and so on gets more and more.Because page structure more complicated, the element of the multi-page document of PDF and so on are of a great variety; And the mobile device resource-constrained; Cause and show that on mobile device a PDF page needs the long time; Thereby reduced user's experience effect, display speed therefore how to accelerate reader as much as possible becomes the problem of a needs research.
For example, the reading of PDF document of the prior art in mobile device,
The mode of playing up wherein has following several kinds:
(1) when being about to show a page, carries out the page again and be written into, in main thread, carry out page rendering.Shortcoming is: owing to lack buffering, when each page need show, carry out the page again and be written into, this has just caused page display efficiency low, and the user has obviously felt the process that is written into of the page.
(2) when showing a document, all pages being put into the backstage plays up in the thread and plays up.Shortcoming is: neither one paging mechanism, caused the user to withdraw from a document and read when getting into other document and read the also page of a document on playing up of background thread; When if display interface is called in the thumbnail forms, the backstage also playing up the main page that shows forms, can cause the thumbnail loading velocity slack-off so.
Reading buffering method wherein has following several kinds:
(1) once all pages in the document is carried out reading displayed.Shortcoming is: owing to what once go all pages are written into, so when PDF document number of pages is more, can cause the load time longer; Owing in internal memory, be written into a large amount of pages, can cause the resource occupancy volume big, program is unstable.
(2) when being about to display page at the reading displayed page to display.Shortcoming is: though it is big to have overcome the resource occupancy volume of scheme one, the unsettled shortcoming of program owing to before showing one page, just the page is written into, can cause the page turning flicker, and user experience is bad.
(3) set up a buffer queue, the document that showed is put into formation,, can show fast if when the user will check the page of having seen like this.Shortcoming is: in the buffer memory page, do not consider the custom that the user uses, only according to checking that the priority of time carries out page cache, page hit rate is not high.
Based on above-mentioned defective of the prior art, invented to inventor's novelty a kind of can quick and smooth read purposefully PDF and so on the portable electric appts and the rendering intent thereof of multi-page document.
Summary of the invention
The objective of the invention is to for overcoming the defective of prior art, and provide a kind of can quick and smooth read purposefully PDF and so on the portable electric appts and the rendering intent thereof of multi-page document.
For realizing above-mentioned purpose, the present invention adopts following technical scheme:
A kind of portable electric appts of reading multi-page document; Comprise processing unit; And the storer and the display screen that connect with processing unit, described processing unit comprise be used to show the UI main thread module of multi-page document and on the backstage to several pages of front and back of institute's display page play up play up the pond module.
Its further technical scheme is: each page (also comprising current page itself) before and after described UI main thread module demonstration comprises at least.
Its further technical scheme is: described UI main thread module also comprises the reading Buffer Pool module that is used to safeguard 4~12 forms, and described each forms show a page.
Its further technical scheme is: described each page comprises the time attribute module, and described time attribute module comprises and is used to write down the time point information that this page is written into forms.
Its further technical scheme is: described each page also comprises the space attribute module, described space attribute module comprise be used to write down this page up and down or the page number information of position, the left and right sides.
Its further technical scheme is: described multi-page document is PDF document or TIFF document.
A kind of rendering intent of reading multi-page document; This method is to be provided with one on the operation backstage of electronic equipment to play up the pond thread, and this is played up the pond thread and carries out synchronisation through a task queue and main UI thread: 1) play up thread each 1~9 page before and after the current reading page is played up; 2) play up the rendering operations of the intact page of thread execution after, notice UI main thread repaints the demonstration forms; 3) the UI main thread is drawn and is shown forms.
Its further technical scheme is: task queue is set, will plays up task according to user's reading requirement and constantly be pushed in the task queue, play up thread and constantly from task queue, get task, carry out rendering operations, during no task, play up thread and be in sleep state; When switching different multi-page documents, with rendering operations full scale clearance from task queue of original multi-page document; In the described page, be provided with time attribute, write down the time that this page is written into forms, and when the user gets into new page, swap out the maximum page of time attribute; At the described page setup attribute that has living space, and, the user is written into the lower page on it or the left and right sides page when getting into new page.
Its further technical scheme is: described multi-page document is PDF document or TIFF document, and playing up thread is that PDF document, TIFF document are played up the picture into JPEG or BMP form; When carrying out the multi-page document reading first, the UI main thread reads synchronously in advance needs the page displayed and the connected page.
Its further technical scheme is: the UI main thread comprises a reading buffer-process with 4~12 forms, and each forms shows a page.
Its further technical scheme is: when the UI main thread shows new page; Whether in reading Buffer Pool, search this page exists; Just these forms are directly moved to the viewing area when existing; Then in reading Buffer Pool, after page of deletion, new page is shown and adds the reading Buffer Pool when not existing.
The present invention's beneficial effect compared with prior art is: can improve the efficient that multi-page document is read, be written into the page and accelerate; Improve the switching efficiency of thumbnail and document, can switch thumbnail fast; Rendering operations to multi-page document moves on to the backstage execution, and interface operation is smooth; Safeguarded buffer queue, the page frequent efficient that changes to when swapping out among a small circle is higher; Need whole pages be written into internal memory, improve the efficient of reading and the stability of program.Through test, this kind method can strengthen the hit probability that will change to the page, makes that reading is smooth, program is stable.
Below in conjunction with accompanying drawing and specific embodiment the present invention is further described.
Description of drawings
Fig. 1 reads the synoptic diagram of the portable electric appts specific embodiment of multi-page document for the present invention;
Fig. 2 read for the present invention multi-page document (PDF document) the rendering intent specific embodiment play up process flow diagram;
Fig. 3 reads the reading buffering figure of the rendering intent specific embodiment of multi-page document (PDF document) for the present invention.
Description of reference numerals
1 processing unit 11UI main thread module
12 play up pond module 13 reads the Buffer Pool module
10 backstages
2 storeies, 3 display screens
Embodiment
In order more to make much of technology contents of the present invention, below in conjunction with specific embodiment technical scheme of the present invention is further introduced and explanation, but be not limited to this.
As shown in Figure 1; A kind of portable electric appts of reading multi-page document of the present invention; Comprise processing unit 1; And the storer that connects with processing unit 12 and display screen 3, processing unit 1 comprises and is used to show the UI main thread module 11 of multi-page document and several pages of front and back of 10 pairs of institute's display pages are played up plays up pond module 12 on the backstage.Each page (also comprising current page itself) before and after 11 demonstrations of UI main thread module comprise at least.In addition, UI main thread module comprises that is also read a Buffer Pool module 13, and this is read Buffer Pool module 13 and safeguards 4~12 forms, and each forms shows a page.These forms can thumbnail form show, with the front and back adjacent page that provides the user to transfer current page at any time.
Wherein, each page in the multi-page document comprises the time attribute module, and the time attribute module comprises and is used to write down the time point information that this page is written into forms.Each page also comprises the space attribute module, described space attribute module comprise be used to write down this page up and down or the page number information of position, the left and right sides.Multi-page document mainly is meant PDF document or TIFF document.
As shown in Figure 2, the rendering intent of a kind of reading multi-page document of the present invention (being the PDF document in this example), this method is to be provided with one on the operation backstage of electronic equipment to play up the pond, this is played up the pond and carries out synchronisation through a task queue and main UI thread:
1) playing up thread plays up each 5 page before and after the current reading page in playing up the pond;
2) task of playing up of current reading page constantly is pushed in the task queue, and the thread of playing up in the pond of playing up is constantly got task from task queue, carries out rendering operations; During no task; Play up thread and be in sleep state, also promptly: the task of playing up of the current PDF page constantly is pushed in the task queue, and the thread of playing up in the pond of playing up is constantly got task from task queue; If there is task just to carry out rendering operations, if not just sleep of this thread;
3) play up the rendering operations of the intact page of thread execution after, notice UI main thread repaints the demonstration forms;
When 4) switching different PDF document, the full scale clearance from task queue of the rendering operations of original PDF document.
The thread of playing up is wherein played up from the head task of getting of task queue.If the user accesses thumbnail list, then the demand of playing up in this thumbnail is pushed into the task list head, make it be performed earlier.Also promptly: if the user has been switched document; The task that the UI main thread will be present in the task queue at once empties the task of playing up of making a concession current document again; If the user accesses thumbnail list, then the demand of playing up in this thumbnail is pushed into the task list head, make it be performed earlier.
The concrete steps of playing up are:
Step 201: begin to read the PDF document;
Step 202: push display page with its up and down or about each five page rendering task in the task formation;
Step 203: play up the page;
Step 204: receive and play up message of successful;
Step 205: redraw display interface;
Step 206: judge whether to switch document, when not switching document, get into step 208, when switching document, get into step 207;
Step 207: the outdated task in the deletion task list;
Step 208: judge whether finish to read,, get into step 203 again, carry out rushing down of the page and dye,, then get into and read the step 209 that finishes if when finishing to read if when not finishing to read;
Step 209: read and finish.
As shown in Figure 3; Wherein reading buffering flow process is: carrying out the PDF document first when reading, the UI main thread read in advance synchronously need page displayed with its before and after (page that comprises above-below direction or left and right directions) each page (reason of doing like this is the problem that can not have flicker when first page is shown).Also promptly: when carrying out document viewing first, read in advance synchronously need page displayed with its about each page, the reason of doing like this is the problem that can not have flicker when first page is shown.Also comprise a reading Buffer Pool with 4~12 forms, each forms shows a page.When the UI main thread shows new page; Whether in reading Buffer Pool, search this page exists; Just these forms are directly moved to the viewing area when existing, then in reading Buffer Pool, after page of deletion, new page is shown and add the reading Buffer Pool when not existing.Select during the deletion page to check the longest page of time (from the time selection) from the current page page (selecting) or selection farthest from the space.The preferential selection deleted from the current page page farthest.
The concrete steps of reading buffering are:
Step 301: begin to read the PDF document;
Step 302: read 3 pages in advance, comprise current page, and the prevpage of current page and the next page;
Step 303: judge whether and to skip,, then get into step 306 and read end if do not skip; How to skip, then new window is added and read Buffer Pool (being step 304);
Step 304: new window is added the reading Buffer Pool;
Step 305: in playing up the pond, be picture with each 5 page rendering of front and back;
Step 306: read and finish.
In sum, can improve the efficient that multi-page document is read, be written into the page and accelerate; Improve the switching efficiency of thumbnail and document, can switch thumbnail fast; Rendering operations to multi-page document moves on to the backstage execution, and interface operation is smooth; Safeguarded buffer queue, the page frequent efficient that changes to when swapping out among a small circle is higher; Need whole pages be written into internal memory, improve the efficient of reading and the stability of program.
The above only further specifies technology contents of the present invention with embodiment, so that the reader is more readily understood, but does not represent embodiment of the present invention to only limit to this, anyly extends or recreation according to the technology that the present invention did, and all receives protection of the present invention.Protection scope of the present invention is as the criterion with claims.