Save DC to Bitmap file

Save DC to Bitmap file

Post by Tony Ts » Sun, 17 Nov 2002 02:13:25



Is there any method to save the dc to a bitmap file ???I have try many
method . but finally cannot get the image bit. It can be done if i use
GetPixel but it take over 10 second to save a 320*240 mono bit map. is there
any simple method to do ?  and where can find the sample source? thanks
 
 
 

Save DC to Bitmap file

Post by Tony Ts » Sun, 17 Nov 2002 02:34:00


Thanks for your answer and I am using win32 too .
would you mind give me a part of source code?
i have try many many times and cannot get the right data. thanks



> >Is there any method to save the dc to a bitmap file ???I have try many
> >method . but finally cannot get the image bit. It can be done if i use
> >GetPixel but it take over 10 second to save a 320*240 mono bit map. is
there
> >any simple method to do ?  and where can find the sample source? thanks

> I've not done this in CE before, but my win32 solution was:
>  (1) CreateDIBSection, and blt from the DC into this dibsection.
>  (2) GetObject(hbm,sizeof(DIBSECTION),&dibs) to retrieve its information
>  (3) write those structures to disk in the correct order. All the
>      information you need is contained within the DIBSECTION information,
>      including a pointer to all the raw bits,
>      and they are mostly in the correct layout already

> --
> Lucian Wischik, Queens' College, Cambridge CB3 9ET. www.wischik.com/lu


 
 
 

Save DC to Bitmap file

Post by Marce » Sun, 17 Nov 2002 02:51:28


find attached some code of how i do it.
the rgb structure is defined as
struct s_RGB
{
        short width;
        short height;
        UINT8 *rgb;

Quote:};

hope this helps!
marcel

>-----Original Message-----
>Thanks for your answer and I am using win32 too .
>would you mind give me a part of source code?
>i have try many many times and cannot get the right data.
thanks




>> >Is there any method to save the dc to a bitmap file ???
I have try many
>> >method . but finally cannot get the image bit. It can
be done if i use
>> >GetPixel but it take over 10 second to save a 320*240
mono bit map. is
>there
>> >any simple method to do ?  and where can find the

sample source? thanks
Quote:

>> I've not done this in CE before, but my win32 solution
was:
>>  (1) CreateDIBSection, and blt from the DC into this
dibsection.
>>  (2) GetObject(hbm,sizeof(DIBSECTION),&dibs) to

retrieve its information
Quote:>>  (3) write those structures to disk in the correct
order. All the
>>      information you need is contained within the

DIBSECTION information,

- Show quoted text -

Quote:>>      including a pointer to all the raw bits,
>>      and they are mostly in the correct layout already

>> --
>> Lucian Wischik, Queens' College, Cambridge CB3 9ET.
www.wischik.com/lu

>.

  SaveBmpFile.cpp
2K Download
 
 
 

Save DC to Bitmap file

Post by Lucian Wisch » Sun, 17 Nov 2002 02:23:15



>Is there any method to save the dc to a bitmap file ???I have try many
>method . but finally cannot get the image bit. It can be done if i use
>GetPixel but it take over 10 second to save a 320*240 mono bit map. is there
>any simple method to do ?  and where can find the sample source? thanks

I've not done this in CE before, but my win32 solution was:
 (1) CreateDIBSection, and blt from the DC into this dibsection.
 (2) GetObject(hbm,sizeof(DIBSECTION),&dibs) to retrieve its information
 (3) write those structures to disk in the correct order. All the
     information you need is contained within the DIBSECTION information,
     including a pointer to all the raw bits,
     and they are mostly in the correct layout already

--
Lucian Wischik, Queens' College, Cambridge CB3 9ET. www.wischik.com/lu

 
 
 

Save DC to Bitmap file

Post by Tony » Sun, 17 Nov 2002 11:49:01


Thanks for your source and i can success write the header.
how can i make the DC to struct s_RGB ??
I am going to save a mono bitmap(1bit) can you give me more information??/
thanks very much~~~~~

> find attached some code of how i do it.
> the rgb structure is defined as
> struct s_RGB
> {
> short width;
> short height;
> UINT8 *rgb;
> };
> hope this helps!
> marcel

> >-----Original Message-----
> >Thanks for your answer and I am using win32 too .
> >would you mind give me a part of source code?
> >i have try many many times and cannot get the right data.
> thanks




> >> >Is there any method to save the dc to a bitmap file ???
> I have try many
> >> >method . but finally cannot get the image bit. It can
> be done if i use
> >> >GetPixel but it take over 10 second to save a 320*240
> mono bit map. is
> >there
> >> >any simple method to do ?  and where can find the
> sample source? thanks

> >> I've not done this in CE before, but my win32 solution
> was:
> >>  (1) CreateDIBSection, and blt from the DC into this
> dibsection.
> >>  (2) GetObject(hbm,sizeof(DIBSECTION),&dibs) to
> retrieve its information
> >>  (3) write those structures to disk in the correct
> order. All the
> >>      information you need is contained within the
> DIBSECTION information,
> >>      including a pointer to all the raw bits,
> >>      and they are mostly in the correct layout already

> >> --
> >> Lucian Wischik, Queens' College, Cambridge CB3 9ET.
> www.wischik.com/lu

> >.