|
Rather than having to supply an unside-down bitmap for it to work (see CodeProject.bmp through a viewer). Just make this simple one line change.
void CDIBSectionLite::Create32BitFromPicture(...)
{
...
// Copy the bits into our 32 bit dib..
for(int i=0;i
|
|
|
|
|
thanx for that hint! I got this problem.
(Best Regards,)
Patrick Hoffmann
-------------------------------------------------------------------------------
Technical and Operations Manager, System Analyst, Software Architect
PGP: http://www.novacom.net/pgp/PatrickHoffmann.asc
-------------------------------------------------------------------------------
veturo, der kostenlose NOVACOM Routenplaner für Europa... http://www.veturo.de
--------------------------------------------------------------------------
|
|
|
|
|
Yes thank you, However with the water effect I got alot of white appearing at the bottom.
To ressolve this i added + 1, to the line:
pLine[(i*iWidth)+j] = FixColorRef(tempDC.GetPixel(j,(iHeight-(i+1))));
thanks agin, and a great effect!
st0per
|
|
|
|
|
Mmmmmmmmmm.....
I will guess that you are born in the year 1971.
Am I right?
- just a guess based on the value of your timer variable
Christian Skovdal Andersen
|
|
|
|
|
I always use my birthday in code..
|
|
|
|
|
Funky.
Great stuff by the way! I have a new thing to put into my programs about box.
Christian Skovdal Andersen
|
|
|
|
|
>>Funky
Never thought of that way..I always thought of it as way of leaving a little mark here and there..
|
|
|
|
|
Your FX-code is leaking. I tried to remove the memory leaks, but until know I'm far from sucess!
I continue trying.
(Best Regards,)
Patrick Hoffmann
-------------------------------------------------------------------------------
Technical and Operations Manager, System Analyst, Software Architect
PGP: http://www.novacom.net/pgp/PatrickHoffmann.asc
-------------------------------------------------------------------------------
veturo, der kostenlose NOVACOM Routenplaner für Europa... http://www.veturo.de
--------------------------------------------------------------------------
|
|
|
|
|
First you should change this...
void CFireRoutine::InitFire()
{
.
.
.
// do all the y index pre-calc..
for (int y = m_iHeight-1; y >=0; y--)
m_pYIndexes[y] = y * m_iWidth;
.
.
.
}
before, this line was...
for (int y = m_iHeight; y >0; y--)
...and looses an item and writes to item m_p>Indexes[m_iHeight] (that's out of bound!)
bye
(Best Regards,)
Patrick Hoffmann
-------------------------------------------------------------------------------
Technical and Operations Manager, System Analyst, Software Architect
PGP: http://www.novacom.net/pgp/PatrickHoffmann.asc
-------------------------------------------------------------------------------
veturo, der kostenlose NOVACOM Routenplaner für Europa... http://www.veturo.de
--------------------------------------------------------------------------
|
|
|
|
|
I found the reason for the memory leaks. Seems that you are a little bit confused with your members...
BOOL CDIBSectionLite::SetBitmap(LPBITMAPINFO lpBitmapInfo, LPVOID lpBits)
{
.
.
.
// Problem is here...
m_hBitmap = CreateDIBSection(hDC, (const BITMAPINFO*) m_DIBinfo,
m_iColorDataType, &m_ppvBits, NULL, 0);
.
.
.
// Flush the GDI batch queue
GdiFlush();
memcpy(m_ppvBits, lpBits, dwImageSize);
delete [] lpBits; // <- Insert this line
.
.
.
}
This is not a very good solution, because a problem ocuurs at:
The call from CDIBSectionLite::CreateGradientBmp() to SetBitmap looks like...
SetBitmap(&bih,m_ppvBits);
So you overwrite the member "m_ppvBits" in SetBitmap. That's the reason, why the memory allocated before is lost.
Basic Rule: You should'nt call non static methods with members as parameters!
bye, bye.
(Best Regards,)
Patrick Hoffmann
-------------------------------------------------------------------------------
Technical and Operations Manager, System Analyst, Software Architect
PGP: http://www.novacom.net/pgp/PatrickHoffmann.asc
-------------------------------------------------------------------------------
veturo, der kostenlose NOVACOM Routenplaner für Europa... http://www.veturo.de
--------------------------------------------------------------------------
|
|
|
|
|
memory leaks here:
void CDIBSectionLite::Create32BitFromPicture (...)
{
// skipped ...
// Create a 32 bit bitmap
<------------ 1. BUG ---------------
m_ppvBits = new DWORD[iWidth*iHeight];
BITMAPINFO bih;
// skipped ...
// create DIB Section
<------------ 2. BUG ---------------
SetBitmap(&bih,m_ppvBits);
1. The CreateDIBSection (in CDIBSectionLite::SetBitmap) themselves sets m_ppvBits to DIB bits.
BOOL CDIBSectionLite::SetBitmap(LPBITMAPINFO lpBitmapInfo, LPVOID lpBits)
{
// skipped ...
m_hBitmap = CreateDIBSection(hDC, (const BITMAPINFO*) m_DIBinfo,
m_iColorDataType, __ &m_ppvBits __, NULL, 0);
}
2. you can use a next code :
void* pvBits = new DWORD[iWidth*iHeight];
SetBitmap(&bih, pvBits);
delete [] pvBits;
Thanks
|
|
|
|
|
CDIBSectionLite is my class, so the fault of the leak is mine. I'll update the class ASAP.
cheers,
Chris Maunder (CodeProject)
|
|
|
|
|
I can't see what the water effect does, but the other two look *great*. I will look forward to pulling your source code apart when I have the time - what you've done is very impressive.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
move your mouse cursor across the image, the waves will follow
|
|
|
|
|
Wow - cool. I've always wanted to do something like this. I can't wait to get into the source now and figure out how it works !!
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Hello,
Now, you agree a lot of cool animations can be done without the DirectX?
Best regards,
Paul.
Paul Selormey, Bsc (Elect Eng), MSc (Mobile Communication) is currently Windows open source developer in Japan, and open for programming contract anywhere!
|
|
|
|
|
While I would always *recommend* DX in terms of speed and so on, it's obviously not *needed*.
Mind you, I have a fast PC and it has trouble doing the water smoothly, I'm sure DX would help in that regard. But what has been achieved here without it is still *very* impressive, to me at least.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
he he he...
Well, you have to admit I have beaten you here. Get ready you will get more knocks
Best regards,
Paul.
Paul Selormey, Bsc (Elect Eng), MSc (Mobile Communication) is currently Windows open source developer in Japan, and open for programming contract anywhere!
|
|
|
|
|
*scratch* Beaten me how ? Was I foolish enough to ever say animation *couldn't* be done without DX/OpenGL ?
Bring the 'knocks' coming, if that means you're going to put up something you've written, I'd love to see it.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Like the little battle going on here.. Thought I would throw in my .02...
Heres a pretty good example of what can be done without DX:
http://tochna.technion.ac.il/project/Tanks2D/html/index.htm
My take? If you are going for a game then to program using dibs and CDC's is akin to enjoying programming windows 3.1.
I see it in the same light that I see most requests to do the stuff we do in VB. I code in vb (when I have to - work), but it does not lend itself to the power we have as C++ coders. So most of the tricks etc. we pull off in C++ do not lend themselves to vb code (without basically writing C wrappers in a module file). I think its the same with DX and using dibs for animation. On some levels it works great, on others - I think the execution can be correct with an improper solution.
Some visual FX, like the ones here, or a more common form (realtime image transition) can be effectively done with CDC/DIB, but you will always suffer a major performance hit compared to a DX blit...Its just faster in DX (closer to the metal).
|
|
|
|
|
To be honest, I don't recall the battle being referred to, but I agree with all of this - as I said, the water effect is not smooth, and would be under DX, but I don't use DX generally, so I know a lot of effects can be done with it ( I do them ). I presume I shot my mouth off at some stage and am now being reminded of it.
Alex
|
|
|
|
|
Not a battle in the hostile exchanges sense-just teasing each other. We both have and love a Win32 GDI book by Feng Yuan, and I was disappointed with the fact that it lacked a single animation. Graus claimed the animation is the field of DX, and I maintained that enough be done with the GDI and there was even a book on Win32 Animation by MS Press, but currently out of print. So this is how it started.
Java does quite sensible animation, even before the Java2D/3D (without OpenGL-of course never with DX!) and I do not see why GDI could not. It is true current graphic cards are optimized for DX/OpenGL but that does not mean enough speed could not be obtained from the GDI animation.
Now, what is used in the Office assistant animation? Any one?
Best regards,
Paul.
Paul Selormey, Bsc (Elect Eng), MSc (Mobile Communication) is currently Windows open source developer in Japan, and open for programming contract anywhere!
|
|
|
|
|
Hi!
I've downloaded your source, and it implements very nice effects!
Congratiulations!
But there is something else I'm also interestied in: Your source includes a file named AutoBuildCount.h. I think I know what this file is about. What mechanism do you use to "auto"-count the value stored, in that file. Or do you edit it manually?
Thanx!
(Best Regards,)
Patrick Hoffmann
-------------------------------------------------------------------------------
Technical and Operations Manager, System Analyst, Software Architect
PGP: http://www.novacom.net/pgp/PatrickHoffmann.asc
-------------------------------------------------------------------------------
veturo, der kostenlose NOVACOM Routenplaner für Europa... http://www.veturo.de
--------------------------------------------------------------------------
|
|
|
|
|
I use such a auto-count tool, too. I' trigger it manually with a single click on a toolbutton in MsDev, everytime I do major changes in a certain project.
---
See me: www.magerquark.de
|
|
|
|
|
What tool exactly you are using?
(Best Regards,)
Patrick Hoffmann
-------------------------------------------------------------------------------
Technical and Operations Manager, System Analyst, Software Architect
PGP: http://www.novacom.net/pgp/PatrickHoffmann.asc
-------------------------------------------------------------------------------
veturo, der kostenlose NOVACOM Routenplaner für Europa... http://www.veturo.de
--------------------------------------------------------------------------
|
|
|
|