Board index » cppbuilder » DIB to Bitmap

DIB to Bitmap

Hi all,

I have the folowing structure:

static BITMAPINFOHEADER bmpInfo;
static BYTE *pVideoBuffer;

who can I get the content of the buffer and create a TbitMap ??

Thanks for all

Mamede
Brazil

 

Re:DIB to Bitmap


Quote
> I have the folowing structure:

> static BITMAPINFOHEADER bmpInfo;
> static BYTE *pVideoBuffer;

Use the StretchDIBits() API function to draw the DIB to the canvas of
your TBitmap.  Something like (untested):

  StretchDIBits(MyBitmap->Canvas->Handle,
    destX, destY,
    destWidth, destHeight,
    srcX, srcY,
    srcWidth, srcHeight,
    yourBits, yourInfoHeader,
    DIB_RGB_COLORS, SRCCOPY);

Good luck!

--
Yoto Yotov

Re:DIB to Bitmap


Thank you very much Yoto

Now I have another problem.. How to Send it back?

How to send a bitmap image to fill the folowing structs?

static BITMAPINFOHEADER bmpInfo;
static BYTE *pVideoBuffer;

Mamede

"Yoto Yotov" <y...@NOSPAMgmx.fr> escreveu na mensagem
news:MPG.162b7cc28920ff429896b3@newsgroups.borland.com...

Quote
> > I have the folowing structure:

> > static BITMAPINFOHEADER bmpInfo;
> > static BYTE *pVideoBuffer;

> Use the StretchDIBits() API function to draw the DIB to the canvas of
> your TBitmap.  Something like (untested):

>   StretchDIBits(MyBitmap->Canvas->Handle,
>     destX, destY,
>     destWidth, destHeight,
>     srcX, srcY,
>     srcWidth, srcHeight,
>     yourBits, yourInfoHeader,
>     DIB_RGB_COLORS, SRCCOPY);

> Good luck!

> --
> Yoto Yotov

Re:DIB to Bitmap


The DIB should be checked to see if it is a pallette
based DIB, and if the destination DC needs a pallette,
it will require some palette handeling code.

Joe
--
Jimmy Page is having a charity artwork sale: Action For Brazil's Children Trust: http://www.abctrust.org.uk/
Whole Lotta Love computing to cure cancer! http://www.wholelottalove.org/

Quote
"Mamede Milanez" <mam...@enter-net.com.br> wrote in message news:3bc64fc5$1_2@dnews...
> Thank you very much Yoto

> Now I have another problem.. How to Send it back?

> How to send a bitmap image to fill the folowing structs?

> static BITMAPINFOHEADER bmpInfo;
> static BYTE *pVideoBuffer;

> Mamede

> "Yoto Yotov" <y...@NOSPAMgmx.fr> escreveu na mensagem
> news:MPG.162b7cc28920ff429896b3@newsgroups.borland.com...
> > > I have the folowing structure:

> > > static BITMAPINFOHEADER bmpInfo;
> > > static BYTE *pVideoBuffer;

> > Use the StretchDIBits() API function to draw the DIB to the canvas of
> > your TBitmap.  Something like (untested):

> >   StretchDIBits(MyBitmap->Canvas->Handle,
> >     destX, destY,
> >     destWidth, destHeight,
> >     srcX, srcY,
> >     srcWidth, srcHeight,
> >     yourBits, yourInfoHeader,
> >     DIB_RGB_COLORS, SRCCOPY);

> > Good luck!

> > --
> > Yoto Yotov

Re:DIB to Bitmap


// see DIBSECTION  in "C:\Program Files\Common Files\Borland Shared\MSHelp\win32sdk.hlp"

DIBSECTION  JDIBSECT ;
ABmp->HandleType = ??DIB ;  

int dibsize = sizeof(DIBSECTION) ;
int Len =  ::GetObject (ABmp->Handle, dibsize , &JDIBSECT) ;
if(dibsize != Len) throw Exception ("GetObject-DIBSECTION" ) ;
JWidthBytes = (int)  (JDIBSECT.dsBm.bmWidthBytes) ;  // mult_of_4  "width of scanline"
JBits       = (BYTE*)(JDIBSECT.dsBm.bmBits) ;        // image data
JSizeImage  = (int)  (JDIBSECT.dsBmih.biSizeImage) ;

Quote
Mamede Milanez wrote:

> Thank you very much Yoto

> Now I have another problem.. How to Send it back?

> How to send a bitmap image to fill the folowing structs?

> static BITMAPINFOHEADER bmpInfo;
> static BYTE *pVideoBuffer;

> Mamede

> "Yoto Yotov" <y...@NOSPAMgmx.fr> escreveu na mensagem
> news:MPG.162b7cc28920ff429896b3@newsgroups.borland.com...
> > > I have the folowing structure:

> > > static BITMAPINFOHEADER bmpInfo;
> > > static BYTE *pVideoBuffer;

> > Use the StretchDIBits() API function to draw the DIB to the canvas of
> > your TBitmap.  Something like (untested):

> >   StretchDIBits(MyBitmap->Canvas->Handle,
> >     destX, destY,
> >     destWidth, destHeight,
> >     srcX, srcY,
> >     srcWidth, srcHeight,
> >     yourBits, yourInfoHeader,
> >     DIB_RGB_COLORS, SRCCOPY);

> > Good luck!

> > --
> > Yoto Yotov

Other Threads