Board index » delphi » Vary large bitmaps > 16Mb Windows XP PixelFormat = pf24bit
William Reid Boyd
Delphi Developer |
Vary large bitmaps > 16Mb Windows XP PixelFormat = pf24bit2003-09-04 04:02:00 AM delphi41 Bottom Lines: 1. Windows XP won't let me create a 32MB bitmap (out of resources) unless I set PixelFormat = pf24bit (not my observation, see credit below). Why (just curious), and can I trust it? 2. At some point creating very large bitmaps (I suspect>16 MB), Windows must write them to disk rather than RAM. How can I find that point programmatically (if not 16Mb limit regardless RAM size, which I suspect) for my user? For example, this code: procedure TMainForm.FormCreate(Sender: TObject); begin with TBitmap.Create do try try begin //.... won't allow as little as 32MB without following line {PixelFormat := pf24bit;} Height:= Trunc(Sqrt(32 * 1024 * 1024) + 0.5); Width:= Height; ShowMessage('32Mb bitmap created OK') end except on EOutOfResources do ShowMessage('Try setting PixelFormat = pf24Bit, stupid') end finally begin ShowMessage('Freeing memory'); Free end end end; By setting PixelFormat = pf24bit, I can load a 256Mb bitmap onto my hard disk in about a minute on my 2-something GHz PB-not machine - only I can not actually do anything much with it anyway without waiting out universes of time. Of course it is no hardship to set PixelFormat = pf24bit as I need that anyway to exploit the ScanLine property of TBitmap (8-18 in Borland's D6 'Developer's Handbook' - although it is hard to understand what the example is supposed to do). I would have never guessed pf24bit without searching this newsgroup - these newsgroups so useful. Credit: From: "Sue D. Nom" <.....> Subject: Re: loading LARGE bitmaps, stitching them, then saving result in 1 filew/o tbitmap Date: Tue, 26 Feb 2002 00:17:18 -0600 Groups: borland.public.delphi.graphics wrote <For producing large bitmaps, an NT class OS is required. It took under 20 seconds to create a 10K x 10K bitmap in PaintShop Pro, 7 seconds to create a bitmap on a 500 MHz machine with 256 meg memory, using this code: Bmp := TBitmap.Create; Bmp.PixelFormat := pf24bit; Bmp.Width := 10000; Bmp.Height := 10000 ...> I need these very large bitmaps because I am about to interest myself in antialiasing using the sub-pixelling treatment described in New Foley Now In C (oh dear) p 134. Sprouts and furious transforms look very interesting for sure, but not the stuff you (me anyway) can toss off in a few evenings and I would rather put them to simmer gently pretty well for ever on the back burner if Ican get away with it. BTW, if anyone knowledgeable waded in this far, anyone know how Corel Photopaint (my Chines takeaway is version 7.0) does antialiasing? My experiments strongly suggest to me it is using nothing more sophisticated than Uncles F's unweighted area sampling technique mentioned above. William Boyd |