DIB to DIB

how can I copy the BitBlt and StretchBlt, but from a DIB to a DIB?

I would like a Win32 API, but C/C++ code to manually do that would be fine, if its decently fast
Tomb64Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nietodCommented:
Your question is a little unclear.  You can't copy BitBlt and StretchBlt(), they are functions.  Are you saying you just want to copy a DIB to another DIB?   If you want to copy the entire DIB and keep it in the same fomat , it is very easy, just copy the BITMAPINFO structure that descrbes the DIB's format using = and then copy the pixel information using memcpy()  

continues.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nietodCommented:
BITMAPINFO SrcBmp = {??????};
void *SrcDat = ????;
BITMAPINFO DstBmp;
int DatSiz;
void *DstDat;

DatSiz = SrcBmp.bmiHeader.biSizeImage;

if (DatSiz == 0)
{
   int BitWdt = SrcBmp.bmiHeader.biBitCount * SrcBmp.bmiHeader.biWidth;
  int BytWdt = ((BitWdt >> 3)+ 3) && 0XFFFFFFFC
  DatSiz = BytWdt*SrcBmp.bmiHeader.biHeight;
}
DstDat = new char[DatSiz];

DstBmp = SrcBmp;
memcpy(DstDat,SrcDat,DatSiz);

continues
0
nietodCommented:
Its harder if you want to copy only a portion of the DIB or change its storage format.   While you can do this by copying the information manually, like a complex version of the example above.  i think the easest way would be to just copy the image from the source DIB to a memory DC using SetDIBIts() and then copy image out the memory DC to a destination DIB in the new format using GetDIBits().  
0
NickRepinCommented:
***Blt work with CreateDIBSection().
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.