View Single Post
Old 04-03-2010, 06:14 PM   #23
Jim Chapman
Addict
Jim Chapman ought to be getting tired of karma fortunes by now.Jim Chapman ought to be getting tired of karma fortunes by now.Jim Chapman ought to be getting tired of karma fortunes by now.Jim Chapman ought to be getting tired of karma fortunes by now.Jim Chapman ought to be getting tired of karma fortunes by now.Jim Chapman ought to be getting tired of karma fortunes by now.Jim Chapman ought to be getting tired of karma fortunes by now.Jim Chapman ought to be getting tired of karma fortunes by now.Jim Chapman ought to be getting tired of karma fortunes by now.Jim Chapman ought to be getting tired of karma fortunes by now.Jim Chapman ought to be getting tired of karma fortunes by now.
 
Posts: 310
Karma: 2025434
Join Date: Oct 2009
Device: Lumia 950 Phone
Quote:
Originally Posted by ondabeach View Post
Feel free to send any code snippets you think might help
Hi Steve,

Take a look at the off-screen bitmap manipulation in Freda (you can find the source code by following the link in the manual http://www.turnip.demon.co.uk/jim/fr...nual/index.htm). The important class to look at is BitmapCache - and the way that the GetBitmapForPage method uses it. What's going on is that if a bitmap is needed for a given page number (plus 'render' attributes like font face/size and page geometry) then that bitmap is drawn using drawstring/drawimage, *unless it's already been drawn and cached* ... in which case the bitmap is copied from the cache. There may be some ideas you can reuse there. Anyhow, I'm in the middle of re-writing all this code to remove various bits of ad-hoccery and improve the general level of abstraction - so the next version might be more re-usable.
One word of warning: I have found out the hard way that in .NetCF (depending on which Bitmap constructor signature you use) you will get either:
Device Independent Bitmap: you can create a large number of these, but they render very slowly; or:
Device Dependent Bitmap: these render acceptably fast, but creating more than ten of these will exhaust the resources in your GDI DLL (you'll get an OOM exception).
I found that 'ten' limit by trial and error - and it varies from phone to phone (and ROM to ROM).

Happy Hacking!

Jim

Last edited by Jim Chapman; 04-03-2010 at 06:16 PM.
Jim Chapman is offline   Reply With Quote