Bitmap gdi+

Bitmap gdi+

Post by manuchi » Thu, 07 Jun 2007 08:10:33


Hello!

I'm trying to grab frames with the directshow Sample Grabber from my
*** . I'm using the sample grabber filter in buffering mode with the
GetCurrentBuffer method. I've connected the source filter, the sample
grabber and a renderer filter.

I want to verify that the sample pointed by the 'pBuffer' pointer is
the image captured by my *** . In order to do that I would like to
use the Bitmap constructor from gdi+:

Bitmap(INT width, INT height, INT stride, PixelFormat format, BYTE
*scan0);

I'm working with C++.

I read that I have to add in my .cpp:

#include gdiplus.h

After doing it I get the following error when compiling:

error C2061: syntax error : identifier 'Bitmap'

Could someone tell me what am I doing wrong and what do I have to do
to fix it?

Thanks in advance.
 
 
 

Bitmap gdi+

Post by The March » Thu, 07 Jun 2007 08:32:35


Are you including <gdiplus.h>?

#include gdiplus.h

will produce a syntax error, AFAIK.

It looks like GDIPlus is in its own namespace.

Have you added

using Gdiplus;

to your code?

Otherwise you would likely need to use the prefix:

Gidplus::Bitmap(...

--
Please read this before replying:
1. Dshow & posting help: http://www.yqcomputer.com/
2. Trim & respond inline (please don't top post or snip everything)
3. Benefit others: follow up if you are helped or you found a solution

 
 
 

Bitmap gdi+

Post by The March » Thu, 07 Jun 2007 08:39:43


I mean Gdiplus::Bitmap(...

--
Please read this before replying:
1. Dshow & posting help: http://www.yqcomputer.com/
2. Trim & respond inline (please don't top post or snip everything)
3. Benefit others: follow up if you are helped or you found a solution
 
 
 

Bitmap gdi+

Post by manuchi » Thu, 07 Jun 2007 09:04:45

Thanks for your fast reply!

I've already had included 'gdiplus.h' but I didn't have 'using
Gdiplus;'. When I added it the following compilation error was
displayed:

error C2873: 'Gdiplus' : symbol cannot be used in a using-
declaration.

I eliminated 'using Gdiplus;' from my code and then I called the
constructor 'Gdiplus::Bitmap' as you suggested and I got some new
linking error that perhaps someone knows how to eliminate.

error LNK2001: unresolved external symbol _GdipFree@4
error LNK2001: unresolved external symbol _GdipAlloc@4
error LNK2001: unresolved external symbol _GdipDisposeImage@4
error LNK2001: unresolved external symbol
_GdipCreateBitmapFromScan0@24
error LNK2001: unresolved external symbol _GdipCloneImage@8

Thanks a lot,

Manuela
 
 
 

Bitmap gdi+

Post by The March » Thu, 07 Jun 2007 09:27:30


Sorry, it's supposed to be:

using namespace Gdiplus;

For the link errors, it looks like you did not add gdiplus.lib in your
linker options.


--
Please read this before replying:
1. Dshow & posting help: http://www.yqcomputer.com/
2. Trim & respond inline (please don't top post or snip everything)
3. Benefit others: follow up if you are helped or you found a solution
 
 
 

Bitmap gdi+

Post by manutkyvg » Fri, 08 Jun 2007 07:25:35

Thanks! That worked great!

Now that I created a Bitmap structure with the data obtained from
GetCurrentBuffer, I would like to save the file into a .bmp file.
I don't know what method or function should I use.

Perhaps someone knows...

Should I use 'Image::save'? If this is the way to do it, how?

Manuela
 
 
 

Bitmap gdi+

Post by The March » Fri, 08 Jun 2007 08:55:57


Looks like this topic has been covered before:

http://www.yqcomputer.com/ %20bitmap%20gdiplus


--
Please read this before replying:
1. Dshow & posting help: http://www.yqcomputer.com/
2. Trim & respond inline (please don't top post or snip everything)
3. Benefit others: follow up if you are helped or you found a solution