Array of COLORREF to screen like a bitmap?

Array of COLORREF to screen like a bitmap?

Post by Evan Marshall Manni » Sat, 17 Feb 1996 04:00:00



I have an application (see .sig) where I calculate, each update
(15 times per second), a new color for each pixel in an active
area of about 35 x 40 pixels.  Right now I've reduced that
calculation to almost nothing and what is killing me on slower
computers is the 21,000 calls to SetPixel() per second.

I've looked into creating a bitmap and blting it to the screen,
using normal, DIB, and WinG bitmaps, but all options seem
extremely complicated.

For a device dependent bitmap, I'd have to determine the actual
layout in bits per pixels & bitplanes, etc. and I'm not equipped
with a wide variety of computers to test the code on.

DIBs seem almost as complicated and slower because there will
inevitably be a color table translation.

WinG bitmaps seem to have more complications than I originally
expected, where you have to query which is the best bitmap
format for a given display & it might be upside-down, and
might just not work on some displays.

Is seems like what I'm trying to do is so simple that there
must be a library out there somewhere that does it!  My dream
function call would be something like:

   ColorrefBlt(HDC, int dc_region_left, int dc_region_top,
               int region_width, int region_height,
               COLORREF * ColorBitMap);

Anybody seen one?  Know how to write one quickly?

Thanks

--

#######   Dynamine: A very different minesweeper game for Windows!   #######
#######      <ftp://alumni.caltech.edu/pub/manning/dmine101.zip>     #######
Your eyes are weary from staring at the CRT.  You feel sleepy.  Notice how
restful it is to watch the cursor blink.  Close your eyes.  The opinions
stated above are yours.  You cannot imagine why you ever felt otherwise.

 
 
 

Array of COLORREF to screen like a bitmap?

Post by Daniel Horder » Wed, 28 Feb 1996 04:00:00



> I have an application (see .sig) where I calculate, each update
> (15 times per second), a new color for each pixel in an active
> area of about 35 x 40 pixels.  Right now I've reduced that
> calculation to almost nothing and what is killing me on slower
> computers is the 21,000 calls to SetPixel() per second.

> I've looked into creating a bitmap and blting it to the screen,
> using normal, DIB, and WinG bitmaps, but all options seem
> extremely complicated.

> For a device dependent bitmap, I'd have to determine the actual
> layout in bits per pixels & bitplanes, etc. and I'm not equipped
> with a wide variety of computers to test the code on.

> DIBs seem almost as complicated and slower because there will
> inevitably be a color table translation.

> WinG bitmaps seem to have more complications than I originally
> expected, where you have to query which is the best bitmap
> format for a given display & it might be upside-down, and
> might just not work on some displays.

> Is seems like what I'm trying to do is so simple that there
> must be a library out there somewhere that does it!  My dream
> function call would be something like:

>    ColorrefBlt(HDC, int dc_region_left, int dc_region_top,
>                int region_width, int region_height,
>                COLORREF * ColorBitMap);

> Anybody seen one?  Know how to write one quickly?

> Thanks

I use an offscreen DIB, update the dib and send this to the screen. I get around
60,000 pixels per second on a dx4-100. The regions I am updating are irregular in
shape, and I send a scan-line at a time to the screen so the user can see the
updates occuring - If I had to update a rectangle of known size, and sent the
entire rectangle to the screen on each update, I would imagine the speed would be
quite a bit faster.

Perhaps you should not write off DIB's yet....

Cheers

Daniel Hordern

 
 
 

Array of COLORREF to screen like a bitmap?

Post by Steve Wilkins » Wed, 06 Mar 1996 04:00:00




>> I have an application (see .sig) where I calculate, each update
>> (15 times per second), a new color for each pixel in an active
>> area of about 35 x 40 pixels.  Right now I've reduced that
>> calculation to almost nothing and what is killing me on slower
>> computers is the 21,000 calls to SetPixel() per second.

>> I've looked into creating a bitmap and blting it to the screen,
>> using normal, DIB, and WinG bitmaps, but all options seem
>> extremely complicated.

>> For a device dependent bitmap, I'd have to determine the actual
>> layout in bits per pixels & bitplanes, etc. and I'm not equipped
>> with a wide variety of computers to test the code on.

>> DIBs seem almost as complicated and slower because there will
>> inevitably be a color table translation.

>> WinG bitmaps seem to have more complications than I originally
>> expected, where you have to query which is the best bitmap
>> format for a given display & it might be upside-down, and
>> might just not work on some displays.

>> Is seems like what I'm trying to do is so simple that there
>> must be a library out there somewhere that does it!  My dream
>> function call would be something like:

>>    ColorrefBlt(HDC, int dc_region_left, int dc_region_top,
>>                int region_width, int region_height,
>>                COLORREF * ColorBitMap);

>> Anybody seen one?  Know how to write one quickly?

>> Thanks

>I use an offscreen DIB, update the dib and send this to the screen. I get around
>60,000 pixels per second on a dx4-100. The regions I am updating are irregular in
>shape, and I send a scan-line at a time to the screen so the user can see the
>updates occuring - If I had to update a rectangle of known size, and sent the
>entire rectangle to the screen on each update, I would imagine the speed would be
>quite a bit faster.

>Perhaps you should not write off DIB's yet....

>Cheers

>Daniel Hordern

Microsoft has a book called Animation in Win32 which shows how to do
this while avoiding the color table translations  (uses an Identity palette).
(The book may be found on the MSDN cdrom).  Wing may not be very good
since it only supports 8 bits per pixel images.