Windows programming

Moderators: None (Apply to moderate this forum)
Number of threads: 3711
Number of posts: 9173

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
loading images to a window Posted by reunion on 19 Jul 2001 at 10:09 PM
Hello!

I finally got my project to work.

Although, it is very slow. Look, First I open a .pcx file
and load it into a buffer. Second I call GetDC(). Then
I encode the image data and put pixel by pixel calling
the SetPixel() function draw this image. With my 650MHz
it is really slow. It takes about a sec for my 640x414
client window. I believe there are one or two ways
to copy data into a window faster.

Let me please know if you know about one.

I know there is the function SetBitmapBits(), but I don't
know how to fill/prepare the buffer.

Reunion


Report
Re: loading images to a window Posted by ColdShine on 20 Jul 2001 at 3:01 AM
First, create a bitmap using the BITMAP structure (maybe there is some newer one...); this will let you directly specify the bitmap pixels memory address (so you can use pointers to directly write into); when you are finished preparing the pixels, you create the bitmap with CreateBitmapIndirect; select it into a DC and do a fast BitBlt to your window. Full stop.
Well, I know there are more recent ways of creating a bitmap pixel-by-pixel, but this is the one I remember (and the easiest I think).
_____________________________
ColdShine
http://www16.brinkster.com/rafonline



Report
Re: thanks Posted by reunion on 21 Jul 2001 at 1:29 PM
: First, create a bitmap using the BITMAP structure (maybe there is some newer one...); this will let you directly specify the bitmap pixels memory address (so you can use pointers to directly write into); when you are finished preparing the pixels, you create the bitmap with CreateBitmapIndirect; select it into a DC and do a fast BitBlt to your window. Full stop.
: Well, I know there are more recent ways of creating a bitmap pixel-by-pixel, but this is the one I remember (and the easiest I think).
: _____________________________
: ColdShine
: http://www16.brinkster.com/rafonline

:
:

Yes. That's it. I think I am supposed to use a device independent bitmap, right? I guess so. That means that I have to create a color table (with 256 colors), and write 8-bits long indexes of colors into the single bitplane.

If anyone care to know how I will have done at the end, post a demand.

Thanks

Reunion



Report
Re: loading images to a window Posted by reshta on 21 Jul 2001 at 1:43 PM
Never use put/get pixel.
Only BitBlt.
All very fast. You can make games without DirectX

If you want to see how I use it
go to http://www.brigsoft.com

: Hello!
:
: I finally got my project to work.
:
: Although, it is very slow. Look, First I open a .pcx file
: and load it into a buffer. Second I call GetDC(). Then
: I encode the image data and put pixel by pixel calling
: the SetPixel() function draw this image. With my 650MHz
: it is really slow. It takes about a sec for my 640x414
: client window. I believe there are one or two ways
: to copy data into a window faster.
:
: Let me please know if you know about one.
:
: I know there is the function SetBitmapBits(), but I don't
: know how to fill/prepare the buffer.
:
: Reunion
:
:


Report
Re: loading images to a window Posted by reunion on 22 Jul 2001 at 7:04 AM
: Never use put/get pixel.
: Only BitBlt.
: All very fast. You can make games without DirectX
:
: If you want to see how I use it
: go to http://www.brigsoft.com
:

I would like to use BitBlt, but I need to know how to convert/transfer a bitplane (256 colors, with color table) (that I get form pcx file) to a bitmap.
It isn't completely clear to me, yet.

Very well, I have been to your site, but I haven't seen how You used IT.



Reunion



Report
Re: loading images to a window Posted by iamthecode on 22 Jul 2001 at 11:25 AM
: Never use put/get pixel.
: Only BitBlt.
: All very fast. You can make games without DirectX
:

Reshta, Ok. I am curious. I have wanted to start learning game programming and was planning on using Direct X. You stated that you can make games without DX. I would be very interested in learning how to do it in windows without DX. For instance, what include files to use, and can you do sprites as well? I know DX is used to access video memory directly and allows for fast page flips. Could you show me how to do it, or at least give me a starting point? Thanks, Ron


Report
Re: loading images to a window Posted by Sephiroth2 on 24 Jul 2001 at 1:47 AM
: : Never use put/get pixel.
: : Only BitBlt.
: : All very fast. You can make games without DirectX
: :
:
: Reshta, Ok. I am curious. I have wanted to start learning game programming and was planning on using Direct X. You stated that you can make games without DX. I would be very interested in learning how to do it in windows without DX. For instance, what include files to use, and can you do sprites as well? I know DX is used to access video memory directly and allows for fast page flips. Could you show me how to do it, or at least give me a starting point? Thanks, Ron
:
:
Just use the usual functions




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.