[comp.windows.ms] Copying Bitmaps

mcdonald@aries.uiuc.edu (Doug McDonald) (10/02/89)

I am trying to write a Windows program that draws text on the screen
from non-Windows bitmapped fonts. Question is, what is the fastest
way to copy the bitmaps to the screen? They characters are in
variable size arrays (i.e. variable number of bytes per row and
rows per character). At the present I am using CreateBitmap on
each single character, using Bitblt, and then junking the Windows
Bitmap object. Ugh! Actually on my 20 MHz 286 it is not too slow - 
maybe 1.8 sec per page. But on a 6Mhz AT............ snooooooze time.

Is there a faster way?

Doug McDonald (mcdonald@aries.scs.uiuc.edu or mcdonald@uxe.cso.uiuc.edu)

press@venice.SEDD.TRW.COM (Barry Press) (10/02/89)

Why do all that work each time, which is what it sounded like.  Why not
do all the conversions at initialization time, then simply blit out the
characters as needed.  Better yet, why not convert to Windows font format,
write a file, and add the font?  You might be able to make up a file
on the fly which you could setup for add font resource....

michaelt@microsoft.UUCP (Michael Thurlkill 1/1029) (10/04/89)

In article <1989Oct1.222918.14330@ux1.cso.uiuc.edu> mcdonald@aries.scs.uiuc.edu (Doug McDonald) writes:
>I am trying to write a Windows program that draws text on the screen
>from non-Windows bitmapped fonts. Question is, what is the fastest
>way to copy the bitmaps to the screen? They characters are in
>variable size arrays (i.e. variable number of bytes per row and
>rows per character). At the present I am using CreateBitmap on
>each single character, using Bitblt, and then junking the Windows
>Bitmap object. Ugh! Actually on my 20 MHz 286 it is not too slow - 
>maybe 1.8 sec per page. But on a 6Mhz AT............ snooooooze time.
>
As another person mentioned, it would be great to convert these to 
Windows fonts. If you want to keep doing it this way, here's a suggestion.
Create a memory DC compatible with the display. Draw or BitBlt your
set of characters into this DC. Keep this DC around the entire time your
application is active. Then, whenever you need to draw one of these
characters, you can quickly Bitblt from this DC. Keep in mind that this
method will potentially consume a large amount of memory, but it will be
very fast. If you look in heapwalk, you can see that this type of cacheing
is used by windows for some of the small bitmaps used for the standard
controls, min/max arrows, etc.
You may just want to keep this in memory while the font is "selected"
instead.

Mike

Disclaimer: These thoughts and opinions are my own. They should not be
mis-construed as being correct or in any way related to my employer.