Board index » delphi » Bitmaps from resources are slow!

Bitmaps from resources are slow!

Is there anybody out there that has experience with resource bitmaps? I
have a 640x480 256 color bitmap that I show in my startup screen. When I
load it in the FormCreate event via the LoadFromResource (or something
like that), the updating is slow (I first see a gray form for a second
and then the bitmap). If I do the same with a BMP file (LoadFromFile),
there is no delay.

Is there something I'm doing wrong. Even VB4 is faster than this...
--
de Vogelaere Stefan
Deurne, Antwerpen - Belgium

 

Re:Bitmaps from resources are slow!


Quote
Stefan de Vogelaere wrote:

> Is there anybody out there that has experience with resource bitmaps? I
> have a 640x480 256 color bitmap that I show in my startup screen. When I
> load it in the FormCreate event via the LoadFromResource (or something
> like that), the updating is slow (I first see a gray form for a second
> and then the bitmap). If I do the same with a BMP file (LoadFromFile),
> there is no delay.

> Is there something I'm doing wrong. Even VB4 is faster than this...
> --
> de Vogelaere Stefan
> Deurne, Antwerpen - Belgium

I have had great results when storing, and loading bitmaps in a .DLL.
I have an about form where numorous 300 x 250 bitmaps are fading in and
out.  I at no time see the canvas behind the images..

I might also ask how you are storing the bitmaps in the resource, or
bitmap editor.  For instance, in Adobe Photoshop, you have lots of
options when storing a bitmap to disk.  The variables are;

Bitmap Resolution (pixels per inch)

Pallette choice, RGB, CYMK, Indexed, 8 bit, 4 bit, etc..

Compression  Yes/No?

Preview (in some instances..)

With this in mind, the bitmaps could originally have been stored
(sampled) at a excessive rate.  Meaning a 640 x 480 bitmap saved as
RGB/24bit could have a file size of 5 mgs.  Where the same graphic saved
as 4 bit 256 colors might be 520k. And if the images were JPEG, the
results would be greatly improved with any method.  Providing the video
card supported it..  Speaking of video cards,.. Does the machine you
develop on routinely do graphic methods?

In any event the load time would increase with the file size.

Rkr

Re:Bitmaps from resources are slow!


Quote
In article <32DEDAD7.6...@pacbell.net>, rkro...@pacbell.net wrote:
>With this in mind, the bitmaps could originally have been stored
>(sampled) at a excessive rate.  Meaning a 640 x 480 bitmap saved as
>RGB/24bit could have a file size of 5 mgs.  Where the same graphic saved
>as 4 bit 256 colors might be 520k. And if the images were JPEG, the
>results would be greatly improved with any method.  Providing the video
>card supported it..  Speaking of video cards,.. Does the machine you
>develop on routinely do graphic methods?

Your math is WAYYYYYYY off here. A 640x480 24 bit image is less than a meg in
size. Also, 4 bit is 16 colors, not 256, so that one is way off as well. Note,
my file sizes are uncompressed. Add compression and the file size will go down
even more.

Please, whatever program you're using to get this size of files, stop, because
whatever it's doing is adding a lot of shit to a file.

Joel

Re:Bitmaps from resources are slow!


In article <5bn8ra$...@news.insnet.com>, darks...@insnet.com says...

Quote

I don't think is a problem of size. Maybe it's just the way I do it (I'm
king of new to Delphi). Can you give me some sample code to display a
splash screen where I first load a bitmap from a resource.
--
de Vogelaere Stefan
Deurne, Antwerpen - Belgium

Re:Bitmaps from resources are slow!


stefa...@innet.be (Stefan de Vogelaere) wrote:

Quote
>In article <5bn8ra$...@news.insnet.com>, darks...@insnet.com says...

>I don't think is a problem of size. Maybe it's just the way I do it (I'm
>king of new to Delphi). Can you give me some sample code to display a
>splash screen where I first load a bitmap from a resource.

I think the problem is the Splash Screen, not the resource! I tried to
make my own splash screen and I had the same problem... The following
I didn't try so that are only my _ideas_:

While you show the splash screen your program creates the main form (I
think you do it this way) and other things... I also think you do this
in one thread... Generally programs seems to hang if you are doing big
things (like mathematics) in background.

Maybe you should try to use threads... Make an own thread for your
splash screen!

That's my idea. If it's wrong, correct me!

I had the same problem when trying to copy files and updating a status
screen...The status form wasn't repainted quick enough when using one
thread for both operations. I solved this with putting every task into
his own thread!

Hope this helps!

Other Threads