[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 353
  • Last Modified:

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
0
Tomb64
Asked:
Tomb64
  • 3
1 Solution
 
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
 
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now